From 0f5d1e55c09bfdcc93de1c993d5d2ded204bd4a2 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 20 Feb 2019 11:30:55 +0100 Subject: [PATCH 1/3] item descriptor not sending the correct warehouse fixed --- modules/item/back/methods/item/getVisibleAvailable.js | 4 ++-- modules/item/front/descriptor/index.js | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/item/back/methods/item/getVisibleAvailable.js b/modules/item/back/methods/item/getVisibleAvailable.js index fecdb736b..dd60a069e 100644 --- a/modules/item/back/methods/item/getVisibleAvailable.js +++ b/modules/item/back/methods/item/getVisibleAvailable.js @@ -23,11 +23,11 @@ module.exports = Self => { } }); - Self.getVisibleAvailable = async(itemFk, warehouseFk) => { + Self.getVisibleAvailable = async(id, warehouseFk) => { let query = ` CALL vn.getItemVisibleAvailable(?,curdate(),?,?)`; - let options = [itemFk, warehouseFk, false]; + let options = [id, warehouseFk, false]; [res] = await Self.rawSql(query, options); return { diff --git a/modules/item/front/descriptor/index.js b/modules/item/front/descriptor/index.js index 922ca4814..da94aacb6 100644 --- a/modules/item/front/descriptor/index.js +++ b/modules/item/front/descriptor/index.js @@ -34,20 +34,21 @@ class Controller { set item(value) { this._item = value; - this.updateStock(); + if (value && value.itemType && value.itemType.warehouseFk) + this.updateStock(value.itemType.warehouseFk); } get item() { return this._item; } - updateStock() { + updateStock(warehouseFk) { this.available = null; this.visible = null; if (this._item && this._item.id) { let options = { params: { - warehouseFk: this._warehouseFk + warehouseFk: warehouseFk } }; this.$http.get(`/item/api/Items/${this._item.id}/getVisibleAvailable`, options).then(response => { @@ -81,7 +82,7 @@ class Controller { warehouseFk: this.warehouseFk }).then(res => { this.vnApp.showSuccess(this.$translate.instant('Data saved!')); - this.updateStock(); + this.updateStock(this.item.itemType.warehouseFk); }); } } From efff9d21848fdefd1adf25c1127f5f6481e986b2 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 20 Feb 2019 11:36:55 +0100 Subject: [PATCH 2/3] deleted duplicated data --- modules/item/front/index/index.html | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index 997f2fded..8a8b920eb 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -72,7 +72,6 @@ {{::item.userNickname}} - {{::item.density}} {{::item.density}} {{::item.taxClass}} From 5d6951a610bad2f1c987f8f14e7165154a65a98f Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 20 Feb 2019 11:41:06 +0100 Subject: [PATCH 3/3] deleted deprecated component --- modules/item/front/index/index.js | 1 - modules/item/front/index/product.html | 38 --------------------- modules/item/front/index/product.js | 49 --------------------------- modules/item/front/index/style.scss | 26 -------------- 4 files changed, 114 deletions(-) delete mode 100644 modules/item/front/index/product.html delete mode 100644 modules/item/front/index/product.js diff --git a/modules/item/front/index/index.js b/modules/item/front/index/index.js index 01b568d11..7a5adc600 100644 --- a/modules/item/front/index/index.js +++ b/modules/item/front/index/index.js @@ -1,5 +1,4 @@ import ngModule from '../module'; -import './product'; import './style.scss'; class Controller { diff --git a/modules/item/front/index/product.html b/modules/item/front/index/product.html deleted file mode 100644 index a390e2e09..000000000 --- a/modules/item/front/index/product.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - -
{{::$ctrl.item.id}} - {{::$ctrl.item.name}}
- - - - - -
- - - - - - -
-
diff --git a/modules/item/front/index/product.js b/modules/item/front/index/product.js deleted file mode 100644 index 0dcaf0824..000000000 --- a/modules/item/front/index/product.js +++ /dev/null @@ -1,49 +0,0 @@ -import ngModule from '../module'; - -class ItemProduct { - onClick(event) { - if (event.defaultPrevented) - event.stopImmediatePropagation(); - } - - set item(value) { - if (value) { - let tags = []; - for (let i = 5; i < 9; i++) { - if (value['tag' + i]) { - let tagValue = value['value' + i]; - let tagKey = value['tag' + i]; - tags.push({tag: {name: tagKey}, value: tagValue}); - } - } - value.tags = tags; - } - - this._item = value; - } - - get item() { - return this._item; - } - - clone(event) { - event.preventDefault(); - this.index.cloneItem(this.item); - } - - preview(event) { - event.preventDefault(); - this.index.showItemPreview(this.item); - } -} - -ngModule.component('vnItemProduct', { - template: require('./product.html'), - bindings: { - item: '<' - }, - controller: ItemProduct, - require: { - index: '^vnItemIndex' - } -}); diff --git a/modules/item/front/index/style.scss b/modules/item/front/index/style.scss index 1cbc88124..74f1c1f9c 100644 --- a/modules/item/front/index/style.scss +++ b/modules/item/front/index/style.scss @@ -1,31 +1,5 @@ @import "variables"; -vn-item-product { - display: block; - - .id { - background-color: $color-main; - color: $color-font-dark; - margin-bottom: 0em; - } - .image { - height: 7em; - width: 7em; - - & > img { - max-height: 100%; - max-width: 100%; - border-radius: .2em; - } - } - vn-label-value:first-of-type section{ - margin-top: 0.6em; - } - vn-fetched-tags vn-horizontal{ - margin-top: 0.9em; - } -} - vn-table { img { border-radius: 50%;