diff --git a/modules/ticket/back/methods/sale-tracking/delete.js b/modules/ticket/back/methods/sale-tracking/delete.js index e2869c89a..23fc9f01d 100644 --- a/modules/ticket/back/methods/sale-tracking/delete.js +++ b/modules/ticket/back/methods/sale-tracking/delete.js @@ -31,25 +31,25 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const itemShelvingSales = await models.ItemShelvingSale.find({saleFk: saleFk}, myOptions); - for (let itemShelvingSale of itemShelvingSales) - await itemShelvingSale.destroy(myOptions); + // const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions); + // for (let itemShelvingSale of itemShelvingSales) + // await itemShelvingSale.destroy(myOptions); - const filter = { - where: { - saleFk: saleFk, - code: stateCode - } - }; - const saleTrackings = await models.SaleTracking.find(filter, myOptions); - for (let saleTracking of saleTrackings) - await saleTracking.destroy(myOptions); + // const filter = { + // where: { + // saleFk: saleFk, + // code: stateCode + // } + // }; + // const saleTrackings = await models.SaleTracking.find(filter, myOptions); + // for (let saleTracking of saleTrackings) + // await saleTracking.destroy(myOptions); - // query = `CALL vn.saleTracking_del(?, ?)`; - // return Self.rawSql(query, - // [ - // saleFk, - // stateCode, - // ], myOptions); + query = `CALL vn.saleTracking_del(?, ?)`; + return Self.rawSql(query, + [ + saleFk, + stateCode, + ], myOptions); }; }; diff --git a/modules/ticket/back/methods/sale-tracking/replace.js b/modules/ticket/back/methods/sale-tracking/replace.js index a2f9d6c08..140d0fc00 100644 --- a/modules/ticket/back/methods/sale-tracking/replace.js +++ b/modules/ticket/back/methods/sale-tracking/replace.js @@ -40,31 +40,31 @@ module.exports = Self => { if (typeof options == 'object') Object.assign(myOptions, options); - const state = await models.State.findOne({ - where: {code: stateCode} - }, myOptions); + // const state = await models.State.findOne({ + // where: {code: stateCode} + // }, myOptions); - if (!state) return; + // if (!state) return; - const data = { - saleFk: saleFk, - isChecked: isChecked, - originalQuantity: quantity, - workerFk: userId, - stateFk: state.id - }; - return models.SaleTracking.replaceOrCreate(data, myOptions); + // const data = { + // saleFk: saleFk, + // isChecked: isChecked, + // originalQuantity: quantity, + // workerFk: userId, + // stateFk: state.id + // }; + // return models.SaleTracking.replaceOrCreate(data, myOptions); - // query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`; - // return Self.rawSql(query, - // [ - // saleFk, - // isChecked, - // quantity, - // userId, - // stateCode, - // 'parameterToDelete', - // null - // ], myOptions); + query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`; + return Self.rawSql(query, + [ + saleFk, + isChecked, + quantity, + userId, + 'parameterToDelete', + stateCode, + null + ], myOptions); }; }; diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 193f87622..1bd79642f 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -3,7 +3,7 @@ url="SaleTrackings/{{$ctrl.$params.id}}/salePreparingList" limit="20" data="$ctrl.sales" - order="concept ASC" + order="concept ASC, quantity DESC" auto-load="true"> @@ -46,7 +46,8 @@ 'none': !sale.isPrevious, }" class="circleState" - vn-tooltip="is previous"> + vn-tooltip="is previous" + vn-click-stop="$ctrl.clickPrevious($index)"> + vn-tooltip="is prepared" + vn-click-stop="$ctrl.clickPrepared($index)"> + vn-tooltip="is controled" + vn-click-stop="$ctrl.clickControled($index)"> diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 62174860b..3016043d6 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -31,11 +31,46 @@ class Controller extends Section { clickPreviousSelected(index) { const sale = this.sales[index]; if (!sale.isPreviousSelected) { - this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); sale.isPreviousSelected = true; + this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); } else { - this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); sale.isPreviousSelected = false; + sale.isPrevious = false; + this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION'); + } + } + + clickPrevious(index) { + const sale = this.sales[index]; + if (!sale.isPrevious) { + sale.isPrevious = true; + sale.isPreviousSelected = true; + this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', true); + } else { + sale.isPrevious = false; + this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false); + } + } + + clickPrepared(index) { + const sale = this.sales[index]; + if (!sale.isPrepared) { + sale.isPrepared = true; + this.saleTrackingNew(sale, 'PREPARED', true); + } else { + sale.isPrepared = false; + this.saleTrackingDel(sale, 'PREPARED'); + } + } + + clickControled(index) { + const sale = this.sales[index]; + if (!sale.isControled) { + sale.isControled = true; + this.saleTrackingNew(sale, 'CHECKED', true); + } else { + sale.isControled = false; + this.saleTrackingDel(sale, 'CHECKED'); } }