Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

add default value for phones and emails clear it on submit when untouched

ThieryMichel6aac01f6b064
diff --git a/src/components/atomic-crm/contacts/ContactCreate.tsx b/src/components/atomic-crm/contacts/ContactCreate.tsx
index ecbeff76..e02c8939 100644
--- a/src/components/atomic-crm/contacts/ContactCreate.tsx
+++ b/src/components/atomic-crm/contacts/ContactCreate.tsx
@@ -15,6 +15,8 @@ export const ContactCreate = () => {
first_seen: new Date().toISOString(),
last_seen: new Date().toISOString(),
tags: [],
+ phone_jsonb: data.phone_jsonb?.filter((p) => p.number !== null) || [],
+ email_jsonb: data.email_jsonb?.filter((e) => e.email !== null) || [],
})}
>
<div className="mt-2 flex lg:mr-72">
diff --git a/src/components/atomic-crm/contacts/ContactInputs.tsx b/src/components/atomic-crm/contacts/ContactInputs.tsx
index 87c330f5..3bd51ab9 100644
--- a/src/components/atomic-crm/contacts/ContactInputs.tsx
+++ b/src/components/atomic-crm/contacts/ContactInputs.tsx
@@ -134,7 +134,11 @@ const ContactPersonalInformationInputs = () => {
<h6 className="text-lg font-semibold">
{translate("resources.contacts.field_categories.personal_info")}
</h6>
- <ArrayInput source="email_jsonb" helperText={false}>
+ <ArrayInput
+ source="email_jsonb"
+ helperText={false}
+ defaultValue={[{ email: null, type: null }]}
+ >
<SimpleFormIterator
inline
disableReordering
@@ -162,7 +166,11 @@ const ContactPersonalInformationInputs = () => {
/>
</SimpleFormIterator>
</ArrayInput>
- <ArrayInput source="phone_jsonb" helperText={false}>
+ <ArrayInput
+ source="phone_jsonb"
+ helperText={false}
+ defaultValue={[{ number: null, type: null }]}
+ >
<SimpleFormIterator
inline
disableReordering