diff --git a/resources/js/store/index.js b/resources/js/store/index.js index 73dd998..7e7316e 100644 --- a/resources/js/store/index.js +++ b/resources/js/store/index.js @@ -2,6 +2,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import admin from "./modules/admin"; import login from "./modules/login"; +import chismosa from "./modules/chismosa"; Vue.use(Vuex); @@ -9,5 +10,6 @@ export default new Vuex.Store({ modules: { admin, login, + chismosa, }, }); diff --git a/resources/js/store/modules/chismosa.js b/resources/js/store/modules/chismosa.js new file mode 100644 index 0000000..e9fa7cb --- /dev/null +++ b/resources/js/store/modules/chismosa.js @@ -0,0 +1,46 @@ +const state = { + lastFetch: null, + pedido_id: null, + nombre: null, + productos: null, + aprobado: null, + total: null, + total_transporte: null, + cantidad_transporte: null, + total_sin_devoluciones: null, + devoluciones_habilitadas: null, + devoluciones_total: null, + devoluciones_notas: null, +}; + +const mutations = { + setState(state, { pedido }) { + state.lastFetch = new Date(); + state.pedido_id = pedido.id; + state.nombre = pedido.nombre; + state.productos = pedido.productos; + state.aprobado = pedido.aprobado; + state.total = pedido.total; + state.total_transporte = pedido.total_transporte; + state.cantidad_transporte = pedido.cantidad_transporte; + state.total_sin_devoluciones = pedido.total_sin_devoluciones; + state.devoluciones_habilitadas = pedido.grupo_de_compra.devoluciones_habilitadas; + state.devoluciones_total = pedido.devoluciones_total; + state.devoluciones_notas = pedido.devoluciones_notas; + }, +}; + +const actions = { + async getPedido({ commit }) { + }, + async modificarChismosa({ commit }, { producto_id, cantidad, notas }) { + }, + async modificarDevoluciones({ commit }, { monto, notas }) {} +}; + +export default { + namespaced: true, + state, + mutations, + actions, +};