Commit 9479e21d by Damien Moulard

linting

parent a91c4f18
Pipeline #2397 passed with stage
in 1 minute 28 seconds
......@@ -284,6 +284,7 @@ function create_pair(payload) {
data.responseJSON.errors.map(function(error) {
message += ('\n' + error);
return null;
});
}
......
......@@ -92,12 +92,12 @@ function new_coop_validation() {
coop_registration_details.find('.shift_template').text(st);
process_state.html(current_coop.firstname + ' ' +current_coop.lastname);
coop_registration_details.find("#parentName").text("")
coop_registration_details.find("#parent").attr("hidden", true)
coop_registration_details.find("#parentName").text("");
coop_registration_details.find("#parent").attr("hidden", true);
if (current_coop.parent_name !== undefined) {
coop_registration_details.find("#parentName").text(current_coop.parent_name)
coop_registration_details.find("#parent").removeAttr("hidden")
coop_registration_details.find("#parentName").text(current_coop.parent_name);
coop_registration_details.find("#parent").removeAttr("hidden");
}
if (current_coop.shift_template.data && current_coop.shift_template.data.id != ASSOCIATE_MEMBER_SHIFT) {
......@@ -126,7 +126,7 @@ function create_new_coop() {
$('.chosen_associate').html("");
$('.chosen_associate_area').hide();
$('.member_choice').removeClass('choice_active');
$(".remove_binome_icon").on("click", hide_chosen_associate)
$(".remove_binome_icon").on("click", hide_chosen_associate);
local_in_process = getLocalInProcess();
if (getLocalInProcess().length > 0) {
empty_waiting_local_processes();
......@@ -271,8 +271,10 @@ function store_new_coop(event) {
if (active_asso_area.length > 0) {
// If user click as if a "binôme" is beeing created, data about parent member must exist
let associated_data_ok = false;
if (
($(active_asso_area[0]).attr('id') === "new_member_choice" && $('#new_member_input').val().trim().length > 0)
($(active_asso_area[0]).attr('id') === "new_member_choice" && $('#new_member_input').val()
.trim().length > 0)
||
($(active_asso_area[0]).attr('id') === "existing_member_choice" && $('#existing_member_choice_action .chosen_associate div.member').length > 0)
) {
......@@ -361,6 +363,7 @@ function modify_current_coop() {
$('#new_member_choice_action').hide();
$('#existing_member_choice').addClass('choice_active');
var member_button = '<div>' + current_coop.parent_name + '</div>';
$('.chosen_associate').html(member_button);
$('.chosen_associate_area').show();
associated_old_choice = 'existing_member_choice';
......
......@@ -75,7 +75,7 @@ var reset_shift_process_actions_zone = function() {
current_shift_process_data_actions.off('click', 'a');
current_shift_process_data_actions.hide();
current_shift_process_data_actions.empty();
}
};
function fill_member_slide(member) {
no_pict_msg.hide();
......@@ -330,12 +330,13 @@ function fill_service_entry(s) {
if (s.state == 'draft' || s.state == 'confirm') {
let btn = $('<a>').addClass('btn btn--primary txtcenter')
.text('Enregistrer les absences / présences')
.attr('id','record_shift_absences');
.attr('id', 'record_shift_absences');
current_shift_process_data_actions.append(btn);
current_shift_process_data_actions.on('click', '#record_shift_absences', function(){
current_shift_process_data_actions.on('click', '#record_shift_absences', function() {
msg = "<p>Lancer le traitement des présences et absences de ce service</p>";
openModal(msg, function() {
btn.attr('disabled', 'true')
btn.attr('disabled', 'true');
try {
$.ajax({
url: '/members/record_shift_absences/' + s.id,
......
......@@ -25,7 +25,7 @@ function init_my_shifts_tile() {
function process_asked_shift_template_change(shift_t_id) {
var s_data = shift_templates[shift_t_id].data;
var shift_name = get_shift_name(s_data);
let msg = 'Inscription au créneau ' + shift_name
let msg = 'Inscription au créneau ' + shift_name;
openModal(
msg,
......@@ -94,8 +94,9 @@ function process_asked_shift_template_change(shift_t_id) {
);
}
function edit_shift_template_registration(){
function edit_shift_template_registration() {
let external = true;
if (calendar == null) calendar = $('#modal-calendar-choice').clone();
if ($('#modal-calendar-choice').html().length > 0) {
$('#modal-calendar-choice').empty();
......@@ -103,7 +104,10 @@ function edit_shift_template_registration(){
}
calendar.find('.oddeven_selector').empty();
displayMsg(calendar.html());
$('#week_types').find('input').change(()=>{filter_weeks(external)});
$('#week_types').find('input')
.change(() => {
filter_weeks(external);
});
retrieve_and_draw_shift_tempates(external);
......@@ -127,7 +131,8 @@ function init_home() {
});
$(".member_shift_name_area").on("click", ".fa-edit", (e) => {
$('#week_types').find('input').change(filter_weeks);
$('#week_types').find('input')
.change(filter_weeks);
e.preventDefault();
edit_shift_template_registration();
});
......
......@@ -599,6 +599,7 @@ function init_calendar_page() {
} else {
// Display modal
let modal_template = $("#modal_add_shift_template");
modal_template.find(".date_new_shift").text(new_shift_date);
modal_template.find(".time_new_shift").text(new_shift_time);
openModal(
......@@ -757,7 +758,8 @@ function init_delete_registration_buttons() {
if (partner_data.extra_shift_done > 0) {
$(".delete_registration_button").on("click", function() {
let shift_name = $(this).closest("div")
.parent().parent()
.parent()
.parent()
.find(".shift_line_date")
.text()
.trim();
......
......@@ -314,6 +314,7 @@ $(document).ready(function() {
// For associated people, their parent name is attached in their display name
let partner_name_split = partner_data.name.split(', ');
partner_data.name = partner_name_split[partner_name_split.length - 1];
base_location = (app_env === 'dev') ? '/members_space/' : '/';
......
......@@ -138,7 +138,7 @@ function debounceFunction(func, delay = 1000) {
*/
function handle_unauthorize() {
alert("La session a expiré. Vous allez devoir vous reconnecter.");
$( "#logout" ).trigger( "click" );
$("#logout").trigger("click");
}
/* - PRODUCTS */
......@@ -314,6 +314,7 @@ function compute_and_affect_product_supplier_quantities(coeff, days) {
// Set qty to purchase for supplier with higher priority
let target_supplierinfo_index = 0;
let min_sequence = Number.POSITIVE_INFINITY; // min sequence = higher priority
for (let i in products[key].suppliersinfo) {
let suppliersinfo_sequence = products[key].suppliersinfo[i].sequence;
......
......@@ -1979,10 +1979,12 @@ function add_products_action() {
for (let qty_input of qty_inputs) {
if ($(qty_input).val() === "") {
has_empty_qty_input = true;
$(qty_input).closest(".product_qty").find(".product_qty_input_alert")
$(qty_input).closest(".product_qty")
.find(".product_qty_input_alert")
.show();
} else {
$(qty_input).closest(".product_qty").find(".product_qty_input_alert")
$(qty_input).closest(".product_qty")
.find(".product_qty_input_alert")
.hide();
}
}
......@@ -2024,8 +2026,10 @@ function create_orders() {
for (let i = 0; i < add_products_lines.length; i++) {
let line = add_products_lines[i];
if ($(line).find(".product_name").text() === p.name) {
product_uom = $(line).find(".product_uom").text();
if ($(line).find(".product_name")
.text() === p.name) {
product_uom = $(line).find(".product_uom")
.text();
if (product_uom.includes("kg")) {
product_qty = parseFloat($(line).find(".product_qty_input")
......@@ -2045,15 +2049,16 @@ function create_orders() {
// If package qty is > than input value, package qty will be used while creating order
let package_qty = p_supplierinfo.package_qty;
if (product_qty < package_qty) {
package_qty = product_qty;
}
// Round differently for unit & kg products
if (product_uom.includes("kg") ) {
if (product_uom.includes("kg")) {
item_qty_package = Math.round((product_qty / package_qty) * 1e2) / 1e2;
} else {
item_qty_package = Math.round(product_qty / package_qty)
item_qty_package = Math.round(product_qty / package_qty);
}
orders_data.suppliers_data[supplier_id].lines.push({
......
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