From dc49094f0017ed298e7be8d521458329a1eff960 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 15 Oct 2025 11:40:22 +0200 Subject: [PATCH] Facturas de cliente --- .../src/web/components/editor/index.ts | 2 +- ...ce-edit-form.tsx => invoice-edit-form.tsx} | 15 +- .../web/components/editor/items/item-row.tsx | 11 +- .../create-customer-invoice-edit-form.tsx | 2 +- .../web/pages/update/invoice-update-comp.tsx | 4 +- modules/customers/src/web/customer-routes.tsx | 5 +- .../src/components/form/TextAreaField.tsx | 2 +- .../rdx-ui/src/components/form/TextField.tsx | 2 +- .../date-input-field.tsx | 87 ++++++ .../date-picker-input-comp.tsx | 270 ++++++++---------- .../date-picker-input-field.tsx | 6 +- .../date-popover-calendar.tsx | 76 +++++ pnpm-lock.yaml | 26 +- 13 files changed, 317 insertions(+), 191 deletions(-) rename modules/customer-invoices/src/web/components/editor/{customer-invoice-edit-form.tsx => invoice-edit-form.tsx} (80%) create mode 100644 packages/rdx-ui/src/components/form/date-picker-input-field/date-input-field.tsx create mode 100644 packages/rdx-ui/src/components/form/date-picker-input-field/date-popover-calendar.tsx diff --git a/modules/customer-invoices/src/web/components/editor/index.ts b/modules/customer-invoices/src/web/components/editor/index.ts index 5d3f91b4..77413531 100644 --- a/modules/customer-invoices/src/web/components/editor/index.ts +++ b/modules/customer-invoices/src/web/components/editor/index.ts @@ -1 +1 @@ -export * from "./customer-invoice-edit-form"; +export * from "./invoice-edit-form"; diff --git a/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx b/modules/customer-invoices/src/web/components/editor/invoice-edit-form.tsx similarity index 80% rename from modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx rename to modules/customer-invoices/src/web/components/editor/invoice-edit-form.tsx index f2110a34..e92671b7 100644 --- a/modules/customer-invoices/src/web/components/editor/customer-invoice-edit-form.tsx +++ b/modules/customer-invoices/src/web/components/editor/invoice-edit-form.tsx @@ -1,5 +1,6 @@ import { FieldErrors, useFormContext } from "react-hook-form"; +import { FormDebug } from '@erp/core/components'; import { cn } from '@repo/shadcn-ui/lib/utils'; import { InvoiceFormData } from "../../schemas"; import { InvoiceBasicInfoFields } from "./invoice-basic-info-fields"; @@ -14,7 +15,7 @@ interface CustomerInvoiceFormProps { className: string; } -export const CustomerInvoiceEditForm = ({ +export const InvoiceEditForm = ({ formId, onSubmit, onError, @@ -27,18 +28,18 @@ export const CustomerInvoiceEditForm = ({
+
-
- - - - +
+
- +
+ +
diff --git a/modules/customer-invoices/src/web/components/editor/items/item-row.tsx b/modules/customer-invoices/src/web/components/editor/items/item-row.tsx index 18ea16c6..32f9b4f0 100644 --- a/modules/customer-invoices/src/web/components/editor/items/item-row.tsx +++ b/modules/customer-invoices/src/web/components/editor/items/item-row.tsx @@ -1,7 +1,7 @@ import { Button, Checkbox, TableCell, TableRow, Tooltip, TooltipContent, TooltipTrigger } from "@repo/shadcn-ui/components"; import { cn } from '@repo/shadcn-ui/lib/utils'; import { ArrowDownIcon, ArrowUpIcon, CopyIcon, Trash2Icon } from "lucide-react"; -import { Control, Controller } from "react-hook-form"; +import { Control, Controller, FieldValues } from "react-hook-form"; import { useInvoiceContext } from '../../../context'; import { useTranslation } from '../../../i18n'; import { CustomerInvoiceTaxesMultiSelect } from '../../customer-invoice-taxes-multi-select'; @@ -10,9 +10,9 @@ import { HoverCardTotalsSummary } from './hover-card-total-summary'; import { PercentageInputField } from './percentage-input-field'; import { QuantityInputField } from './quantity-input-field'; -export type ItemRowProps = { +export type ItemRowProps = { - control: Control, + control: Control, rowIndex: number; isSelected: boolean; isFirst: boolean; @@ -26,8 +26,7 @@ export type ItemRowProps = { } -export const ItemRow = ({ - +export const ItemRow = ({ control, rowIndex, isSelected, @@ -38,7 +37,7 @@ export const ItemRow = ({ onDuplicate, onMoveUp, onMoveDown, - onRemove, }: ItemRowProps) => { + onRemove, }: ItemRowProps) => { const { t } = useTranslation(); const { currency_code, language_code } = useInvoiceContext(); diff --git a/modules/customer-invoices/src/web/pages/create/create-customer-invoice-edit-form.tsx b/modules/customer-invoices/src/web/pages/create/create-customer-invoice-edit-form.tsx index 25401c35..0ada8c00 100644 --- a/modules/customer-invoices/src/web/pages/create/create-customer-invoice-edit-form.tsx +++ b/modules/customer-invoices/src/web/pages/create/create-customer-invoice-edit-form.tsx @@ -5,7 +5,7 @@ import * as z from "zod"; import { CustomerModalSelector } from "@erp/customers/components"; import { DevTool } from "@hookform/devtools"; -import { DatePickerInputField, TextAreaField, TextField } from "@repo/rdx-ui/components"; +import { TextAreaField, TextField } from "@repo/rdx-ui/components"; import { Button, Calendar, 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 e0f185eb..afb3f216 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 @@ -10,7 +10,7 @@ import { useMemo } from 'react'; import { FieldErrors, FormProvider } from "react-hook-form"; import { useNavigate } from "react-router-dom"; import { - CustomerInvoiceEditForm, + InvoiceEditForm, PageHeader } from "../../components"; import { useInvoiceContext } from '../../context'; @@ -104,7 +104,7 @@ export const InvoiceUpdateComp = ({ - @@ -22,11 +21,11 @@ export const CustomerRoutes = (params: ModuleClientParams): RouteObject[] => { ), children: [ - { path: "", index: true, element: }, // index + /*{ path: "", index: true, element: }, // index { path: "list", element: }, { path: "create", element: }, { path: ":id", element: }, - { path: ":id/edit", element: }, + { path: ":id/edit", element: },*/ // /*{ path: "create", element: }, diff --git a/packages/rdx-ui/src/components/form/TextAreaField.tsx b/packages/rdx-ui/src/components/form/TextAreaField.tsx index 0b280517..af775de7 100644 --- a/packages/rdx-ui/src/components/form/TextAreaField.tsx +++ b/packages/rdx-ui/src/components/form/TextAreaField.tsx @@ -48,7 +48,7 @@ export function TextAreaField({ name={name} render={({ field, fieldState }) => { return ( - + {label && {label}}