salix/modules/ticket/front/sale-tracking/index.js

89 lines
2.3 KiB
JavaScript

import ngModule from '../module';
import Section from 'salix/components/section';
import './style.scss';
class Controller extends Section {
constructor($element, $) {
super($element, $);
this.filter = {
include: [
{
relation: 'item'
}, {
relation: 'isChecked',
scope: {
fields: ['isChecked']
}
}
]
};
}
$onInit() {
const query = `Sales/${this.$params.id}/salePreparingList`;
this.$http.get(query)
.then(res => {
this.salePreparingList = res.data;
});
}
showItemDescriptor(event, sale) {
this.quicklinks = {
btnThree: {
icon: 'icon-transaction',
state: `item.card.diary({
id: ${sale.itemFk},
warehouseFk: ${this.ticket.warehouseFk},
lineFk: ${sale.id}
})`,
tooltip: 'Item diary'
}
};
this.$.itemDescriptor.show(event.target, sale.itemFk);
}
chipHasSaleGroupDetail(saleId) {
this.salePreparing = this.salePreparingList.find(element => element.saleFk == saleId);
if (this.salePreparing.hasSaleGroupDetail) return 'pink';
else return 'message';
}
chipIsPreviousSelected() {
if (this.salePreparing.isPreviousSelected) return 'notice';
else return 'message';
}
chipIsPrevious() {
if (this.salePreparing.isPrevious) return 'dark-notice';
else return 'message';
}
chipIsPrepared() {
if (this.salePreparing.isPrepared) return 'warning';
else return 'message';
}
chipIsControled() {
if (this.salePreparing.isControled) return 'yellow';
else return 'message';
}
showSaleTracking(sale) {
this.saleId = sale.id;
this.$.saleTracking.show();
}
showItemShelvingSale(sale) {
this.saleId = sale.id;
this.$.itemShelvingSale.show();
}
}
ngModule.vnComponent('vnTicketSaleTracking', {
template: require('./index.html'),
controller: Controller,
bindings: {
ticket: '<'
}
});