1$(document).ready(function() { 2 3 /* Formulaire répartition Paris CAS 3 BTN VALIDER */ 4 if ($(".repartition-form").length) { 5 $("button[name=tmp-submit]").prop('disabled', true).css({'pointer-events': 'none', 'cursor': 'pointer'}).text('Vérifier le formulaire'); 6 7 $("#cancel-popup, .btn-close").click(function () { 8 $("button[name=tmp-submit]").prop('disabled', true).css({'pointer-events': 'none', 'cursor': 'pointer'}).text('Vérifier le formulaire'); 9 }); 10 11 $(".repartition-form button[name=tmp-submit]").parent().click(function () { 12 $("button[name=tmp-submit]").prop('disabled', true).css({'pointer-events': 'none', 'cursor': 'pointer'}).text('Vérifier le formulaire'); 13 let nombreParticipants = parseInt($("input[name=total_parts_update]").val()); 14 var error = false; 15 16 var more18 = parseInt($("input[name=18_less_parts]").val()); 17 var less18 = parseInt($("input[name=18_more_parts]").val()); 18 var totalParticipants = less18 + more18; 19 20 if (nombreParticipants !== totalParticipants) { 21 swal({ 22 title: "Erreur", 23 text: "La répartition des participants selon l'âge n'est pas égal au nombre total de participants (" + totalParticipants + " personnes renseignées sur " + nombreParticipants + " participants).", 24 icon: "error", 25 button: "Ok", 26 }); 27 error = true; 28 return; 29 } 30 31 var repartitionAccompagnants = parseInt($("input[name=number_acc_parts]").val()); 32 var accompagnantsHomme = parseInt($("input[name=number_homme_parts]").val()); 33 var accompagnantsFemme = parseInt($("input[name=number_femme_parts]").val()); 34 var totalAccompagnants = accompagnantsFemme + accompagnantsHomme; 35 if (repartitionAccompagnants !== totalAccompagnants) { 36 swal({ 37 title: "Erreur", 38 text: "La répartition H/F n'est pas égal au nombre total d'accompagnants (" + accompagnantsFemme + " femmes et " + accompagnantsHomme + " hommes sur " + repartitionAccompagnants + " accompagnants).", 39 icon: "error", 40 button: "Ok", 41 }); 42 error = true; 43 return; 44 } 45 if (repartitionAccompagnants === 0) { 46 swal({ 47 title: "Erreur", 48 text: "Aucun accompagnant renseigné.", 49 icon: "error", 50 button: "Ok", 51 }); 52 error = true; 53 return; 54 } 55 if (nombreParticipants < totalAccompagnants || nombreParticipants < repartitionAccompagnants) { 56 swal({ 57 title: "Erreur", 58 text: "Le nombre d'accompagnant est supérieur au nombre de participants (" + totalAccompagnants + " personnes renseignées sur " + nombreParticipants + " participants).", 59 icon: "error", 60 button: "Ok", 61 }); 62 error = true; 63 return; 64 } 65 66 var nombreJeunes = parseInt($("input[name=number_jeune_parts]").val()); 67 /* Point de controle NB jeunes + Accompagnants = total participants */ 68 if (nombreParticipants < nombreJeunes + totalAccompagnants || nombreParticipants > nombreJeunes + totalAccompagnants) { 69 swal({ 70 title: "Erreur", 71 text: "Le nombre de Jeunes/élèves et Accompagnants n'est pas égal au nombre de participants (" + nombreJeunes + " élèves et " + totalAccompagnants + " accompagnants " + " renseignés sur " + nombreParticipants + " participants).", 72 icon: "error", 73 button: "Ok", 74 }); 75 error = true; 76 return; 77 } 78 79 if (nombreJeunes === 0) { 80 swal({ 81 title: "Erreur", 82 text: "Aucun élève renseigné.", 83 icon: "error", 84 button: "Ok", 85 }); 86 error = true; 87 return; 88 } 89 90 var garcon = parseInt($("input[name=number_garcon_parts]").val()); 91 var fille = parseInt($("input[name=number_fille_parts]").val()); 92 var totalJeunes = garcon + fille; 93 if (nombreJeunes !== totalJeunes) { 94 swal({ 95 title: "Erreur", 96 text: "La répartition F/G n'est pas égal au nombre total des Jeunes/élèves ("+ garcon + " garçons et " + fille + " filles sur " + nombreJeunes + " élèves).", 97 icon: "error", 98 button: "Ok", 99 }); 100 error = true; 101 return; 102 } 103 104 if(!$('input[name=alim]').is(':checked') && !$("input[name=alim_spe]").is(":checked")) { 105 swal({ 106 title: "Erreur", 107 text: "Aucun régime alimentaire n'a été précisé.", 108 icon: "error", 109 button: "Ok", 110 }); 111 error = true; 112 return; 113 } 114 115 var nombrePorc = parseInt($("input[name=no_porc_alim]").val()); 116 var nombreVege = parseInt($("input[name=vege_alim]").val()); 117 var nombreAutre1 = parseInt($("input[name=autre1_alim]").val()); 118 var nombreAutre2 = parseInt($("input[name=autre2_alim]").val()); 119 var totalNombre = nombrePorc + nombreVege + nombreAutre1 + nombreAutre2; 120 var alimSpeValue = $("input[name='alim_spe']:checked").val(); 121 122 if (totalNombre === 0 && alimSpeValue === 'Oui') { 123 swal({ 124 title: "Erreur", 125 text: "Régimes alimentaires : Vous ne pouvez pas mettre une valeur négative, nulle ou supérieur au nombre total de participant.", 126 icon: "error", 127 button: "Ok", 128 }); 129 error = true; 130 return; 131 } 132 if (totalNombre > nombreParticipants) { 133 swal({ 134 title: "Erreur", 135 text: "Le nombre de personnes ayant un régime alimentaire spécifique est supérieur au nombre total de participant.", 136 icon: "error", 137 button: "Ok", 138 }); 139 error = true; 140 return; 141 } 142 143 if(!$('input[name=handicap]').is(':checked') && !$("input[name=handicap_spe]").is(":checked")) { 144 swal({ 145 title: "Erreur", 146 text: "Aucun handicap n'a été précisé.", 147 icon: "error", 148 button: "Ok", 149 }); 150 error = true; 151 return; 152 } 153 154 var handicap_frm_number = parseInt($('input[name=handicap_frm_number]').val()); 155 var handicap_fre_number = parseInt($('input[name=handicap_fre_number]').val()); 156 var autisme = parseInt($('input[name=handicap_autisme_number]').val()); 157 var voyant = parseInt($('input[name=handicap_nonvoyant_number]').val()); 158 var surdite = parseInt($('input[name=handicap_surdite_number]').val()); 159 var dys = parseInt($('input[name=handicap_dys_number]').val()); 160 var autreHandicap = parseInt($('input[name=handicap_autre_number]').val()); 161 var totalHandicap = handicap_frm_number + handicap_fre_number + autisme + voyant + surdite + dys + autreHandicap; 162 var handicapSpeValue = $("input[name='handicap_spe']:checked").val(); 163 164 165 if (totalHandicap === 0 && handicapSpeValue === 'Oui') { 166 swal({ 167 title: "Erreur", 168 text: "Handicap/Besoins spécifiques : Vous ne pouvez pas mettre une valeur négative, nulle ou supérieur au nombre total de participant.", 169 icon: "error", 170 button: "Ok", 171 }); 172 error = true; 173 return; 174 } 175 if (totalHandicap > nombreParticipants) { 176 swal({ 177 title: "Erreur", 178 text: "Le nombre de personnes ayant un handicap est supérieur au nombre total de participants.", 179 icon: "error", 180 button: "Ok", 181 }); 182 error = true; 183 return; 184 } 185 186 if (error) { 187 $("button[name=tmp-submit]").prop('disabled', true).css({'pointer-events': 'none', 'cursor': 'pointer'}).text('Vérifier le formulaire'); 188 } 189 190 /* If error = false send form && create recap */ 191 if (!error) { 192 var button = $("button[name=tmp-submit]"); 193 // Active le bouton 194 button.prop('disabled', false).css('pointer-events', 'all').text('Valider'); 195 196 // Récupère l'ID du modal à partir de l'attribut de données du bouton 197 var modalId = button.data('bs-target'); 198 199 $('#responseAjax').empty(); 200 $('#responseAjax').append('<div class="d-flex align-items-center loader"><strong>Génération du récapitulatif / Generating the summary...</strong><div class="spinner-border ms-auto" role="status" aria-hidden="true"></div></div>'); 201 202 203 // Ouvre le modal Bootstrap correspondant 204 $(modalId).modal('show'); 205 206 // Trouve le formulaire le plus proche et le soumet 207 $('#ajaxPopup').submit(); 208 209 } 210 }); 211 212 /* STEP BY STEP ERROR GENERATION */ 213 /* Ajout des valeurs auto AGE */ 214 215 // Ãcouter les changements dans les champs more18 et less18 216 $("input[name='18_more_parts']").on("input", function() { 217 // Récupérer la valeur de more18 218 var more18 = parseInt($(this).val()); 219 220 // Si more18 est valide, mettre à jour less18 221 if (!isNaN(more18)) { 222 let nombreParticipants = parseInt($("input[name='total_parts_update']").val()); 223 $("input[name='18_less_parts']").val(nombreParticipants - more18); 224 } 225 }); 226 227 // Ãcouter les changements dans le champ less18 228 $("input[name='18_less_parts']").on("input", function() { 229 // Récupérer la valeur de less18 230 var less18 = parseInt($(this).val()); 231 232 // Si less18 est valide, mettre à jour more18 233 if (!isNaN(less18)) { 234 let nombreParticipants = parseInt($("input[name='total_parts_update']").val()); 235 $("input[name='18_more_parts']").val(nombreParticipants - less18); 236 } 237 }); 238 239 // Ãcouter les changements dans les champs more18 et less18 240 $("input[name='number_acc_parts']").on("input", function() { 241 // Récupérer la valeur de more18 242 var acc = parseInt($(this).val()); 243 let nombreParticipants = parseInt($("input[name='total_parts_update']").val()); 244 245 // Si more18 est valide, mettre à jour less18 246 if (!isNaN(acc) && nombreParticipants !== 0) { 247 $("input[name='number_jeune_parts']").val(nombreParticipants - acc); 248 } 249 }); 250 251 // Ãcouter les changements dans le champ less18 252 $("input[name='number_jeune_parts']").on("input", function() { 253 // Récupérer la valeur de less18 254 var jeunes = parseInt($(this).val()); 255 let nombreParticipants = parseInt($("input[name='total_parts_update']").val()); 256 257 // Si less18 est valide, mettre à jour more18 258 if (!isNaN(jeunes) && nombreParticipants !== 0) { 259 $("input[name='number_acc_parts']").val(nombreParticipants - jeunes); 260 } 261 }); 262 263 264 // Ãcouter les changements dans les champs more18 et less18 265 $("input[name='number_femme_parts']").on("input", function() { 266 // Récupérer la valeur de more18 267 var femmes = parseInt($(this).val()); 268 let nombreAccompagnant = parseInt($("input[name='number_acc_parts']").val()); 269 270 // Si more18 est valide, mettre à jour less18 271 if (femmes > nombreAccompagnant) { 272 swal({ 273 title: "Erreur", 274 text: "Le nombre de femmes est supérieur au nombre total d'accompagnants.", 275 icon: "error", 276 button: "Ok", 277 }); 278 $(this).val(0); 279 return false; 280 } 281 if (!isNaN(femmes) && nombreAccompagnant !== 0 && femmes <= nombreAccompagnant) { 282 $("input[name='number_homme_parts']").val(nombreAccompagnant - femmes); 283 } 284 285 }); 286 287 // Ãcouter les changements dans le champ less18 288 $("input[name='number_homme_parts']").on("input", function() { 289 // Récupérer la valeur de less18 290 var hommes = parseInt($(this).val()); 291 let nombreAccompagnant = parseInt($("input[name='number_acc_parts']").val()); 292 293 // Si less18 est valide, mettre à jour more18 294 if (hommes > nombreAccompagnant) { 295 swal({ 296 title: "Erreur", 297 text: "Le nombre d'hommes est supérieur au nombre total d'accompagnants.", 298 icon: "error", 299 button: "Ok", 300 }); 301 $(this).val(0); 302 return false; 303 } 304 if (!isNaN(hommes) && nombreAccompagnant !== 0 && hommes <= nombreAccompagnant) { 305 $("input[name='number_femme_parts']").val(nombreAccompagnant - hommes); 306 } 307 308 }); 309 310 // Ãcouter les changements dans les champs more18 et less18 311 $("input[name='number_fille_parts']").on("input", function() { 312 // Récupérer la valeur de more18 313 var filles = parseInt($(this).val()); 314 let nombreEleves = parseInt($("input[name='number_jeune_parts']").val()); 315 316 // Si more18 est valide, mettre à jour less18 317 if (filles > nombreEleves) { 318 swal({ 319 title: "Erreur", 320 text: "Le nombre de filles est supérieur au nombre total d'élèves.", 321 icon: "error", 322 button: "Ok", 323 }); 324 $(this).val(0); 325 return false; 326 } 327 if (!isNaN(filles) && nombreEleves !== 0 && filles <= nombreEleves) { 328 $("input[name='number_garcon_parts']").val(nombreEleves - filles); 329 } 330 }); 331 332 // Ãcouter les changements dans le champ less18 333 $("input[name='number_garcon_parts']").on("input", function() { 334 // Récupérer la valeur de less18 335 var garcons = parseInt($(this).val()); 336 let nombreEleves = parseInt($("input[name='number_jeune_parts']").val()); 337 338 // Si less18 est valide, mettre à jour more18 339 if (garcons > nombreEleves) { 340 swal({ 341 title: "Erreur", 342 text: "Le nombre de garçons est supérieur au nombre total d'élèves.", 343 icon: "error", 344 button: "Ok", 345 }); 346 $(this).val(0); 347 return false; 348 } 349 if (!isNaN(garcons) && nombreEleves !== 0 && garcons <= nombreEleves) { 350 $("input[name='number_fille_parts']").val(nombreEleves - garcons); 351 } 352 }); 353 354 $("input[name=alim], input[name=alim_spe]").click(function() { 355 let nombreParticipants = pa
355rseInt($("input[name='total_parts_update']").val()); 356 var porc = parseInt($('input[name=no_porc_alim]').val()); 357 var vege = parseInt($('input[name=vege_alim]').val()); 358 var autre1 = parseInt($('input[name=autre1_alim]').val()); 359 var autre2 = parseInt($('input[name=autre2_alim]').val()); 360 var totalAlim = porc + vege + autre1 + autre2; 361 if (porc >= nombreParticipants || vege >= nombreParticipants || autre1 >= nombreParticipants || autre2 >= nombreParticipants || totalAlim >= nombreParticipants) { 362 var thisValue = parseInt($(this).parent('.radio-toggle').next(".number-toggle").find("input[type=number]").val()); 363 if (thisValue === 0) { 364 swal({ 365 title: "Erreur", 366 text: "La somme des participants pour les régimes alimentaires dépasse le nombre total de participants.", 367 icon: "error", 368 button: "Ok", 369 }); 370 $(this).prop('readonly', true); 371 return false; 372 } else { 373 $(this).prop('readonly', false); 374 } 375 } else { 376 $(this).prop('readonly', false); 377 } 378 }); 379 380 $("input[name=no_porc_alim], input[name=vege_alim], input[name=autre1_alim], input[name=autre2_alim]").change(function() { 381 let nombreParticipants = parseInt($("input[name='total_parts_update']").val()); 382 var porc = parseInt($('input[name=no_porc_alim]').val()); 383 var vege = parseInt($('input[name=vege_alim]').val()); 384 var autre1 = parseInt($('input[name=autre1_alim]').val()); 385 var autre2 = parseInt($('input[name=autre2_alim]').val()); 386 var totalAlim = porc + vege + autre1 + autre2; 387 var thisValue = parseInt($(this).val()); 388 389 if (totalAlim > nombreParticipants) { 390 swal({ 391 title: "Erreur", 392 text: "Vous avez renseigné le nombre maximum de participants pour les régimes alimentaires.", 393 icon: "error", 394 button: "Ok", 395 }); 396 $(this).val(0); 397 return false; 398 } 399 400 }); 401 402 403 $("input[name=handicap], input[name=handicap_spe]").click(function() { 404 let nombreParticipants = parseInt($("input[name='total_parts_update']").val()); 405 var handicap_frm_number = parseInt($('input[name=handicap_frm_number]').val()); 406 var handicap_fre_number = parseInt($('input[name=handicap_fre_number]').val()); 407 var autisme = parseInt($('input[name=handicap_autisme_number]').val()); 408 var voyant = parseInt($('input[name=handicap_nonvoyant_number]').val()); 409 var surdite = parseInt($('input[name=handicap_surdite_number]').val()); 410 var dys = parseInt($('input[name=handicap_dys_number]').val()); 411 var autreHandicap = parseInt($('input[name=handicap_autre_number]').val()); 412 var totalHandicap = handicap_frm_number + handicap_fre_number + autisme + voyant + surdite + dys + autreHandicap; 413 var handicapSpeValue = $("input[name='handicap_spe']:checked").val(); 414 if (totalHandicap >= nombreParticipants || handicap_frm_number >= nombreParticipants || handicap_fre_number >= nombreParticipants || autisme >= nombreParticipants || voyant >= nombreParticipants || surdite >= nombreParticipants || dys >= nombreParticipants) { 415 var thisValue = parseInt($(this).parent('.radio-toggle').next(".number-toggle").find("input[type=number]").val()); 416 if (thisValue === 0) { 417 swal({ 418 title: "Erreur", 419 text: "Vous avez renseigné le nombre maximum de participants pour les handicap.", 420 icon: "error", 421 button: "Ok", 422 }); 423 $(this).prop('readonly', true); 424 return false; 425 } else { 426 $(this).prop('readonly', false); 427 } 428 } else { 429 $(this).prop('readonly', false); 430 } 431 }); 432 433 434 $("input[name=handicap_frm_number], input[name=handicap_fre_number], input[name=handicap_autisme_number], input[name=handicap_nonvoyant_number], input[name=handicap_surdite_number], input[name=handicap_dys_number], input[name=handicap_autre_number]").change(function() { 435 let nombreParticipants = parseInt($("input[name='total_parts_update']").val()); 436 var handicap_frm_number = parseInt($('input[name=handicap_frm_number]').val()); 437 var handicap_fre_number = parseInt($('input[name=handicap_fre_number]').val()); 438 var autisme = parseInt($('input[name=handicap_autisme_number]').val()); 439 var voyant = parseInt($('input[name=handicap_nonvoyant_number]').val()); 440 var surdite = parseInt($('input[name=handicap_surdite_number]').val()); 441 var dys = parseInt($('input[name=handicap_dys_number]').val()); 442 var autreHandicap = parseInt($('input[name=handicap_autre_number]').val()); 443 var totalHandicap = handicap_frm_number + handicap_fre_number + autisme + voyant + surdite + dys + autreHandicap; 444 var handicapSpeValue = $("input[name='handicap_spe']:checked").val(); 445 if (totalHandicap > nombreParticipants) { 446 swal({ 447 title: "Erreur", 448 text: "Vous avez renseigné le nombre maximum de participants pour les handicap.", 449 icon: "error", 450 button: "Ok", 451 }); 452 $(this).val(0); 453 return false; 454 } 455 456 }); 457 458 } 459 460});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.