Facturas de cliente y Veri*Factu
This commit is contained in:
parent
0f4619dd06
commit
50dd4103b2
@ -20,7 +20,7 @@ Este módulo es para **facturas de cliente (Customer Invoices)** y debe cumplir
|
||||
|
||||
La entidad `CustomerInvoice` tendrá:
|
||||
- `id`: UUID (ValueObject `UniqueID`)
|
||||
- `status`: string (ValueObject) (`Draft`, `Emitted`, `Sent`, `Rejected`)
|
||||
- `status`: string (ValueObject) (`Draft`, `Issued`, `Sent`, `Rejected`)
|
||||
- `invoiceNumber`: string (ValueObject )
|
||||
- `invoiceSeries`: string (ValueObject )
|
||||
- `customerId`: UUID (ValueObject)
|
||||
|
||||
@ -282,7 +282,7 @@ export class CustomerInvoice
|
||||
return CustomerInvoice.create(
|
||||
{
|
||||
...this.props,
|
||||
status: CustomerInvoiceStatus.createEmitted(),
|
||||
status: CustomerInvoiceStatus.createIssued(),
|
||||
isProforma: false,
|
||||
invoiceNumber: Maybe.some(newInvoiceNumber),
|
||||
},
|
||||
|
||||
@ -10,17 +10,17 @@ export enum INVOICE_STATUS {
|
||||
SENT = "sent", // <- Proforma
|
||||
APPROVED = "approved", // <- Proforma
|
||||
REJECTED = "rejected", // <- Proforma
|
||||
EMITTED = "emitted", // <- Factura y enviada a Veri*Factu
|
||||
ISSUED = "issued", // <- Factura y enviada a Veri*Factu
|
||||
}
|
||||
export class CustomerInvoiceStatus extends ValueObject<ICustomerInvoiceStatusProps> {
|
||||
private static readonly ALLOWED_STATUSES = ["draft", "sent", "approved", "rejected", "emitted"];
|
||||
private static readonly ALLOWED_STATUSES = ["draft", "sent", "approved", "rejected", "issued"];
|
||||
private static readonly FIELD = "invoiceStatus";
|
||||
private static readonly ERROR_CODE = "INVALID_INVOICE_STATUS";
|
||||
|
||||
private static readonly TRANSITIONS: Record<string, string[]> = {
|
||||
draft: [INVOICE_STATUS.SENT],
|
||||
sent: [INVOICE_STATUS.APPROVED, INVOICE_STATUS.REJECTED],
|
||||
approved: [INVOICE_STATUS.EMITTED],
|
||||
approved: [INVOICE_STATUS.ISSUED],
|
||||
rejected: [INVOICE_STATUS.DRAFT],
|
||||
};
|
||||
|
||||
@ -41,8 +41,8 @@ export class CustomerInvoiceStatus extends ValueObject<ICustomerInvoiceStatusPro
|
||||
? CustomerInvoiceStatus.createRejected()
|
||||
: value === "sent"
|
||||
? CustomerInvoiceStatus.createSent()
|
||||
: value === "emitted"
|
||||
? CustomerInvoiceStatus.createEmitted()
|
||||
: value === "issued"
|
||||
? CustomerInvoiceStatus.createIssued()
|
||||
: value === "approved"
|
||||
? CustomerInvoiceStatus.createApproved()
|
||||
: CustomerInvoiceStatus.createDraft()
|
||||
@ -53,8 +53,8 @@ export class CustomerInvoiceStatus extends ValueObject<ICustomerInvoiceStatusPro
|
||||
return new CustomerInvoiceStatus({ value: INVOICE_STATUS.DRAFT });
|
||||
}
|
||||
|
||||
public static createEmitted(): CustomerInvoiceStatus {
|
||||
return new CustomerInvoiceStatus({ value: INVOICE_STATUS.EMITTED });
|
||||
public static createIssued(): CustomerInvoiceStatus {
|
||||
return new CustomerInvoiceStatus({ value: INVOICE_STATUS.ISSUED });
|
||||
}
|
||||
|
||||
public static createSent(): CustomerInvoiceStatus {
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
"catalog": {
|
||||
"status": {
|
||||
"draft": "Draft",
|
||||
"emitted": "Emitted",
|
||||
"issued": "Issued",
|
||||
"sent": "Sent",
|
||||
"received": "Received",
|
||||
"rejected": "Rejected"
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
"catalog": {
|
||||
"status": {
|
||||
"draft": "Borrador",
|
||||
"emitted": "Emitida",
|
||||
"issued": "Emitida",
|
||||
"sent": "Enviada",
|
||||
"received": "Recibida",
|
||||
"rejected": "Rechazada"
|
||||
|
||||
@ -3,7 +3,7 @@ import { cn } from "@repo/shadcn-ui/lib/utils";
|
||||
import { forwardRef } from "react";
|
||||
import { useTranslation } from "../i18n";
|
||||
|
||||
export type CustomerInvoiceStatus = "draft" | "emitted" | "sent" | "received" | "rejected";
|
||||
export type CustomerInvoiceStatus = "draft" | "issued" | "sent" | "received" | "rejected";
|
||||
|
||||
export type CustomerInvoiceStatusBadgeProps = {
|
||||
status: string; // permitir cualquier valor
|
||||
@ -16,7 +16,7 @@ const statusColorConfig: Record<CustomerInvoiceStatus, { badge: string; dot: str
|
||||
"bg-gray-600/10 dark:bg-gray-600/20 hover:bg-gray-600/10 text-gray-500 border-gray-600/60",
|
||||
dot: "bg-gray-500",
|
||||
},
|
||||
emitted: {
|
||||
issued: {
|
||||
badge:
|
||||
"bg-amber-600/10 dark:bg-amber-600/20 hover:bg-amber-600/10 text-amber-500 border-amber-600/60",
|
||||
dot: "bg-amber-500",
|
||||
|
||||
@ -34,7 +34,7 @@ export class VerifactuRecordEstado extends ValueObject<IVerifactuRecordEstadoPro
|
||||
private static readonly TRANSITIONS: Record<string, string[]> = {
|
||||
draft: [INVOICE_STATUS.SENT],
|
||||
sent: [INVOICE_STATUS.APPROVED, INVOICE_STATUS.REJECTED],
|
||||
approved: [INVOICE_STATUS.EMITTED],
|
||||
approved: [INVOICE_STATUS.ISSUED],
|
||||
rejected: [INVOICE_STATUS.DRAFT],
|
||||
};
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user