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); }); } } 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}} 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%;