diff --git a/resources/js/processes/import/components/ImportPIModal.vue b/resources/js/processes/import/components/ImportPIModal.vue index f1d37a0135..e0228a700d 100644 --- a/resources/js/processes/import/components/ImportPIModal.vue +++ b/resources/js/processes/import/components/ImportPIModal.vue @@ -77,16 +77,32 @@ export default { } this.$root.file = this.file; - let formData = new FormData(); - formData.append('file', this.file); - this.fileIsValid = true; }, removeFile() { this.file = ''; this.fileIsValid = false; }, - importNewPI() {} + importNewPI() { + if (!this.file) { + return; + } + + let formData = new FormData(); + formData.append('file', this.file); + + ProcessMaker.apiClient + .post(`/package-ai/pi_process/import`, formData) + .then((response) => { + // TODO: Make import and redirect to Modeler + }) + .catch((error) => { + window.ProcessMaker.alert( + this.$t("An error ocurred while importing the current PI Process."), + "danger", + ); + }); + } }, computed: { title() { diff --git a/resources/lang/en.json b/resources/lang/en.json index afc538fd59..e3a9e68c8b 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -121,6 +121,7 @@ "Alpha-Numeric": "Alpha-Numeric", "Alpha": "Alpha", "An error occurred. Check the form for errors in red text.": "An error occurred. Check the form for errors in red text.", + "An error ocurred while importing the current PI Process.": "An error ocurred while importing the current PI Process.", "An existing user has been found with the email {{ email }} would you like to save and reactivate their account?": "An existing user has been found with the email {{ email }} would you like to save and reactivate their account?", "An existing user has been found with the email {{ username }} would you like to save and reactivate their account?": "An existing user has been found with the username {{ username }} would you like to save and reactivate their account?", "Analytics Chart": "Analytics Chart",