Merge pull request 'fixes #5168 Mostrar instance-log en Ticket/Sale solo cuando haya registros' (!1341) from 5168-mostrar-instanceLog into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1341 Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
commit
e7e7fef285
|
@ -197,6 +197,7 @@ describe('Ticket Edit sale path', () => {
|
|||
});
|
||||
|
||||
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.waitForSelector(selectors.ticketSales.firstSaleHistory);
|
||||
const result = await page.countElement(selectors.ticketSales.firstSaleHistory);
|
||||
|
|
|
@ -87,6 +87,14 @@ module.exports = Self => {
|
|||
for (let problem of problems)
|
||||
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) {
|
||||
const problems = saleProblems.get(sale.id);
|
||||
const itemStock = itemAvailable.get(sale.itemFk);
|
||||
|
@ -98,6 +106,8 @@ module.exports = Self => {
|
|||
sale.hasTicketRequest = problems.hasTicketRequest;
|
||||
sale.hasComponentLack = problems.hasComponentLack;
|
||||
}
|
||||
if (salesWithLogs.includes(sale.id))
|
||||
sale.$hasLogs = true;
|
||||
}
|
||||
|
||||
return sales;
|
||||
|
|
|
@ -211,7 +211,8 @@
|
|||
vn-none
|
||||
vn-tooltip="History"
|
||||
icon="history"
|
||||
ng-click="log.open()">
|
||||
ng-click="log.open()"
|
||||
ng-show="sale.$hasLogs">
|
||||
</vn-icon-button>
|
||||
<vn-instance-log
|
||||
vn-id="log"
|
||||
|
|
Loading…
Reference in New Issue