{"version":3,"file":"program_manager-BVDb_yvZ.js","sources":["../../../app/frontend/entrypoints/apps/program_manager.js"],"sourcesContent":["import 'vue-select/dist/vue-select.css';\nimport axios from \"axios\"\nimport { component as VueNumber } from '@coders-tm/vue-number-format'\nimport { directive as VNumber } from '@coders-tm/vue-number-format'\nimport { ref } from 'vue';\nimport {useToast} from 'vue-toast-notification';\nimport vSelect from 'vue-select'\nimport 'vue-toast-notification/dist/theme-bootstrap.css';\nimport \"admin-lte\"\nimport \"bootstrap\"\nimport \"jquery\"\nimport { computed } from 'vue';\n\nconst $toast = useToast();\nconst backend_data=window.backend_data\n\n\nexport const program_manager_app={\n mounted() {\n this.get_programs()\n },\n data() {\n return {\n prueba:\"HOLAS\",\n role:backend_data.current_user.role,\n filters:{\n f0:null,\n f1:null,\n current_view:\"active\",\n admin_view:\"all\",\n consultant_id:null,\n _id:null,\n docs:null,\n pdt:null,\n diag:null,\n program:null,\n search:null\n },\n programs:[],\n spinners:{main:false},\n consultants:backend_data.consultants,\n editing_program:null,\n selected_consultant:null,\n selected_aux_consultant:null\n }\n },\n methods: {\n select_view:function(view){\n this.filters.current_view=view;\n this.get_programs()\n },\n clearSearch: function(){\n this.filters.search = null;\n this.get_programs();\n },\n select_admin_view:function(view){\n this.filters.admin_view=view\n },\n get_programs:function(){\n this.spinners.main=true\n axios.get(\"/programs.json\",{params:this.getparams}).then(res=>{\n this.programs=res.data.programs\n this.spinners.main=false\n }) \n },\n modal_consultant:function(pid){\n this.editing_program=pid\n $(\"#modal_consultant\").modal(\"show\")\n },\n modal_aux_consultant:function(pid){\n this.editing_program=pid\n $(\"#modal_aux_consultant\").modal(\"show\")\n },\n assign_consultant:function(){\n axios.patch(\"/programs/\"+this.editing_program+\".json\",{authenticity_token:backend_data.authenticity_token,program:{consultant_id:this.selected_consultant}}).then(r=>{\n this.selected_consultant=null\n $(\"#modal_consultant\").modal(\"hide\")\n this.get_programs()\n }).catch(err=>{\n console.log(\"ERROR\",err);\n $(\"#modal_consultant\").modal(\"hide\")\n $toast.error(\"Error: \"+err.response.data.msg,{position:\"top-right\",duration:5000});\n })\n\n },\n assign_aux_consultant:function(){\n axios.patch(\"/programs/\"+this.editing_program+\".json\",{authenticity_token:backend_data.authenticity_token,program:{consultant_aux_id:this.selected_aux_consultant}}).then(r=>{\n this.selected_aux_consultant=null\n $(\"#modal_aux_consultant\").modal(\"hide\")\n this.get_programs()\n }).catch(err=>{\n console.log(\"ERROR\",err);\n $(\"#modal_aux_consultant\").modal(\"hide\")\n $toast.error(\"Error: \"+err.response.data.msg,{position:\"top-right\",duration:5000});\n })\n\n },\n showprogram:function(pid){\n window.location.href = \"/programs/\"+pid;\n }\n },\n computed: {\n getparams() {\n let uri = window.location.search.substring(1);\n const params = new URLSearchParams(uri);\n params.append(\"review\",true)\n for (let f in this.filters){\n if (this.filters[f]!=null) params.append(f,this.filters[f])\n }\n return params;\n }\n },\n components: {\n 'v-select': vSelect,\n 'vue-number': VueNumber\n },\n}"],"names":["$toast","useToast","backend_data","program_manager_app","view","axios","res","pid","$","r","err","uri","params","f","vSelect","VueNumber"],"mappings":"uKAaA,MAAMA,EAASC,EAAQ,SAAA,EACjBC,EAAa,OAAO,aAGbC,EAAoB,CAC7B,SAAU,CACN,KAAK,aAAc,CACtB,EACD,MAAO,CACH,MAAO,CACH,OAAO,QACP,KAAKD,EAAa,aAAa,KAC/B,QAAQ,CACJ,GAAG,KACH,GAAG,KACH,aAAa,SACb,WAAW,MACX,cAAc,KACd,IAAI,KACJ,KAAK,KACL,IAAI,KACJ,KAAK,KACL,QAAQ,KACR,OAAO,IACV,EACD,SAAS,CAAE,EACX,SAAS,CAAC,KAAK,EAAK,EACpB,YAAYA,EAAa,YACzB,gBAAgB,KAChB,oBAAoB,KACpB,wBAAwB,IAC3B,CACJ,EACD,QAAS,CACL,YAAY,SAASE,EAAK,CACtB,KAAK,QAAQ,aAAaA,EAC1B,KAAK,aAAc,CACtB,EACD,YAAa,UAAU,CACnB,KAAK,QAAQ,OA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