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

View File

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

View File

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

View File

@ -31,11 +31,46 @@ class Controller extends Section {
clickPreviousSelected(index) { clickPreviousSelected(index) {
const sale = this.sales[index]; const sale = this.sales[index];
if (!sale.isPreviousSelected) { if (!sale.isPreviousSelected) {
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false);
sale.isPreviousSelected = true; sale.isPreviousSelected = true;
this.saleTrackingNew(sale, 'PREVIOUS_PREPARATION', false);
} else { } else {
this.saleTrackingDel(sale, 'PREVIOUS_PREPARATION');
sale.isPreviousSelected = false; 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');
} }
} }