From 29bbd51b0dd502f899ed16b852f03af2333a0393 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 Oct 2025 09:44:56 +0200 Subject: [PATCH] Facturas de cliente --- .../components/form-commit-button-group.tsx | 2 +- .../src/web/components/editor/index.ts | 5 +- .../editor/recipient/invoice-recipient.tsx | 3 +- .../src/web/components/index.tsx | 1 - .../src/web/pages/list/invoices-list-page.tsx | 2 +- .../web/pages/update/invoice-update-comp.tsx | 4 +- .../update/invoice-update-form.tsx} | 11 ++-- .../src/web/schemas/invoice-dto.adapter.ts | 1 + .../customer-modal-selector/customer-card.tsx | 54 +++++++++---------- .../customer-modal-selector.tsx | 4 +- 10 files changed, 44 insertions(+), 43 deletions(-) rename modules/customer-invoices/src/web/{components/editor/invoice-edit-form.tsx => pages/update/invoice-update-form.tsx} (78%) diff --git a/modules/core/src/web/hooks/use-unsaved-changes-notifier/components/form-commit-button-group.tsx b/modules/core/src/web/hooks/use-unsaved-changes-notifier/components/form-commit-button-group.tsx index 881a3a13..a5da9127 100644 --- a/modules/core/src/web/hooks/use-unsaved-changes-notifier/components/form-commit-button-group.tsx +++ b/modules/core/src/web/hooks/use-unsaved-changes-notifier/components/form-commit-button-group.tsx @@ -94,7 +94,7 @@ export const UpdateCommitButtonGroup = ({ className )} > - {preview && } + {submit && } {showCancel && } diff --git a/modules/customer-invoices/src/web/components/editor/index.ts b/modules/customer-invoices/src/web/components/editor/index.ts index 77413531..3b6bd8ed 100644 --- a/modules/customer-invoices/src/web/components/editor/index.ts +++ b/modules/customer-invoices/src/web/components/editor/index.ts @@ -1 +1,4 @@ -export * from "./invoice-edit-form"; +export * from "./invoice-basic-info-fields"; +export * from "./invoice-items-editor"; +export * from "./invoice-totals"; +export * from "./recipient"; diff --git a/modules/customer-invoices/src/web/components/editor/recipient/invoice-recipient.tsx b/modules/customer-invoices/src/web/components/editor/recipient/invoice-recipient.tsx index 26cb91e3..8bd1879c 100644 --- a/modules/customer-invoices/src/web/components/editor/recipient/invoice-recipient.tsx +++ b/modules/customer-invoices/src/web/components/editor/recipient/invoice-recipient.tsx @@ -9,8 +9,7 @@ export const InvoiceRecipient = (props: ComponentProps<"fieldset">) => { const { t } = useTranslation(); const { control, getValues } = useFormContext(); - - const recipient = getValues('recipient'); + const recipient = getValues("recipient"); return (
diff --git a/modules/customer-invoices/src/web/components/index.tsx b/modules/customer-invoices/src/web/components/index.tsx index d16d34bd..f443819c 100644 --- a/modules/customer-invoices/src/web/components/index.tsx +++ b/modules/customer-invoices/src/web/components/index.tsx @@ -1,4 +1,3 @@ -export * from "../pages/list/invoices-list-grid"; export * from "./customer-invoice-editor-skeleton"; export * from "./customer-invoice-prices-card"; export * from "./customer-invoice-status-badge"; diff --git a/modules/customer-invoices/src/web/pages/list/invoices-list-page.tsx b/modules/customer-invoices/src/web/pages/list/invoices-list-page.tsx index d023d1af..844d8b89 100644 --- a/modules/customer-invoices/src/web/pages/list/invoices-list-page.tsx +++ b/modules/customer-invoices/src/web/pages/list/invoices-list-page.tsx @@ -4,10 +4,10 @@ import { Button } from "@repo/shadcn-ui/components"; import { PlusIcon } from "lucide-react"; import { useMemo, useState } from 'react'; import { useNavigate } from "react-router-dom"; -import { InvoicesListGrid, PageHeader } from '../../components'; import { useInvoicesQuery } from '../../hooks'; import { useTranslation } from "../../i18n"; import { invoiceResumeDtoToFormAdapter } from '../../schemas/invoice-resume-dto.adapter'; +import { InvoicesListGrid } from './invoices-list-grid'; export const InvoiceListPage = () => { const { t } = useTranslation(); diff --git a/modules/customer-invoices/src/web/pages/update/invoice-update-comp.tsx b/modules/customer-invoices/src/web/pages/update/invoice-update-comp.tsx index 6e87c091..7f218b64 100644 --- a/modules/customer-invoices/src/web/pages/update/invoice-update-comp.tsx +++ b/modules/customer-invoices/src/web/pages/update/invoice-update-comp.tsx @@ -9,7 +9,6 @@ import { useMemo } from 'react'; import { FieldErrors, FormProvider } from "react-hook-form"; import { useNavigate } from "react-router-dom"; import { - InvoiceEditForm, PageHeader } from "../../components"; import { useInvoiceContext } from '../../context'; @@ -22,6 +21,7 @@ import { defaultCustomerInvoiceFormData, invoiceDtoToFormAdapter } from "../../schemas"; +import { InvoiceUpdateForm } from './invoice-update-form'; export type InvoiceUpdateCompProps = { @@ -104,7 +104,7 @@ export const InvoiceUpdateComp = ({ - void; onError: (errors: FieldErrors) => void; className: string; } -export const InvoiceEditForm = ({ +export const InvoiceUpdateForm = ({ formId, onSubmit, onError, className, -}: CustomerInvoiceFormProps) => { +}: InvoiceUpdateFormProps) => { const form = useFormContext(); return ( diff --git a/modules/customer-invoices/src/web/schemas/invoice-dto.adapter.ts b/modules/customer-invoices/src/web/schemas/invoice-dto.adapter.ts index f2d16cee..6db33a15 100644 --- a/modules/customer-invoices/src/web/schemas/invoice-dto.adapter.ts +++ b/modules/customer-invoices/src/web/schemas/invoice-dto.adapter.ts @@ -20,6 +20,7 @@ export const invoiceDtoToFormAdapter = { operation_date: dto.operation_date, customer_id: dto.customer_id, + recipient: dto.recipient, reference: dto.reference ?? "", description: dto.description ?? "", diff --git a/modules/customers/src/web/components/customer-modal-selector/customer-card.tsx b/modules/customers/src/web/components/customer-modal-selector/customer-card.tsx index 39e6aa91..970fac20 100644 --- a/modules/customers/src/web/components/customer-modal-selector/customer-card.tsx +++ b/modules/customers/src/web/components/customer-modal-selector/customer-card.tsx @@ -74,33 +74,33 @@ export const CustomerCard = ({ )} - -
- - -
+ + + + + ); diff --git a/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector.tsx b/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector.tsx index c7f788cb..5b0e6920 100644 --- a/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector.tsx +++ b/modules/customers/src/web/components/customer-modal-selector/customer-modal-selector.tsx @@ -33,7 +33,7 @@ export const CustomerModalSelector = ({ readOnly = false, className, }: CustomerModalSelectorProps) => { - // UI state + const [showSearch, setShowSearch] = useState(false); const [showForm, setShowForm] = useState(false); const [searchQuery, setSearchQuery] = useState(""); @@ -82,6 +82,8 @@ export const CustomerModalSelector = ({ setShowSearch(false); }; + console.log(selected); + return ( <>