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