/[openfoncier]/trunk/app/js/script.js
ViewVC logotype

Diff of /trunk/app/js/script.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2290 by vpihour, Fri Sep 13 10:42:10 2013 UTC revision 2367 by softime, Thu Oct 3 10:18:04 2013 UTC
# Line 762  $(function() { Line 762  $(function() {
762      if (url.indexOf("form.php?obj=demande_dossier_existant&") != -1      if (url.indexOf("form.php?obj=demande_dossier_existant&") != -1
763          && url.indexOf("&action=0") != -1 ){          && url.indexOf("&action=0") != -1 ){
764    
765          /*Cache les champs avant que dossier_autorisation_type_detaille soit choisi*/          //Cache les champs avant que dossier_autorisation_type_detaille soit choisi
766          hideFields();          hideFields();
767          changeDemandeType();          //On affiche le select du type de la demande
768            $('#demande_type').parent().parent().show();
769      }      }
770            
771      // Modification de demande      // Modification de demande
# Line 1355  function addNewFieldReferencesCadastrale Line 1356  function addNewFieldReferencesCadastrale
1356  }  }
1357    
1358  function addButtonCadastraleAdesse(){  function addButtonCadastraleAdesse(){
1359    
1360        // Permet d'ajouter le bouton de récupération d'adresse si sig activé
1361        if ($('#option_sig').val() == 'sig_externe'){
1362            
1363      $('#terrain_references_cadastrales').parent().parent().after('<div class="field field-type-text" >' +          $('#terrain_references_cadastrales').parent().parent().after('<div class="field field-type-text" >' +
1364          '<div class="form-libelle"></div>' +              '<div class="form-libelle"></div>' +
1365          '<div class="form-content buttonCadAdr">' +              '<div class="form-content buttonCadAdr">' +
1366              '<input id="cad-adr-them" '+                  '<input id="cad-adr-them" '+
1367                  'class="ui-button ui-widget ui-state-default ui-corner-all" '+                      'class="ui-button ui-widget ui-state-default ui-corner-all" '+
1368                  'type="button" '+                      'type="button" '+
1369                  'onclick="getAdressFromCadastrale();" '+                      'onclick="getAdressFromCadastrale();" '+
1370                  'value="Récupérer l\'adresse de la parcelle"/>' +                      'value="Récupérer l\'adresse de la parcelle"/>' +
1371          '</div>' +              '</div>' +
1372     '</div>' );         '</div>' );
1373        }
1374  }  }
1375    
1376  /*  /*
# Line 2222  function finalizeDocument(idx, obj, sous Line 2227  function finalizeDocument(idx, obj, sous
2227                  //Si on le document est finalisé, on cache les actions du portlet                  //Si on le document est finalisé, on cache les actions du portlet
2228                  if ( status == 1 ){                  if ( status == 1 ){
2229                                            
2230                      $(".edit-16").parent().parent().remove();                      $("#"+sousform+obj+" .edit-16").parent().parent().remove();
2231                      $(".delete-16").parent().parent().remove();                      $("#"+sousform+obj+" .delete-16").parent().parent().remove();
2232                  }                  }
2233                  else{                  else{
2234                                            
# Line 2240  function finalizeDocument(idx, obj, sous Line 2245  function finalizeDocument(idx, obj, sous
2245                          actions += data.actions.supprimer;                          actions += data.actions.supprimer;
2246                      }                      }
2247                                            
2248                      $('.portlet-list').prepend(actions);                      $('#'+sousform+obj+' .portlet-list').prepend(actions);
2249                  }                  }
2250                                    
2251                  //On affiche un message de valisation                  //On affiche un message de valisation
# Line 2448  function set_geolocalisation_message(res Line 2453  function set_geolocalisation_message(res
2453  function set_geolocalisation_centroide(res) {  function set_geolocalisation_centroide(res) {
2454            
2455      var content = "<a id='action-form-localiser'"+      var content = "<a id='action-form-localiser'"+
2456              " target='_blank' href='../app/redirect_plan_sig.php?idx="+res['return']['dossierID']+"'>"+              " target='_SIG' href='../app/redirect_plan_sig.php?idx="+res['return']['dossierID']+"'>"+
2457              "<span class='om-icon om-icon-16 om-icon-fix sig-16' title='Localiser'>Localiser</span> "+              "<span class='om-icon om-icon-16 om-icon-fix sig-16' title='Localiser'>Localiser</span> "+
2458              " POINT("+res['return']['coordX']+" "+res['return']['coordY']+")"+              " POINT("+res['return']['coordX']+" "+res['return']['coordY']+")"+
2459              " </a>";              " </a>";
# Line 2641  function getAdressFromCadastrale(){ Line 2646  function getAdressFromCadastrale(){
2646          async: false          async: false
2647      });      });
2648  }  }
2649    
2650    /**
2651     * Modifie les champs requis pour le formulaire demande_type
2652     * @param  integer  demande_nature                         Identifiant
2653     * @param  string   lib_dossier_autorisation_type_detaille Libellé du champ
2654     * dossier_autorisation_type_detaille
2655     * @param  string   lib_dossier_instruction_type           Libellé du champ
2656     * dossier_instruction_type
2657     */
2658    function required_fields_demande_type(demande_nature, lib_dossier_autorisation_type_detaille, lib_dossier_instruction_type) {
2659    
2660        // Lien
2661        link = "../app/getDemandeNatureInfo.php?demande_nature=" + demande_nature;
2662    
2663        // Traitement
2664        $.ajax({
2665            type: "GET",
2666            url: link,
2667            cache: false,
2668            dataType: "json",
2669            success: function(demande_nature_info) {
2670    
2671                // On enlève le "*" au libellé du champ
2672                // dossier_autorisation_type_detaille pour montrer qu'il n'est
2673                // pas obligatoire
2674                $("#lib-dossier_autorisation_type_detaille").text('');
2675                $("#lib-dossier_autorisation_type_detaille")
2676                    .html(lib_dossier_autorisation_type_detaille);
2677    
2678                // On enlève le "*" au libellé du champ
2679                // dossier_instruction_type pour montrer qu'il n'est
2680                // pas obligatoire
2681                $("#lib-dossier_instruction_type").text('');
2682                $("#lib-dossier_instruction_type")
2683                    .html(lib_dossier_instruction_type);
2684                
2685                // Si c'est une nouvelle demande
2686                if (demande_nature_info != ''
2687                    && demande_nature_info != null) {
2688    
2689                    if (demande_nature_info['code'] == 'NOUV') {
2690    
2691                        // On ajoute le "*" au libellé du champ
2692                        // dossier_autorisation_type_detaille pour montrer qu'il est
2693                        // obligatoire
2694                        $("#lib-dossier_autorisation_type_detaille").text('');
2695                        $("#lib-dossier_autorisation_type_detaille")
2696                            .html(lib_dossier_autorisation_type_detaille + ' <span class="not-null-tag">*</span>');
2697    
2698                        // On ajoute le "*" au libellé du champ
2699                        // dossier_instruction_type pour montrer qu'il est
2700                        // obligatoire
2701                        $("#lib-dossier_instruction_type").text('');
2702                        $("#lib-dossier_instruction_type")
2703                            .html(lib_dossier_instruction_type + ' <span class="not-null-tag">*</span>');
2704    
2705                    }
2706    
2707                }
2708                
2709            },
2710            async:false
2711        });
2712    }
2713    
2714    /**
2715     * Appel au chargement de la page
2716     **/
2717    $(function() {
2718    
2719        // url de la page
2720        url = document.location + "";
2721    
2722        // Si dans le formulaire des type de demande
2723        // et que c'est en mode ajout ou modifier
2724        if (url.indexOf("form.php?obj=demande_type&") != -1
2725            && (url.indexOf("&action=0") != -1
2726            || url.indexOf("&action=1") != -1
2727            || url.indexOf("&validation=") != -1)) {
2728    
2729            // Récupère les paramètres nécessaires
2730            var demande_nature = $("#demande_nature").val();
2731            var lib_dossier_autorisation_type_detaille = $("#lib-dossier_autorisation_type_detaille").text();
2732            var lib_dossier_instruction_type = $("#lib-dossier_instruction_type").text();
2733    
2734            // Appelle la fonction pour indiquer si les champs sont requis ou non
2735            required_fields_demande_type(demande_nature, lib_dossier_autorisation_type_detaille, lib_dossier_instruction_type);
2736        }
2737    
2738    });

Legend:
Removed from v.2290  
changed lines
  Added in v.2367

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26