Commit 2e9aacb6 by François C. Committed by Alexis Aoun

After ESLint --fix on last merge

parent 130904b7
......@@ -7,7 +7,7 @@ function init_datatable() {
// For a smooth migration...
for (const i in lists) {
if (('partners' in lists[i]) === false) {
lists[i]['partners'] = [lists[i]['partner']]
lists[i]['partners'] = [lists[i]['partner']];
}
}
......@@ -31,6 +31,7 @@ function init_datatable() {
for (const i in data) {
res += `${data[i]}<br/>`;
}
return res;
}
},
......
......@@ -258,21 +258,21 @@ function save_current_coop(callback) {
sex_error = false;
if (/([0-9]{2})\/([0-9]{2})\/([0-9]{4})/.exec(birthdate)) {
try{
try {
var jj = RegExp.$1,
mm = RegExp.$2,
aaaa = RegExp.$3;
let tmp_date = aaaa + "-" + mm + "-" + jj;
// try to create a date object
date_test = new Date(tmp_date);
// if date is invalid a correction is apply in date object. Check it
// january start at 0, so we add + 1 for the month
if ((date_test.getDate() !== parseInt(jj)) || ((date_test.getMonth()+1) !== parseInt(mm)) || (date_test.getFullYear() !== parseInt(aaaa)) || !date_test.isValid())
{
if ((date_test.getDate() !== parseInt(jj)) || ((date_test.getMonth()+1) !== parseInt(mm)) || (date_test.getFullYear() !== parseInt(aaaa)) || !date_test.isValid()) {
birthdate_error = true;
}
}catch(Exception){
} catch (Exception) {
birthdate_error = true;
}
......
......@@ -9,7 +9,7 @@ var suppliers_list = [],
_id: null,
last_update : {
timestamp: null,
fingerprint: null,
fingerprint: null
},
products: [],
selected_suppliers: [],
......@@ -31,7 +31,7 @@ function reset_data() {
_id: null,
last_update : {
timestamp: null,
fingerprint: null,
fingerprint: null
},
products: [],
selected_suppliers: []
......@@ -45,7 +45,7 @@ function reset_data() {
* @returns difference object
*/
function dates_diff(date1, date2) {
var diff = {}
var diff = {};
var tmp = date2 - date1;
tmp = Math.floor(tmp/1000);
......@@ -676,6 +676,7 @@ function update_order_selection_screen() {
$(".order_pill").off();
let existing_orders_container = $("#existing_orders");
existing_orders_container.empty();
dbc.allDocs({
......@@ -686,6 +687,7 @@ function update_order_selection_screen() {
} else {
for (let row of result.rows) {
let template = $("#templates #order_pill_template");
template.find(".pill_order_name").text(row.id);
existing_orders_container.append(template.html());
......@@ -739,7 +741,7 @@ function goto_main_screen(doc) {
products = order_doc.products;
selected_suppliers = order_doc.selected_suppliers;
update_order()
update_order();
update_main_screen();
switch_screen();
}
......@@ -759,32 +761,33 @@ function order_pill_on_click() {
dbc.get(doc_id).then((doc) => {
if (doc.last_update.fingerprint !== fingerprint) {
time_diff = dates_diff(new Date(doc.last_update.timestamp), new Date())
diff_str = ``
time_diff = dates_diff(new Date(doc.last_update.timestamp), new Date());
diff_str = ``;
if (time_diff.days !== 0) {
diff_str += `${time_diff.days} jour(s), `
diff_str += `${time_diff.days} jour(s), `;
}
if (time_diff.hours !== 0) {
diff_str += `${time_diff.hours} heure(s), `
diff_str += `${time_diff.hours} heure(s), `;
}
if (time_diff.min !== 0) {
diff_str += `${time_diff.min} min, `
diff_str += `${time_diff.min} min, `;
}
diff_str += `${time_diff.sec}s`
diff_str += `${time_diff.sec}s`;
let modal_order_access = $('#templates #modal_order_access');
modal_order_access.find(".order_last_update").text(diff_str);
openModal(
modal_order_access.html(),
() => {
goto_main_screen(doc)
goto_main_screen(doc);
},
'Valider'
);
} else {
goto_main_screen(doc)
goto_main_screen(doc);
}
})
.catch(function (err) {
......@@ -823,7 +826,7 @@ function update_order() {
// Save that current user last updated the order
order_doc.last_update = {
timestamp: Date.now(),
fingerprint: fingerprint,
fingerprint: fingerprint
};
dbc.put(order_doc, function callback(err, result) {
......
......@@ -37,6 +37,7 @@ IFCBarcodes = {
try {
let price = parseFloat(value);
if (currency == 'FF')
price = price / 6.55957;
......@@ -131,6 +132,7 @@ IFCBarcodes = {
if (product_data !== null) {
p_uom = (this.uoms)[product_data[this.keys.uom_id]];
let qty = 1;
if (encoded_value.length > 0 && !isNaN(encoded_value)) {
qty = 0; //if no rule is found it will advise user that there is a problem
/*
......@@ -149,7 +151,8 @@ IFCBarcodes = {
} else {
let list_price = product_data[this.keys.list_price];
let currency = null;
if (pattern_type == 'FF_price_to_weight') currency = 'FF'
if (pattern_type == 'FF_price_to_weight') currency = 'FF';
qty = parseFloat(this.get_quantity_eq_to_encoded_price(encoded_value, list_price, currency));
}
......
......@@ -326,7 +326,12 @@ function initLists() {
className:"dt-head-center dt-body-center",
visible: (reception_status == "False"),
render: function (data, type, full) {
let disp = [full.product_qty, (full.old_qty !== undefined)?full.old_qty:full.product_qty].join("/");
let disp = [
full.product_qty,
(full.old_qty !== undefined)?full.old_qty:full.product_qty
].join("/");
return disp;
},
orderable: false
......@@ -1355,6 +1360,7 @@ function openErrorReport() {
// this is necessary because default behavior is overwritten by the listener defined in jquery.pos.js;
$("#error_report").keypress(function(e) {
var key = e.keyCode;
if (key === 13) {
this.value += "\n";
}
......
......@@ -63,10 +63,12 @@ function display_orders(orders) {
orderable: false,
render: function (data) {
let res = '<ul>';
for (p of data) {
res += `<li>${p.journal_id[1]} : ${p.amount} €</li>`
res += `<li>${p.journal_id[1]} : ${p.amount} €</li>`;
}
res += "</ul>"
res += "</ul>";
return res;
}
}
......@@ -97,6 +99,7 @@ function get_sales() {
openModal();
var url = "/sales/get_sales";
url += '?from=' + encodeURIComponent(from_datepicker.val());
url += '&to=' + encodeURIComponent(to_datepicker.val());
......@@ -189,7 +192,7 @@ $(document).ready(function() {
enable_validation();
});
$( "#sales_form" ).submit(function( event ) {
$("#sales_form").submit(function(event) {
event.preventDefault();
get_sales();
});
......
......@@ -1068,15 +1068,17 @@ var shouldCategoryBeShown = function (cat_id) {
}
if (typeof cat_nb_pdts != "undefined") {
let list = cat_nb_pdts.list;
let cat_ids = Object.keys(list).map(x => parseInt(x,10));
let cat_ids = Object.keys(list).map(x => parseInt(x, 10));
//cat_ids is now an array of category ids which have product
if (cat_ids.indexOf(cat_id) < 0) {
// cat_id is corresponding to a category which have no product
answer = false;
}
}
return answer;
}
};
var appendChildrenCatToMenu = function (catdiv, children) {
var ul = catdiv.find('ul');
......@@ -1400,28 +1402,29 @@ var showSentCart = function() {
content = $('<div>'),
table = $('<table>');
let header = $('<tr><th>Article</th><th>Qté</th><th>Prix Total (T.T.C)</th></tr>');
let bottom_msg = $('<p>').html("<em>Contenu non modifiable.</em>")
let bottom_msg = $('<p>').html("<em>Contenu non modifiable.</em>");
table.append(header);
$.each(my_sent_orders, function(i,e) {
$.each(my_sent_orders, function(i, e) {
if (e._id == id) {
$.each(e.products, function (j,p) {
$.each(e.products, function (j, p) {
let tr = $('<tr>'),
name = $('<td>').text(p.name),
qty = $('<td>').text(p.qty),
total = $('<td>').text(p.total)
total = $('<td>').text(p.total);
tr.append(name);
tr.append(qty);
tr.append(total);
table.append(tr);
})
});
}
})
});
content.append(table);
content.append(bottom_msg);
displayMsg(content.html());
}
};
var destroySentCart = function() {
var clicked = $(this);
......
......@@ -318,6 +318,7 @@ function fetch_product_from_bc(barcode) {
if (p_existing !== null) {
without_consent_update_product(p_existing, product.qty);
return 0;
} else {
add_product(product);
......
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