Commit ba8cceb1 by Damien Moulard

linting

parent ab49214a
Pipeline #1880 passed with stage
in 1 minute 31 seconds
...@@ -68,8 +68,7 @@ function prepare_server_data(data) { ...@@ -68,8 +68,7 @@ function prepare_server_data(data) {
if (history_item.associate_registered == false || history_item.associate_registered == undefined) { if (history_item.associate_registered == false || history_item.associate_registered == undefined) {
history_item.associate_registered = ""; history_item.associate_registered = "";
} } else {
else {
if (partner_data.associated_partner_id != "False") { if (partner_data.associated_partner_id != "False") {
if (history_item.associate_registered==="partner") { if (history_item.associate_registered==="partner") {
history_item.associate_registered = partner_data.name; history_item.associate_registered = partner_data.name;
......
...@@ -40,7 +40,7 @@ function add_or_change_shift(new_shift_id) { ...@@ -40,7 +40,7 @@ function add_or_change_shift(new_shift_id) {
+'&idPartner=' + partner_data.partner_id +'&idPartner=' + partner_data.partner_id
+ '&shift_type=' + partner_data.shift_type + '&shift_type=' + partner_data.shift_type
+ '&verif_token=' + partner_data.verif_token; + '&verif_token=' + partner_data.verif_token;
} else if(partner_data.is_associated_people === "True" && block_actions_for_attached_people === "False") { } else if (partner_data.is_associated_people === "True" && block_actions_for_attached_people === "False") {
tData = 'idNewShift=' + new_shift_id tData = 'idNewShift=' + new_shift_id
+'&idPartner=' + partner_data.parent_id +'&idPartner=' + partner_data.parent_id
+ '&shift_type=' + partner_data.shift_type + '&shift_type=' + partner_data.shift_type
...@@ -144,6 +144,8 @@ function add_or_change_shift(new_shift_id) { ...@@ -144,6 +144,8 @@ function add_or_change_shift(new_shift_id) {
} }
}); });
} }
return null;
} }
/** /**
...@@ -160,7 +162,7 @@ function delete_shift_registration(shift_registration_id) { ...@@ -160,7 +162,7 @@ function delete_shift_registration(shift_registration_id) {
if (partner_data.is_associated_people === "False") { if (partner_data.is_associated_people === "False") {
tData += '&verif_token=' + partner_data.verif_token; tData += '&verif_token=' + partner_data.verif_token;
} else if(partner_data.is_associated_people === "True" && block_actions_for_attached_people === "False") { } else if (partner_data.is_associated_people === "True" && block_actions_for_attached_people === "False") {
tData += '&verif_token=' + partner_data.parent_verif_token; tData += '&verif_token=' + partner_data.parent_verif_token;
} else { } else {
return false; return false;
...@@ -205,6 +207,8 @@ function delete_shift_registration(shift_registration_id) { ...@@ -205,6 +207,8 @@ function delete_shift_registration(shift_registration_id) {
} }
}); });
} }
return null;
} }
/** /**
...@@ -212,7 +216,7 @@ function delete_shift_registration(shift_registration_id) { ...@@ -212,7 +216,7 @@ function delete_shift_registration(shift_registration_id) {
* @param {string} partner * @param {string} partner
* @param {string} shift_id * @param {string} shift_id
*/ */
function affect_shift(partner, shift_id) { function affect_shift(partner, shift_id) {
if (is_time_to('affect_shift')) { if (is_time_to('affect_shift')) {
tData = 'idShiftRegistration=' + shift_id tData = 'idShiftRegistration=' + shift_id
+'&idPartner=' + partner_data.partner_id +'&idPartner=' + partner_data.partner_id
...@@ -295,6 +299,7 @@ function init_shifts_list() { ...@@ -295,6 +299,7 @@ function init_shifts_list() {
let datetime_shift_start = new Date(shift.date_begin.replace(/\s/, 'T')); let datetime_shift_start = new Date(shift.date_begin.replace(/\s/, 'T'));
let f_date_shift_start = datetime_shift_start.toLocaleDateString("fr-fr", date_options); let f_date_shift_start = datetime_shift_start.toLocaleDateString("fr-fr", date_options);
f_date_shift_start = f_date_shift_start.charAt(0).toUpperCase() + f_date_shift_start.slice(1); f_date_shift_start = f_date_shift_start.charAt(0).toUpperCase() + f_date_shift_start.slice(1);
shift_line_template.find(".shift_line_date").text(f_date_shift_start); shift_line_template.find(".shift_line_date").text(f_date_shift_start);
...@@ -316,7 +321,8 @@ function init_shifts_list() { ...@@ -316,7 +321,8 @@ function init_shifts_list() {
if (partner_data.associated_partner_id === "False" && partner_data.parent_id === "False") { if (partner_data.associated_partner_id === "False" && partner_data.parent_id === "False") {
shift_line_template.find('.affect_associate_registered').hide(); shift_line_template.find('.affect_associate_registered').hide();
} else { } else {
shift_line_template.find('.affect_associate_registered').closest(".shift_line_container").attr('id', 'shift_id_'+shift.id); shift_line_template.find('.affect_associate_registered').closest(".shift_line_container")
.attr('id', 'shift_id_'+shift.id);
if (shift.associate_registered==="both") { if (shift.associate_registered==="both") {
shift_line_template.find('.affect_associate_registered').text("Les deux"); shift_line_template.find('.affect_associate_registered').text("Les deux");
} else if (shift.associate_registered==="partner") { } else if (shift.associate_registered==="partner") {
...@@ -341,6 +347,7 @@ function init_shifts_list() { ...@@ -341,6 +347,7 @@ function init_shifts_list() {
if (partner_data.extra_shift_done > 0 && shift.is_makeup === false) { if (partner_data.extra_shift_done > 0 && shift.is_makeup === false) {
if (shift_line_template.find(".delete_registration_button").length === 0) { if (shift_line_template.find(".delete_registration_button").length === 0) {
let delete_reg_button_template = $("#delete_registration_button_template"); let delete_reg_button_template = $("#delete_registration_button_template");
shift_line_template.find(".shift_line_container").append(delete_reg_button_template.html()); shift_line_template.find(".shift_line_container").append(delete_reg_button_template.html());
} }
} else { } else {
...@@ -379,7 +386,8 @@ function init_shifts_list() { ...@@ -379,7 +386,8 @@ function init_shifts_list() {
$(".affect_associate_registered").on("click", function() { $(".affect_associate_registered").on("click", function() {
// Display modal // Display modal
let id = $(this).closest(".shift_line_container").attr('id') let id = $(this).closest(".shift_line_container")
.attr('id')
.split('_')[2]; .split('_')[2];
let modal_template = $("#modal_affect_shift"); let modal_template = $("#modal_affect_shift");
...@@ -697,8 +705,12 @@ function init_read_only_calendar_page() { ...@@ -697,8 +705,12 @@ function init_read_only_calendar_page() {
function init_delete_registration_buttons() { function init_delete_registration_buttons() {
$(".delete_registration_button").off(); $(".delete_registration_button").off();
$(".delete_registration_button").on("click", function() { $(".delete_registration_button").on("click", function() {
let shift_name = $(this).closest("div").siblings(".selectable_shift_line").text().trim(); let shift_name = $(this).closest("div")
let shift_id = $(this).closest(".shift_line_container").attr('id') .siblings(".selectable_shift_line")
.text()
.trim();
let shift_id = $(this).closest(".shift_line_container")
.attr('id')
.split('_')[2]; .split('_')[2];
openModal( openModal(
......
...@@ -265,7 +265,7 @@ $(document).ready(function() { ...@@ -265,7 +265,7 @@ $(document).ready(function() {
// debouncing function from John Hann // debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) { var debounce = function (func, threshold, execAsap) {
var timeout; var timeout = null;
return function debounced () { return function debounced () {
var obj = this, args = arguments; var obj = this, args = arguments;
......
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