Compare commits

..

No commits in common. "6004578d6d38b65045355e077c38b4396f862cc9" and "132408ac236b523a31df0c9ae489de9dd870a4d8" have entirely different histories.

9 changed files with 40 additions and 18 deletions

View File

@ -153,7 +153,6 @@ export class ProformaRepository
where: {
id: id.toString(),
company_id: companyId.toString(),
is_proforma: true,
...(options.where ?? {}),
},
transaction,
@ -278,7 +277,7 @@ export class ProformaRepository
where: {
...(options.where ?? {}),
id: id.toString(),
is_proforma: true,
is_proforma: false,
company_id: companyId.toString(),
},
order: [

View File

@ -1 +0,0 @@
export * from "./proforma-status-ui";

View File

@ -11,15 +11,19 @@ import {
import { useState } from "react";
import { useTranslation } from "../../../i18n";
import { PROFORMA_STATUS, PROFORMA_STATUS_TRANSITIONS, type ProformaListRow } from "../../shared";
import { getProformaStatusIcon } from "../helpers";
import {
PROFORMA_STATUS,
PROFORMA_STATUS_TRANSITIONS,
type ProformaSummaryData,
getProformaStatusIcon,
} from "../../types";
import { StatusNode, TimelineConnector } from "./components";
interface ChangeStatusDialogProps {
open: boolean;
onOpenChange: (open: boolean) => void;
proformas: ProformaListRow[];
proformas: ProformaSummaryData[];
targetStatus?: string;
isSubmitting: boolean;
onConfirm: (status: PROFORMA_STATUS) => void;

View File

@ -4,7 +4,7 @@ import { cn } from "@repo/shadcn-ui/lib/utils";
import { CheckCircle2, type LucideIcon } from "lucide-react";
import { useTranslation } from "../../../../i18n";
import type { PROFORMA_STATUS } from "../../../shared";
import type { PROFORMA_STATUS } from "../../../types";
interface StatusNodeProps {
status: PROFORMA_STATUS;

View File

@ -7,8 +7,6 @@ import {
XCircleIcon,
} from "lucide-react";
import type { ProformaStatus } from "../../shared";
export const getProformaStatusButtonVariant = (
status: ProformaStatus
): "default" | "secondary" | "outline" | "destructive" => {

View File

@ -0,0 +1,25 @@
import type { ProformaSummary, ProformaSummaryPage } from "./proforma.api.schema";
export type ProformaSummaryData = ProformaSummary & {
subtotal_amount_fmt: string;
subtotal_amount: number;
discount_percentage_fmt: string;
discount_percentage: number;
discount_amount_fmt: string;
discount_amount: number;
taxable_amount_fmt: string;
taxable_amount: number;
taxes_amount_fmt: string;
taxes_amount: number;
total_amount_fmt: string;
total_amount: number;
};
export type ProformaSummaryPageData = ProformaSummaryPage & {
items: ProformaSummaryData[];
};

View File

@ -28,7 +28,7 @@ export const CreateProformaFromFactugesRequestSchema = z.object({
//id: z.uuid(),
series: z.string(),
series: z.string().default(""),
//invoice_number: z.string(),
reference: z.string().default(""),
@ -63,11 +63,11 @@ export const CreateProformaFromFactugesRequestSchema = z.object({
website: z.string(),
}),
global_discount_percentage_value: NumericStringSchema,
global_discount_percentage_value: NumericStringSchema.default(""),
payment_method: z.string().default(""),
items: z.array(CreateProformaItemFromFactugesRequestSchema),
items: z.array(CreateProformaItemFromFactugesRequestSchema).default([]),
});
export type CreateProformaFromFactugesRequestDTO = z.infer<
typeof CreateProformaFromFactugesRequestSchema

View File

@ -7,13 +7,10 @@ import { MoneyValue, Percentage, Quantity } from "../value-objects";
/** any | null | undefined -> Maybe<T> usando validación */
export function maybeFromNullableResult<T, S>(
input: S,
validate: (raw: NonNullable<S>) => Result<T>
validate: (raw: S) => Result<T>
): Result<Maybe<T>> {
if (isNullishOrEmpty(input)) {
return Result.ok(Maybe.none<T>());
}
const value = validate(input as NonNullable<S>);
if (isNullishOrEmpty(input)) return Result.ok(Maybe.none<T>());
const value = validate(input);
return value.isSuccess ? Result.ok(Maybe.some(value.data)) : Result.fail(value.error);
}