feat: enhance RowShareAction component to group and display cutting results by product, improving shareable output format
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (8.3) (push) Waiting to run
tests / ci (8.4) (push) Waiting to run
tests / ci (8.5) (push) Waiting to run

This commit is contained in:
Yoga Pangestu 2026-07-05 21:57:39 +07:00
parent d57ad3e65d
commit 366380ae67

View File

@ -36,6 +36,30 @@ const whatsappText = computed(() => {
text += `Deskripsi: ${c.description}\n`;
}
if (c.results?.length) {
const groups: Record<string, { name: string; items: typeof c.results }> = {};
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}`;