diff --git a/resources/js/components/pedidos/NavMigas.vue b/resources/js/components/pedidos/NavMigas.vue index 33ff5bb..6e8f672 100644 --- a/resources/js/components/pedidos/NavMigas.vue +++ b/resources/js/components/pedidos/NavMigas.vue @@ -1,55 +1,59 @@ <template> - <nav class="breadcrumb is-centered has-background-danger-light is-fixed-top" aria-label="breadcrumbs" v-show="visible"> - <ul class="mt-4"> - <li v-for="(miga, i) in migas" :key="i" :class="{'is-active': i == migaActiva}"> - <a :href="miga.href" v-text="miga.nombre" - :class="{'has-text-danger': i != migaActiva}"></a> - </li> - </ul> - </nav> + <nav v-if="pedidoDefinido" class="breadcrumb is-centered has-background-danger-light is-fixed-top" + aria-label="breadcrumbs" v-show="visible"> + <ul class="mt-4"> + <li v-for="(miga, i) in migas" :key="i" :class="{'is-active': i == migaActiva}"> + <a :href="miga.href" v-text="miga.nombre" + :class="{'has-text-danger': i != migaActiva}"></a> + </li> + </ul> + </nav> </template> <script> - export default { - data() { - return { - initial: [{ nombre: 'Categorías', href: '/productos' }], - migas: [{ nombre: 'Categorías', href: '/productos' }], - } - }, - computed: { - visible: function() { - return this.migas.length > 0 - }, - migaActiva: function() { - return this.migas.length-1 - } - }, - mounted() { - Event.$on('migas-setear-como-inicio', (miga) => { - this.migas = []; - this.migas.push(miga); - }); - Event.$on('migas-agregar', (miga) => { - this.migas.push(miga); - }); - Event.$on('migas-reset', () => { - this.migas = this.initial; - }); - Event.$on('migas-pop', () => { - this.migas.pop(); - }); - } - } +import { mapGetters } from "vuex"; + +export default { + data() { + return { + initial: [{ nombre: 'Categorías', href: '/productos' }], + migas: [{ nombre: 'Categorías', href: '/productos' }], + } + }, + computed: { + ...mapGetters('pedido', ["pedidoDefinido"]), + visible: function () { + return this.migas.length > 0 + }, + migaActiva: function () { + return this.migas.length - 1 + } + }, + mounted() { + Event.$on('migas-setear-como-inicio', (miga) => { + this.migas = []; + this.migas.push(miga); + }); + Event.$on('migas-agregar', (miga) => { + this.migas.push(miga); + }); + Event.$on('migas-reset', () => { + this.migas = this.initial; + }); + Event.$on('migas-pop', () => { + this.migas.pop(); + }); + } +} </script> <style> nav.breadcrumb.is-fixed-top { - position: fixed; - left: 0; - right: 0; - top: 3.25rem; - height: 2.75rem; - z-index: 5; + position: fixed; + left: 0; + right: 0; + top: 3.25rem; + height: 2.75rem; + z-index: 5; } </style> diff --git a/resources/js/store/modules/pedido.js b/resources/js/store/modules/pedido.js index 20881e4..0494489 100644 --- a/resources/js/store/modules/pedido.js +++ b/resources/js/store/modules/pedido.js @@ -45,9 +45,16 @@ const actions = { async modificarDevoluciones({ commit }, { monto, notas }) {} }; +const getters = { + pedidoDefinido() { + return state.lastFetch !== null; + }, +} + export default { namespaced: true, state, mutations, actions, + getters, };