diff --git a/resources/js/components/pedidos/SubpedidoSelect.vue b/resources/js/components/pedidos/SubpedidoSelect.vue index 0c87e5e..11bdf8b 100644 --- a/resources/js/components/pedidos/SubpedidoSelect.vue +++ b/resources/js/components/pedidos/SubpedidoSelect.vue @@ -5,20 +5,20 @@
- +

Debe ser claro para que tus compas del barrio te identifiquen.

-
-
+

Podés seguir escribiendo en el campo de arriba para refinar la búsqueda.

-

a.nombre.toLowerCase()) - }, - botonCrearDesabilitado: function () { - return !this.subpedido || this.nombresDeSubpedidos.includes(this.subpedido.toLowerCase()) + deshabilitado: function () { + return !this.searchString?.trim() + || this.pedidos.some(p => p.nombre.toLowerCase() === this.searchString.toLowerCase()) } }, - async mounted() { - await this.getGrupoDeCompra(); - }, methods: { ...mapActions('barrio',["getGrupoDeCompra"]), onType() { - if (!this.subpedido) { - this.subpedidosExistentes = []; + if (!this.searchString) { + this.pedidos = []; return; } axios.get("/api/subpedidos", { params: { - nombre: this.subpedido, + nombre: this.searchString, grupo_de_compra: this.grupo_de_compra_id } }).then(response => { - this.subpedidosExistentes = response.data + this.pedidos = response.data }); }, submit() { axios.post("/api/subpedidos", { - nombre: this.subpedido, + nombre: this.searchString, grupo_de_compra_id: this.grupo_de_compra_id }).then(response => { //se creo el subpedido