diff --git a/resources/js/components/pedidos/ProductoCard.vue b/resources/js/components/pedidos/ProductoCard.vue index fa3a978..1b560a0 100644 --- a/resources/js/components/pedidos/ProductoCard.vue +++ b/resources/js/components/pedidos/ProductoCard.vue @@ -24,37 +24,35 @@ export default { diff --git a/resources/js/components/pedidos/ProductosContainer.vue b/resources/js/components/pedidos/ProductosContainer.vue index 70c8772..ef9b817 100644 --- a/resources/js/components/pedidos/ProductosContainer.vue +++ b/resources/js/components/pedidos/ProductosContainer.vue @@ -1,11 +1,13 @@ @@ -28,5 +30,51 @@ export default { } } }, + methods: { + checkIfLastRowIncomplete() { + this.$nextTick(() => { + const wrapper = this.$refs.columnsWrapper; + if (!wrapper) return; + + const columns = wrapper.querySelectorAll('.column'); + if (columns.length === 0) { + this.isLastRowIncomplete = false; + return; + } + + const firstRowTop = columns[0].offsetTop; + + let firstRowCount = 0; + columns.forEach(col => { + if (col.offsetTop === firstRowTop) firstRowCount++; + }); + + this.isLastRowIncomplete = this.productos.length % firstRowCount !== 0; + }); + } + }, + data() { + return { + isLastRowIncomplete: false + } + }, + mounted() { + this.checkIfLastRowIncomplete(); + window.addEventListener('resize', this.checkIfLastRowIncomplete); + }, + beforeDestroy() { + window.removeEventListener('resize', this.checkIfLastRowIncomplete); + }, } + +