2018-07-03 13:00:33 +00:00
|
|
|
import ngModule from '../module';
|
2020-03-18 07:35:59 +00:00
|
|
|
import Section from 'salix/components/section';
|
2022-12-28 11:16:23 +00:00
|
|
|
import './style.scss';
|
2018-07-03 13:00:33 +00:00
|
|
|
|
2022-12-28 11:16:23 +00:00
|
|
|
class Controller extends Section {
|
|
|
|
constructor($element, $) {
|
|
|
|
super($element, $);
|
|
|
|
this.filter = {
|
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'item'
|
|
|
|
}, {
|
2023-01-03 12:06:30 +00:00
|
|
|
relation: 'saleTracking',
|
2022-12-28 11:16:23 +00:00
|
|
|
scope: {
|
|
|
|
fields: ['isChecked']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-01-03 12:06:30 +00:00
|
|
|
get sales() {
|
|
|
|
return this._sales;
|
|
|
|
}
|
|
|
|
|
|
|
|
set sales(value) {
|
|
|
|
this._sales = value;
|
|
|
|
if (value) {
|
|
|
|
const query = `Sales/${this.$params.id}/salePreparingList`;
|
|
|
|
this.$http.get(query)
|
|
|
|
.then(res => {
|
|
|
|
this.salePreparingList = res.data;
|
|
|
|
for (const salePreparing of this.salePreparingList) {
|
|
|
|
for (const sale of this.sales) {
|
|
|
|
if (salePreparing.saleFk == sale.id)
|
|
|
|
sale.preparingList = salePreparing;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2022-12-28 11:16:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
showItemDescriptor(event, sale) {
|
|
|
|
this.quicklinks = {
|
|
|
|
btnThree: {
|
|
|
|
icon: 'icon-transaction',
|
|
|
|
state: `item.card.diary({
|
2023-01-20 11:37:41 +00:00
|
|
|
id: ${sale.item.id},
|
2022-12-28 11:16:23 +00:00
|
|
|
warehouseFk: ${this.ticket.warehouseFk},
|
|
|
|
lineFk: ${sale.id}
|
|
|
|
})`,
|
|
|
|
tooltip: 'Item diary'
|
|
|
|
}
|
|
|
|
};
|
2023-01-20 11:37:41 +00:00
|
|
|
this.$.itemDescriptor.show(event.target, sale.item.id);
|
2022-12-28 11:16:23 +00:00
|
|
|
}
|
|
|
|
|
2023-01-03 12:06:30 +00:00
|
|
|
chipHasSaleGroupDetail(hasSaleGroupDetail) {
|
|
|
|
if (hasSaleGroupDetail) return 'pink';
|
2022-12-28 11:16:23 +00:00
|
|
|
else return 'message';
|
|
|
|
}
|
|
|
|
|
2023-01-03 12:06:30 +00:00
|
|
|
chipIsPreviousSelected(isPreviousSelected) {
|
|
|
|
if (isPreviousSelected) return 'notice';
|
2022-12-28 11:16:23 +00:00
|
|
|
else return 'message';
|
|
|
|
}
|
|
|
|
|
2023-01-03 12:06:30 +00:00
|
|
|
chipIsPrevious(isPrevious) {
|
|
|
|
if (isPrevious) return 'dark-notice';
|
2022-12-28 11:16:23 +00:00
|
|
|
else return 'message';
|
|
|
|
}
|
|
|
|
|
2023-01-03 12:06:30 +00:00
|
|
|
chipIsPrepared(isPrepared) {
|
|
|
|
if (isPrepared) return 'warning';
|
2022-12-28 11:16:23 +00:00
|
|
|
else return 'message';
|
|
|
|
}
|
|
|
|
|
2023-01-03 12:06:30 +00:00
|
|
|
chipIsControled(isControled) {
|
|
|
|
if (isControled) return 'yellow';
|
2022-12-28 11:16:23 +00:00
|
|
|
else return 'message';
|
|
|
|
}
|
|
|
|
|
|
|
|
showSaleTracking(sale) {
|
|
|
|
this.saleId = sale.id;
|
|
|
|
this.$.saleTracking.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
showItemShelvingSale(sale) {
|
|
|
|
this.saleId = sale.id;
|
|
|
|
this.$.itemShelvingSale.show();
|
|
|
|
}
|
|
|
|
}
|
2018-07-03 13:00:33 +00:00
|
|
|
|
2020-07-24 12:22:30 +00:00
|
|
|
ngModule.vnComponent('vnTicketSaleTracking', {
|
2018-07-03 13:00:33 +00:00
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
2022-12-28 11:16:23 +00:00
|
|
|
ticket: '<'
|
|
|
|
}
|
2018-07-03 13:00:33 +00:00
|
|
|
});
|