Agregada miga para volver al select de pedidos
This commit is contained in:
parent
8488d9d6c5
commit
0512ea9ab2
4 changed files with 19 additions and 5 deletions
|
@ -11,12 +11,13 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { mapActions, mapGetters, mapState } from "vuex";
|
||||
import { mapActions, mapGetters, mapMutations, mapState } from "vuex";
|
||||
|
||||
export default {
|
||||
methods: {
|
||||
...mapActions('productos',["getProductos"]),
|
||||
...mapActions('ui',["clickMiga"]),
|
||||
...mapMutations('ui',["addMiga"]),
|
||||
},
|
||||
computed: {
|
||||
...mapState('ui',["migas"]),
|
||||
|
@ -26,8 +27,17 @@ export default {
|
|||
},
|
||||
migaActiva() {
|
||||
return this.migas.length - 1
|
||||
},
|
||||
pedido() {
|
||||
return this.pedidoDefinido
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pedido(newValue) {
|
||||
if (newValue)
|
||||
this.addMiga({ nombre: 'Categorias', action: 'productos/getProductos' });
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
3
resources/js/store/modules/barrio.js
vendored
3
resources/js/store/modules/barrio.js
vendored
|
@ -31,6 +31,9 @@ const actions = {
|
|||
}
|
||||
});
|
||||
commit('setPedidos', response.data);
|
||||
},
|
||||
async limpiarPedidos({ commit }) {
|
||||
commit('setPedidos', []);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
6
resources/js/store/modules/pedido.js
vendored
6
resources/js/store/modules/pedido.js
vendored
|
@ -85,8 +85,10 @@ const actions = {
|
|||
dispatch("ui/error", { error: error }, { root: true });
|
||||
}
|
||||
},
|
||||
async resetear({ commit }) {
|
||||
await axios.delete("/pedido/sesion")
|
||||
async resetear({ commit, dispatch }) {
|
||||
await axios.delete("/pedido/sesion");
|
||||
dispatch("barrio/limpiarPedidos", null, { root: true });
|
||||
dispatch("productos/getProductos", null, { root: true });
|
||||
commit('reset');
|
||||
},
|
||||
};
|
||||
|
|
3
resources/js/store/modules/ui.js
vendored
3
resources/js/store/modules/ui.js
vendored
|
@ -3,8 +3,7 @@ import { dropWhile } from "lodash/array";
|
|||
const state = {
|
||||
show_chismosa: false,
|
||||
show_devoluciones: false,
|
||||
miga_inicial: { nombre: 'Categorias', action: 'productos/getProductos' },
|
||||
migas: [{ nombre: 'Categorias', action: 'productos/getProductos' }],
|
||||
migas: [{ nombre: 'Pedidos', action: 'pedido/resetear' }],
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
|
|
Loading…
Add table
Reference in a new issue