diff --git a/examples/crm/src/contacts/ContactAside.tsx b/examples/crm/src/contacts/ContactAside.tsx index 6e7af8d67f..f0ed014fad 100644 --- a/examples/crm/src/contacts/ContactAside.tsx +++ b/examples/crm/src/contacts/ContactAside.tsx @@ -66,33 +66,31 @@ export const ContactAside = ({ link = 'edit' }: { link?: 'edit' | 'show' }) => { /> )} - {record.phone_number1 && ( + {record.phone_number1.number && ( - {' '} - - Work - + {' '} + {record.phone_number1.type !== 'Other' && ( + + )} )} - {record.phone_number2 && ( + {record.phone_number2.number && ( - {' '} - - Home - + {' '} + {record.phone_number2.type !== 'Other' && ( + + )} )} diff --git a/examples/crm/src/contacts/ContactInputs.tsx b/examples/crm/src/contacts/ContactInputs.tsx index e8b538e7af..dfe29c9a1f 100644 --- a/examples/crm/src/contacts/ContactInputs.tsx +++ b/examples/crm/src/contacts/ContactInputs.tsx @@ -42,7 +42,7 @@ export const ContactInputs = () => { const isMobile = useMediaQuery(theme.breakpoints.down('sm')); return ( - + @@ -141,8 +141,34 @@ const ContactPersonalInformationInputs = () => { Personal info - - + + + choice.id} + choices={[{ id: 'Work' }, { id: 'Home' }, { id: 'Other' }]} + /> + + + + choice.id} + choices={[{ id: 'Work' }, { id: 'Home' }, { id: 'Other' }]} + /> + { company_id: company.id, company_name: company.name, email, - phone_number1: phone.phoneNumber(), - phone_number2: phone.phoneNumber(), + phone_number1: { + number: phone.phoneNumber(), + type: random.arrayElement(['Work', 'Home', 'Other']), + }, + phone_number2: { + number: phone.phoneNumber(), + type: random.arrayElement(['Work', 'Home', 'Other']), + }, background: lorem.sentence(), acquisition: random.arrayElement(['inbound', 'outbound']), avatar, diff --git a/examples/crm/src/types.ts b/examples/crm/src/types.ts index 0fc65b9f81..8d4374feae 100644 --- a/examples/crm/src/types.ts +++ b/examples/crm/src/types.ts @@ -56,6 +56,8 @@ export interface Contact extends RaRecord { nb_notes: number; status: string; background: string; + phone_number1: { number: string; type: 'Work' | 'Home' | 'Other' }; + phone_number2: { number: string; type: 'Work' | 'Home' | 'Other' }; } export interface ContactNote extends RaRecord {