refs #5561 feat: permite coloear todos los circulos
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-06-02 10:57:28 +02:00
parent cf2bf0a17b
commit 02d2afcb8b
4 changed files with 85 additions and 47 deletions

View File

@ -31,25 +31,25 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const itemShelvingSales = await models.ItemShelvingSale.find({saleFk: saleFk}, myOptions);
for (let itemShelvingSale of itemShelvingSales)
await itemShelvingSale.destroy(myOptions);
// const itemShelvingSales = await models.ItemShelvingSale.find({where: {saleFk: saleFk}}, myOptions);
// for (let itemShelvingSale of itemShelvingSales)
// await itemShelvingSale.destroy(myOptions);
const filter = {
where: {
saleFk: saleFk,
code: stateCode
}
};
const saleTrackings = await models.SaleTracking.find(filter, myOptions);
for (let saleTracking of saleTrackings)
await saleTracking.destroy(myOptions);
// const filter = {
// where: {
// saleFk: saleFk,
// code: stateCode
// }
// };
// const saleTrackings = await models.SaleTracking.find(filter, myOptions);
// for (let saleTracking of saleTrackings)
// await saleTracking.destroy(myOptions);
// query = `CALL vn.saleTracking_del(?, ?)`;
// return Self.rawSql(query,
// [
// saleFk,
// stateCode,
// ], myOptions);
query = `CALL vn.saleTracking_del(?, ?)`;
return Self.rawSql(query,
[
saleFk,
stateCode,
], myOptions);
};
};

View File

@ -40,31 +40,31 @@ module.exports = Self => {
if (typeof options == 'object')
Object.assign(myOptions, options);
const state = await models.State.findOne({
where: {code: stateCode}
}, myOptions);
// const state = await models.State.findOne({
// where: {code: stateCode}
// }, myOptions);
if (!state) return;
// if (!state) return;
const data = {
saleFk: saleFk,
isChecked: isChecked,
originalQuantity: quantity,
workerFk: userId,
stateFk: state.id
};
return models.SaleTracking.replaceOrCreate(data, myOptions);
// const data = {
// saleFk: saleFk,
// isChecked: isChecked,
// originalQuantity: quantity,
// workerFk: userId,
// stateFk: state.id
// };
// return models.SaleTracking.replaceOrCreate(data, myOptions);
// query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`;
// return Self.rawSql(query,
// [
// saleFk,
// isChecked,
// quantity,
// userId,
// stateCode,
// 'parameterToDelete',
// null
// ], myOptions);
query = `CALL vn.saleTracking_new(?, ?, ?, ?, ?, ?, ?)`;
return Self.rawSql(query,
[
saleFk,
isChecked,
quantity,
userId,
'parameterToDelete',
stateCode,
null
], myOptions);
};
};

View File

@ -3,7 +3,7 @@
url="SaleTrackings/{{$ctrl.$params.id}}/salePreparingList"
limit="20"
data="$ctrl.sales"
order="concept ASC"
order="concept ASC, quantity DESC"
auto-load="true">
</vn-crud-model>
<vn-data-viewer model="model">
@ -46,7 +46,8 @@
'none': !sale.isPrevious,
}"
class="circleState"
vn-tooltip="is previous">
vn-tooltip="is previous"
vn-click-stop="$ctrl.clickPrevious($index)">
</vn-chip>
<vn-chip
ng-class="{
@ -54,7 +55,8 @@
'none': !sale.isPrepared,
}"
class="circleState"
vn-tooltip="is prepared">
vn-tooltip="is prepared"
vn-click-stop="$ctrl.clickPrepared($index)">
</vn-chip>
<vn-chip
ng-class="{
@ -62,7 +64,8 @@
'none': !sale.isControled,
}"
class="circleState"
vn-tooltip="is controled">
vn-tooltip="is controled"
vn-click-stop="$ctrl.clickControled($index)">
</vn-chip>
</vn-td>
<vn-td number>

View File

@ -31,11 +31,46 @@ class Controller extends Section {
clickPreviousSelected(index) {
const sale = this.sales[index];
if (!sale.isPreviousSelected) {
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false);
sale.isPreviousSelected = true;
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false);
} else {
this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION');
sale.isPreviousSelected = false;
sale.isPrevious = false;
this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION');
}
}
clickPrevious(index) {
const sale = this.sales[index];
if (!sale.isPrevious) {
sale.isPrevious = true;
sale.isPreviousSelected = true;
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', true);
} else {
sale.isPrevious = false;
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false);
}
}
clickPrepared(index) {
const sale = this.sales[index];
if (!sale.isPrepared) {
sale.isPrepared = true;
this.saleTrackingNew(sale, 'PREPARED', true);
} else {
sale.isPrepared = false;
this.saleTrackingDel(sale, 'PREPARED');
}
}
clickControled(index) {
const sale = this.sales[index];
if (!sale.isControled) {
sale.isControled = true;
this.saleTrackingNew(sale, 'CHECKED', true);
} else {
sale.isControled = false;
this.saleTrackingDel(sale, 'CHECKED');
}
}