From 415fa04e3bfdad51f3d99482e6fef89dcf86dca2 Mon Sep 17 00:00:00 2001 From: vicent Date: Tue, 3 Jan 2023 13:06:30 +0100 Subject: [PATCH] refs #2952 feat: add chips --- modules/ticket/front/sale-tracking/index.html | 18 +++---- modules/ticket/front/sale-tracking/index.js | 48 ++++++++++++------- 2 files changed, 39 insertions(+), 27 deletions(-) diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 015e8954a..851817551 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -4,7 +4,7 @@ filter="::$ctrl.filter" link="{ticketFk: $ctrl.$params.id}" limit="20" - data="sales" + data="$ctrl.sales" order="concept ASC" auto-load="true"> @@ -21,13 +21,13 @@ - + - - - - - + + + + + @@ -96,7 +96,7 @@ - + {{::sale.quantity}} {{::sale.originalQuantity}} diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 25a4632ca..60e42a461 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -10,7 +10,7 @@ class Controller extends Section { { relation: 'item' }, { - relation: 'isChecked', + relation: 'saleTracking', scope: { fields: ['isChecked'] } @@ -19,12 +19,25 @@ class Controller extends Section { }; } - $onInit() { - const query = `Sales/${this.$params.id}/salePreparingList`; - this.$http.get(query) - .then(res => { - this.salePreparingList = res.data; - }); + get sales() { + return this._sales; + } + + set sales(value) { + this._sales = value; + if (value) { + const query = `Sales/${this.$params.id}/salePreparingList`; + this.$http.get(query) + .then(res => { + this.salePreparingList = res.data; + for (const salePreparing of this.salePreparingList) { + for (const sale of this.sales) { + if (salePreparing.saleFk == sale.id) + sale.preparingList = salePreparing; + } + } + }); + } } showItemDescriptor(event, sale) { @@ -42,29 +55,28 @@ class Controller extends Section { this.$.itemDescriptor.show(event.target, sale.itemFk); } - chipHasSaleGroupDetail(saleId) { - this.salePreparing = this.salePreparingList.find(element => element.saleFk == saleId); - if (this.salePreparing.hasSaleGroupDetail) return 'pink'; + chipHasSaleGroupDetail(hasSaleGroupDetail) { + if (hasSaleGroupDetail) return 'pink'; else return 'message'; } - chipIsPreviousSelected() { - if (this.salePreparing.isPreviousSelected) return 'notice'; + chipIsPreviousSelected(isPreviousSelected) { + if (isPreviousSelected) return 'notice'; else return 'message'; } - chipIsPrevious() { - if (this.salePreparing.isPrevious) return 'dark-notice'; + chipIsPrevious(isPrevious) { + if (isPrevious) return 'dark-notice'; else return 'message'; } - chipIsPrepared() { - if (this.salePreparing.isPrepared) return 'warning'; + chipIsPrepared(isPrepared) { + if (isPrepared) return 'warning'; else return 'message'; } - chipIsControled() { - if (this.salePreparing.isControled) return 'yellow'; + chipIsControled(isControled) { + if (isControled) return 'yellow'; else return 'message'; }