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 {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
showSaleTracking(sale) {
|
2023-06-01 13:31:16 +00:00
|
|
|
this.saleId = sale.saleFk;
|
2022-12-28 11:16:23 +00:00
|
|
|
this.$.saleTracking.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
showItemShelvingSale(sale) {
|
2023-06-01 13:31:16 +00:00
|
|
|
this.saleId = sale.saleFk;
|
2022-12-28 11:16:23 +00:00
|
|
|
this.$.itemShelvingSale.show();
|
|
|
|
}
|
2023-06-01 13:01:38 +00:00
|
|
|
|
2023-06-06 09:56:14 +00:00
|
|
|
clickSaleGroupDetail(index) {
|
|
|
|
const sale = this.sales[index];
|
2023-07-21 10:20:06 +00:00
|
|
|
if (!sale.saleGroupDetailFk) return;
|
|
|
|
|
2023-07-21 10:01:01 +00:00
|
|
|
return this.$http.delete(`SaleGroupDetails/${sale.saleGroupDetailFk}`)
|
2023-06-06 09:56:14 +00:00
|
|
|
.then(() => {
|
|
|
|
sale.hasSaleGroupDetail = false;
|
|
|
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-01 13:01:38 +00:00
|
|
|
clickPreviousSelected(index) {
|
|
|
|
const sale = this.sales[index];
|
2023-06-01 13:31:16 +00:00
|
|
|
if (!sale.isPreviousSelected) {
|
2023-06-02 08:57:28 +00:00
|
|
|
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false);
|
2023-06-06 09:56:14 +00:00
|
|
|
sale.isPreviousSelected = true;
|
2023-06-01 13:01:38 +00:00
|
|
|
} else {
|
2023-06-06 09:56:14 +00:00
|
|
|
this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION');
|
2023-06-01 13:31:16 +00:00
|
|
|
sale.isPreviousSelected = false;
|
2023-06-02 08:57:28 +00:00
|
|
|
sale.isPrevious = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
clickPrevious(index) {
|
|
|
|
const sale = this.sales[index];
|
|
|
|
if (!sale.isPrevious) {
|
2023-06-06 09:56:14 +00:00
|
|
|
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', true);
|
2023-06-02 08:57:28 +00:00
|
|
|
sale.isPrevious = true;
|
|
|
|
sale.isPreviousSelected = true;
|
|
|
|
} else {
|
|
|
|
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false);
|
2023-06-06 09:56:14 +00:00
|
|
|
sale.isPrevious = false;
|
2023-06-02 08:57:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
clickPrepared(index) {
|
|
|
|
const sale = this.sales[index];
|
|
|
|
if (!sale.isPrepared) {
|
|
|
|
this.saleTrackingNew(sale, 'PREPARED', true);
|
2023-06-06 09:56:14 +00:00
|
|
|
sale.isPrepared = true;
|
2023-06-02 08:57:28 +00:00
|
|
|
} else {
|
|
|
|
this.saleTrackingDel(sale, 'PREPARED');
|
2023-06-06 09:56:14 +00:00
|
|
|
sale.isPrepared = false;
|
2023-06-02 08:57:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
clickControled(index) {
|
|
|
|
const sale = this.sales[index];
|
|
|
|
if (!sale.isControled) {
|
|
|
|
this.saleTrackingNew(sale, 'CHECKED', true);
|
2023-06-06 09:56:14 +00:00
|
|
|
sale.isControled = true;
|
2023-06-02 08:57:28 +00:00
|
|
|
} else {
|
|
|
|
this.saleTrackingDel(sale, 'CHECKED');
|
2023-06-06 09:56:14 +00:00
|
|
|
sale.isControled = false;
|
2023-06-01 13:01:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
saleTrackingNew(sale, stateCode, isChecked) {
|
|
|
|
const params = {
|
2023-06-01 13:31:16 +00:00
|
|
|
saleFk: sale.saleFk,
|
2023-06-01 13:01:38 +00:00
|
|
|
isChecked: isChecked,
|
|
|
|
quantity: sale.quantity,
|
|
|
|
stateCode: stateCode
|
|
|
|
};
|
2023-06-06 09:56:14 +00:00
|
|
|
this.$http.post(`SaleTrackings/new`, params).then(() => {
|
2023-06-01 13:01:38 +00:00
|
|
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
saleTrackingDel(sale, stateCode) {
|
|
|
|
const params = {
|
2023-06-01 13:31:16 +00:00
|
|
|
saleFk: sale.saleFk,
|
2023-12-01 08:44:49 +00:00
|
|
|
stateCodes: [stateCode]
|
2023-06-01 13:01:38 +00:00
|
|
|
};
|
|
|
|
this.$http.post(`SaleTrackings/delete`, params).then(() => {
|
|
|
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
|
|
|
});
|
|
|
|
}
|
2023-06-06 09:56:14 +00:00
|
|
|
|
|
|
|
updateQuantity(itemShelvingSale) {
|
|
|
|
const params = {
|
|
|
|
quantity: itemShelvingSale.quantity
|
|
|
|
};
|
|
|
|
this.$http.patch(`ItemShelvingSales/${itemShelvingSale.id}`, params)
|
|
|
|
.then(() => {
|
|
|
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-06 10:15:39 +00:00
|
|
|
async updateShelving(itemShelvingSale) {
|
2023-06-06 09:56:14 +00:00
|
|
|
const params = {
|
|
|
|
shelvingFk: itemShelvingSale.shelvingFk
|
|
|
|
};
|
2023-06-06 10:15:39 +00:00
|
|
|
const res = await this.$http.patch(`ItemShelvings/${itemShelvingSale.itemShelvingFk}`, params);
|
2023-06-06 09:56:14 +00:00
|
|
|
|
2023-06-06 10:15:39 +00:00
|
|
|
const filter = {
|
|
|
|
fields: ['parkingFk'],
|
|
|
|
where: {
|
|
|
|
code: res.data.shelvingFk
|
|
|
|
}
|
|
|
|
};
|
|
|
|
this.$http.get(`Shelvings/findOne`, {filter})
|
|
|
|
.then(res => {
|
|
|
|
itemShelvingSale.parkingFk = res.data.parkingFk;
|
2023-06-06 09:56:14 +00:00
|
|
|
this.vnApp.showSuccess(this.$t('Data saved!'));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-06-06 10:15:39 +00:00
|
|
|
async updateParking(itemShelvingSale) {
|
2023-06-06 09:56:14 +00:00
|
|
|
const filter = {
|
|
|
|
fields: ['id'],
|
|
|
|
where: {
|
|
|
|
code: itemShelvingSale.shelvingFk
|
|
|
|
}
|
|
|
|
};
|
2023-06-06 10:15:39 +00:00
|
|
|
const res = await this.$http.get(`Shelvings/findOne`, {filter});
|
|
|
|
|
|
|
|
const params = {
|
|
|
|
parkingFk: itemShelvingSale.parkingFk
|
|
|
|
};
|
|
|
|
this.$http.patch(`Shelvings/${res.data.id}`, params)
|
|
|
|
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')));
|
2023-06-06 09:56:14 +00:00
|
|
|
}
|
2022-12-28 11:16:23 +00:00
|
|
|
}
|
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: {
|
2023-06-01 13:01:38 +00:00
|
|
|
ticket: '<',
|
|
|
|
model: '<?'
|
2022-12-28 11:16:23 +00:00
|
|
|
}
|
2018-07-03 13:00:33 +00:00
|
|
|
});
|