item create
This commit is contained in:
parent
1a772978b0
commit
586ad2911c
|
@ -9,16 +9,9 @@
|
|||
<div style="max-width: 70em; margin: 0 auto;">
|
||||
<vn-card>
|
||||
<vn-vertical pad-large>
|
||||
<vn-title>Create item</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Size" field="$ctrl.item.size" vn-focus></vn-textfield>
|
||||
<vn-textfield vn-five label="Category" field="$ctrl.item.category"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Stems" field="$ctrl.item.stems"></vn-textfield>
|
||||
<vn-textfield vn-five label="Description" field="$ctrl.item.description"></vn-textfield>
|
||||
</vn-horizontal>
|
||||
<vn-title>New item</vn-title>
|
||||
<vn-horizontal>
|
||||
<vn-textfield vn-one label="Name" field="$ctrl.item.name" vn-focus></vn-textfield>
|
||||
<vn-autocomplete vn-one
|
||||
url="/item/api/ItemTypes"
|
||||
label="Type"
|
||||
|
@ -27,17 +20,23 @@
|
|||
field="$ctrl.item.typeFk"
|
||||
>
|
||||
</vn-autocomplete>
|
||||
|
||||
<vn-autocomplete vn-one
|
||||
url="/item/api/Inks"
|
||||
label="Ink"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
field="$ctrl.item.inkFk"
|
||||
>
|
||||
</vn-autocomplete>
|
||||
</vn-horizontal>
|
||||
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-one
|
||||
url="/item/api/Intrastats"
|
||||
label="Intrastat"
|
||||
show-field="description"
|
||||
value-field="id"
|
||||
field="$ctrl.item.intrastatFk"
|
||||
order="description ASC"
|
||||
filter-search="{where: {description: {regexp: 'search'}} }"
|
||||
>
|
||||
<tpl-item>{{$parent.$parent.item.description}}</tpl-item>
|
||||
</vn-autocomplete>
|
||||
<vn-textfield vn-one label="Relevancy" field="$ctrl.item.relevancy" type="number"></vn-textfield>
|
||||
|
||||
</vn-horizontal>
|
||||
|
||||
<vn-horizontal>
|
||||
<vn-autocomplete vn-one
|
||||
url="/item/api/Origins"
|
||||
|
@ -45,18 +44,10 @@
|
|||
show-field="name"
|
||||
value-field="id"
|
||||
field="$ctrl.item.originFk"
|
||||
>
|
||||
</vn-autocomplete>
|
||||
|
||||
<vn-autocomplete vn-one
|
||||
url="/item/api/Producers"
|
||||
label="Producer"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
field="$ctrl.item.producerFk"
|
||||
>
|
||||
</vn-autocomplete>
|
||||
></vn-autocomplete>
|
||||
<vn-one></vn-one>
|
||||
</vn-horizontal>
|
||||
|
||||
</vn-vertical>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class ItemCreate {
|
||||
constructor() {
|
||||
this.item = {};
|
||||
constructor($scope, $state) {
|
||||
this.$ = $scope;
|
||||
this.$state = $state;
|
||||
this.item = {
|
||||
relevancy: 0
|
||||
};
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.submit().then(
|
||||
json => this.$state.go('item.card.basic', {id: json.data.id})
|
||||
json => this.$state.go('item.card.data', {id: json.data.id})
|
||||
);
|
||||
}
|
||||
}
|
||||
ItemCreate.$inject = ['$scope', '$state'];
|
||||
|
||||
ngModule.component('vnItemCreate', {
|
||||
template: require('./item-create.html'),
|
||||
|
|
|
@ -4,5 +4,8 @@
|
|||
"Category": "Categoría",
|
||||
"Description": "Descripción",
|
||||
"Size": "Tamaño",
|
||||
"Type": "Tipo"
|
||||
"Type": "Tipo",
|
||||
"Name": "Nombre",
|
||||
"Relevancy": "Relevancia",
|
||||
"New item": "Nuevo artículo"
|
||||
}
|
|
@ -18,9 +18,9 @@
|
|||
}
|
||||
},
|
||||
"relations": {
|
||||
"taxGroup": {
|
||||
"taxClass": {
|
||||
"type": "belongsTo",
|
||||
"model": "TaxGroup",
|
||||
"model": "TaxClass",
|
||||
"foreignKey": "taxClassFk"
|
||||
},
|
||||
"taxCode": {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/item/filter.js')(Self);
|
||||
|
||||
Self.validatesPresenceOf('name', {message: 'Cannot be blank'});
|
||||
Self.validatesPresenceOf('originFk', {message: 'Cannot be blank'});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue