From 7acb047ec9017494b4e7d480418dae9fa603d3da Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Wed, 20 Dec 2017 12:40:29 +0100 Subject: [PATCH] Item: interfaz crear item --- client/item/routes.json | 2 +- client/item/src/create/item-create.html | 65 +++++++++++++++++++++ client/item/src/create/item-create.js | 18 ++++++ client/item/src/item.js | 1 + services/item/common/methods/item/filter.js | 5 ++ 5 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 client/item/src/create/item-create.html create mode 100644 client/item/src/create/item-create.js diff --git a/client/item/routes.json b/client/item/routes.json index 014dc318d..8096f991f 100644 --- a/client/item/routes.json +++ b/client/item/routes.json @@ -18,7 +18,7 @@ "state": "item.create", "component": "vn-item-create" }, { - "url": "/data", + "url": "/:id/data", "state": "item.data", "component": "vn-item-data" } diff --git a/client/item/src/create/item-create.html b/client/item/src/create/item-create.html new file mode 100644 index 000000000..bd3e3cce3 --- /dev/null +++ b/client/item/src/create/item-create.html @@ -0,0 +1,65 @@ + + + +
+
+ + + Create item + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/client/item/src/create/item-create.js b/client/item/src/create/item-create.js new file mode 100644 index 000000000..139822c44 --- /dev/null +++ b/client/item/src/create/item-create.js @@ -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 +}); diff --git a/client/item/src/item.js b/client/item/src/item.js index 436f5a0ac..908f0e46f 100644 --- a/client/item/src/item.js +++ b/client/item/src/item.js @@ -2,3 +2,4 @@ export * from './module'; import './list/list'; import './filter-panel/filter-panel'; +import './create/item-create'; diff --git a/services/item/common/methods/item/filter.js b/services/item/common/methods/item/filter.js index 683117b2d..5db641a04 100644 --- a/services/item/common/methods/item/filter.js +++ b/services/item/common/methods/item/filter.js @@ -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;