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AAU,EACnB,SAAU,CACR,GAAG5B,EAAUC,CAAgB,CAC9B,EACD,QAAS,CACP,GAAGU,EAAWV,EAAkB,CAAC,cAAc,CAAC,EAChD,mBAAoB,CACd,KAAK,UACP,OAAO,KAAK,KAAK,QAAQ,EAAE,QAAQ4B,GAAO,CACxC,KAAK,aAAa,CAAC,IAAAA,EAAK,MAAO,KAAK,SAASA,CAAG,CAAC,CAAC,CAC5D,CAAS,CAEJ,CACF,CACH","names":["_sfc_main","mapStores","dynamicFormStore","mapState","_b","_a","_d","_c","defineAsyncComponent","__variableDynamicImportRuntimeHelper","Loading","newValue","mapActions","_openBlock","_createBlock","_resolveDynamicComponent","$options","$event","$props","ApiMethods","url","successConfig","e","errorConfig","title","text","icon","redirect","response","LayoutMethods","key"],"sources":["../../../../app/javascript/mints-components/cali-dynamic-form/components/Layouts/Field.vue","../../../../app/javascript/mints-components/cali-dynamic-form/mixins/api_methods.js","../../../../app/javascript/mints-components/cali-dynamic-form/mixins/layout_methods.js"],"sourcesContent":["\r\n \r\n\r\n\r\n\r\n","// Store\r\nimport { dynamicFormStore } from \"../stores/store\";\r\nimport { mapStores, mapState, mapActions } from 'pinia'\r\n\r\nexport default {\r\n inject: ['onFinished'],\r\n computed: {\r\n ...mapStores(dynamicFormStore),\r\n ...mapState(dynamicFormStore, ['answers', 'buttonField', 'defaultApi']),\r\n },\r\n methods: {\r\n ...mapActions(dynamicFormStore, ['resetStep', 'changeStatus', 'resetAnswers']),\r\n callApi() {\r\n this.changeStatus({ key: 'submit', value: true });\r\n \r\n const url = this.buttonField?.extra_parameters?.api || this.defaultApi\r\n\r\n this.$axios.post(url, { data: this.answers }).then(() => {\r\n const successConfig = this.buttonField?.extra_parameters?.success_message;\r\n \r\n if (successConfig) {\r\n this.callSweetAlert(successConfig.title, successConfig.text, successConfig.icon, successConfig.redirect)\r\n }\r\n \r\n this.resetStep();\r\n this.resetAnswers();\r\n this.onFinished(this.answers);\r\n \r\n setTimeout(async () => {\r\n if (typeof this.updateStepByAutofill === 'function') {\r\n await this.initializeContact();\r\n await this.updateStepByAutofill();\r\n this.$emit('resetVErrors');\r\n }\r\n })\r\n }).catch(e => {\r\n const errorConfig = this.buttonField?.extra_parameters?.error_message;\r\n \r\n if (errorConfig) {\r\n this.callSweetAlert(errorConfig.title, errorConfig.text, errorConfig.icon)\r\n }\r\n }).finally(() => {\r\n this.changeStatus({ key: 'submit', value: false });\r\n })\r\n },\r\n callSweetAlert(title, text, icon, redirect=null) {\r\n this.$swal.fire({ title, text, icon })\r\n .then( response =>{\r\n if (redirect) window.location.replace(redirect)\r\n })\r\n }\r\n }\r\n}","// Store\r\nimport { dynamicFormStore } from \"../stores/store\";\r\nimport { mapStores, mapActions } from 'pinia'\r\n\r\nexport default {\r\n inject: ['$contact'],\r\n computed: {\r\n ...mapStores(dynamicFormStore),\r\n },\r\n methods: {\r\n ...mapActions(dynamicFormStore, ['updateAnswer']),\r\n initializeContact() {\r\n if (this.$contact) {\r\n Object.keys(this.$contact).forEach(key => {\r\n this.updateAnswer({key, value: this.$contact[key]});\r\n })\r\n }\r\n }\r\n }\r\n}"],"file":"assets/js/layout_methods-838dc53e-chunk.js"}