2952-ticket.sale-checked #1246
|
@ -0,0 +1,33 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('salePreparingList', {
|
||||||
|
description: 'Returns a list with the lines of a ticket and its different states of preparation',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The ticket id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}],
|
||||||
|
returns: {
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/:id/salePreparingList`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.salePreparingList = async(ctx, id, options) => {
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
query = `CALL vn.salePreparingList(?)`;
|
||||||
|
const [sales] = await Self.rawSql(query, [id], myOptions);
|
||||||
|
|
||||||
|
return sales;
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,5 +1,6 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
require('../methods/sale/getClaimableFromTicket')(Self);
|
require('../methods/sale/getClaimableFromTicket')(Self);
|
||||||
|
require('../methods/sale/salePreparingList')(Self);
|
||||||
require('../methods/sale/reserve')(Self);
|
require('../methods/sale/reserve')(Self);
|
||||||
require('../methods/sale/deleteSales')(Self);
|
require('../methods/sale/deleteSales')(Self);
|
||||||
require('../methods/sale/updatePrice')(Self);
|
require('../methods/sale/updatePrice')(Self);
|
||||||
|
|
|
@ -22,10 +22,11 @@
|
||||||
<vn-tbody>
|
<vn-tbody>
|
||||||
<vn-tr ng-repeat="sale in sales">
|
<vn-tr ng-repeat="sale in sales">
|
||||||
<vn-td center shrink>
|
<vn-td center shrink>
|
||||||
<vn-check
|
<span class="chip {{::$ctrl.chipHasSaleGroupDetail(sale.id)}}"></span>
|
||||||
vn-one ng-model="sale.isChecked.isChecked"
|
<span class="chip {{::$ctrl.chipIsPreviousSelected($ctrl.salePreparingList.isPreviousSelected)}}"></span>
|
||||||
disabled="true">
|
<span class="chip {{::$ctrl.chipIsPrevious($ctrl.salePreparingList.isPrevious)}}"></span>
|
||||||
</vn-check>
|
<span class="chip {{::$ctrl.chipIsPrepared($ctrl.salePreparingList.isPrepared)}}"></span>
|
||||||
|
<span class="chip {{::$ctrl.chipIsControled($ctrl.salePreparingList.isControled)}}"></span>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
<vn-td number>
|
<vn-td number>
|
||||||
<span
|
<span
|
||||||
|
|
|
@ -17,12 +17,21 @@ class Controller extends Section {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$onInit() {
|
||||||
|
const query = `Sales/${this.$params.id}/salePreparingList`;
|
||||||
|
this.$http.get(query)
|
||||||
|
.then(res => {
|
||||||
|
this.salePreparingList = res.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
showItemDescriptor(event, sale) {
|
showItemDescriptor(event, sale) {
|
||||||
this.quicklinks = {
|
this.quicklinks = {
|
||||||
btnThree: {
|
btnThree: {
|
||||||
icon: 'icon-transaction',
|
icon: 'icon-transaction',
|
||||||
state: `item.card.diary({
|
state: `item.card.diary({
|
||||||
id: ${sale.itemFk},
|
id: ${sale.itemFk},
|
||||||
warehouseFk: ${this.ticket.warehouseFk},
|
warehouseFk: ${this.ticket.warehouseFk},
|
||||||
lineFk: ${sale.id}
|
lineFk: ${sale.id}
|
||||||
})`,
|
})`,
|
||||||
|
@ -31,6 +40,32 @@ class Controller extends Section {
|
||||||
};
|
};
|
||||||
this.$.itemDescriptor.show(event.target, sale.itemFk);
|
this.$.itemDescriptor.show(event.target, sale.itemFk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chipHasSaleGroupDetail(saleId) {
|
||||||
|
const salePreparing = this.salePreparingList.find(element => element.saleFk = saleId);
|
||||||
|
if (salePreparing.hasSaleGroupDetail) return 'success';
|
||||||
|
else return 'message';
|
||||||
|
}
|
||||||
|
|
||||||
|
chipIsPreviousSelected(isActive) {
|
||||||
|
if (isActive) return 'notice';
|
||||||
|
else return 'message';
|
||||||
|
}
|
||||||
|
|
||||||
|
chipIsPrevious(isActive) {
|
||||||
|
if (isActive) return 'success';
|
||||||
|
else return 'message';
|
||||||
|
}
|
||||||
|
|
||||||
|
chipIsPrepared(isActive) {
|
||||||
|
if (isActive) return 'warning';
|
||||||
|
else return 'message';
|
||||||
|
}
|
||||||
|
|
||||||
|
chipIsControled(isActive) {
|
||||||
|
if (isActive) return 'warning';
|
||||||
|
else return 'message';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngModule.vnComponent('vnTicketSaleChecked', {
|
ngModule.vnComponent('vnTicketSaleChecked', {
|
||||||
|
|
Loading…
Reference in New Issue