Info tags cerradas en pedido select si no fueron interactuadas
This commit is contained in:
parent
a16487cc3f
commit
0173d7bd36
4 changed files with 32 additions and 17 deletions
|
@ -27,7 +27,7 @@ export default {
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div v-if="!show_tags" class="info-tab" @click="toggleTags">
|
<div v-if="!show_tags" class="info-tab" @click="toggleTags(true)">
|
||||||
<button class="button is-borderless" type="button">
|
<button class="button is-borderless" type="button">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<i class="fas fa-info-circle"></i>
|
<i class="fas fa-info-circle"></i>
|
||||||
|
@ -48,7 +48,7 @@ export default {
|
||||||
<span class="tag is-danger">{{ fechaCanasta }}</span>
|
<span class="tag is-danger">{{ fechaCanasta }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button class="delete" type="button" @click="toggleTags"></button>
|
<button class="delete" type="button" @click="toggleTags(true)"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script >
|
<script >
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { mapState } from "vuex";
|
import { mapMutations, mapState } from "vuex";
|
||||||
import CategoriasContainer from "./CategoriasContainer.vue";
|
import CategoriasContainer from "./CategoriasContainer.vue";
|
||||||
import ProductosContainer from "./ProductosContainer.vue";
|
import ProductosContainer from "./ProductosContainer.vue";
|
||||||
import Chismosa from "./Chismosa.vue";
|
import Chismosa from "./Chismosa.vue";
|
||||||
|
@ -9,7 +9,14 @@ import DevolucionesModal from "./DevolucionesModal.vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { DevolucionesModal, CategoriasContainer, ProductosContainer, Chismosa },
|
components: { DevolucionesModal, CategoriasContainer, ProductosContainer, Chismosa },
|
||||||
computed: {
|
computed: {
|
||||||
...mapState('ui', ["show_chismosa", "show_devoluciones"])
|
...mapState('ui', ["show_chismosa", "show_devoluciones", "tags_interactuada"])
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapMutations("ui", ["toggleTags"]),
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (!this.tags_interactuada)
|
||||||
|
this.toggleTags(false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
Pedidos MPS
|
Pedidos MPS
|
||||||
</h1>
|
</h1>
|
||||||
<p class="subtitle">
|
<p class="subtitle">
|
||||||
Bienvenidx a la aplicación de pedidos del <strong>Mercado Popular de Subsistencia</strong>
|
Bienvenidx a la aplicación de pedidos del
|
||||||
|
<strong>Mercado Popular de Subsistencia</strong>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label class="label">Escribí el nombre de tu familia o grupo de convivencia</label>
|
<label class="label">Escribí el nombre de tu familia o grupo de convivencia</label>
|
||||||
<div class="columns">
|
<div class="columns">
|
||||||
|
@ -16,7 +16,9 @@
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<input class="input" @input="onType" v-model="searchString"/>
|
<input class="input" @input="onType" v-model="searchString"/>
|
||||||
</div>
|
</div>
|
||||||
<p class="help">Debe ser claro para que tus compas del barrio te identifiquen.</p>
|
<p class="help">
|
||||||
|
Debe ser clarx para que tus compas del barrio te identifiquen.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="column is-one-third buttons">
|
<div class="column is-one-third buttons">
|
||||||
|
@ -58,11 +60,11 @@ import axios from "axios";
|
||||||
export default {
|
export default {
|
||||||
name: 'PedidoSelect',
|
name: 'PedidoSelect',
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
this.toggleTags(false);
|
||||||
await this.getGrupoDeCompra();
|
await this.getGrupoDeCompra();
|
||||||
const sesion = await axios.get("/pedido/sesion");
|
const sesion = await axios.get("/pedido/sesion");
|
||||||
if (sesion.data.id) {
|
if (sesion.data.id)
|
||||||
await this.elegirPedido({ pedido_id: sesion.data.id });
|
await this.elegirPedido({ pedido_id: sesion.data.id });
|
||||||
}
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -72,13 +74,14 @@ export default {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState('pedido', ["grupo_de_compra"]),
|
...mapState('pedido', ["grupo_de_compra"]),
|
||||||
deshabilitado: function () {
|
deshabilitado() {
|
||||||
return !this.searchString?.trim()
|
return !this.searchString?.trim()
|
||||||
|| this.pedidos.some(p => p.nombre.toLowerCase() === this.searchString.toLowerCase())
|
|| this.pedidos.some(p => p.nombre.toLowerCase() === this.searchString.toLowerCase())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('pedido', ["getGrupoDeCompra", "crearPedido", "elegirPedido"]),
|
...mapActions('pedido', ["getGrupoDeCompra", "crearPedido", "elegirPedido"]),
|
||||||
|
...mapMutations("ui", ["toggleTags"]),
|
||||||
async getPedidos(nombre) {
|
async getPedidos(nombre) {
|
||||||
const response = await axios.get('/api/subpedidos/',{
|
const response = await axios.get('/api/subpedidos/',{
|
||||||
params: {
|
params: {
|
||||||
|
@ -89,17 +92,19 @@ export default {
|
||||||
this.pedidos = response.data;
|
this.pedidos = response.data;
|
||||||
},
|
},
|
||||||
onType() {
|
onType() {
|
||||||
if (!this.searchString) {
|
if (!this.searchString)
|
||||||
this.setPedidos([]);
|
this.pedidos = [];
|
||||||
return;
|
else
|
||||||
}
|
|
||||||
this.getPedidos(this.searchString);
|
this.getPedidos(this.searchString);
|
||||||
},
|
},
|
||||||
async submit(pedido) {
|
async submit(pedido) {
|
||||||
if (pedido)
|
if (pedido)
|
||||||
await this.elegirPedido({ pedido_id: pedido.id });
|
await this.elegirPedido({ pedido_id: pedido.id });
|
||||||
else
|
else
|
||||||
await this.crearPedido({ nombre: this.searchString, grupo_de_compra_id: this.grupo_de_compra.id });
|
await this.crearPedido({
|
||||||
|
nombre: this.searchString,
|
||||||
|
grupo_de_compra_id: this.grupo_de_compra.id
|
||||||
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
5
resources/js/store/modules/ui.js
vendored
5
resources/js/store/modules/ui.js
vendored
|
@ -2,6 +2,7 @@ const state = {
|
||||||
show_chismosa: false,
|
show_chismosa: false,
|
||||||
show_devoluciones: false,
|
show_devoluciones: false,
|
||||||
show_tags: true,
|
show_tags: true,
|
||||||
|
tags_interactuada: false,
|
||||||
migas: [{ nombre: 'Pedidos', action: 'pedido/resetear' }],
|
migas: [{ nombre: 'Pedidos', action: 'pedido/resetear' }],
|
||||||
canasta_actual: null,
|
canasta_actual: null,
|
||||||
};
|
};
|
||||||
|
@ -16,7 +17,9 @@ const mutations = {
|
||||||
toggleDevoluciones(state) {
|
toggleDevoluciones(state) {
|
||||||
state.show_devoluciones = !state.show_devoluciones;
|
state.show_devoluciones = !state.show_devoluciones;
|
||||||
},
|
},
|
||||||
toggleTags(state) {
|
toggleTags(state, manual) {
|
||||||
|
if (manual)
|
||||||
|
state.tags_interactuada = true;
|
||||||
state.show_tags = !state.show_tags;
|
state.show_tags = !state.show_tags;
|
||||||
},
|
},
|
||||||
addMiga(state, miga) {
|
addMiga(state, miga) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue