Commit 45ec2544 by Damien Moulard

reception products: add color to products qty changed

parent 5790b181
Pipeline #2731 passed with stage
in 1 minute 27 seconds
...@@ -221,11 +221,19 @@ div#container_edition { ...@@ -221,11 +221,19 @@ div#container_edition {
} }
tr.even td.row_product_no_qty { tr.even td.row_product_no_qty {
background-color: #f0ad4e; /*#ec971f*/ background-color: #f0ad4e !important;
} }
tr.odd td.row_product_no_qty { tr.odd td.row_product_no_qty {
background-color: rgb(236, 182, 106); /*#ec971f*/ background-color: #F2B969 !important;
}
tr.even td.row_product_qty_changed {
background-color: #ffc0b7 !important;
}
tr.odd td.row_product_qty_changed {
background-color: #FFB7AD !important;
} }
.add_products_button_container { .add_products_button_container {
......
...@@ -269,9 +269,9 @@ function resetPopUpButtons() { ...@@ -269,9 +269,9 @@ function resetPopUpButtons() {
/* FETCH SERVER DATA */ /* FETCH SERVER DATA */
function store_received_product_coeffs(coeffs) { function store_received_product_coeffs(coeffs) {
for (let i=0;i<coeffs.length;i++) { for (let i=0; i<coeffs.length; i++) {
if(product_coeffs.indexOf(coeffs[i]) == -1) if (product_coeffs.indexOf(coeffs[i]) == -1)
product_coeffs.push(coeffs[i]) product_coeffs.push(coeffs[i]);
} }
} }
...@@ -704,6 +704,17 @@ function initLists() { ...@@ -704,6 +704,17 @@ function initLists() {
$(cell_node).addClass('row_product_no_qty'); $(cell_node).addClass('row_product_no_qty');
} }
} else if (
row_data !== undefined
&& row_data.product_qty !== 0
&& 'old_qty' in row_data
&& row_data.old_qty != row_data.product_qty
) {
for (var j = 0; j < row.cells.length; j++) {
const cell_node = row.cells[j];
$(cell_node).addClass('row_product_qty_changed');
}
} }
} }
}); });
...@@ -735,6 +746,17 @@ function initLists() { ...@@ -735,6 +746,17 @@ function initLists() {
$(cell_node).addClass('row_product_no_qty'); $(cell_node).addClass('row_product_no_qty');
} }
} else if (
row_data !== undefined
&& row_data.product_qty !== 0
&& 'old_qty' in row_data
&& row_data.old_qty != row_data.product_qty
) {
for (var j = 0; j < row.cells.length; j++) {
const cell_node = row.cells[j];
$(cell_node).addClass('row_product_qty_changed');
}
} }
} }
}); });
...@@ -1358,28 +1380,27 @@ function editProductInfo (productToEdit, value = null, batch = false) { ...@@ -1358,28 +1380,27 @@ function editProductInfo (productToEdit, value = null, batch = false) {
try { try {
// Let's compute product final price, using coeffs. // Let's compute product final price, using coeffs.
let computing_shelf_price_details = {base_value: productToEdit.new_shelf_price, intermediate_values: []}; let computing_shelf_price_details = {base_value: productToEdit.new_shelf_price, intermediate_values: []};
for (let k = 1; k <10; k++) { for (let k = 1; k <10; k++) {
if (typeof productToEdit['coeff' + k + '_id'] !== "undefined") { if (typeof productToEdit['coeff' + k + '_id'] !== "undefined") {
product_coeffs.forEach( product_coeffs.forEach((coeff) => {
(coeff) => { if (coeff.id == productToEdit['coeff' + k + '_id']) {
if (coeff.id == productToEdit['coeff' + k + '_id']) { if (coeff.operation_type == "fixed") {
if (coeff.operation_type == "fixed") { productToEdit.new_shelf_price += coeff.value;
productToEdit.new_shelf_price += coeff.value; computing_shelf_price_details.intermediate_values.push({msg: "Found fixed coeff " + coeff.value, new_value: productToEdit.new_shelf_price});
computing_shelf_price_details.intermediate_values.push({msg: "Found fixed coeff " + coeff.value, new_value: productToEdit.new_shelf_price}) } else if (coeff.operation_type == "multiplier") {
} else if (coeff.operation_type == "multiplier") { productToEdit.new_shelf_price *= (1 + coeff.value);
productToEdit.new_shelf_price *= (1 + coeff.value); computing_shelf_price_details.intermediate_values.push({msg: "Found multiplier coeff " + coeff.value, new_value: productToEdit.new_shelf_price});
computing_shelf_price_details.intermediate_values.push({msg: "Found multiplier coeff " + coeff.value, new_value: productToEdit.new_shelf_price})
}
} }
} }
) });
} }
} }
productToEdit.new_shelf_price *= productToEdit.tax_coeff; productToEdit.new_shelf_price *= productToEdit.tax_coeff;
computing_shelf_price_details.intermediate_values.push({msg: "Applying tax coeff " + productToEdit.tax_coeff, new_value: productToEdit.new_shelf_price}) computing_shelf_price_details.intermediate_values.push({msg: "Applying tax coeff " + productToEdit.tax_coeff, new_value: productToEdit.new_shelf_price});
productToEdit.new_shelf_price = productToEdit.new_shelf_price.toFixed(2); productToEdit.new_shelf_price = productToEdit.new_shelf_price.toFixed(2);
computing_shelf_price_details.final_value = productToEdit.new_shelf_price computing_shelf_price_details.final_value = productToEdit.new_shelf_price;
productToEdit.computing_shelf_price_details = computing_shelf_price_details productToEdit.computing_shelf_price_details = computing_shelf_price_details;
} catch (e) { } catch (e) {
productToEdit.new_shelf_price = null; productToEdit.new_shelf_price = null;
err = {msg: e.name + ' : ' + e.message, ctx: 'computing new_shelf_price'}; err = {msg: e.name + ' : ' + e.message, ctx: 'computing new_shelf_price'};
...@@ -1513,6 +1534,7 @@ function print_product_labels() { ...@@ -1513,6 +1534,7 @@ function print_product_labels() {
$.ajax("../../orders/print_product_labels?oids=" + group_ids.join(',')) $.ajax("../../orders/print_product_labels?oids=" + group_ids.join(','))
.done(function(data) { .done(function(data) {
let success = false; let success = false;
if (typeof data.res !== "undefined") { if (typeof data.res !== "undefined") {
if (typeof data.res.error === "undefined") { if (typeof data.res.error === "undefined") {
success = true; success = true;
...@@ -1522,7 +1544,7 @@ function print_product_labels() { ...@@ -1522,7 +1544,7 @@ function print_product_labels() {
alert("l' impression des étiquettes à coller sur les articles vient d'être lancée."); alert("l' impression des étiquettes à coller sur les articles vient d'être lancée.");
$('#barcodesToPrint').hide(); $('#barcodesToPrint').hide();
} else { } else {
alert("Une erreur est survenue.") alert("Une erreur est survenue.");
} }
}); });
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment