Item: interfaz crear item
This commit is contained in:
parent
75c77fcdc6
commit
7acb047ec9
|
@ -18,7 +18,7 @@
|
|||
"state": "item.create",
|
||||
"component": "vn-item-create"
|
||||
}, {
|
||||
"url": "/data",
|
||||
"url": "/:id/data",
|
||||
"state": "item.data",
|
||||
"component": "vn-item-data"
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<mg-ajax path="/item/api/Items" options="vnPost"></mg-ajax>
|
||||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
data="$ctrl.item"
|
||||
form="form"
|
||||
save="post">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" margin-medium>
|
||||
<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-horizontal>
|
||||
<vn-autocomplete vn-one
|
||||
url="/item/api/ItemTypes"
|
||||
label="Type"
|
||||
show-field="name"
|
||||
value-field="id"
|
||||
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/Origins"
|
||||
label="Origin"
|
||||
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-vertical>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit label="Create"></vn-submit>
|
||||
</vn-button-bar>
|
||||
</div>
|
||||
</form>
|
|
@ -0,0 +1,18 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
class ItemCreate {
|
||||
constructor() {
|
||||
this.item = {};
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.submit().then(
|
||||
json => this.$state.go('item.data', {id: json.data.id})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.component('vnItemCreate', {
|
||||
template: require('./item-create.html'),
|
||||
controller: ItemCreate
|
||||
});
|
|
@ -2,3 +2,4 @@ export * from './module';
|
|||
|
||||
import './list/list';
|
||||
import './filter-panel/filter-panel';
|
||||
import './create/item-create';
|
||||
|
|
|
@ -19,6 +19,11 @@ module.exports = Self => {
|
|||
delete params.size;
|
||||
delete params.order;
|
||||
|
||||
if (params.itemSize) {
|
||||
filter.where.size = params.itemSize;
|
||||
delete params.itemSize;
|
||||
}
|
||||
|
||||
Object.assign(filter.where, params);
|
||||
|
||||
return filter;
|
||||
|
|
Loading…
Reference in New Issue