diff --git a/components/responsable/cartaAceptacion.vue b/components/responsable/cartaAceptacion.vue index d1b5cc5..81abdc2 100644 --- a/components/responsable/cartaAceptacion.vue +++ b/components/responsable/cartaAceptacion.vue @@ -29,12 +29,7 @@ - Enviar @@ -45,7 +40,9 @@ export default { data() { return { + isFullPage: true, file: "", + idServicio: "", }; }, methods: { @@ -63,12 +60,65 @@ export default { type: "is-danger", }); }, + Enviar() { + const loadingComponent = this.$buefy.loading.open({ + container: this.isFullPage ? null : this.$refs.element.$el, + }); + const data = { idServicio: this.idServicio }; + const formData = new FormData(); + formData.append("data", JSON.stringify(data)); + formData.append("cartaTermino", this.file); + console.log(formData); + axios + .put(`${process.env.api}/servicio/carta_aceptacion`, formData, { + headers: { + "Content-Type": "multipart/form-data", + }, + }) + .then((res) => { + console.log(res.data); + + loadingComponent.close(); + this.$buefy.dialog.alert({ + title: "Success", + message: "Se enviaron los datos correctamente", + type: "is-success", + hasIcon: true, + icon: "checkbox-marked-circle", + iconPack: "mdi", + ariaRole: "alertdialog", + ariaModal: true, + }); + }) + .catch((error) => { + loadingComponent.close(); + this.$buefy.dialog.alert({ + title: "Error", + message: error.response.data.message, + type: "is-danger", + hasIcon: true, + icon: "alert-circle", + iconPack: "mdi", + ariaRole: "alertdialog", + ariaModal: true, + }); + }) + .finally(() => { + this.$router.push("/responsable"); + }); + }, + getIdLocal() { + this.idServicio = localStorage.getItem("idServicio"); + }, }, watch: { file: function(newFile, oldFile) { this.validarTamaño(); }, }, + created() { + this.getIdLocal(); + }, }; diff --git a/components/responsable/cartaTermino.vue b/components/responsable/cartaTermino.vue index 453f6f3..b843a16 100644 --- a/components/responsable/cartaTermino.vue +++ b/components/responsable/cartaTermino.vue @@ -46,6 +46,7 @@ import axios from "axios"; export default { data() { return { + isFullPage: true, file: [], idServicio: "", }; @@ -67,9 +68,9 @@ export default { }); }, Enviar() { - // const loadingComponent = this.$buefy.loading.open({ - // container: this.isFullPage ? null : this.$refs.element.$el, - // }); + const loadingComponent = this.$buefy.loading.open({ + container: this.isFullPage ? null : this.$refs.element.$el, + }); const data = { idServicio: this.idServicio }; const formData = new FormData(); formData.append("data", JSON.stringify(data)); @@ -84,7 +85,7 @@ export default { .then((res) => { console.log(res.data); - // loadingComponent.close(); + loadingComponent.close(); this.$buefy.dialog.alert({ title: "Success", message: "Se enviaron los datos correctamente", @@ -97,7 +98,7 @@ export default { }); }) .catch((error) => { - // loadingComponent.close(); + loadingComponent.close(); this.$buefy.dialog.alert({ title: "Error", message: error.response.data.message, diff --git a/components/responsable/inputTable.vue b/components/responsable/inputTable.vue index 0d84c2d..938db35 100644 --- a/components/responsable/inputTable.vue +++ b/components/responsable/inputTable.vue @@ -156,7 +156,7 @@ props.row.idStatus == 9 " > - + - +