hide company for non company users
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
parent
1fda8d8d7b
commit
4faafe6667
@ -114,7 +114,7 @@ function mapFormToPayload(values: CustomerFormValues) {
|
||||
|
||||
const mapLookupOption = (item: any) => ({
|
||||
value: String(item.id),
|
||||
label: item.title||item.name || `#${item.id}`,
|
||||
label: item.title || item.name || `#${item.id}`,
|
||||
})
|
||||
|
||||
const STORE_OBJECT = { getOptionValue: (o: any) => o, getOptionLabel: (o: any) => o.label || o.name || `#${o.id}` }
|
||||
@ -134,6 +134,7 @@ export function CustomerForm({ resourceId, initialData, onSuccess }: CustomerFor
|
||||
mapToFormValues: mapCustomerToFormValues,
|
||||
})
|
||||
|
||||
const { customer_type} = form.watch()
|
||||
const { mutate, error, isPending } = useFormMutation(form, {
|
||||
mutationFn: (values: CustomerFormValues) => {
|
||||
const payload = mapFormToPayload(values)
|
||||
@ -192,7 +193,11 @@ export function CustomerForm({ resourceId, initialData, onSuccess }: CustomerFor
|
||||
<RhfTextField name="last_name" label="Last Name" placeholder="Doe" required />
|
||||
</div>
|
||||
|
||||
|
||||
{
|
||||
customer_type?.label === "Company" &&
|
||||
<RhfTextField name="company_name" label="Company Name" placeholder="Doe Holdings" />
|
||||
}
|
||||
|
||||
{/* Contact */}
|
||||
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user