Conjunto 36310ea en sipes


Ignorar:
Fecha y hora:
18/08/2017 11:24:01 (hace 7 años)
Autor:
Sipes Apn <root@…>
Branches:
stable
Children:
c43ea01
Parents:
4efc6f2
Mensaje:

se mejoro la funcion de seleccion de los responsables

Fichero:
1 editado

Leyenda

No modificado
Añadido
Eliminado
  • 0.3-modules/proyectos_operativos_mcti/js/proyectos_operativos_mcti_datos_basicos.js

    rd74fe6c r36310ea  
    2828 */
    2929Drupal.behaviors.proyectosOperativosDatosBasicosMcti = function (context) {
     30  //cambio de institucion
    3031  $('#field_proyecto_ente_datos_basicos').hide();
    31   //cambio de institucion
    32   $('#field_proyecto_ente_datos_basicos select').change(function() {
    33     $('#default_gerente input:text').each(function(index) {
    34       $(this).val('');
     32  $('.responsable').change(function() {
     33    var self = $(this);
     34    $(this).parent().next('table').find('input').each(function(index) {
     35      if (!self.val() || self.val() == 0) {
     36        $(this).val("");
     37      }
     38      else {
     39        var value = Drupal.settings.responsables[self.val()][index];
     40        $(this).val(value);
     41      }
    3542    });
    36     $('#default_tecnico input:text').each(function(index) {
    37       $(this).val('');
    38     });
    39     $('#default_registrador input:text').each(function(index) {
    40       $(this).val('');
    41     });
    42     $('#default_administrativo input:text').each(function(index) {
    43       $(this).val('');
    44     });
    45   });
    46 
    47   $('#wrapper-proyectos-resposab select[name=default_gerente]').change(function() {
    48     if ($(this).val() != 0 && $(this).val() != 1) {
    49       cambiar_estado_responsables('gerente', this);
    50     }
    51     else {
    52       $('.form-text.gerente').val('');
    53     }
    54   });
    55   $('#wrapper-proyectos-resposab select[name=default_tecnico]').change(function() {
    56     if ($(this).val() != 0 && $(this).val() != 1) {
    57       cambiar_estado_responsables('tecnico', this);
    58     }
    59     else {
    60       $('.form-text.tecnico').val('');
    61     }
    62   });
    63   $('#wrapper-proyectos-resposab select[name=default_registrador]').change(function() {
    64     if ($(this).val() != 0 && $(this).val() != 1) {
    65      cambiar_estado_responsables('registrador', this);
    66     }
    67     else {
    68       $('.form-text.registrador').val('');
    69     }
    70   });
    71   $('#wrapper-proyectos-resposab select[name=default_administrativo]').change(function() {
    72     if ($(this).val() != 0 && $(this).val() != 1) {
    73       cambiar_estado_responsables('administrativo', this);
    74     }
    75     else {
    76       $('.form-text.administrativo').val('');
    77     }
    7843  });
    7944
     
    10166                }*/
    10267        });
    103 
    10468}
    105 
    106 /**
    107  * Modifica el estado de los responsables del proyecto
    108  */
    109 function cambiar_estado_responsables(responsable, referencia) {
    110   var ultimo = 0;
    111   var opciones = 0;
    112   $('#wrapper-proyectos-resposab select[name=default_' + responsable + '] option').each(function(index) {
    113     ultimo = $(this).val();
    114   });
    115   //estructura del array_proyecto => nid del proyecto, ente o institucion, nombre, cedula, correo, telefono
    116   if (responsable == 'gerente') {
    117     for (values in Drupal.settings.responsables.gerente) {
    118      if (values == $(referencia).val()) {
    119        $('[name=field_proyecto_nombre_gere]').val(Drupal.settings.responsables.gerente[values].name[0]);
    120        $('[name=field_proyecto_cedul_gere]').val(Drupal.settings.responsables.gerente[values].cedula[0]);
    121        $('[name=field_proyecto_corre_gere]').val(Drupal.settings.responsables.gerente[values].email[0]);
    122        $('[name=field_proyecto_telef_gere]').val(Drupal.settings.responsables.gerente[values].phone[0]);
    123       }
    124     }
    125   }
    126   if (responsable == 'tecnico') {
    127     for (values in Drupal.settings.responsables.tecnico) {
    128      if (values == $(referencia).val()) {
    129        $('[name=field_proyecto_nom_r_tec]').val(Drupal.settings.responsables.tecnico[values].name[0]);
    130        $('[name=field_proyecto_ced_r_tec]').val(Drupal.settings.responsables.tecnico[values].cedula[0]);
    131        $('[name=field_proyecto_cor_r_tec]').val(Drupal.settings.responsables.tecnico[values].email[0]);
    132        $('[name=field_proyecto_tel_r_tec]').val(Drupal.settings.responsables.tecnico[values].phone[0]);
    133        $('[name=field_proyecto_und_r_tec]').attr('value', Drupal.settings.responsables.tecnico[values].unidad[0]);
    134       }
    135     }
    136   }
    137   if (responsable == 'registrador') {
    138     for (values in Drupal.settings.responsables.registrador) {
    139      if (values == $(referencia).val()) {
    140        $('[name=field_proyecto_nom_r_reg]').val(Drupal.settings.responsables.registrador[values].name[0]);
    141        $('[name=field_proyecto_ced_r_reg]').val(Drupal.settings.responsables.registrador[values].cedula[0]);
    142        $('[name=field_proyecto_cor_r_reg]').val(Drupal.settings.responsables.registrador[values].email[0]);
    143        $('[name=field_proyecto_tel_r_reg]').val(Drupal.settings.responsables.registrador[values].phone[0]);
    144       }
    145     }
    146   }
    147   if (responsable == 'administrativo') {
    148     for (values in Drupal.settings.responsables.administrativo) {
    149      if (values == $(referencia).val()) {
    150        $('[name=field_proyecto_nom_r_adm]').val(Drupal.settings.responsables.administrativo[values].name[0]);
    151        $('[name=field_proyecto_ced_r_adm]').val(Drupal.settings.responsables.administrativo[values].cedula[0]);
    152        $('[name=field_proyecto_cor_r_adm]').val(Drupal.settings.responsables.administrativo[values].email[0]);
    153        $('[name=field_proyecto_tel_r_adm]').val(Drupal.settings.responsables.administrativo[values].phone[0]);
    154       }
    155     }
    156   }
    157   var status_institu = $('#field_proyecto_ente_datos_basicos select').val();
    158 }
Nota: Vea TracChangeset para ayuda en el uso del visor de conjuntos de cambios.