//PAISES function ordenarAsc(p_array_json, p_key) { p_array_json.sort(function (a, b) { return a[p_key] > b[p_key]; }); } var PAISES =""; $(document).ready(function(){ // PAISES $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=paises", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); $("#residence_country").html(texto_dropdown) $("#residence_country").attr("disabled",false) $("#residence_country").select2({'width':"100%",}) $("#pais_impuestos").html(texto_dropdown) $("#pais_impuestos").attr("disabled",true) $("#pais_impuestos").select2({'width':"100%",}) $("#procedencia_fondos").html(texto_dropdown) $("#procedencia_fondos").attr("disabled",false) $("#procedencia_fondos").select2({'width':"100%",}) $("#pais-origen").html(texto_dropdown) $("#pais-origen").attr("disabled",false) $("#pais-origen").select2({'width':"100%",}) $("#pais_destino").html(texto_dropdown) $("#pais_destino").attr("disabled",false) $("#pais_destino").select2({'width':"100%",}) $("#pais_empresa").html(texto_dropdown) $("#pais_empresa").attr("disabled",false) $("#pais_empresa").select2({'width':"100%",}) PAISES = texto_dropdown }, }) $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=paises_nacionalidad", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); $("#nationality").html(texto_dropdown) $("#nationality").attr("disabled",false) $("#nationality").select2({'width':"100%",}) $("#nationality_pasaporte").html(texto_dropdown) $("#nationality_pasaporte").attr("disabled",false) $("#nationality_pasaporte").select2({'width':"100%",}) }, }) // PROVINCIA $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=provincias", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); $("#geographic_location1").html(texto_dropdown) $("#geographic_location1").attr("disabled",false) $("#geographic_location1").select2({'width':"100%",}) }, }) // SITUACION LABORAL $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=situacion_laboral", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); // TODO: Cambiar a los campos donde se selecciona la situacion laboral $("#situacion-laboral").html(texto_dropdown) $("#situacion-laboral").attr("disabled",false) $("#situacion-laboral").select2({'width':"100%",}) }, }) // ACTIVIDAD ECONOMICA $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=actividad_economica", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); $("#actividad_economica").html(texto_dropdown) $("#actividad_economica").attr("disabled",false) $("#actividad_economica").select2({'width':"100%",}) }, }) //PROFESION $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=profesiones", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); $("#title").html(texto_dropdown) $("#title").attr("disabled",false) $("#title").select2({'width':"100%",}) }, }) //PROFESION $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=ocupaciones", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); $("#occupation").html(texto_dropdown) $("#occupation").attr("disabled",false) $("#occupation").select2({'width':"100%",}) }, }) // INDUSTRIAS $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=industrias", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` $.ajax({ url: `/api/cuenta-preferida/info-catalogos?tipo_catalogo=subindustrias&industria=${element.id}`, method: 'GET', async: false, success: function(response){ response.data.forEach(subind => { texto_dropdown+=`` }) } }) texto_dropdown+=`` }); $("#industria").html(texto_dropdown) $("#industria").attr("disabled",false) $("#industria").select2({'width':"100%",}) }, }) // ESTADOS CIVILES $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=estados_civiles", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); $("#marital_status").html(texto_dropdown) $("#marital_status").attr("disabled",false) $("#marital_status").select2({'width':"100%",}) $("#marital_status_pasaporte").html(texto_dropdown) $("#marital_status_pasaporte").attr("disabled",false) $("#marital_status_pasaporte").select2({'width':"100%",}) }, }) // ESCOLARIDAD $.ajax({ url: "/api/cuenta-preferida/info-catalogos?tipo_catalogo=escolaridad", method: 'GET', success: function(response){ texto_dropdown = '' response.data.forEach(element => { texto_dropdown+=`` }); $("#escolaridad").html(texto_dropdown) $("#escolaridad").attr("disabled",false) $("#escolaridad").select2({'width':"100%",}) }, }) })