{"version":3,"file":"program_show-Bi3N3t8X.js","sources":["../../../app/frontend/entrypoints/apps/program_show.js"],"sourcesContent":["import 'vue-select/dist/vue-select.css';\nimport axios from \"axios\"\n//import { component as VueNumber } from '@coders-tm/vue-number-format'\n//import { directive as VNumber } from '@coders-tm/vue-number-format'\n//import { ref } from 'vue';\nimport {useToast} from 'vue-toast-notification';\nimport vSelect from 'vue-select'\n\nimport 'vue-toast-notification/dist/theme-bootstrap.css';\nimport \"admin-lte\"\nimport \"bootstrap\"\nimport \"jquery\"\n//import { computed } from 'vue';\n\nconst $toast = useToast();\nconst backend_data=window.backend_data\n\nexport const program_show_app={\n data() {\n return {\n area_power:{},\n prueba:\"MASA\",\n care_diag_form:backend_data.care_diag_form,\n pdt_form:backend_data.pdt_form,\n files:{},\n spinners:{sendfile:false},\n buscadores: { municipios: { data: { results: [] } }, ciiu: { data: { results: [] } }, paises: { data: { results: [] } } },\n metrics:backend_data.metrics,\n internacionalizacion20_closing_realiza_exportaciones:backend_data.internacionalizacion20_closing_realiza_exportaciones,\n internacionalizacion20_closing_paises_exportacion:[]\n } \n },\n methods: {\n metrics_variation:function(index){\n if ((this.metrics[index].final_measurement > this.metrics[index].initial_measurement) && (this.metrics[index].final_measurement > this.metrics[index].middle_measurement)){\n return (this.metrics[index].final_measurement - this.metrics[index].initial_measurement)\n } else if ((this.metrics[index].middle_measurement > this.metrics[index].initial_measurement) && (this.metrics[index].final_measurement < this.metrics[index].middle_measurement)){\n return (this.metrics[index].middle_measurement - this.metrics[index].initial_measurement)\n } else {\n return 0\n }\n },\n coincidencia_helper:function(c){\n if(c>=0 && c<25){\n return {bg:\"bg-white\",label:\"Incipiente\"}\n } else if(c>=25 && c<50){\n return {bg:\"bg-yellow\",label:\"Inicial\"}\n } else if(c>=50 && c<75){\n return {bg:\"bg-orange\",label:\"Estandarización\"}\n } else if(c>=75 && c<=100){\n return {bg:\"bg-green\",label:\"Mejora Continua\"}\n }\n },\n buscadorciiu: function (search, loading) {\n loading(true);\n axios.get(`/findciiu/?term=${search}`).then(res => {\n this.buscadores.ciiu = res;\n loading(false)\n });\n },\n openform:function(form){\n $(`#modal_${form}`).modal(\"show\")\n },\n buscadorpaises: function (search, loading) {\n loading(true);\n axios.get(`/findcountry/?term=${search}`).then(res => {\n this.buscadores.paises = res.data;\n loading(false)\n });\n }, \n send_form_diag:function(){\n axios.post(\"/programs/\"+backend_data.program_id+\"/send_to_brain_diag_json/\",{fields:this.care_diag_form,authenticity_token:backend_data.authenticity_token}).then(res=>{\n $toast.success(\"Actualizado, Se revisará el plan de trabajo de nuevo\",{position:\"top-right\",duration:5000});\n this.set_flag_program('review_diag',true)\n location.reload()\n }).catch(e=>{\n $toast.error(\"Error:\" +e,{position:\"top-right\",duration:5000});\n })\n },\n update_diag_final:function(){\n axios.patch(\"/programs/\"+backend_data.program_id+\"/send_diag_final.json\",{fields:this.care_diag_form,authenticity_token:backend_data.authenticity_token}).then(res=>{\n $toast.success(\"Diagnóstico final actualizado\",{position:\"top-right\",duration:5000});\n }).catch(e=>{\n $toast.error(\"Error:\" +e,{position:\"top-right\",duration:5000});\n })\n },\n send_form_pdt:function(){\n axios.post(\"/programs/\"+backend_data.program_id+\"/send_to_brain_pdt_json/\",{fields:this.pdt_form,authenticity_token:backend_data.authenticity_token}).then(res=>{\n $toast.success(\"Actualizado, Se enviara para reentrenamiento\",{position:\"top-right\",duration:5000});\n this.set_flag_program('pdt_review',true)\n location.reload()\n }).catch(e=>{\n $toast.error(\"Eroror:\" +e,{position:\"top-right\",duration:5000});\n })\n },\n set_flag_program: function(flag, value){\n let flags = {}\n flags[flag] = value\n axios.patch(\"/programs/\"+backend_data.program_id+\"/set_flags\",{flags:flags,authenticity_token:backend_data.authenticity_token})\n .then(res => {\n console.log('la respuesta es ', res);\n }).catch(error => {\n console.log('the error is ', error);\n })\n },\n updateMetrics:function(){\n axios.patch(\"/programs/\"+backend_data.program_id+\"/update_metric_internacionalizacion\",{metric:this.metrics,authenticity_token:backend_data.authenticity_token})\n .then(res=>{\n $toast.success(\"Se ha actualizado la tabla de indicadores\",{position:\"top-right\",duration:5000});\n })\n .catch(error=>{\n $toast.error(\"Error al actualizar la tabla de indicadores\",{position:\"top-right\",duration:5000});\n })\n },\n fileupload: function(event, type,program_id) {\n let name = \"doc_\" + type;\n this.files[name] = event.target.files[0];\n console.log('Selected file:', this.files[name]);\n this.filesend(program_id, type, this.files[name].name);\n },\n delete_file:function(id){\n axios.delete(\"/docs/\"+id+\".json\",{data:{authenticity_token:backend_data.authenticity_token}}).then(res=>{\n location.reload();\n })\n },\n filesend: function(program_id, type, filename) {\n this.spinners.sendfile = true;\n let formData = new FormData();\n formData.append('file', this.files[\"doc_\" + type]);\n formData.append('type', type);\n formData.append('description', \"\");\n formData.append('user_id', backend_data.user_id);\n formData.append('company_id', backend_data.company_id);\n formData.append('program_id', program_id);\n formData.append('filename', filename);\n formData.append('bucket', 'normania-docs');\n formData.append('authenticity_token', backend_data.authenticity_token);\n axios.post('/docs', formData, { headers: { 'Content-Type': 'multipart/form-data' } })\n .then(res => {\n console.log('rta',res);\n this.spinners.sendfile = false;\n location.reload();\n })\n .catch(err => {\n this.spinners.sendfile = false;\n alert('error subiendo archivo', err);\n console.log('error',err);\n });\n },\n save_diagnostico_final:function(){\n\n console.log('save_diagnostico_final',this.care_diag_form)\n }\n\n },\n computed:{\n show_btn_update_diagnosis:function () {\n let value = true\n if (typeof(this.pdt_form) == 'object' && this.pdt_form.length > 0) {\n value = false\n }\n return value\n },\n average_coincidence:function(){\n let sum=0\n this.care_diag_form.forEach(e=>{\n let number=parseInt(e.coincidencia)\n sum+=number\n })\n return (sum / this.care_diag_form.length).toFixed(2);\n },\n average_coincidence_final:function(){\n let sum=0\n this.care_diag_form.forEach(e=>{\n let number=parseInt(e.coincidencia_final)\n sum+=number\n })\n return (sum / this.care_diag_form.length).toFixed(2);\n },\n paisesSeleccionadosString: {\n get() {\n return this.internacionalizacion20_closing_paises_exportacion;\n },\n set(value) {\n this.internacionalizacion20_closing_paises_exportacion = value\n }\n }\n },\n components:{\n vSelect\n\n }\n}"],"names":["$toast","useToast","backend_data","program_show_app","index","c","search","loading","axios","res","form","$","flag","value","flags","error","event","type","program_id","name","id","filename","formData","err","sum","e","number","vSelect"],"mappings":"+HAcA,MAAMA,EAASC,EAAQ,SAAA,EACjBC,EAAa,OAAO,aAEbC,EAAiB,CAC1B,MAAO,CACH,MAAO,CACH,WAAW,CAAE,EACb,OAAO,OACP,eAAeD,EAAa,eAC5B,SAASA,EAAa,SACtB,MAAM,CAAE,EACR,SAAS,CAAC,SAAS,EAAK,EACxB,WAAY,CAAE,WAAY,CAAE,KAAM,CAAE,QAAS,CAAE,CAAA,GAAM,KAAM,CAAE,KAAM,CAAE,QAAS,CAAA,CAAI,CAAA,EAAI,OAAQ,CAAE,KAAM,CAAE,QAAS,CAAE,CAAA,EAAM,EACzH,QAAQA,EAAa,QACrB,qDAAqDA,EAAa,qDAClE,kDAAkD,CAAE,CACvD,CACJ,EACD,QAAS,CACL,kBAAkB,SAASE,EAAM,CAC7B,OAAK,KAAK,QAAQA,CAAK,EAAE,kBAAoB,KAAK,QAAQA,CAAK,EAAE,qBAAyB,KAAK,QAAQA,CAAK,EAAE,kBAAoB,KAAK,QAAQA,CAAK,EAAE,mBAC1I,KAAK,QAAQA,CAAK,EAAE,kBAAoB,KAAK,QAAQA,CAAK,EAAE,oBAC5D,KAAK,QAAQA,CAAK,EAAE,mBAAqB,KAAK,QAAQA,CAAK,EAAE,qBAAyB,KAAK,QAAQA,CAAK,EAAE,kBAAoB,KAAK,QAAQA,CAAK,EAAE,mBAClJ,KAAK,QAAQA,CAAK,EAAE,mBAAqB,KAAK,QAAQA,CAAK,EAAE,oBAE9D,CAEd,EACD,oBAAoB,SAASC,EAAE,CAC3B,GAAGA,GAAG,GAAKA,EAAE,GACT,MAAO,CAAC,GAAG,WAAW,MAAM,YAAY,EACrC,GAAGA,GAAG,IAAMA,EAAE,GACjB,MAAO,CAAC,GAAG,YAAY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