{"version":3,"sources":["webpack:///./src/views/Admin/catalogos/programa-educativo/ProgramaEducativo.vue?e0ad","webpack:///./src/views/Admin/catalogos/programa-educativo/ProgramaEducativo.vue?3043","webpack:///./src/views/Admin/catalogos/programa-educativo/ProgramaEducativo.js","webpack:///./src/views/Admin/catalogos/programa-educativo/ProgramaEducativo.js?77ec","webpack:///./src/views/Admin/catalogos/programa-educativo/ProgramaEducativo.vue?eff6"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","attrs","form","title","slot","_l","control","index","show","name","key","class","classes","_v","_s","label","_e","type","on","$event","validateControl","model","value","callback","$$v","$set","expression","option","text","showError","deleteImage","srcImage","onLoadErrorImageHandler","uploadFile","onSaveForm","staticRenderFns","isFormValid","isEditMode","idProgramToEdit","selectedIdGradoEducativo","changeMode","$route","params","idProgram","getForm","watch","to","methods","idProgam","programaEducativoObj","controls","forEach","idProgramaEducativo","fetch","$BASE","baseUrl","method","headers","sessionStorage","getItem","then","rs","json","catch","error","console","log","status","JSON","parse","result","formulario","texto","getGradosEducativos","showNotify","fillGradoEducativoOptions","gradosEducativos","getProgramaEducativoToEdit","fillFormToEdit","find","options","selectedGradoEducativoObject","grado","pagina","gradosEducativosList","push","nombre","id","response","validateForm","apiService","body","stringify","createProgramaEducativoObj","setTimeout","$router","getRouteListado","$vs","notify","color","idGradoEducativo","required","isValidated","isValid","e","_this","file","target","files","uploadImage","image","Image","src","reader","FileReader","onload","readAsDataURL","setSelectedIdGradoEducativo","validateFunction","validateTextEmpty","validateComboEmpty","component"],"mappings":"yIAAA,yBAA2gB,EAAG,G,yCCA9gB,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,MAAM,CAACE,YAAY,UAAU,CAACF,EAAG,MAAM,CAACE,YAAY,yBAAyB,CAAEN,EAAQ,KAAE,CAACI,EAAG,UAAU,CAACG,MAAM,CAAC,MAAQP,EAA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AAQ7C,IACvB,GAAIA,EAAQ+F,SACR,OAAQ/F,EAAQW,MACZ,IAAK,OACDtB,KAAK4H,kBAAkBjH,GACvB,MACJ,IAAK,SACDX,KAAK6H,mBAAmBlH,GACxB,MACJ,QACI,SAITX,KAAKyC,eCrQ0H,I,wBCQ9IqF,EAAY,eACd,EACAhI,EACA0C,GACA,EACA,KACA,KACA,MAIa,aAAAsF,E","file":"js/chunk-520cdb56.04641fd4.js","sourcesContent":["import mod from \"-!../../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../../../node_modules/css-loader/index.js??ref--6-oneOf-1-1!../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ProgramaEducativo.vue?vue&type=style&index=0&lang=css&\"; export default mod; export * from \"-!../../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--6-oneOf-1-0!../../../../../node_modules/css-loader/index.js??ref--6-oneOf-1-1!../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../node_modules/postcss-loader/src/index.js??ref--6-oneOf-1-2!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ProgramaEducativo.vue?vue&type=style&index=0&lang=css&\"","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"vx-row\"},[_c('div',{staticClass:\"vx-col w-full mb-base\"},[(_vm.form)?[_c('vx-card',{attrs:{\"title\":_vm.form.title}},[_c('template',{slot:\"actions\"},[_c('feather-icon',{attrs:{\"icon\":\"SettingsIcon\",\"svgClasses\":\"w-6 h-6 text-gray\"}})],1),_c('div',{staticClass:\"vx-row ml-auto mr-auto\"},[_c('div',{staticClass:\"vx-col w-full sm:w-3/4\"},[_c('div',{staticClass:\"vx-row\"},[_vm._l((_vm.form.controls),function(control,index){return [(control.show && control.name !== 'urlImagen')?[_c('div',{key:index,staticClass:\"vx-col w-full mb-2\",class:control.classes},[_c('small',[_c('span',{staticClass:\"font-bold text-gray-500\"},[_vm._v(_vm._s(control.label))]),(control.required)?_c('span',{staticClass:\"text-danger\"},[_vm._v(\"*\")]):_vm._e()]),(control.type === 'select')?[_c('vs-select',{staticClass:\"w-full\",attrs:{\"autocomplete\":\"\"},on:{\"change\":function($event){return _vm.validateControl(control)}},model:{value:(control.value),callback:function ($$v) {_vm.$set(control, \"value\", $$v)},expression:\"control.value\"}},_vm._l((control.options),function(option,index){return _c('vs-select-item',{key:index,attrs:{\"value\":option.value,\"text\":option.text}})}),1)]:_vm._e(),(control.type === 'text')?[_c('vs-input',{staticClass:\"w-full\",on:{\"keyup\":function($event){return _vm.validateControl(control)}},model:{value:(control.value),callback:function ($$v) {_vm.$set(control, \"value\", $$v)},expression:\"control.value\"}})]:_vm._e(),(control.type === 'textarea')?[_c('vs-textarea',{model:{value:(control.value),callback:function ($$v) {_vm.$set(control, \"value\", $$v)},expression:\"control.value\"}})]:_vm._e(),(_vm.showError(control))?_c('span',{staticClass:\"text-danger\"},[_vm._v(\"Campo obligatorio.\")]):_vm._e()],2)]:_vm._e()]})],2)]),_c('div',{staticClass:\"vx-col w-full sm:w-1/4 mb-3\"},[_c('vx-card',{attrs:{\"title\":\"Imagen\"}},[(_vm.srcImage)?[_c('button',{staticClass:\"btn-delete-img\",on:{\"click\":function($event){return _vm.deleteImage()}}},[_c('i',{staticClass:\"material-icons notranslate\"},[_vm._v(\"clear\")])]),_c('img',{staticClass:\"responsive\",attrs:{\"src\":_vm.srcImage},on:{\"error\":_vm.onLoadErrorImageHandler}})]:[_c('div',{staticClass:\"con-input-upload w-full h-12\"},[_c('input',{attrs:{\"type\":\"file\"},on:{\"change\":_vm.uploadFile}}),_c('span',{staticClass:\"text-input\"},[_vm._v(\"\\n selecciona\\n \")])])]],2)],1)]),_c('div',{staticClass:\"flex justify-end\"},[_c('vs-button',{on:{\"click\":_vm.onSaveForm}},[_vm._v(\"Guardar\")])],1)],2)]:_vm._e()],2)])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","export default {\r\n data() {\r\n return {\r\n form: null,\r\n isFormValid: true,\r\n isEditMode: false,\r\n idProgramToEdit: null,\r\n srcImage: '',\r\n selectedIdGradoEducativo: null\r\n }\r\n },\r\n created() {\r\n this.changeMode(this.$route.params.idProgram);\r\n\r\n this.getForm();\r\n },\r\n watch: {\r\n $route(to) {//from\r\n this.changeMode(to.params.idProgram);\r\n\r\n this.getForm();\r\n }\r\n },\r\n methods: {\r\n changeMode(idProgam) { /* If Id exists in route, is Edit Mode */\r\n if (+idProgam !== 0) {\r\n this.isEditMode = true;\r\n this.idProgramToEdit = idProgam;\r\n } else {\r\n this.isEditMode = false;\r\n this.idProgramToEdit = null;\r\n }\r\n },\r\n createProgramaEducativoObj() {\r\n // Programa Educativo Object\r\n let programaEducativoObj = {}\r\n\r\n this.form.controls.forEach(control => {\r\n if (control.show) {\r\n programaEducativoObj[control.name] = control.value;\r\n }\r\n });\r\n\r\n if (this.isEditMode) {\r\n programaEducativoObj.idProgramaEducativo = this.idProgramToEdit;\r\n }\r\n\r\n return programaEducativoObj;\r\n },\r\n deleteImage(){\r\n this.form.controls.forEach(control => {\r\n if (control.name === 'urlImagen') {\r\n control.value = '';\r\n }\r\n });\r\n this.srcImage = '';\r\n },\r\n getForm() {\r\n fetch(`${this.$BASE.baseUrl}api/obtenerFormulario/programaEducativo`,{\r\n method:'GET',\r\n headers:{\r\n 'Authorization': sessionStorage.getItem('token')\r\n }\r\n })\r\n .then(rs=>rs.json())\r\n .catch(error=>console.log('error: ', error))\r\n .then(rs=>{\r\n if (rs.status === 200) {\r\n this.form = JSON.parse(rs.result.formulario.texto);\r\n // this.form = {}; // MOCK\r\n this.getGradosEducativos();\r\n } else {\r\n this.showNotify(rs.status);\r\n }\r\n });\r\n },\r\n getGradosEducativos() {\r\n fetch(`${this.$BASE.baseUrl}api/FormularioPrograma`, {\r\n method: 'GET',\r\n headers: {\r\n 'Authorization': sessionStorage.getItem('token')\r\n }\r\n })\r\n .then(rs => rs.json())\r\n .catch(error => console.log('ERROR FormularioPrograma:, ', error))\r\n .then(rs => {\r\n if (rs.status === 200) {\r\n this.fillGradoEducativoOptions(rs.result.gradosEducativos);\r\n if (this.isEditMode) {\r\n this.getProgramaEducativoToEdit(this.idProgramToEdit);\r\n }\r\n } else {\r\n this.showNotify(rs.status);\r\n }\r\n })\r\n },\r\n getProgramaEducativoToEdit(idProgram) {\r\n fetch(`${this.$BASE.baseUrl}api/ObtenerPrograma/${idProgram}`, {\r\n method: 'GET',\r\n headers: {\r\n 'Authorization': sessionStorage.getItem('token'),\r\n 'pagina': 'programaEducativo'\r\n }\r\n })\r\n .then(rs => rs.json())\r\n .catch(error => console.log('ERROR FormularioPrograma:, ', error))\r\n .then(rs => {\r\n if (rs.status === 200) {\r\n this.fillFormToEdit(rs.result);\r\n } else {\r\n this.showNotify(rs.status);\r\n }\r\n })\r\n },\r\n getRouteListado() {\r\n //Se obtienen los grados educativos del formulario\r\n let gradosEducativos = this.form.controls.find(control => control.name === 'gradoEducativo').options;\r\n // Se obtiene el objeto del grado educativo seleccionado\r\n let selectedGradoEducativoObject = gradosEducativos.find(grado => grado.value === this.selectedIdGradoEducativo);\r\n\r\n // como el servicio response \"ListadoN\" lo cambiamos a \"listado\"\r\n // para que haga match con la url de la ruta a donde se enviará\r\n return selectedGradoEducativoObject.pagina;\r\n },\r\n fillGradoEducativoOptions(gradosEducativosList) {\r\n this.form.controls.forEach(control => {\r\n if (control.name === 'gradoEducativo') {\r\n gradosEducativosList.forEach(grado => {\r\n control.options.push({\r\n text: grado.nombre,\r\n value: grado.id,\r\n pagina: grado.pagina\r\n });\r\n });\r\n }\r\n });\r\n },\r\n fillFormToEdit(response) {\r\n this.form.controls.forEach(control => {\r\n control.value = response[control.name];\r\n if (control.name === 'urlImagen') {\r\n this.srcImage = control.value !== '' ? \r\n this.$BASE.baseUrl+control.value : '';\r\n }\r\n });\r\n },\r\n onLoadErrorImageHandler(){//event\r\n // event.target.src = require(`@/assets/images/elements/no-photo.png`);\r\n },\r\n onSaveForm() {\r\n if (this.validateForm()) {\r\n\r\n let apiService = !this.isEditMode ?\r\n 'AgregarPrograma' :\r\n 'EditarPrograma';\r\n\r\n fetch(`${this.$BASE.baseUrl}api/${apiService}`, {\r\n method: 'POST',\r\n headers: {\r\n 'Authorization': sessionStorage.getItem('token'),\r\n 'pagina': 'programaEducativo',\r\n 'Content-Type':'application/json',\r\n },\r\n body: JSON.stringify(this.createProgramaEducativoObj())\r\n })\r\n .then(rs => rs.json())\r\n .catch(error => console.log('ERROR FormularioPrograma:, ', error))\r\n .then(rs => {\r\n if (rs.status == 200) {\r\n this.showNotify(rs.status);\r\n setTimeout(() => {\r\n this.$router.push(`/${this.getRouteListado()}`);\r\n }, 1000);\r\n }else{\r\n this.showNotify(rs.status);\r\n }\r\n });\r\n \r\n \r\n } else {\r\n this.$vs.notify({color:'danger',title:'Alerta',text:'Existen campos vacíos.'})\r\n }\r\n },\r\n setSelectedIdGradoEducativo(idGradoEducativo) {\r\n this.selectedIdGradoEducativo = idGradoEducativo;\r\n },\r\n showError(control) {\r\n if (control.required) {\r\n return control.isValidated && !control.isValid;\r\n } else {\r\n return false\r\n }\r\n },\r\n uploadFile(e){\r\n let _this = this;\r\n let file = e.target.files[0];\r\n function uploadImage(e){\r\n var image = new Image();\r\n image.src = e.target.result;\r\n _this.srcImage = image.src;\r\n _this.form.controls.forEach(control => {\r\n if (control.name === 'urlImagen') {\r\n control.value = image.src\r\n }\r\n });\r\n }\r\n let reader = new FileReader();\r\n reader.onload = uploadImage;\r\n reader.readAsDataURL(file);\r\n },\r\n validateControl(control) {\r\n\r\n // Se ejecuta setSelectedIdGradoEducativo\r\n // porque se requiere el id del grado educativo seleccionado\r\n // para después identificar la ruta que se usará\r\n // para mandar al listado correspondiente al guardar el formulario.\r\n if (control.name === 'gradoEducativo') {\r\n this.setSelectedIdGradoEducativo(control.value);\r\n }\r\n\r\n if (typeof control.validateFunction !== 'undefined' &&\r\n control.required) {\r\n this[control.validateFunction](control);\r\n }\r\n },\r\n validateComboEmpty(control) {\r\n if (control.value === 0) {\r\n control.isValidated = true;\r\n control.isValid = false;\r\n this.isFormValid = false;\r\n } else {\r\n control.isValidated = true;\r\n control.isValid = true;\r\n }\r\n },\r\n validateTextEmpty(control) {\r\n if (control.value === '') {\r\n control.isValidated = true;\r\n control.isValid = false;\r\n this.isFormValid = false;\r\n } else {\r\n control.isValidated = true;\r\n control.isValid = true;\r\n }\r\n },\r\n validateForm() {\r\n this.isFormValid = true;\r\n this.form.controls.forEach(control => {\r\n if (control.required) {\r\n switch (control.type) {\r\n case 'text':\r\n this.validateTextEmpty(control);\r\n break;\r\n case 'select':\r\n this.validateComboEmpty(control);\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n });\r\n return this.isFormValid;\r\n }\r\n }\r\n}","import mod from \"-!../../../../../node_modules/eslint-loader/index.js??ref--12-0!./ProgramaEducativo.js?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../node_modules/eslint-loader/index.js??ref--12-0!./ProgramaEducativo.js?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./ProgramaEducativo.vue?vue&type=template&id=088c8162&\"\nimport script from \"./ProgramaEducativo.js?vue&type=script&lang=js&\"\nexport * from \"./ProgramaEducativo.js?vue&type=script&lang=js&\"\nimport style0 from \"./ProgramaEducativo.vue?vue&type=style&index=0&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}