fixes #5168 Mostrar instance-log en Ticket/Sale solo cuando haya registros #1341
|
@ -197,6 +197,7 @@ describe('Ticket Edit sale path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check in the history that logs has been added', async() => {
|
it('should check in the history that logs has been added', async() => {
|
||||||
|
await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']});
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton);
|
await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton);
|
||||||
await page.waitForSelector(selectors.ticketSales.firstSaleHistory);
|
await page.waitForSelector(selectors.ticketSales.firstSaleHistory);
|
||||||
const result = await page.countElement(selectors.ticketSales.firstSaleHistory);
|
const result = await page.countElement(selectors.ticketSales.firstSaleHistory);
|
||||||
|
|
|
@ -87,6 +87,14 @@ module.exports = Self => {
|
||||||
for (let problem of problems)
|
for (let problem of problems)
|
||||||
saleProblems.set(problem.saleFk, problem);
|
saleProblems.set(problem.saleFk, problem);
|
||||||
|
|
||||||
|
const ticketLog = await Self.rawSql(`SELECT DISTINCT changedModelId
|
||||||
|
FROM ticketLog tl
|
||||||
|
WHERE changedModel = 'Sale'
|
||||||
|
AND originFk = ?`, [id], myOptions);
|
||||||
|
const salesWithLogs = ticketLog.map(sale => {
|
||||||
|
return sale.changedModelId;
|
||||||
|
});
|
||||||
|
|
||||||
for (let sale of sales) {
|
for (let sale of sales) {
|
||||||
const problems = saleProblems.get(sale.id);
|
const problems = saleProblems.get(sale.id);
|
||||||
const itemStock = itemAvailable.get(sale.itemFk);
|
const itemStock = itemAvailable.get(sale.itemFk);
|
||||||
|
@ -98,6 +106,8 @@ module.exports = Self => {
|
||||||
sale.hasTicketRequest = problems.hasTicketRequest;
|
sale.hasTicketRequest = problems.hasTicketRequest;
|
||||||
sale.hasComponentLack = problems.hasComponentLack;
|
sale.hasComponentLack = problems.hasComponentLack;
|
||||||
}
|
}
|
||||||
|
if (salesWithLogs.includes(sale.id))
|
||||||
|
sale.$hasLogs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sales;
|
return sales;
|
||||||
|
|
|
@ -211,7 +211,8 @@
|
||||||
vn-none
|
vn-none
|
||||||
vn-tooltip="History"
|
vn-tooltip="History"
|
||||||
icon="history"
|
icon="history"
|
||||||
ng-click="log.open()">
|
ng-click="log.open()"
|
||||||
|
ng-show="sale.$hasLogs">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
<vn-instance-log
|
<vn-instance-log
|
||||||
vn-id="log"
|
vn-id="log"
|
||||||
|
|
Loading…
Reference in New Issue