From 4b4a2849143d471e6a4699832adead4bf4e63538 Mon Sep 17 00:00:00 2001 From: ale Date: Tue, 27 May 2025 23:38:37 -0300 Subject: [PATCH] Cambio en layout de productos --- .../js/components/pedidos/ProductoCard.vue | 56 +++++++++-------- .../components/pedidos/ProductosContainer.vue | 60 +++++++++++++++++-- 2 files changed, 81 insertions(+), 35 deletions(-) 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); + }, } + +