refactor tod usa get sales
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javi Gallego 2021-05-19 17:04:13 +02:00
parent bc887bce8e
commit df073cce2f
2 changed files with 6 additions and 21 deletions

View File

@ -22,7 +22,7 @@ module.exports = Self => {
Self.summary = async ticketFk => {
let models = Self.app.models;
let summaryObj = await getTicketData(Self, ticketFk);
summaryObj.sales = await getSales(models.Sale, ticketFk);
summaryObj.sales = await models.Ticket.getSales(ticketFk);
summaryObj.packagings = await models.TicketPackaging.find({
where: {ticketFk: ticketFk},
include: [{relation: 'packaging',
@ -102,20 +102,6 @@ module.exports = Self => {
return await Self.findOne(filter);
}
async function getSales(Sale, ticketFk) {
let filter = {
where: {
ticketFk: ticketFk
},
order: 'concept',
include: [
{relation: 'item'},
{relation: 'claimBeginning'}
]
};
return await Sale.find(filter);
}
async function getRequests(Self, ticketFk) {
let filter = {
where: {

View File

@ -120,6 +120,7 @@
<vn-tr>
<vn-th shrink></vn-th>
<vn-th number shrink>Item</vn-th>
<vn-th number shrink>Available</vn-th>
<vn-th number shrink>Quantity</vn-th>
<vn-th>Description</vn-th>
<vn-th number>Price</vn-th>
@ -137,12 +138,6 @@
vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimBeginning.claimFk}}">
</vn-icon>
</a>
<vn-icon
ng-show="sale.visible || sale.available"
color-main
icon="warning"
vn-tooltip="Visible: {{::sale.visible || 0}} <br> {{::$ctrl.translate.instant('Available')}} {{::sale.available || 0}}">
</vn-icon>
<vn-icon ng-show="sale.reserved" icon="icon-reserva"></vn-icon>
</vn-td>
<vn-td number shrink>
@ -152,6 +147,10 @@
{{sale.itemFk | zeroFill:6}}
</span>
</vn-td>
<vn-td number shrink>
<vn-chip class="transparent" ng-class="{'message': sale.available < 0}">{{::sale.available}}
</vn-chip>
</vn-td>
<vn-td number shrink>{{::sale.quantity}}</vn-td>
<vn-td vn-fetched-tags wide>
<vn-one title="{{::sale.item.name}}">{{::sale.item.name}}</vn-one>