Commit 9e7a737c by Damien Moulard Committed by Alexis Aoun

[WIP] linting

parent 7a034324
......@@ -42,7 +42,7 @@ function group_goto(group_index) {
// Find order data
for (let order of orders) {
if (order.id == order_groups.groups[group_index][i]) {
order_data = order
order_data = order;
}
}
......@@ -63,19 +63,20 @@ function create_order_doc(order_data, go_to_order = false) {
dbc.get(order_doc_id).then(() => {
if (go_to_order === true) {
goto(order_data.id)
goto(order_data.id);
}
})
.catch(function (err) {
// Create if doesn't exist
if (err.status === 404) {
let order_doc = { ... order_data };
let order_doc = { ...order_data };
order_doc._id = order_doc_id;
dbc.put(order_doc, (err) => {
if (!err) {
if (go_to_order === true) {
goto(order_data.id)
goto(order_data.id);
}
} else {
error = {
......@@ -96,7 +97,7 @@ function create_order_doc(order_data, go_to_order = false) {
/**
* Validate all prices of an order
*/
function validatePrices() {
function validatePrices() {
// Loading on
openModal();
......@@ -194,7 +195,7 @@ function group_action() {
if (!err) {
goto(group_ids[0]);
} else {
alert("Une erreur est survenue lors de la création du groupe. Veuillez ré-essayer plus tard svp.")
alert("Une erreur est survenue lors de la création du groupe. Veuillez ré-essayer plus tard svp.");
console.log(err);
}
});
......@@ -445,6 +446,12 @@ $(document).ready(function() {
});
// TODO sync on change : get data, update data & dom
sync.on('change', function (info) {
console.log(info);
}).on('error', function (err) {
console.log(err);
});
// TODO on button click to access order: verif fingerprint & timestamp
// Get or create order groups doc
......
......@@ -417,7 +417,7 @@ function initLists() {
orders[data.id_po]['valid_products'] = [];
}
orders[data.id_po]['valid_products'].push(data['id']);
update_distant_order(data.id_po)
update_distant_order(data.id_po);
// Reset search
document.getElementById('search_input').value = '';
......@@ -1322,7 +1322,7 @@ function send() {
traditional: true,
contentType: "application/json; charset=utf-8",
data: JSON.stringify(updates),
success: function(data) {},
success: function() {},
error: function() {
closeModal();
alert('Erreur dans l\'envoi du rapport.');
......@@ -1395,7 +1395,7 @@ function saveErrorReport() {
// Save comments in all orders
for (order_id of Object.keys(orders)) {
orders[order_id].user_comments = user_comments;
update_distant_order(order_id)
update_distant_order(order_id);
}
document.getElementById("search_input").focus();
......@@ -1606,6 +1606,12 @@ $(document).ready(function() {
});
// TODO on sync change : redirect (cf order_helper)
sync.on('change', function (info) {
console.log(info);
}).on('error', function (err) {
console.log(err);
});
// TODO insert fingerprint & timestamp on access to order
// Disable alert errors from datatables
......@@ -1670,7 +1676,8 @@ $(document).ready(function() {
/* Get order info from couchdb */
// Get order groups
let order_groups = []
let order_groups = [];
dbc.get("grouped_orders").then((doc) => {
order_groups = doc.groups;
......@@ -1697,6 +1704,7 @@ $(document).ready(function() {
for (let order_id of group_ids) {
// find order
let order = result.rows.find(el => el.id == 'order_' + order_id);
order = order.doc;
orders[order_id] = order;
......@@ -1727,6 +1735,7 @@ $(document).ready(function() {
})
.catch(function (e) {
let msg = ('message' in e && 'name' in e) ? e.name + ' : ' + e.message : '';
err = {msg, ctx: 'page init - get orders from couchdb', details: e};
console.error(err);
report_JS_error(err, 'reception');
......@@ -1738,6 +1747,7 @@ $(document).ready(function() {
})
.catch(function (e) {
let msg = ('message' in e && 'name' in e) ? e.name + ' : ' + e.message : '';
err = {msg, ctx: 'page init - get grouped orders', details: e};
console.error(err);
report_JS_error(err, 'reception');
......
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