From 8453d25852f4916dfdec9b4d60b8fa32348eab74 Mon Sep 17 00:00:00 2001 From: jgallego Date: Wed, 6 May 2020 18:42:50 +0200 Subject: [PATCH] #2224item.diary provar directiva $anchorScroll --- .../02-sale_calculateComponent.sql | 16 +-- db/changes/10180-holyWeek/03-itemDiary.sql | 130 ++++++++++++++++++ e2e/helpers/selectors.js | 2 +- e2e/paths/05-ticket/11_diary.spec.js | 2 +- modules/claim/front/summary/index.html | 2 +- modules/claim/front/summary/index.js | 4 +- .../item/{getDiary.js => getBalance.js} | 8 +- .../back/methods/item/specs/getDiary.spec.js | 4 +- modules/item/back/models/item.js | 2 +- modules/item/front/diary/index.html | 12 +- modules/item/front/diary/index.js | 110 +++------------ modules/item/front/diary/index.spec.js | 65 --------- modules/item/front/routes.json | 2 +- modules/ticket/front/component/index.html | 2 +- modules/ticket/front/component/index.js | 8 +- modules/ticket/front/expedition/index.js | 16 +-- modules/ticket/front/request/index/index.html | 2 +- modules/ticket/front/request/index/index.js | 8 +- modules/ticket/front/sale-checked/index.html | 2 +- modules/ticket/front/sale-checked/index.js | 8 +- modules/ticket/front/sale-tracking/index.html | 2 +- modules/ticket/front/sale-tracking/index.js | 8 +- modules/ticket/front/sale/index.html | 2 +- modules/ticket/front/sale/index.js | 8 +- modules/ticket/front/summary/index.html | 4 +- modules/ticket/front/summary/index.js | 8 +- modules/ticket/front/volume/index.html | 2 +- modules/ticket/front/volume/index.js | 8 +- 28 files changed, 214 insertions(+), 233 deletions(-) create mode 100644 db/changes/10180-holyWeek/03-itemDiary.sql rename modules/item/back/methods/item/{getDiary.js => getBalance.js} (70%) diff --git a/db/changes/10180-holyWeek/02-sale_calculateComponent.sql b/db/changes/10180-holyWeek/02-sale_calculateComponent.sql index a0a5f8833..979608a35 100644 --- a/db/changes/10180-holyWeek/02-sale_calculateComponent.sql +++ b/db/changes/10180-holyWeek/02-sale_calculateComponent.sql @@ -15,8 +15,8 @@ proc: BEGIN DECLARE vWarehouseFk SMALLINT; DECLARE vAgencyModeFk INT; DECLARE vAddressFk INT; - DECLARE vTicket BIGINT; - DECLARE vItem BIGINT; + DECLARE vTicketFk BIGINT; + DECLARE vItemFk BIGINT; DECLARE vLanded DATE; DECLARE vIsEditable BOOLEAN; DECLARE vZoneFk INTEGER; @@ -31,8 +31,8 @@ proc: BEGIN t.agencyModeFk, t.landed INTO vIsEditable, - vTicket, - vItem, + vTicketFk, + vItemFk, vZoneFk, vWarehouseFk, vShipped, @@ -69,13 +69,13 @@ proc: BEGIN -- rellena la tabla buyUltimate con la ultima compra CALL buyUltimate (vWarehouseFk, vShipped); - DELETE FROM tmp.buyUltimate WHERE itemFk != vItem; + DELETE FROM tmp.buyUltimate WHERE itemFk != vItemFk; DROP TEMPORARY TABLE IF EXISTS tmp.ticketLot; CREATE TEMPORARY TABLE tmp.ticketLot - SELECT vWarehouseFk warehouseFk, NULL available, vItem itemFk, buyFk, vZoneFk zoneFk + SELECT vWarehouseFk warehouseFk, NULL available, vItemFk itemFk, buyFk, vZoneFk zoneFk FROM tmp.buyUltimate - WHERE itemFk = vItem; + WHERE itemFk = vItemFk; CALL catalog_componentPrepare(); CALL catalog_componentCalculate(vZoneFk, vAddressFk, vShipped, vWarehouseFk); @@ -92,7 +92,7 @@ proc: BEGIN CALL ticketComponentUpdateSale(vOption); INSERT INTO ticketLog (originFk, userFk, `action`, description) - VALUES (vTicket, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); + VALUES (vTicketFk, account.userGetId(), 'update', CONCAT('Bionizo linea id ', vSale)); CALL catalog_componentPurge(); DROP TEMPORARY TABLE tmp.buyUltimate; diff --git a/db/changes/10180-holyWeek/03-itemDiary.sql b/db/changes/10180-holyWeek/03-itemDiary.sql new file mode 100644 index 000000000..d30597e14 --- /dev/null +++ b/db/changes/10180-holyWeek/03-itemDiary.sql @@ -0,0 +1,130 @@ +DROP procedure IF EXISTS `vn`.`item_getBalance`; + +DELIMITER $$ +USE `vn`$$ +CREATE DEFINER=`root`@`%` PROCEDURE `item_getBalance`(IN vItemId INT, IN vWarehouse INT) +BEGIN + DECLARE vDateInventory DATETIME; + DECLARE vCurdate DATE DEFAULT CURDATE(); + DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); + + SELECT inventoried INTO vDateInventory FROM config; + SET @a = 0; + SET @currentLineFk = 0; + SET @shipped = ''; + + SELECT DATE(@shipped:= shipped) shipped, + alertLevel, + stateName, + origin, + reference, + clientFk, + name, + `in`, + `out`, + @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, + @currentLineFk := IF (@shipped < CURDATE() + OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)), + lineFk,@currentLineFk) lastPreparedLineFk, + isTicket, + lineFk,isPicked + FROM + ( SELECT tr.landed as shipped, + b.quantity as `in`, + NULL as `out`, + al.alertLevel as alertLevel, + st.name AS stateName, + s.name as name, + e.ref as reference, + e.id as origin, + s.id as clientFk, + IF(al.alertLevel = 3, TRUE, FALSE) isPicked, + FALSE AS isTicket, + b.id lineFk, + NULL `order` + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.alertLevel = + CASE + WHEN tr.shipped < CURDATE() THEN 3 + WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.landed >= vDateInventory + AND vWarehouse = tr.warehouseInFk + AND b.itemFk = vItemId + AND e.isInventory = FALSE + AND e.isRaid = FALSE + UNION ALL + + SELECT tr.shipped, + NULL as `in`, + b.quantity as `out`, + al.alertLevel as alertLevel, + st.name AS stateName, + s.name as name, + e.ref as reference, + e.id as origin, + s.id as clientFk, + IF(al.alertLevel = 3, TRUE, FALSE) isPicked, + FALSE AS isTicket, + b.id, + NULL `order` + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.alertLevel = + CASE + WHEN tr.shipped < CURDATE() THEN 3 + WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.shipped >= vDateInventory + AND vWarehouse =tr.warehouseOutFk + AND s.id <> 4 + AND b.itemFk = vItemId + AND e.isInventory = FALSE + AND w.isFeedStock = FALSE + AND e.isRaid = FALSE + UNION ALL + + SELECT DATE(t.shipped), + NULL as `in`, + s.quantity as `out`, + al.alertLevel as alertLevel, + st.name AS stateName, + t.nickname as name, + t.refFk as reference, + t.id as origin, + t.clientFk, + stk.id as isPicked, + TRUE as isTicket, + s.id, + st.`order` + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN ticketState ts ON ts.ticket = t.id + LEFT JOIN state st ON st.code = ts.code + JOIN client c ON c.id = t.clientFk + JOIN alertLevel al ON al.alertLevel = + CASE + WHEN t.shipped < curdate() THEN 3 + WHEN t.shipped > util.dayEnd(curdate()) THEN 0 + ELSE IFNULL(ts.alertLevel, 0) + END + LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' + LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id + WHERE t.shipped >= vDateInventory + AND s.itemFk = vItemId + AND vWarehouse =t.warehouseFk + ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC + ) AS itemDiary; + +END$$ +delimiter ; \ No newline at end of file diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 551573836..6ec1d8ebe 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -354,7 +354,7 @@ export default { firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table vn-tbody > :nth-child(1) > vn-td:nth-child(2) > span', firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img', itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor', - itemDescriptorPopoverItemDiaryButton: 'vn-item-descriptor a[href="#!/item/2/diary?warehouseFk=5&ticketFk=20"]', + itemDescriptorPopoverItemDiaryButton: 'vn-item-descriptor a[href="#!/item/2/diary?warehouseFk=5&lineFk=16"]', popoverDiaryButton: '.vn-popover.shown vn-item-descriptor vn-icon[icon="icon-transaction"]', firstSaleQuantity: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3)', firstSaleDiscount: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6)', diff --git a/e2e/paths/05-ticket/11_diary.spec.js b/e2e/paths/05-ticket/11_diary.spec.js index a75e1ae24..e4c63855a 100644 --- a/e2e/paths/05-ticket/11_diary.spec.js +++ b/e2e/paths/05-ticket/11_diary.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -// #2221 Local MySQL8 crashes when rest method Items/getDiary is called +// #2221 Local MySQL8 crashes when rest method Items/getBalance is called xdescribe('Ticket diary path', () => { let page; diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index 6f639c709..44a093336 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -61,7 +61,7 @@ {{::saleClaimed.sale.itemFk | zeroFill:6}} diff --git a/modules/claim/front/summary/index.js b/modules/claim/front/summary/index.js index 094aa49fe..a9bde7289 100644 --- a/modules/claim/front/summary/index.js +++ b/modules/claim/front/summary/index.js @@ -33,8 +33,8 @@ class Controller extends Section { }); } - showItemDescriptor(event, itemFk) { - this.$.itemDescriptor.itemFk = itemFk; + showItemDescriptor(event, sale) { + this.$.itemDescriptor.itemFk = sale.itemFk; this.$.itemDescriptor.parent = event.target; this.$.itemDescriptor.show(); } diff --git a/modules/item/back/methods/item/getDiary.js b/modules/item/back/methods/item/getBalance.js similarity index 70% rename from modules/item/back/methods/item/getDiary.js rename to modules/item/back/methods/item/getBalance.js index 5d8259867..26fc2a7dc 100644 --- a/modules/item/back/methods/item/getDiary.js +++ b/modules/item/back/methods/item/getBalance.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethod('getDiary', { + Self.remoteMethod('getBalance', { description: 'Returns the ', accessType: 'READ', accepts: [{ @@ -14,14 +14,14 @@ module.exports = Self => { root: true }, http: { - path: `/getDiary`, + path: `/getBalance`, verb: 'GET' } }); - Self.getDiary = async filter => { + Self.getBalance = async filter => { let where = filter.where; - let [diary] = await Self.rawSql(`CALL vn.itemDiary(?, ?)`, [where.itemFk, where.warehouseFk]); + let [diary] = await Self.rawSql(`CALL vn.item_getBalance(?, ?)`, [where.itemFk, where.warehouseFk]); return diary; }; }; diff --git a/modules/item/back/methods/item/specs/getDiary.spec.js b/modules/item/back/methods/item/specs/getDiary.spec.js index d47ac1d7d..cf9ed9320 100644 --- a/modules/item/back/methods/item/specs/getDiary.spec.js +++ b/modules/item/back/methods/item/specs/getDiary.spec.js @@ -1,9 +1,9 @@ const app = require('vn-loopback/server/server'); -describe('item getDiary()', () => { +describe('item getBalance()', () => { it('should check the property balance of the 4 resultant entries', async() => { let params = {where: {itemFk: 1, warehouseFk: 2}}; - let result = await app.models.Item.getDiary(params); + let result = await app.models.Item.getBalance(params); expect(result.length).toBe(4); expect(result[0].balance).toBe(-100); diff --git a/modules/item/back/models/item.js b/modules/item/back/models/item.js index 01061ce99..d273404ea 100644 --- a/modules/item/back/models/item.js +++ b/modules/item/back/models/item.js @@ -4,7 +4,7 @@ module.exports = Self => { require('../methods/item/filter')(Self); require('../methods/item/clone')(Self); require('../methods/item/updateTaxes')(Self); - require('../methods/item/getDiary')(Self); + require('../methods/item/getBalance')(Self); require('../methods/item/getLastEntries')(Self); require('../methods/item/getSummary')(Self); require('../methods/item/getCard')(Self); diff --git a/modules/item/front/diary/index.html b/modules/item/front/diary/index.html index f3c9ff63a..40d398e7a 100644 --- a/modules/item/front/diary/index.html +++ b/modules/item/front/diary/index.html @@ -1,6 +1,6 @@ @@ -39,11 +39,12 @@ 'balanceNegative': sale.balance < 0}" ng-repeat="sale in sales" vn-repeat-last - on-last="$ctrl.scrollToLine()"> + on-last="$ctrl.scrollToLine(sale.lastPreparedLineFk)" + ng-attr-id="vnItemDiary-{{::sale.lineFk}}"> - {{::sale.date | date:'dd/MM/yyyy' }} + ng-class="::{warning: $ctrl.today == sale.shipped}"> + {{::sale.shipped | date:'dd/MM/yyyy' }} @@ -66,7 +67,8 @@ {{::sale.in | dashIfEmpty}} {{::sale.out | dashIfEmpty}} - + {{::sale.balance | dashIfEmpty}} diff --git a/modules/item/front/diary/index.js b/modules/item/front/diary/index.js index e77ad1c2c..55b63a60e 100644 --- a/modules/item/front/diary/index.js +++ b/modules/item/front/diary/index.js @@ -3,6 +3,15 @@ import Section from 'salix/components/section'; import './style.scss'; class Controller extends Section { + constructor($element, $scope, $anchorScroll, $location) { + super($element, $scope); + this.$anchorScroll = $anchorScroll; + this.$location = $location; + let today = new Date(); + today.setHours(0, 0, 0, 0); + this.today = today.toJSON(); + } + get item() { return this._item; } @@ -20,8 +29,8 @@ class Controller extends Section { else if (value) this.warehouseFk = value.itemType.warehouseFk; - if (this.$params.ticketFk) - this.ticketFk = this.$params.ticketFk; + if (this.$params.lineFk) + this.lineFk = this.$params.lineFk; }); } @@ -42,96 +51,11 @@ class Controller extends Section { return this._warehouseFk; } - get freeLineIndex() { - let lines = this.$.model.data; - let minDate = new Date(); - minDate.setHours(0, 0, 0, 0); - - let maxDate = new Date(); - maxDate.setHours(23, 59, 59, 59); - - for (let i = 0; i < lines.length; i++) { - const dated = new Date(lines[i].date); - - let isForFuture = dated > maxDate; - let isForToday = (dated >= minDate && dated <= maxDate); - if (isForFuture || isForToday) - return i; - } - } - - get onPreparationLineIndex() { - let lines = this.$.model.data; - for (let i = this.freeLineIndex; i >= 0; i--) { - let line = lines[i]; - - let currentDate = new Date(); - currentDate.setHours(0, 0, 0, 0); - - let isPastDate = new Date(lines[i].date) < currentDate; - let isPicked = line.alertLevel == 1 && line.isPicked; - - if ((isPicked) || line.alertLevel > 1 || isPastDate) - return i + 1; - } - } - - get givenTicketIndex() { - let lines = this.$.model.data; - - for (let i = lines.length - 1; i > 0; i--) { - let line = lines[i]; - - if (line.origin == this.ticketFk) - return i; - } - } - - scrollToLine() { - let body = this.$window.document.body; - let selectedTicketLineIndex = this.givenTicketIndex; - let lineIndex = this.onPreparationLineIndex; - - let lines = body.querySelector('vn-tbody').children; - - if (lineIndex == undefined || !lines.length) return; - - let onPreparationLine = lines[lineIndex]; - - let balance = onPreparationLine.querySelector('.balanceSpan'); - balance.classList.add('message'); - balance.title = this.$translate.instant('Visible quantity'); - - let headerOffset = body.querySelector('vn-topbar').getBoundingClientRect(); - let headerHeight = headerOffset.height; - - let offsetTop; - if (this.ticketFk) { - let selectedTicketLine = lines[selectedTicketLineIndex]; - let id = selectedTicketLine.querySelector('[name=origin]'); - id.classList.add('message'); - offsetTop = selectedTicketLine.offsetTop - headerHeight; - } else - offsetTop = onPreparationLine.offsetTop - headerHeight; - - this.$window.scrollTo(0, offsetTop); - this.ticketFk = null; - } - - /** - * Compares a date with the current one - * @param {Object} date - Date to compare - * @return {Boolean} - Returns true if the two dates equals - */ - isToday(date) { - let today = new Date(); - today.setHours(0, 0, 0, 0); - - let comparedDate = new Date(date); - comparedDate.setHours(0, 0, 0, 0); - - if (!(today - comparedDate)) - return true; + scrollToLine(lineFk) { + const hashFk = this.lineFk || lineFk; + const hash = `vnItemDiary-${hashFk}`; + this.$location.hash(hash); + this.$anchorScroll(); } showDescriptor(event, sale) { @@ -159,6 +83,8 @@ class Controller extends Section { } } +Controller.$inject = ['$element', '$scope', '$anchorScroll', '$location']; + ngModule.component('vnItemDiary', { template: require('./index.html'), controller: Controller, diff --git a/modules/item/front/diary/index.spec.js b/modules/item/front/diary/index.spec.js index 94458a569..ccf7ac1a1 100644 --- a/modules/item/front/diary/index.spec.js +++ b/modules/item/front/diary/index.spec.js @@ -16,56 +16,6 @@ describe('Item', () => { controller.$params = {id: 1}; })); - describe('isToday()', () => { - it(`should call isToday() an return true if an specified date is the current date`, () => { - let date = new Date(); - - let result = controller.isToday(date); - - expect(result).toBeTruthy(); - }); - - it(`should call isToday() an return false if an specified date is the current date`, () => { - let date = '2018-07-03'; - - let result = controller.isToday(date); - - expect(result).toBeFalsy(); - }); - }); - - describe('freeLineIndex()', () => { - it(`should call freeLineIndex() and return an index from line with alertLevel 0 and current date`, () => { - let currentDate = new Date(); - currentDate.setDate(currentDate.getDate() + 1); - - controller.$.model = {data: [ - {name: 'My item 1', alertLevel: 3, date: '2018-05-02'}, - {name: 'My item 2', alertLevel: 1, date: '2018-05-03'}, - {name: 'My item 3', alertLevel: 0, date: currentDate}] - }; - let result = controller.freeLineIndex; - - expect(result).toEqual(2); - }); - }); - - describe('onPreparationLineIndex()', () => { - it(`should call onPreparationLineIndex() and return an index from line with alertLevel 1 and isPicked true`, () => { - let currentDate = new Date(); - currentDate.setDate(currentDate.getDate() + 1); - controller.$.model = {data: [ - {name: 'My item 1', alertLevel: 3, isPicked: true, date: currentDate}, - {name: 'My item 3', alertLevel: 1, isPicked: true, date: currentDate}, - {name: 'My item 4', alertLevel: 1, isPicked: false, date: currentDate}, - {name: 'My item 5', alertLevel: 0, isPicked: false, date: currentDate}] - }; - let result = controller.onPreparationLineIndex; - - expect(result).toEqual(1); - }); - }); - describe('set item()', () => { it('should set warehouseFk property based on itemType warehouseFk', () => { jest.spyOn(controller.$, '$applyAsync'); @@ -90,21 +40,6 @@ describe('Item', () => { expect(controller.item.id).toEqual(1); }); }); - - describe('givenTicketIndex() setter', () => { - it(`should return the index position of the line of a given ticket fk`, () => { - controller.$.model = {data: [ - {name: 'My item 1', origin: 1, alertLevel: 3, isPicked: true, date: '2018-05-02'}, - {name: 'My item 3', origin: 2, alertLevel: 1, isPicked: true, date: '2018-05-03'}, - {name: 'My item 4', origin: 3, alertLevel: 1, isPicked: false, date: '2018-05-03'}] - }; - controller.ticketFk = 2; - - let index = controller.givenTicketIndex; - - expect(controller.$.model.data[index].origin).toEqual(2); - }); - }); }); }); diff --git a/modules/item/front/routes.json b/modules/item/front/routes.json index a3cf0bee6..2aab4301e 100644 --- a/modules/item/front/routes.json +++ b/modules/item/front/routes.json @@ -107,7 +107,7 @@ "item": "$ctrl.item" } }, { - "url" : "/diary?warehouseFk&ticketFk", + "url" : "/diary?warehouseFk&lineFk", "state": "item.card.diary", "component": "vn-item-diary", "description": "Diary", diff --git a/modules/ticket/front/component/index.html b/modules/ticket/front/component/index.html index e555eb8d7..a39233563 100644 --- a/modules/ticket/front/component/index.html +++ b/modules/ticket/front/component/index.html @@ -27,7 +27,7 @@ {{sale.itemFk | zeroFill:6}} diff --git a/modules/ticket/front/component/index.js b/modules/ticket/front/component/index.js index d0b6ed880..40054571e 100644 --- a/modules/ticket/front/component/index.js +++ b/modules/ticket/front/component/index.js @@ -47,19 +47,19 @@ class Controller extends Section { return sum; } - showDescriptor(event, itemFk) { + showDescriptor(event, sale) { this.quicklinks = { btnThree: { icon: 'icon-transaction', state: `item.card.diary({ - id: ${itemFk}, + id: ${sale.itemFk}, warehouseFk: ${this.ticket.warehouseFk}, - ticketFk: ${this.ticket.id} + lineFk: ${sale.id} })`, tooltip: 'Item diary' } }; - this.$.descriptor.itemFk = itemFk; + this.$.descriptor.itemFk = sale.itemFk; this.$.descriptor.parent = event.target; this.$.descriptor.show(); } diff --git a/modules/ticket/front/expedition/index.js b/modules/ticket/front/expedition/index.js index 1079e0b21..28193cd3b 100644 --- a/modules/ticket/front/expedition/index.js +++ b/modules/ticket/front/expedition/index.js @@ -15,20 +15,8 @@ class Controller extends Section { } } - showItemDescriptor(event, itemFk) { - if (!itemFk) return; - this.quicklinks = { - btnThree: { - icon: 'icon-transaction', - state: `item.card.diary({ - id: ${itemFk}, - warehouseFk: ${this.ticket.warehouseFk}, - ticketFk: ${this.ticket.id} - })`, - tooltip: 'Item diary', - }, - }; - this.$.itemDescriptor.itemFk = itemFk; + showItemDescriptor(event, sale) { + this.$.itemDescriptor.itemFk = sale.itemFk; this.$.itemDescriptor.parent = event.target; this.$.itemDescriptor.show(); } diff --git a/modules/ticket/front/request/index/index.html b/modules/ticket/front/request/index/index.html index 0acb661e3..eeb111a8f 100644 --- a/modules/ticket/front/request/index/index.html +++ b/modules/ticket/front/request/index/index.html @@ -73,7 +73,7 @@ {{::request.saleFk | zeroFill:6}} diff --git a/modules/ticket/front/request/index/index.js b/modules/ticket/front/request/index/index.js index c2e6dc123..d1a2b3d61 100644 --- a/modules/ticket/front/request/index/index.js +++ b/modules/ticket/front/request/index/index.js @@ -44,18 +44,18 @@ class Controller extends Section { }); } - showItemDescriptor(event, itemFk) { + showItemDescriptor(event, sale) { this.quicklinks = { btnThree: { icon: 'icon-transaction', state: `item.card.diary({ - id: ${itemFk}, - ticketFk: ${this.$params.id} + id: ${sale.itemFk}, + lineFk: ${sale.id} })`, tooltip: 'Item diary' } }; - this.$.itemDescriptor.itemFk = itemFk; + this.$.itemDescriptor.itemFk = sale.itemFk; this.$.itemDescriptor.parent = event.target; this.$.itemDescriptor.show(); } diff --git a/modules/ticket/front/sale-checked/index.html b/modules/ticket/front/sale-checked/index.html index a2afd3b8f..e96d93d05 100644 --- a/modules/ticket/front/sale-checked/index.html +++ b/modules/ticket/front/sale-checked/index.html @@ -29,7 +29,7 @@ {{::sale.itemFk | zeroFill:6}} diff --git a/modules/ticket/front/sale-checked/index.js b/modules/ticket/front/sale-checked/index.js index 1fd9b662b..ad98bfb12 100644 --- a/modules/ticket/front/sale-checked/index.js +++ b/modules/ticket/front/sale-checked/index.js @@ -17,19 +17,19 @@ class Controller extends Section { }; } - showDescriptor(event, itemFk) { + showDescriptor(event, sale) { this.quicklinks = { btnThree: { icon: 'icon-transaction', state: `item.card.diary({ - id: ${itemFk}, + id: ${sale.itemFk}, warehouseFk: ${this.ticket.warehouseFk}, - ticketFk: ${this.ticket.id} + lineFk: ${sale.id} })`, tooltip: 'Item diary' } }; - this.$.descriptor.itemFk = itemFk; + this.$.descriptor.itemFk = sale.itemFk; this.$.descriptor.parent = event.target; this.$.descriptor.show(); } diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index b365ef1ca..c5ef66d77 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -34,7 +34,7 @@ {{sale.itemFk | zeroFill:6}} diff --git a/modules/ticket/front/sale-tracking/index.js b/modules/ticket/front/sale-tracking/index.js index 8dca9c026..6ad929636 100644 --- a/modules/ticket/front/sale-tracking/index.js +++ b/modules/ticket/front/sale-tracking/index.js @@ -2,19 +2,19 @@ import ngModule from '../module'; import Section from 'salix/components/section'; class Controller extends Section { - showItemDescriptor(event, itemFk) { + showItemDescriptor(event, sale) { this.quicklinks = { btnThree: { icon: 'icon-transaction', state: `item.card.diary({ - id: ${itemFk}, + id: ${sale.itemFk}, warehouseFk: ${this.ticket.warehouseFk}, - ticketFk: ${this.ticket.id} + lineFk: ${sale.id} })`, tooltip: 'Item diary', }, }; - this.$.itemDescriptor.itemFk = itemFk; + this.$.itemDescriptor.itemFk = sale.itemFk; this.$.itemDescriptor.parent = event.target; this.$.itemDescriptor.show(); } diff --git a/modules/ticket/front/sale/index.html b/modules/ticket/front/sale/index.html index e120ad942..a7315e79c 100644 --- a/modules/ticket/front/sale/index.html +++ b/modules/ticket/front/sale/index.html @@ -106,7 +106,7 @@ + ng-click="$ctrl.showDescriptor($event, sale)"> {{sale.itemFk}} {{sale.itemFk | zeroFill:6}} @@ -208,7 +208,7 @@ {{request.sale.itemFk | zeroFill:6}} diff --git a/modules/ticket/front/summary/index.js b/modules/ticket/front/summary/index.js index 7e892b265..e240cdfc0 100644 --- a/modules/ticket/front/summary/index.js +++ b/modules/ticket/front/summary/index.js @@ -44,19 +44,19 @@ class Controller extends Section { this.$.routeDescriptor.show(); } - showDescriptor(event, itemFk) { + showDescriptor(event, sale) { this.quicklinks = { btnThree: { icon: 'icon-transaction', state: `item.card.diary({ - id: ${itemFk}, + id: ${sale.itemFk}, warehouseFk: ${this.ticket.warehouseFk}, - ticketFk: ${this.ticket.id} + lineFk: ${sale.id} })`, tooltip: 'Item diary' } }; - this.$.descriptor.itemFk = itemFk; + this.$.descriptor.itemFk = sale.itemFk; this.$.descriptor.parent = event.target; this.$.descriptor.show(); } diff --git a/modules/ticket/front/volume/index.html b/modules/ticket/front/volume/index.html index 977f76513..0ecd6ef91 100644 --- a/modules/ticket/front/volume/index.html +++ b/modules/ticket/front/volume/index.html @@ -37,7 +37,7 @@ {{sale.itemFk | zeroFill:6}} diff --git a/modules/ticket/front/volume/index.js b/modules/ticket/front/volume/index.js index bf616cb24..3bdb9df9f 100644 --- a/modules/ticket/front/volume/index.js +++ b/modules/ticket/front/volume/index.js @@ -44,19 +44,19 @@ class Controller extends Section { }); } - showDescriptor(event, itemFk) { + showDescriptor(event, sale) { this.quicklinks = { btnThree: { icon: 'icon-transaction', state: `item.card.diary({ - id: ${itemFk}, + id: ${sale.itemFk}, warehouseFk: ${this.ticket.warehouseFk}, - ticketFk: ${this.ticket.id} + lineFk: ${sale.id} })`, tooltip: 'Item diary' } }; - this.$.descriptor.itemFk = itemFk; + this.$.descriptor.itemFk = sale.itemFk; this.$.descriptor.parent = event.target; this.$.descriptor.show(); }