.
This commit is contained in:
parent
91212e8e90
commit
6004578d6d
@ -0,0 +1 @@
|
||||
export * from "./proforma-status-ui";
|
||||
@ -7,6 +7,8 @@ import {
|
||||
XCircleIcon,
|
||||
} from "lucide-react";
|
||||
|
||||
import type { ProformaStatus } from "../../shared";
|
||||
|
||||
export const getProformaStatusButtonVariant = (
|
||||
status: ProformaStatus
|
||||
): "default" | "secondary" | "outline" | "destructive" => {
|
||||
@ -11,19 +11,15 @@ import {
|
||||
import { useState } from "react";
|
||||
|
||||
import { useTranslation } from "../../../i18n";
|
||||
import {
|
||||
PROFORMA_STATUS,
|
||||
PROFORMA_STATUS_TRANSITIONS,
|
||||
type ProformaSummaryData,
|
||||
getProformaStatusIcon,
|
||||
} from "../../types";
|
||||
import { PROFORMA_STATUS, PROFORMA_STATUS_TRANSITIONS, type ProformaListRow } from "../../shared";
|
||||
import { getProformaStatusIcon } from "../helpers";
|
||||
|
||||
import { StatusNode, TimelineConnector } from "./components";
|
||||
|
||||
interface ChangeStatusDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
proformas: ProformaSummaryData[];
|
||||
proformas: ProformaListRow[];
|
||||
targetStatus?: string;
|
||||
isSubmitting: boolean;
|
||||
onConfirm: (status: PROFORMA_STATUS) => void;
|
||||
|
||||
@ -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 "../../../types";
|
||||
import type { PROFORMA_STATUS } from "../../../shared";
|
||||
|
||||
interface StatusNodeProps {
|
||||
status: PROFORMA_STATUS;
|
||||
|
||||
@ -1,25 +0,0 @@
|
||||
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[];
|
||||
};
|
||||
@ -28,7 +28,7 @@ export const CreateProformaFromFactugesRequestSchema = z.object({
|
||||
|
||||
//id: z.uuid(),
|
||||
|
||||
series: z.string().default(""),
|
||||
series: z.string(),
|
||||
//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.default(""),
|
||||
global_discount_percentage_value: NumericStringSchema,
|
||||
|
||||
payment_method: z.string().default(""),
|
||||
|
||||
items: z.array(CreateProformaItemFromFactugesRequestSchema).default([]),
|
||||
items: z.array(CreateProformaItemFromFactugesRequestSchema),
|
||||
});
|
||||
export type CreateProformaFromFactugesRequestDTO = z.infer<
|
||||
typeof CreateProformaFromFactugesRequestSchema
|
||||
|
||||
@ -7,10 +7,13 @@ import { MoneyValue, Percentage, Quantity } from "../value-objects";
|
||||
/** any | null | undefined -> Maybe<T> usando validación */
|
||||
export function maybeFromNullableResult<T, S>(
|
||||
input: S,
|
||||
validate: (raw: S) => Result<T>
|
||||
validate: (raw: NonNullable<S>) => Result<T>
|
||||
): Result<Maybe<T>> {
|
||||
if (isNullishOrEmpty(input)) return Result.ok(Maybe.none<T>());
|
||||
const value = validate(input);
|
||||
if (isNullishOrEmpty(input)) {
|
||||
return Result.ok(Maybe.none<T>());
|
||||
}
|
||||
|
||||
const value = validate(input as NonNullable<S>);
|
||||
return value.isSuccess ? Result.ok(Maybe.some(value.data)) : Result.fail(value.error);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user