fixes #5168 Mostrar instance-log en Ticket/Sale solo cuando haya registros #1341

Merged
alexandre merged 4 commits from 5168-mostrar-instanceLog into dev 2023-02-24 08:34:17 +00:00
2 changed files with 12 additions and 1 deletions
Showing only changes of commit 42b8f08a4d - Show all commits

View File

@ -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;

View File

@ -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"