From c3521810ed9d6d0275437ee171d496665c9562aa Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Sat, 3 Jan 2026 01:37:14 +0000 Subject: [PATCH] a --- Js/fonctions.js | 187 ++++++++++++++++++++++++++++++++++++++++++++++++ Vue/gabarit.php | 2 +- 2 files changed, 188 insertions(+), 1 deletion(-) diff --git a/Js/fonctions.js b/Js/fonctions.js index c18ba48..08a4104 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -1374,3 +1374,190 @@ function creer_avenant() window.location.assign($("#racineWeb" ).val()+"Creeravenant/"); } + +function enregistrer_avenant() +{ + codeTypeAvenant=$("#codeTypeAvenant").val(); + oldCodeTypeAvenant=$("#oldCodeTypeAvenant").val(); + + if ($("#codeTypeAvenant").val()<" ") + { + v_msg="Veuillez sélectionner le type d\'avenant!"; + v_msgEng="Please select the type of amendment!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if(codeTypeAvenant!="CHE" && codeTypeAvenant!="REN") + { + var d_effet = new Date($("#dateEffetSql").val()); + var d_fin = new Date($("#dateFinSql").val()); + var d_avenant = $("#dateAvenant").datepicker("getDate"); + + dt_effet = Math.round(Date.parse(d_effet)/(1000*3600*24)); + dt_fin = Math.round(Date.parse(d_fin)/(1000*3600*24)); + dt_avenant = Math.round(Date.parse(d_avenant)/(1000*3600*24)); + + /* + alert("dt_effet => "+dt_effet); + alert("dt_fin => "+dt_fin); + alert("dt_avenant => "+dt_avenant); + return; + */ + + if (dt_avenant>dt_fin || dt_avenantdt2) + { + v_msg="Veuillez revoir la date de renouvellement!"; + v_msgEng="Please review the renewal date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + var eff = $("#dateAvenant").datepicker("getDate"); + var ech = $("#dateEcheanceRen").datepicker("getDate"); + + if (ech>eff.addMonths(12)) { + v_msg="Période supérieur à un an!"; + v_msgEng="Period greater than one year!"; + alert_ebene(v_msg, v_msgEng); + } + } + + if(codeTypeAvenant=="CHE" && oldCodeTypeAvenant=="REN") + { + var td1 = new Date($("#dateEffet").val()); + var td2 = $("#dateAvenant").datepicker("getDate"); + + dt1=Math.round(Date.parse(td1)/(1000*3600*24)); + dt2=Math.round(Date.parse(td2)/(1000*3600*24)); + + if (dt1>dt2) + { + v_msg="Veuillez revoir la date!"; + v_msgEng="Please review the date!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + } + + if ( + codeTypeAvenant=="RET" || + codeTypeAvenant=="RES" || + codeTypeAvenant=="SUS" || + codeTypeAvenant=="ANL"|| + codeTypeAvenant=="RVP"|| + codeTypeAvenant=="ADL"|| + codeTypeAvenant=="CHE") + { + motifavenant=$("#motifavenant").val(); + + if ($("#motifavenant").val()<" ") + { + v_msg="Veuillez fournir le motif!"; + v_msgEng="Please provide the reason"; + alert_ebene(v_msg, v_msgEng); + + return; + } + } + + v_msg="Confirmez-vous cet avenant?"; + v_msgEng="Do you confirm this amendment to the contract?"; + + if(confirm_ebene(v_msg, v_msgEng)) + { + var div_attente = $('#div_attente'); + div_attente.html('
  ' + 'Chargement en cours! Veuillez patienter...' + '
'); + + codeTypeAvenant=$("#codeTypeAvenant").val(); + + donnees = ""; + + if (codeTypeAvenant=="ANL") + { + donnees = "controle=existequittance"; + } + + if(donnees>" ") + { + $.ajax({ + url: $("#racineWeb").val()+"Ajaxcontroleavenantpolice/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + alert(data); + $("#div_controler_avenant").html(data); + }, + complete: function() { + $("#controler_avenant").val($("#controler_avenant_info").val()); + + resultat_controler_avenant = $("#controler_avenant").val(); + + if (resultat_controler_avenant=="Q") + { + v_msg="Attention, cette police possède des quittances!"; + v_msgEng="Warning, this policy has premium issues!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + + if (resultat_controler_avenant=="C") + { + v_msg="Attention, cette police possède des sinistres!"; + v_msgEng="Warning, this policy has claims!"; + alert_ebene(v_msg, v_msgEng); + + return; + } + return; + } + }); + } + else + if (codeTypeAvenant=="ADL") + { + donnees = "dateAvenant="+$("#dateAvenant").val()+"&motifavenant="+motifavenant; + + $.ajax({ + url: $("#racineWeb").val()+"Ajaxlimiteadditionnelle/", + type : 'post', + data: donnees, + error: function(errorData) { + }, + success: function(data) { + }, + complete: function() { + $("#btn_enreg").click(); + } + }); + } + else + { + $("#btn_enreg").click(); + } + } +} diff --git a/Vue/gabarit.php b/Vue/gabarit.php index 1b98bf6..d0f98ab 100755 --- a/Vue/gabarit.php +++ b/Vue/gabarit.php @@ -595,7 +595,7 @@ $activeChildId = $menuData['child']; - +