From a5af168e6b0b0903a49d87f70c60345543cf8f7e Mon Sep 17 00:00:00 2001 From: david Date: Tue, 8 Jul 2025 20:50:08 +0200 Subject: [PATCH] Facturas de cliente --- .../src/common/locales/en.json | 19 +- .../src/common/locales/es.json | 19 +- .../buttons/append-block-row-button.tsx | 23 -- .../append-catalog-article-row-button.tsx | 26 -- .../buttons/append-empty-row-button.tsx | 23 +- .../src/web/components/buttons/index.ts | 2 - .../customer-invoice-items-card-editor.tsx | 32 +- ...voice-items-sortable-datatable-toolbar.tsx | 32 +- ...tomer-invoice-items-sortable-datatable.tsx | 20 +- modules/customer-invoices/src/web/globals.css | 2 + .../create/customer-invoice-edit-form.tsx | 274 +++--------------- modules/customers/src/web/globals.css | 2 + packages/rdx-ui/package.json | 8 +- .../src/components/form/DatePickerField.tsx | 89 ++++++ packages/rdx-ui/src/components/form/index.tsx | 1 + packages/rdx-ui/src/components/index.tsx | 1 + packages/rdx-ui/src/index.ts | 1 + packages/rdx-ui/src/locales/en.json | 3 + packages/rdx-ui/src/locales/es.json | 3 + packages/rdx-ui/src/locales/i18n.ts | 14 + packages/rdx-ui/src/styles/globals.css | 1 + packages/shadcn-ui/src/styles/globals.css | 231 +++++++-------- pnpm-lock.yaml | 13 +- 23 files changed, 335 insertions(+), 504 deletions(-) delete mode 100644 modules/customer-invoices/src/web/components/buttons/append-block-row-button.tsx delete mode 100644 modules/customer-invoices/src/web/components/buttons/append-catalog-article-row-button.tsx create mode 100644 packages/rdx-ui/src/components/form/DatePickerField.tsx create mode 100644 packages/rdx-ui/src/components/form/index.tsx create mode 100644 packages/rdx-ui/src/locales/i18n.ts diff --git a/modules/customer-invoices/src/common/locales/en.json b/modules/customer-invoices/src/common/locales/en.json index f953e57b..963789b8 100644 --- a/modules/customer-invoices/src/common/locales/en.json +++ b/modules/customer-invoices/src/common/locales/en.json @@ -1,5 +1,12 @@ { - "common": {}, + "common": { + "append_empty_row": "Append row", + "append_empty_row_tooltip": "Append a empty row", + "duplicate_row": "Duplicate", + "insert_row_above": "Insert row above", + "insert_row_below": "Insert row below", + "remove_row": "Remove" + }, "pages": { "title": "Customer invoices", "description": "Manage your customer invoices", @@ -45,6 +52,16 @@ "placeholder": "", "description": "" }, + "issue_date": { + "label": "Date", + "placeholder": "Select a date", + "description": "Invoice issue date" + }, + "operation_date": { + "label": "Operation date", + "placeholder": "Select a date", + "description": "Invoice operation date" + }, "items": { "quantity": { "label": "Quantity", diff --git a/modules/customer-invoices/src/common/locales/es.json b/modules/customer-invoices/src/common/locales/es.json index 79bc9713..a420c33e 100644 --- a/modules/customer-invoices/src/common/locales/es.json +++ b/modules/customer-invoices/src/common/locales/es.json @@ -1,5 +1,12 @@ { - "common": {}, + "common": { + "append_empty_row": "Añadir fila", + "append_empty_row_tooltip": "Añadir una fila vacía", + "duplicate_row": "Duplicar fila", + "insert_row_above": "Insertar fila encima", + "insert_row_below": "Insertar fila debajo", + "remove_row": "Eliminar" + }, "pages": { "title": "Facturas", "description": "Gestiona tus facturas", @@ -45,6 +52,16 @@ "placeholder": "", "description": "" }, + "issue_date": { + "label": "Fecha", + "placeholder": "Seleccionar una fecha", + "description": "Fecha de emisión de la factura" + }, + "operation_date": { + "label": "Intervención", + "placeholder": "Seleccionar una fecha", + "description": "Fecha de intervención de los trabajos" + }, "items": { "quantity": { "label": "Cantidad", diff --git a/modules/customer-invoices/src/web/components/buttons/append-block-row-button.tsx b/modules/customer-invoices/src/web/components/buttons/append-block-row-button.tsx deleted file mode 100644 index e73ef1ff..00000000 --- a/modules/customer-invoices/src/web/components/buttons/append-block-row-button.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Button } from "@repo/shadcn-ui/components"; -import { t } from "i18next"; -import { PackagePlusIcon } from "lucide-react"; -import { JSX, forwardRef } from "react"; - -export interface AppendBlockRowButtonProps extends React.ComponentProps { - label?: string; -} - -export const AppendBlockRowButton = forwardRef( - ( - { label = t("common.append_block"), className, ...props }: AppendBlockRowButtonProps, - ref - ): JSX.Element => ( - - ) -); - -AppendBlockRowButton.displayName = "AppendBlockRowButton"; diff --git a/modules/customer-invoices/src/web/components/buttons/append-catalog-article-row-button.tsx b/modules/customer-invoices/src/web/components/buttons/append-catalog-article-row-button.tsx deleted file mode 100644 index 763016ff..00000000 --- a/modules/customer-invoices/src/web/components/buttons/append-catalog-article-row-button.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Button } from "@repo/shadcn-ui/components"; -import { t } from "i18next"; -import { PackagePlusIcon } from "lucide-react"; -import { JSX, forwardRef } from "react"; - -export interface AppendCatalogArticleRowButtonProps extends React.ComponentProps { - label?: string; -} - -export const AppendCatalogArticleRowButton = forwardRef< - HTMLButtonElement, - AppendCatalogArticleRowButtonProps ->( - ( - { label = t("common.append_article"), className, ...props }: AppendCatalogArticleRowButtonProps, - ref - ): JSX.Element => ( - - ) -); - -AppendCatalogArticleRowButton.displayName = "AppendCatalogArticleRowButton"; diff --git a/modules/customer-invoices/src/web/components/buttons/append-empty-row-button.tsx b/modules/customer-invoices/src/web/components/buttons/append-empty-row-button.tsx index 1ed526a1..dd71d00b 100644 --- a/modules/customer-invoices/src/web/components/buttons/append-empty-row-button.tsx +++ b/modules/customer-invoices/src/web/components/buttons/append-empty-row-button.tsx @@ -1,7 +1,8 @@ import { Button } from "@repo/shadcn-ui/components"; -import { t } from "i18next"; import { PlusCircleIcon } from "lucide-react"; import { JSX, forwardRef } from "react"; +import { useTranslation } from "react-i18next"; +import { MODULE_NAME } from "../../manifest"; export interface AppendEmptyRowButtonProps extends React.ComponentProps { label?: string; @@ -9,15 +10,17 @@ export interface AppendEmptyRowButtonProps extends React.ComponentProps( - ( - { label = t("common.append_empty_row"), className, ...props }: AppendEmptyRowButtonProps, - ref - ): JSX.Element => ( - - ) + ({ label, className, ...props }: AppendEmptyRowButtonProps, ref): JSX.Element => { + const { t } = useTranslation(MODULE_NAME); + const _label = label || t("common.append_empty_row"); + + return ( + + ); + } ); AppendEmptyRowButton.displayName = "AppendEmptyRowButton"; diff --git a/modules/customer-invoices/src/web/components/buttons/index.ts b/modules/customer-invoices/src/web/components/buttons/index.ts index f09f7446..e5658673 100644 --- a/modules/customer-invoices/src/web/components/buttons/index.ts +++ b/modules/customer-invoices/src/web/components/buttons/index.ts @@ -1,3 +1 @@ -export * from "./append-block-row-button"; -export * from "./append-catalog-article-row-button"; export * from "./append-empty-row-button"; diff --git a/modules/customer-invoices/src/web/components/items/customer-invoice-items-card-editor.tsx b/modules/customer-invoices/src/web/components/items/customer-invoice-items-card-editor.tsx index 3b5f62bc..78fad8fc 100644 --- a/modules/customer-invoices/src/web/components/items/customer-invoice-items-card-editor.tsx +++ b/modules/customer-invoices/src/web/components/items/customer-invoice-items-card-editor.tsx @@ -76,7 +76,7 @@ export const CustomerInvoiceItemsCardEditor = ({ { id: "description" as const, accessorKey: "description", - header: t("customer_invoices.form_fields.description.label"), + header: t("form_fields.items.description.label"), cell: ({ row: { index, original } }) => (