From 366380ae6784b1e7247fe1f72520c804d4408a4d Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Sun, 5 Jul 2026 21:57:39 +0700 Subject: [PATCH] feat: enhance RowShareAction component to group and display cutting results by product, improving shareable output format --- .../js/components/button/RowShareAction.vue | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/resources/js/components/button/RowShareAction.vue b/resources/js/components/button/RowShareAction.vue index f55b6e5..b06d643 100644 --- a/resources/js/components/button/RowShareAction.vue +++ b/resources/js/components/button/RowShareAction.vue @@ -36,6 +36,30 @@ const whatsappText = computed(() => { text += `Deskripsi: ${c.description}\n`; } + if (c.results?.length) { + const groups: Record = {}; + + c.results.forEach((result) => { + const productName = result.product_variant?.product?.name ?? 'Produk Tidak Diketahui'; + + if (!groups[productName]) { + groups[productName] = { name: productName, items: [] }; + } + + groups[productName].items.push(result); + }); + + text += `\n*Hasil Produk:*\n`; + + Object.values(groups).forEach((group, index) => { + text += `${index + 1}. ${group.name}\n`; + + group.items.forEach((item) => { + text += ` - ${item.product_variant?.name ?? '-'}: ${item.cutting_result} pcs\n`; + }); + }); + } + text += `\nTotal Hasil Cutting: ${c.total_result_pieces ?? 0} pcs\n`; text += `\nLihat detail lengkap:\n${shareLink.value}`;