From 700445499bf7735b1888852b8c7481b4fe2eb12e Mon Sep 17 00:00:00 2001 From: david Date: Thu, 19 Mar 2026 19:10:52 +0100 Subject: [PATCH] . --- .../proformas/di/proforma-use-cases.di.ts | 8 +-- .../application/proformas/use-cases/index.ts | 2 +- .../proformas/express/proformas.routes.ts | 5 +- ...elize-proforma-number-generator.service.ts | 6 +-- .../use-proforma-grid-columns.tsx | 2 + .../list/ui/pages/proforma-list-page.tsx | 8 +-- modules/customers/src/common/locales/en.json | 8 ++- modules/customers/src/common/locales/es.json | 15 +----- .../editor/customer-basic-info-fields.tsx | 19 +++++-- .../components/editor/customer-edit-form.tsx | 2 + .../use-customer-grid-columns.tsx | 50 ++++++++++++++++--- .../web/list/ui/components/address-cell.tsx | 23 +++++++-- .../web/list/ui/components/contact-cell.tsx | 41 +++++++++++++-- packages/shadcn-ui/package.json | 2 +- packages/shadcn-ui/src/styles/globals.css | 6 +-- pnpm-lock.yaml | 8 +-- 16 files changed, 148 insertions(+), 57 deletions(-) diff --git a/modules/customer-invoices/src/api/application/proformas/di/proforma-use-cases.di.ts b/modules/customer-invoices/src/api/application/proformas/di/proforma-use-cases.di.ts index 1601c96d..26678db8 100644 --- a/modules/customer-invoices/src/api/application/proformas/di/proforma-use-cases.di.ts +++ b/modules/customer-invoices/src/api/application/proformas/di/proforma-use-cases.di.ts @@ -13,6 +13,7 @@ import type { import type { IProformaFullSnapshotBuilder } from "../snapshot-builders/full"; import { GetProformaByIdUseCase, ListProformasUseCase, ReportProformaUseCase } from "../use-cases"; import { CreateProformaUseCase } from "../use-cases/create-proforma"; +import { IssueProformaUseCase } from "../use-cases/issue-proforma.use-case"; export function buildGetProformaByIdUseCase(deps: { finder: IProformaFinder; @@ -64,6 +65,10 @@ export function buildCreateProformaUseCase(deps: { }); } +export function buildIssueProformaUseCase(deps: { finder: IProformaFinder }) { + return new IssueProformaUseCase(deps.finder); +} + /*export function buildUpdateProformaUseCase(deps: { finder: IProformaFinder; fullSnapshotBuilder: IProformaFullSnapshotBuilder; @@ -75,9 +80,6 @@ export function buildDeleteProformaUseCase(deps: { finder: IProformaFinder }) { return new DeleteProformaUseCase(deps.finder); } -export function buildIssueProformaUseCase(deps: { finder: IProformaFinder }) { - return new IssueProformaUseCase(deps.finder); -} export function buildChangeStatusProformaUseCase(deps: { finder: IProformaFinder; diff --git a/modules/customer-invoices/src/api/application/proformas/use-cases/index.ts b/modules/customer-invoices/src/api/application/proformas/use-cases/index.ts index 5560787a..6107e7cf 100644 --- a/modules/customer-invoices/src/api/application/proformas/use-cases/index.ts +++ b/modules/customer-invoices/src/api/application/proformas/use-cases/index.ts @@ -2,7 +2,7 @@ export * from "./create-proforma"; //export * from "./delete-proforma.use-case"; export * from "./get-proforma-by-id.use-case"; -//export * from "./issue-proforma.use-case"; +export * from "./issue-proforma.use-case"; export * from "./list-proformas.use-case"; export * from "./report-proforma.use-case"; //export * from "./update-proforma"; diff --git a/modules/customer-invoices/src/api/infrastructure/proformas/express/proformas.routes.ts b/modules/customer-invoices/src/api/infrastructure/proformas/express/proformas.routes.ts index a5e601e7..48896163 100644 --- a/modules/customer-invoices/src/api/infrastructure/proformas/express/proformas.routes.ts +++ b/modules/customer-invoices/src/api/infrastructure/proformas/express/proformas.routes.ts @@ -12,6 +12,7 @@ import { import { CreateProformaRequestSchema, GetProformaByIdRequestSchema, + IssueProformaByIdParamsRequestSchema, ListProformasRequestSchema, ReportProformaByIdParamsRequestSchema, ReportProformaByIdQueryRequestSchema, @@ -129,7 +130,7 @@ export const proformasRouter = (params: ModuleParams, deps: ProformasInternalDep const controller = new ChangeStatusProformaController(useCase); return controller.execute(req, res, next); } - ); + );*/ router.put( "/:proforma_id/issue", @@ -142,7 +143,7 @@ export const proformasRouter = (params: ModuleParams, deps: ProformasInternalDep const controller = new IssuedProformaController(useCase); return controller.execute(req, res, next); } - );*/ + ); app.use(`${config.server.apiBasePath}/proformas`, router); }; diff --git a/modules/customer-invoices/src/api/infrastructure/proformas/persistence/sequelize/services/sequelize-proforma-number-generator.service.ts b/modules/customer-invoices/src/api/infrastructure/proformas/persistence/sequelize/services/sequelize-proforma-number-generator.service.ts index e081bd71..d109cf9e 100644 --- a/modules/customer-invoices/src/api/infrastructure/proformas/persistence/sequelize/services/sequelize-proforma-number-generator.service.ts +++ b/modules/customer-invoices/src/api/infrastructure/proformas/persistence/sequelize/services/sequelize-proforma-number-generator.service.ts @@ -17,7 +17,7 @@ export class SequelizeProformaNumberGenerator implements IProformaNumberGenerato ): Promise> { const where: WhereOptions = { company_id: companyId.toString(), - is_proforma: false, + is_proforma: true, }; series.match( @@ -41,12 +41,12 @@ export class SequelizeProformaNumberGenerator implements IProformaNumberGenerato lock: transaction.LOCK.UPDATE, // requiere InnoDB y TX abierta }); - let nextValue = "001"; // valor inicial por defecto + let nextValue = "0001"; // valor inicial por defecto if (lastInvoice) { const current = Number(lastInvoice.invoice_number); const next = Number.isFinite(current) && current > 0 ? current + 1 : 1; - nextValue = String(next).padStart(3, "0"); + nextValue = String(next).padStart(4, "0"); } const numberResult = InvoiceNumber.create(nextValue); diff --git a/modules/customer-invoices/src/web/proformas/list/ui/blocks/proformas-grid/use-proforma-grid-columns.tsx b/modules/customer-invoices/src/web/proformas/list/ui/blocks/proformas-grid/use-proforma-grid-columns.tsx index d3fc9de5..1287a0ca 100644 --- a/modules/customer-invoices/src/web/proformas/list/ui/blocks/proformas-grid/use-proforma-grid-columns.tsx +++ b/modules/customer-invoices/src/web/proformas/list/ui/blocks/proformas-grid/use-proforma-grid-columns.tsx @@ -226,6 +226,8 @@ export function useProformasGridColumns( const availableTransitions = PROFORMA_STATUS_TRANSITIONS[proforma.status as ProformaStatus] ?? []; + console.log(availableTransitions); + return (
{!isIssued && actionHandlers.onEditClick && ( diff --git a/modules/customer-invoices/src/web/proformas/list/ui/pages/proforma-list-page.tsx b/modules/customer-invoices/src/web/proformas/list/ui/pages/proforma-list-page.tsx index e1a371c2..359ffe13 100644 --- a/modules/customer-invoices/src/web/proformas/list/ui/pages/proforma-list-page.tsx +++ b/modules/customer-invoices/src/web/proformas/list/ui/pages/proforma-list-page.tsx @@ -36,10 +36,10 @@ export const ProformaListPage = () => { } = useProformaListPageController(); const columns = useProformasGridColumns({ - //onEditClick: (proforma) => navigate(`/proformas/${proforma.id}/edit`), - //onIssueClick: handleIssueProforma, - //onDeleteClick: handleDeleteProforma, - //onChangeStatusClick: handleChangeStatusProforma, + onEditClick: (proforma) => navigate(`/proformas/${proforma.id}/edit`), + onIssueClick: handleIssueProforma, + onDeleteClick: handleDeleteProforma, + onChangeStatusClick: handleChangeStatusProforma, }); if (listCtrl.isError || !listCtrl.data) { diff --git a/modules/customers/src/common/locales/en.json b/modules/customers/src/common/locales/en.json index f11267a0..bf0e0bc5 100644 --- a/modules/customers/src/common/locales/en.json +++ b/modules/customers/src/common/locales/en.json @@ -80,8 +80,8 @@ "description": "The street address of the customer" }, "street2": { - "label": "Street", - "placeholder": "Enter street", + "label": "Street 2", + "placeholder": "Enter street 2", "description": "The street address of the customer" }, "city": { @@ -114,7 +114,6 @@ "placeholder": "Enter secondary email", "description": "The secondary email address of the customer" }, - "phone_primary": { "label": "Primary phone", "placeholder": "Enter primary phone number", @@ -125,7 +124,6 @@ "placeholder": "Enter secondary phone number ", "description": "The secondary phone number of the customer" }, - "mobile_primary": { "label": "Primary mobile", "placeholder": "Enter primary mobile number", @@ -196,4 +194,4 @@ "create_label": "Create new item" } } -} +} \ No newline at end of file diff --git a/modules/customers/src/common/locales/es.json b/modules/customers/src/common/locales/es.json index 9a6db22d..d6c9ff25 100644 --- a/modules/customers/src/common/locales/es.json +++ b/modules/customers/src/common/locales/es.json @@ -82,7 +82,7 @@ "description": "La dirección de la calle del cliente" }, "street2": { - "label": "Calle", + "label": "Calle (ampliación)", "placeholder": "Ingrese la calle", "description": "La dirección de la calle del cliente" }, @@ -106,67 +106,56 @@ "placeholder": "Seleccione el país", "description": "El país del cliente" }, - "email_primary": { "label": "Email principal", "placeholder": "Ingrese el correo electrónico", "description": "La dirección de correo electrónico principal del cliente" }, - "email_secondary": { "label": "Email secundario", "placeholder": "Ingrese el correo electrónico", "description": "La dirección de correo electrónico secundario del clientºe" }, - "phone_primary": { "label": "Teléfono", "placeholder": "Ingrese el número de teléfono", "description": "El número de teléfono del cliente" }, - "phone_secondary": { "label": "Teléfono secundario", "placeholder": "Ingrese el número de teléfono secundario", "description": "El número de teléfono secundario del cliente" }, - "mobile_primary": { "label": "Teléfono", "placeholder": "Ingrese el número de teléfono", "description": "El número de teléfono del cliente" }, - "mobile_secondary": { "label": "Teléfono secundario", "placeholder": "Ingrese el número de teléfono secundario", "description": "El número de teléfono secundario del cliente" }, - "fax": { "label": "Fax", "placeholder": "Ingrese el número de fax", "description": "El número de fax del cliente" }, - "website": { "label": "Sitio web", "placeholder": "Ingrese la URL del sitio web", "description": "El sitio web del cliente" }, - "default_taxes": { "label": "Impuesto por defecto", "placeholder": "Seleccione el impuesto por defecto", "description": "La tasa de impuesto por defecto para el cliente" }, - "language_code": { "label": "Idioma", "placeholder": "Seleccione el idioma", "description": "El idioma preferido del cliente" }, - "currency_code": { "label": "Moneda", "placeholder": "Seleccione la moneda", @@ -207,4 +196,4 @@ "create_label": "Crear nuevo elemento" } } -} +} \ No newline at end of file diff --git a/modules/customers/src/web/components/editor/customer-basic-info-fields.tsx b/modules/customers/src/web/components/editor/customer-basic-info-fields.tsx index 89980e50..701588f9 100644 --- a/modules/customers/src/web/components/editor/customer-basic-info-fields.tsx +++ b/modules/customers/src/web/components/editor/customer-basic-info-fields.tsx @@ -55,7 +55,8 @@ export const CustomerBasicInfoFields = ({ required /> - + + + + + + ( - + {t("form_fields.default_taxes.label")} { return (
+
diff --git a/modules/customers/src/web/list/ui/blocks/customers-grid/use-customer-grid-columns.tsx b/modules/customers/src/web/list/ui/blocks/customers-grid/use-customer-grid-columns.tsx index fead1165..bec7d798 100644 --- a/modules/customers/src/web/list/ui/blocks/customers-grid/use-customer-grid-columns.tsx +++ b/modules/customers/src/web/list/ui/blocks/customers-grid/use-customer-grid-columns.tsx @@ -2,6 +2,7 @@ import { DataTableColumnHeader } from "@repo/rdx-ui/components"; import { Avatar, AvatarFallback, + Badge, Button, DropdownMenu, DropdownMenuContent, @@ -11,15 +12,12 @@ import { DropdownMenuTrigger, } from "@repo/shadcn-ui/components"; import type { ColumnDef } from "@tanstack/react-table"; -import { EyeIcon, MoreHorizontalIcon } from "lucide-react"; +import { Building2Icon, EyeIcon, MoreHorizontalIcon, UserIcon } from "lucide-react"; import * as React from "react"; import { useTranslation } from "../../../../i18n"; -import { CustomerStatusBadge } from "../../../../ui"; import type { CustomerSummaryData } from "../../../types"; import { AddressCell, ContactCell, Initials } from "../../components"; -import { KindBadge } from "../../components/kind-badge"; -import { Soft } from "../../components/soft"; type GridActionHandlers = { onEditClick?: (customer: CustomerSummaryData) => void; @@ -81,8 +79,48 @@ export function useCustomersGridColumns( const customer = row.original; const isCompany = String(customer.is_company).toLowerCase() === "true"; return ( +
+ + + + + +
+
+ {customer.name} + {customer.trade_name && ( + ({customer.trade_name}) + )} +
+
+ {customer.tin} + + {customer.is_company ? ( + <> + + Empresa + + ) : ( + <> + + Particular + + )} + +
+
+
+ ); + + /*return (
- + @@ -99,7 +137,7 @@ export function useCustomersGridColumns(
- ); + );*/ }, }, diff --git a/modules/customers/src/web/list/ui/components/address-cell.tsx b/modules/customers/src/web/list/ui/components/address-cell.tsx index 9125ed2a..74f5a4e6 100644 --- a/modules/customers/src/web/list/ui/components/address-cell.tsx +++ b/modules/customers/src/web/list/ui/components/address-cell.tsx @@ -1,15 +1,30 @@ -import type { CustomerSummaryData } from "../../types"; +import { MapPinIcon } from "lucide-react"; -import { Soft } from "./soft"; +import type { CustomerSummaryData } from "../../types"; export const AddressCell = ({ customer }: { customer: CustomerSummaryData }) => { const line1 = [customer.street, customer.street2].filter(Boolean).join(", "); const line2 = [customer.postal_code, customer.city].filter(Boolean).join(" "); const line3 = [customer.province, customer.country].filter(Boolean).join(", "); return ( +
+ +
+

{line1}

+

+ {line2} · {line3} +

+
+
+ ); +}; + +/* +
{line1 || -}
{[line2, line3].filter(Boolean).join(" • ")}
- ); -}; + + +*/ diff --git a/modules/customers/src/web/list/ui/components/contact-cell.tsx b/modules/customers/src/web/list/ui/components/contact-cell.tsx index ae8e8627..62d9533b 100644 --- a/modules/customers/src/web/list/ui/components/contact-cell.tsx +++ b/modules/customers/src/web/list/ui/components/contact-cell.tsx @@ -2,9 +2,42 @@ import { MailIcon, PhoneIcon } from "lucide-react"; import type { CustomerSummaryData } from "../../types"; -import { Soft } from "./soft"; - export const ContactCell = ({ customer }: { customer: CustomerSummaryData }) => ( +
+ + + {customer.email_primary} + + {customer.email_secondary && ( + + + {customer.email_secondary} + + )} + {customer.phone_primary ? ( + + + {customer.phone_primary} + + ) : ( + + - + + )} +
+); + +/* +
{customer.email_primary && (
@@ -31,4 +64,6 @@ export const ContactCell = ({ customer }: { customer: CustomerSummaryData }) =>
{false}
-); + + + */ diff --git a/packages/shadcn-ui/package.json b/packages/shadcn-ui/package.json index 0fdd1359..6baf8bd9 100644 --- a/packages/shadcn-ui/package.json +++ b/packages/shadcn-ui/package.json @@ -40,7 +40,7 @@ "typescript": "^5.6.0" }, "dependencies": { - "@fontsource-variable/geist": "^5.2.8", + "@fontsource-variable/inter": "^5.2.8", "@hookform/resolvers": "^5.2.2", "add": "^2.0.6", "class-variance-authority": "^0.7.1", diff --git a/packages/shadcn-ui/src/styles/globals.css b/packages/shadcn-ui/src/styles/globals.css index 453c7beb..a8874e98 100644 --- a/packages/shadcn-ui/src/styles/globals.css +++ b/packages/shadcn-ui/src/styles/globals.css @@ -1,6 +1,6 @@ @import "tailwindcss"; @import "tw-animate-css"; -@import "@fontsource-variable/geist"; +@import "@fontsource-variable/inter"; @custom-variant dark (&:is(.dark *)); @@ -98,7 +98,7 @@ @layer utilities { body { - font-family: "Geist Variable", ui-sans-serif, sans-serif, system-ui; + font-family: "Inter", ui-sans-serif, sans-serif, system-ui; } } @@ -111,7 +111,7 @@ **/ :root { - --font-sans: "Geist Variable", ui-sans-serif, sans-serif, system-ui; + --font-sans: "Inter", ui-sans-serif, sans-serif, system-ui; --background: oklch(1 0 0); --foreground: oklch(0.145 0 0); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 982f8181..f18c8d6c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -912,7 +912,7 @@ importers: packages/shadcn-ui: dependencies: - '@fontsource-variable/geist': + '@fontsource-variable/inter': specifier: ^5.2.8 version: 5.2.8 '@hookform/resolvers': @@ -1597,8 +1597,8 @@ packages: '@floating-ui/utils@0.2.10': resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==} - '@fontsource-variable/geist@5.2.8': - resolution: {integrity: sha512-cJ6m9e+8MQ5dCYJsLylfZrgBh6KkG4bOLckB35Tr9J/EqdkEM6QllH5PxqP1dhTvFup+HtMRPuz9xOjxXJggxw==} + '@fontsource-variable/inter@5.2.8': + resolution: {integrity: sha512-kOfP2D+ykbcX/P3IFnokOhVRNoTozo5/JxhAIVYLpea/UBmCQ/YWPBfWIDuBImXX/15KH+eKh4xpEUyS2sQQGQ==} '@hapi/hoek@9.3.0': resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==} @@ -7635,7 +7635,7 @@ snapshots: '@floating-ui/utils@0.2.10': {} - '@fontsource-variable/geist@5.2.8': {} + '@fontsource-variable/inter@5.2.8': {} '@hapi/hoek@9.3.0': {}