Commit 619a82ca by Damien Moulard

linting

parent a58dde81
...@@ -55,10 +55,10 @@ sync.on('change', function (info) { ...@@ -55,10 +55,10 @@ sync.on('change', function (info) {
update_completed_count(); update_completed_count();
online = true; online = true;
}) })
.on('denied', function (err) { .on('denied', function () {
// a document failed to replicate (e.g. due to permissions) // a document failed to replicate (e.g. due to permissions)
}) })
.on('complete', function (info) { .on('complete', function () {
// handle complete // handle complete
}) })
.on('error', function (err) { .on('error', function (err) {
...@@ -87,9 +87,7 @@ function new_coop_validation() { ...@@ -87,9 +87,7 @@ function new_coop_validation() {
coop_list_view.hide(); coop_list_view.hide();
schoice_view.hide(); schoice_view.hide();
ncoop_view.hide(); ncoop_view.hide();
var barcode_base = current_coop.barcode_base;
var st = get_shift_name(current_coop.shift_template.data); var st = get_shift_name(current_coop.shift_template.data);
//coop_registration_details.find('.numbox').text('N° '+ barcode_base);
coop_registration_details.find('.shift_template').text(st); coop_registration_details.find('.shift_template').text(st);
process_state.html(current_coop.firstname + ' ' +current_coop.lastname); process_state.html(current_coop.firstname + ' ' +current_coop.lastname);
...@@ -148,12 +146,11 @@ function _really_save_new_coop(email, fname, lname, cap, pm, cn, bc, msex) { ...@@ -148,12 +146,11 @@ function _really_save_new_coop(email, fname, lname, cap, pm, cn, bc, msex) {
if (email != current_email) { if (email != current_email) {
//delete current_coop after copying revelant data //delete current_coop after copying revelant data
dbc.remove(current_email, coop._rev, function(err, response) { dbc.remove(current_email, coop._rev, function(err) {
if (err) { if (err) {
return console.log(err); return console.log(err);
} }
//console.log(response);
}); });
delete coop._rev; delete coop._rev;
...@@ -461,7 +458,7 @@ function setLocalInProcess(lip) { ...@@ -461,7 +458,7 @@ function setLocalInProcess(lip) {
localStorage.setItem("in_process", JSON.stringify(lip)); localStorage.setItem("in_process", JSON.stringify(lip));
} }
function keep_in_process_work(event) { function keep_in_process_work() {
//If data registration is in process, save it in localStorage //If data registration is in process, save it in localStorage
if (current_coop != null && typeof (current_coop.shift_template) == "undefined") { if (current_coop != null && typeof (current_coop.shift_template) == "undefined") {
local_in_process = getLocalInProcess(); local_in_process = getLocalInProcess();
......
...@@ -9,7 +9,7 @@ if (coop_is_connected()) { ...@@ -9,7 +9,7 @@ if (coop_is_connected()) {
env_template = $('#templates [data-type="envelops"]'); env_template = $('#templates [data-type="envelops"]');
// PouchDB sync actions listeners // PouchDB sync actions listeners
sync.on('change', function (info) { sync.on('change', function () {
// handle change // handle change
...@@ -27,10 +27,10 @@ if (coop_is_connected()) { ...@@ -27,10 +27,10 @@ if (coop_is_connected()) {
//update_completed_count(); //update_completed_count();
online = true; online = true;
}) })
.on('denied', function (err) { .on('denied', function () {
// a document failed to replicate (e.g. due to permissions) // a document failed to replicate (e.g. due to permissions)
}) })
.on('complete', function (info) { .on('complete', function () {
// handle complete // handle complete
}) })
.on('error', function (err) { .on('error', function (err) {
...@@ -333,7 +333,7 @@ if (coop_is_connected()) { ...@@ -333,7 +333,7 @@ if (coop_is_connected()) {
dsha1 = sha1(jss), dsha1 = sha1(jss),
member = {_id: dsha1, data: data, hash: dsha1 }; member = {_id: dsha1, data: data, hash: dsha1 };
dbc.put(member, function callback(err, result) { dbc.put(member, function callback(err) {
if (!err) { if (!err) {
closeModal(); closeModal();
page_cleaning(); page_cleaning();
......
...@@ -33,7 +33,6 @@ var shift_members = $('#current_shift_members'); ...@@ -33,7 +33,6 @@ var shift_members = $('#current_shift_members');
var service_validation = $('#service_validation'); var service_validation = $('#service_validation');
var validation_last_call = 0; var validation_last_call = 0;
var rattrapage_wanted = $('[data-next="rattrapage_1"]'); var rattrapage_wanted = $('[data-next="rattrapage_1"]');
var rattrapage_validation = $('#rattrapage_validation');
var webcam_is_attached = false; var webcam_is_attached = false;
var photo_advice = $('#photo_advice'); var photo_advice = $('#photo_advice');
var photo_studio = $('#photo_studio'); var photo_studio = $('#photo_studio');
...@@ -637,7 +636,7 @@ shift_members.on("click", '.btn[data-rid]', function() { ...@@ -637,7 +636,7 @@ shift_members.on("click", '.btn[data-rid]', function() {
}); });
pages.shopping_entry.on('css', function(e) { pages.shopping_entry.on('css', function() {
photo_advice.hide(); photo_advice.hide();
photo_studio.hide(); photo_studio.hide();
search_box_clear_html_elts(); search_box_clear_html_elts();
...@@ -645,14 +644,14 @@ pages.shopping_entry.on('css', function(e) { ...@@ -645,14 +644,14 @@ pages.shopping_entry.on('css', function(e) {
move_search_box(pages.rattrapage_1, pages.shopping_entry); move_search_box(pages.rattrapage_1, pages.shopping_entry);
}); });
pages.service_entry.on('css', function(e) { pages.service_entry.on('css', function() {
photo_advice.hide(); photo_advice.hide();
photo_studio.hide(); photo_studio.hide();
clean_service_entry(); clean_service_entry();
get_service_entry_data(); get_service_entry_data();
}); });
pages.rattrapage_1.on('css', function(e) { pages.rattrapage_1.on('css', function() {
search_box_clear_html_elts(); search_box_clear_html_elts();
var msg = "Vous venez pour un rattrapage."; var msg = "Vous venez pour un rattrapage.";
...@@ -682,7 +681,7 @@ function ask_for_easy_shift_validation() { ...@@ -682,7 +681,7 @@ function ask_for_easy_shift_validation() {
{ {
coop_id: operator.id coop_id: operator.id
}, },
function(err, result) { function(err) {
if (!err) { if (!err) {
alert("1 point volant vient d'être ajouté."); alert("1 point volant vient d'être ajouté.");
clean_search_for_easy_validate_zone(); clean_search_for_easy_validate_zone();
...@@ -798,7 +797,7 @@ $(document).ready(function() { ...@@ -798,7 +797,7 @@ $(document).ready(function() {
display_possible_members(); display_possible_members();
}, },
error: function(data) { error: function() {
err = { err = {
msg: "erreur serveur lors de la recherche de membres", msg: "erreur serveur lors de la recherche de membres",
ctx: 'easy_validate.search_members' ctx: 'easy_validate.search_members'
......
...@@ -11,6 +11,7 @@ function switch_active_tab() { ...@@ -11,6 +11,7 @@ function switch_active_tab() {
$('.tab_content').hide(); $('.tab_content').hide();
let tab = $(this).attr('id'); let tab = $(this).attr('id');
if (tab == 'tab_makeups') { if (tab == 'tab_makeups') {
$('#tab_makeups_content').show(); $('#tab_makeups_content').show();
} }
...@@ -23,6 +24,7 @@ function switch_active_tab() { ...@@ -23,6 +24,7 @@ function switch_active_tab() {
*/ */
function load_tab_data() { function load_tab_data() {
let current_tab = $('.tab .active').attr('id'); let current_tab = $('.tab .active').attr('id');
if (current_tab === 'tab_makeups' && makeups_members === null) { if (current_tab === 'tab_makeups' && makeups_members === null) {
load_makeups_members(); load_makeups_members();
} }
...@@ -66,13 +68,13 @@ function display_makeups_members() { ...@@ -66,13 +68,13 @@ function display_makeups_members() {
} }
// Remove members with 0 makeups to do // Remove members with 0 makeups to do
ids_to_remove = [] ids_to_remove = [];
for (member_item of makeups_members) { for (member_item of makeups_members) {
if (member_item.makeups_to_do == 0) { if (member_item.makeups_to_do == 0) {
ids_to_remove.push(member_item.id) ids_to_remove.push(member_item.id);
} }
} }
makeups_members = makeups_members.filter(m => !ids_to_remove.includes(m.id)) makeups_members = makeups_members.filter(m => !ids_to_remove.includes(m.id));
// TODO : select multiple and grouped action // TODO : select multiple and grouped action
makeups_members_table = $('#makeups_members_table').DataTable({ makeups_members_table = $('#makeups_members_table').DataTable({
...@@ -90,7 +92,7 @@ function display_makeups_members() { ...@@ -90,7 +92,7 @@ function display_makeups_members() {
}, },
{ {
data: "name", data: "name",
title: "Nom", title: "Nom"
}, },
{ {
data: "makeups_to_do", data: "makeups_to_do",
...@@ -102,7 +104,7 @@ function display_makeups_members() { ...@@ -102,7 +104,7 @@ function display_makeups_members() {
<button class="decrement_makeup btn--primary" id="decrement_member_${full.id}"> <button class="decrement_makeup btn--primary" id="decrement_member_${full.id}">
<i class="fas fa-arrow-down"></i> <i class="fas fa-arrow-down"></i>
</button>`; </button>`;
}, }
} }
], ],
aLengthMenu: [ aLengthMenu: [
...@@ -118,11 +120,12 @@ function display_makeups_members() { ...@@ -118,11 +120,12 @@ function display_makeups_members() {
] ]
], ],
iDisplayLength: -1, iDisplayLength: -1,
language: {url : '/static/js/datatables/french.json'}, language: {url : '/static/js/datatables/french.json'}
}); });
$('#makeups_members_table').on('click', 'tbody td .decrement_makeup', function () { $('#makeups_members_table').on('click', 'tbody td .decrement_makeup', function () {
const button_id = $(this).prop('id').split('_'); const button_id = $(this).prop('id')
.split('_');
const member_id = button_id[button_id.length - 1]; const member_id = button_id[button_id.length - 1];
const member = makeups_members.find(m => m.id == member_id); const member = makeups_members.find(m => m.id == member_id);
...@@ -134,7 +137,7 @@ function display_makeups_members() { ...@@ -134,7 +137,7 @@ function display_makeups_members() {
}, },
"Confirmer", "Confirmer",
false false
) );
}); });
$('#makeups_members_table').on('click', 'tbody td .select_member_cb', function () { $('#makeups_members_table').on('click', 'tbody td .select_member_cb', function () {
...@@ -149,6 +152,7 @@ function display_makeups_members() { ...@@ -149,6 +152,7 @@ function display_makeups_members() {
selected_rows.push(m_id); selected_rows.push(m_id);
} else { } else {
const i = selected_rows.findIndex(id => id == m_id); const i = selected_rows.findIndex(id => id == m_id);
selected_rows.splice(i, 1); selected_rows.splice(i, 1);
} }
...@@ -163,11 +167,12 @@ function display_makeups_members() { ...@@ -163,11 +167,12 @@ function display_makeups_members() {
}, },
"Confirmer", "Confirmer",
false false
) );
}); });
} }
} else { } else {
$("#decrement_selected_members_makeups").off().hide(); $("#decrement_selected_members_makeups").off()
.hide();
} }
}); });
} }
...@@ -179,7 +184,7 @@ function display_makeups_members() { ...@@ -179,7 +184,7 @@ function display_makeups_members() {
function decrement_makeups(member_ids) { function decrement_makeups(member_ids) {
openModal(); openModal();
data = [] data = [];
for (mid of member_ids) { for (mid of member_ids) {
member_index = makeups_members.findIndex(m => m.id == mid); member_index = makeups_members.findIndex(m => m.id == mid);
makeups_members[member_index].makeups_to_do -= 1; makeups_members[member_index].makeups_to_do -= 1;
...@@ -187,7 +192,7 @@ function decrement_makeups(member_ids) { ...@@ -187,7 +192,7 @@ function decrement_makeups(member_ids) {
data.push({ data.push({
member_id: mid, member_id: mid,
target_makeups_nb: makeups_members[member_index].makeups_to_do target_makeups_nb: makeups_members[member_index].makeups_to_do
}) });
} }
$.ajax({ $.ajax({
...@@ -197,10 +202,10 @@ function decrement_makeups(member_ids) { ...@@ -197,10 +202,10 @@ function decrement_makeups(member_ids) {
dataType:"json", dataType:"json",
traditional: true, traditional: true,
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
success: function(data) { success: function() {
selected_rows = []; selected_rows = [];
display_makeups_members(); display_makeups_members();
closeModal() closeModal();
}, },
error: function(data) { error: function(data) {
err = {msg: "erreur serveur pour décrémenter les rattrapages", ctx: 'load_makeups_members'}; err = {msg: "erreur serveur pour décrémenter les rattrapages", ctx: 'load_makeups_members'};
......
...@@ -46,10 +46,10 @@ sync.on('change', function (info) { ...@@ -46,10 +46,10 @@ sync.on('change', function (info) {
// replicate resumed (e.g. new changes replicating, user went back online) // replicate resumed (e.g. new changes replicating, user went back online)
online = true; online = true;
}) })
.on('denied', function (err) { .on('denied', function () {
// a document failed to replicate (e.g. due to permissions) // a document failed to replicate (e.g. due to permissions)
}) })
.on('complete', function (info) { .on('complete', function () {
// handle complete // handle complete
}) })
.on('error', function (err) { .on('error', function (err) {
...@@ -113,7 +113,7 @@ function put_current_coop_in_buffer_db(callback) { ...@@ -113,7 +113,7 @@ function put_current_coop_in_buffer_db(callback) {
var can_continue = true; var can_continue = true;
if (typeof current_coop._old_id != "undefined") { if (typeof current_coop._old_id != "undefined") {
dbc.remove(current_coop._old_id, current_coop._rev, function(err, response) { dbc.remove(current_coop._old_id, current_coop._rev, function(err) {
if (err) { if (err) {
console.log(err); can_continue = false; console.log(err); can_continue = false;
} }
...@@ -131,7 +131,6 @@ function put_current_coop_in_buffer_db(callback) { ...@@ -131,7 +131,6 @@ function put_current_coop_in_buffer_db(callback) {
function process_new_warning(event) { function process_new_warning(event) {
event.preventDefault(); event.preventDefault();
var msg = warning_msg.val(); var msg = warning_msg.val();
var btn = $(event.target).find('button');
openModal(); openModal();
if (msg.length > 0) { if (msg.length > 0) {
...@@ -208,7 +207,7 @@ function submit_full_coop_form() { ...@@ -208,7 +207,7 @@ function submit_full_coop_form() {
} }
post_form( post_form(
'/members/coop_validated_data', form_data, '/members/coop_validated_data', form_data,
function(err, result) { function(err) {
if (!err) { if (!err) {
setTimeout(after_save, 1500); setTimeout(after_save, 1500);
} else { } else {
......
...@@ -92,7 +92,7 @@ function process_form_submission(event) { ...@@ -92,7 +92,7 @@ function process_form_submission(event) {
openModal(); openModal();
post_form( post_form(
'/members/coop_validated_data', form_data, '/members/coop_validated_data', form_data,
function(err, result) { function(err) {
closeModal(); closeModal();
if (!err) { if (!err) {
...@@ -119,7 +119,7 @@ function process_form_submission(event) { ...@@ -119,7 +119,7 @@ function process_form_submission(event) {
openModal(); openModal();
post_form( post_form(
'/members/coop_warning_msg', data, '/members/coop_warning_msg', data,
function(err, result) { function(err) {
closeModal(); closeModal();
if (!err) { if (!err) {
$('#main_content').remove(); $('#main_content').remove();
......
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