#2224item.diary provar directiva $anchorScroll
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
71b0f38b53
commit
8453d25852
|
@ -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;
|
||||
|
|
|
@ -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 ;
|
|
@ -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)',
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
<vn-tr ng-repeat="saleClaimed in $ctrl.summary.salesClaimed">
|
||||
<vn-td number>
|
||||
<span
|
||||
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale.itemFk)"
|
||||
ng-click="$ctrl.showItemDescriptor($event, saleClaimed.sale)"
|
||||
class="link">
|
||||
{{::saleClaimed.sale.itemFk | zeroFill:6}}
|
||||
</span>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<vn-crud-model
|
||||
vn-id="model"
|
||||
url="Items/getDiary"
|
||||
url="Items/getBalance"
|
||||
filter="$ctrl.filter"
|
||||
data="sales"
|
||||
auto-load="false">
|
||||
|
@ -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}}">
|
||||
<vn-td expand>
|
||||
<span class="chip"
|
||||
ng-class="::{warning: $ctrl.isToday(sale.date)}">
|
||||
{{::sale.date | date:'dd/MM/yyyy' }}
|
||||
ng-class="::{warning: $ctrl.today == sale.shipped}">
|
||||
{{::sale.shipped | date:'dd/MM/yyyy' }}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td number>
|
||||
|
@ -66,7 +67,8 @@
|
|||
<vn-td number class="in">{{::sale.in | dashIfEmpty}}</vn-td>
|
||||
<vn-td number>{{::sale.out | dashIfEmpty}}</vn-td>
|
||||
<vn-td number class="balance">
|
||||
<span class="chip balanceSpan">
|
||||
<span class="chip balanceSpan"
|
||||
ng-class="::{message: sale.lineFk == sale.lastPreparedLineFk}">
|
||||
{{::sale.balance | dashIfEmpty}}
|
||||
</span>
|
||||
</vn-td>
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<tr style="height: initial;">
|
||||
<td rowspan="{{::sale.components.length + 1}}" number>
|
||||
<span
|
||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)"
|
||||
ng-click="$ctrl.showDescriptor($event, sale)"
|
||||
class="link">
|
||||
{{sale.itemFk | zeroFill:6}}
|
||||
</span>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
<vn-td number>
|
||||
<span
|
||||
ng-show="::request.saleFk"
|
||||
ng-click="$ctrl.showItemDescriptor($event, request.sale.itemFk)"
|
||||
ng-click="$ctrl.showItemDescriptor($event, request.sale)"
|
||||
class="link">
|
||||
{{::request.saleFk | zeroFill:6}}
|
||||
</span>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</vn-td>
|
||||
<vn-td number>
|
||||
<span
|
||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)"
|
||||
ng-click="$ctrl.showDescriptor($event, sale)"
|
||||
class="link">
|
||||
{{::sale.itemFk | zeroFill:6}}
|
||||
</span>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</vn-td>
|
||||
<vn-td number>
|
||||
<span
|
||||
ng-click="$ctrl.showItemDescriptor($event, sale.itemFk)"
|
||||
ng-click="$ctrl.showItemDescriptor($event, sale)"
|
||||
class="link">
|
||||
{{sale.itemFk | zeroFill:6}}
|
||||
</span>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
</vn-td>
|
||||
<vn-td vn-focus number>
|
||||
<span class="link" ng-if="sale.id"
|
||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)">
|
||||
ng-click="$ctrl.showDescriptor($event, sale)">
|
||||
{{sale.itemFk}}
|
||||
</span>
|
||||
<vn-autocomplete
|
||||
|
|
|
@ -296,19 +296,19 @@ class Controller extends Section {
|
|||
}
|
||||
|
||||
// Item Descriptor
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
</vn-td>
|
||||
<vn-td number shrink>
|
||||
<span
|
||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)"
|
||||
ng-click="$ctrl.showDescriptor($event, sale)"
|
||||
class="link">
|
||||
{{sale.itemFk | zeroFill:6}}
|
||||
</span>
|
||||
|
@ -208,7 +208,7 @@
|
|||
<vn-td number>
|
||||
<span
|
||||
ng-show="::request.saleFk"
|
||||
ng-click="$ctrl.showDescriptor($event, request.sale.itemFk)"
|
||||
ng-click="$ctrl.showDescriptor($event, request.sale)"
|
||||
class="link">
|
||||
{{request.sale.itemFk | zeroFill:6}}
|
||||
</span>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<vn-tr ng-repeat="sale in $ctrl.sales">
|
||||
<vn-td number>
|
||||
<span
|
||||
ng-click="$ctrl.showDescriptor($event, sale.itemFk)"
|
||||
ng-click="$ctrl.showDescriptor($event, sale)"
|
||||
class="link">
|
||||
{{sale.itemFk | zeroFill:6}}
|
||||
</span>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue