diff --git a/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx b/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx index c138a790..f9d00128 100644 --- a/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx +++ b/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx @@ -2,7 +2,7 @@ import { Description, FieldGroup, Fieldset, Legend } from "@repo/rdx-ui/componen import { FieldErrors, useFormContext } from "react-hook-form"; import { FormDebug } from "@erp/core/components"; -import { CustomerModalSelector } from "@erp/customers/components"; +import { CustomerModalSelectorField } from "@erp/customers/components"; import { UserIcon } from "lucide-react"; import { useTranslation } from "../../i18n"; import { CustomerInvoiceFormData } from "../../schemas"; @@ -42,7 +42,7 @@ export const CustomerInvoiceEditForm = ({ {t("form_groups.customer.description")} - + diff --git a/modules/customer-invoices/src/web/components/editor/invoice-items-editor.tsx b/modules/customer-invoices/src/web/components/editor/invoice-items-editor.tsx index e08532cb..0fc23ce1 100644 --- a/modules/customer-invoices/src/web/components/editor/invoice-items-editor.tsx +++ b/modules/customer-invoices/src/web/components/editor/invoice-items-editor.tsx @@ -8,7 +8,7 @@ import { CustomerInvoiceFormData } from "../../schemas"; import { BlocksView, TableView } from "./items"; export const InvoiceItems = () => { - const [viewMode, setViewMode] = useState<"blocks" | "table">("blocks"); + const [viewMode, setViewMode] = useState<"blocks" | "table">("table"); const { t } = useTranslation(); const { control } = useFormContext(); @@ -86,7 +86,7 @@ export const InvoiceItems = () => {
-
-

{customer.name}

- -
+

{customer.name}

-
- - {customer.email_primary} -
+ {customer.email_primary && ( +
+ + {customer.email_primary} +
+ )} + {customer.mobile_primary && (
diff --git a/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector-field.tsx b/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector-field.tsx new file mode 100644 index 00000000..06778763 --- /dev/null +++ b/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector-field.tsx @@ -0,0 +1,40 @@ +import { FormField, FormItem } from "@repo/shadcn-ui/components"; + +import { Control, FieldPath, FieldValues } from "react-hook-form"; +import { CustomerModalSelector } from "./customer-modal-selector"; + +type CustomerModalSelectorFieldProps = { + control: Control; + name: FieldPath; + disabled?: boolean; + required?: boolean; + readOnly?: boolean; + className?: string; +}; + +export function CustomerModalSelectorField({ + control, + name, + disabled = false, + required = false, + readOnly = false, + className, +}: CustomerModalSelectorFieldProps) { + const isDisabled = disabled; + const isReadOnly = readOnly && !disabled; + + return ( + { + console.log(field); + return ( + + + + ); + }} + /> + ); +} diff --git a/modules/customers/src/web/components/customer-modal-selector/index.ts b/modules/customers/src/web/components/customer-modal-selector/index.ts index d3e79bfe..be077e63 100644 --- a/modules/customers/src/web/components/customer-modal-selector/index.ts +++ b/modules/customers/src/web/components/customer-modal-selector/index.ts @@ -1 +1,2 @@ export * from "./customer-modal-selector"; +export * from "./customer-modal-selector-field";