A full-featured CRM built with React, shadcn/ui, and Supabase.
Allow contacts with no company
François Zaninottof00038ffaa3b
diff --git a/src/contacts/ContactInputs.tsx b/src/contacts/ContactInputs.tsxindex ab86635d..8474c355 100644--- a/src/contacts/ContactInputs.tsx+++ b/src/contacts/ContactInputs.tsx@@ -109,7 +109,6 @@ const ContactPositionInputs = () => {<ReferenceInput source="company_id" reference="companies"><AutocompleteInputoptionText="name"- validate={required()}onCreate={handleCreateCompany}helperText={false}/>diff --git a/src/contacts/ContactListContent.tsx b/src/contacts/ContactListContent.tsxindex 4be5bacd..1520e62b 100644--- a/src/contacts/ContactListContent.tsx+++ b/src/contacts/ContactListContent.tsx@@ -74,14 +74,19 @@ export const ContactListContent = () => {primary={`${contact.first_name} ${contact.last_name}`}secondary={<>- {contact.title} at{' '}- <ReferenceField- source="company_id"- reference="companies"- link={false}- >- <TextField source="name" />- </ReferenceField>+ {contact.title}+ {contact.title &&+ contact.company_id != null &&+ ' at '}+ {contact.company_id != null && (+ <ReferenceField+ source="company_id"+ reference="companies"+ link={false}+ >+ <TextField source="name" />+ </ReferenceField>+ )}{contact.nb_tasks? ` - ${contact.nb_tasks} task${contact.nb_tasks > 1diff --git a/src/contacts/ContactShow.tsx b/src/contacts/ContactShow.tsxindex 22fee762..34e31474 100644--- a/src/contacts/ContactShow.tsx+++ b/src/contacts/ContactShow.tsx@@ -36,14 +36,19 @@ const ContactShowContent = () => {{record.first_name} {record.last_name}</Typography><Typography variant="body2" component="div">- {record.title} at{' '}- <ReferenceField- source="company_id"- reference="companies"- link="show"- >- <TextField source="name" />- </ReferenceField>+ {record.title}+ {record.title &&+ record.company_id != null &&+ ' at '}+ {record.company_id != null && (+ <ReferenceField+ source="company_id"+ reference="companies"+ link="show"+ >+ <TextField source="name" />+ </ReferenceField>+ )}</Typography></Box><Box>