From 91740025be48dc5fcbea4a080a9881200ca09197 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Sat, 3 Jan 2026 01:43:23 +0000 Subject: [PATCH] a --- .../ControleurAjaxcontroleavenantpolice.php | 32 ++++ Js/fonctions.js | 147 ++---------------- 2 files changed, 42 insertions(+), 137 deletions(-) create mode 100644 Controleur/ControleurAjaxcontroleavenantpolice.php diff --git a/Controleur/ControleurAjaxcontroleavenantpolice.php b/Controleur/ControleurAjaxcontroleavenantpolice.php new file mode 100644 index 0000000..9c67a9f --- /dev/null +++ b/Controleur/ControleurAjaxcontroleavenantpolice.php @@ -0,0 +1,32 @@ +police = new Police(); + } + + public function index() + { + $controler_avenant_info = "0"; + + $idPolice = $_SESSION['idPolice_C']; + + $controle = $this->requete->getParametreFormulaire("controle"); + + if($controle=="existequittance") + { + $controler_avenant_info = $this->police->getExisteQuittance($idPolice); + + if($controler_avenant_info=="0") + { + $controler_avenant_info = $this->police->getExisteConsommationPolice($idPolice); + } + } + + $this->genererVueAjax(array('controler_avenant_info' => $controler_avenant_info)); + } +} \ No newline at end of file diff --git a/Js/fonctions.js b/Js/fonctions.js index 3b24a83..786aef4 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -1377,9 +1377,6 @@ function creer_avenant() function enregistrer_avenant() { - alert("enregistrer_avenant"); - return; - codeTypeAvenant=$("#codeTypeAvenant").val(); oldCodeTypeAvenant=$("#oldCodeTypeAvenant").val(); @@ -1419,71 +1416,16 @@ function enregistrer_avenant() } } - if(codeTypeAvenant=="REN") - { - var td1 = new Date($("#DateRenouvellement").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 de renouvellement!"; - v_msgEng="Please review the renewal date!"; - alert_ebene(v_msg, v_msgEng); + 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; - } - - 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; - } - } + return; + } v_msg="Confirmez-vous cet avenant?"; v_msgEng="Do you confirm this amendment to the contract?"; @@ -1492,75 +1434,6 @@ function enregistrer_avenant() { 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(); - } + $("#btn_enreg").click(); } }