diff --git a/resources/views/penawaran/layouts/scripts.blade.php b/resources/views/penawaran/layouts/scripts.blade.php index 8c572a9..3738708 100644 --- a/resources/views/penawaran/layouts/scripts.blade.php +++ b/resources/views/penawaran/layouts/scripts.blade.php @@ -46,7 +46,7 @@ email_kantor: { title: 'Email Kantor', render: (item, data) => { - let emails = [data.kjpp.email_kantor]; // Always include the main email + let emails = new Set([data.kjpp.email_kantor]); // Always include the main email // Check if there's a detail_email_kantor and try to parse it if (data.kjpp.detail_email_kantor) { @@ -56,15 +56,12 @@ // If the parsed result is an array, extract emails from each object and concatenate if (Array.isArray(detailEmails)) { detailEmails.forEach(item => { - if (item.email_kantor) { - emails.push(item - .email_kantor); // Add the email from each object - } + emails.add(item); }); } else { // If it's a single object (not an array), just add the email - if (detailEmails.email_kantor) { - emails.push(detailEmails.email_kantor); + if (detailEmails) { + emails.add(detailEmails); } } } catch (e) { @@ -74,6 +71,8 @@ } } + emails = Array.from(emails); + // Helper function for basic email validation (regex pattern) const isValidEmail = (email) => { const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;