From e4e4fe2fff2a1458faa0e5b291c86691f8398fcf Mon Sep 17 00:00:00 2001 From: ale Date: Wed, 13 Aug 2025 00:58:24 -0300 Subject: [PATCH] =?UTF-8?q?Cambio=20de=20m=C3=A9todo=20seg=C3=BAn=20si=20s?= =?UTF-8?q?e=20est=C3=A1=20modificando=20o=20creando=20un=20barrio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../comisiones/barrios/ModalBarrio.vue | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/resources/js/components/comisiones/barrios/ModalBarrio.vue b/resources/js/components/comisiones/barrios/ModalBarrio.vue index e5ef2d5..4198c99 100644 --- a/resources/js/components/comisiones/barrios/ModalBarrio.vue +++ b/resources/js/components/comisiones/barrios/ModalBarrio.vue @@ -40,7 +40,7 @@ @@ -62,13 +62,28 @@ export default { }, computed: { ...mapState('ui', ["show_modal_barrio"]), - ...mapState('comisiones', ["grupo_de_compra_actual"]), + ...mapState('comisiones', ["grupo_de_compra_actual", "grupo_de_compra_nuevo"]), }, methods: { ...mapMutations("comisiones", ["seleccionarGrupoDeCompra"]), ...mapMutations('ui', ["toggleModalBarrio"]), - ...mapActions("comisiones", ["modificarBarrio"]), - ...mapActions('ui', ["toast"]), + ...mapActions("comisiones", ["modificarBarrio", "crearBarrio"]), + ...mapActions('ui', ["toast", "error"]), + async confirmar() { + if (this.grupo_de_compra_nuevo) + this.crear(); + else + this.modificar(); + }, + async crear() { + await this.crearBarrio({ + nombre: this.nombreControl, + region: this.regionControl, + passBarrio: this.passBarrio, + passAdmin: this.passAdmin, + passOllas: this.passOllas + }); + }, async modificar() { const nombre = this.nombreControl !== this.grupo_de_compra_actual.nombre ? this.nombreControl : undefined; const region = this.regionControl !== this.grupo_de_compra_actual.region ? this.regionControl : undefined; @@ -84,7 +99,7 @@ export default { }, cerrar() { this.toggleModalBarrio(); - this.seleccionarGrupoDeCompra(false); + this.seleccionarGrupoDeCompra({ grupoDeCompra: false }); }, }, mounted() {