only clearing first_name, mobile_no, email, last_name while contact exist

This commit is contained in:
Muhammed Raihan P A 2025-02-20 21:15:09 -08:00 committed by GitHub
parent cf43935508
commit 7a759f6296
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -191,21 +191,10 @@ function createDeal() {
deal.website = 'https://' + deal.website
}
if (chooseExistingContact.value) {
const contactDetailsFields = new Set(
tabs.data.flatMap((tab) =>
tab.sections
.filter((section) => section.name === 'contact_details_section')
.flatMap((section) =>
section.columns.flatMap((column) =>
column.fields.map((field) => field.fieldname),
),
),
),
)
contactDetailsFields.forEach((field) => {
deal[field] = null
})
deal['first_name'] = null
deal['last_name'] = null
deal['email'] = null
deal['mobile_no'] = null
} else deal['contact'] = null
createResource({