Compare commits
No commits in common. "2a1d49d1c41a93c69ad522d54a0592af51d4b7e0" and "911fdbb1c3b0ad34039bb646cc77205f52c16bd5" have entirely different histories.
2a1d49d1c4
...
911fdbb1c3
@ -1,11 +1,8 @@
|
|||||||
import type { Name, TextValue, UniqueID } from "@repo/rdx-ddd";
|
|
||||||
import type { Maybe } from "@repo/rdx-utils";
|
|
||||||
|
|
||||||
export type PaymentMethodDetail = {
|
export type PaymentMethodDetail = {
|
||||||
id: UniqueID;
|
id: string;
|
||||||
companyId: UniqueID;
|
name: string;
|
||||||
name: Name;
|
type: string;
|
||||||
description: Maybe<TextValue>;
|
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
is_system: boolean;
|
created_at: string;
|
||||||
|
updated_at: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,23 +1,19 @@
|
|||||||
import type { GetPaymentMethodByIdResponseDTO } from "@erp/catalogs/common";
|
import type { GetPaymentMethodByIdResponseDTO } from "@erp/catalogs/common";
|
||||||
import type { ISnapshotBuilder } from "@erp/core/api";
|
import type { ISnapshotBuilder } from "@erp/core/api";
|
||||||
import { maybeToNullable } from "@repo/rdx-ddd";
|
import { toNullable } from "@repo/rdx-ddd";
|
||||||
|
|
||||||
import type { PaymentMethod } from "../../../../domain";
|
import type { PaymentMethod } from "../../../../domain";
|
||||||
|
|
||||||
export type PaymentMethodFullSnapshot = GetPaymentMethodByIdResponseDTO;
|
|
||||||
|
|
||||||
export interface IPaymentMethodFullSnapshotBuilder
|
export interface IPaymentMethodFullSnapshotBuilder
|
||||||
extends ISnapshotBuilder<PaymentMethod, PaymentMethodFullSnapshot> {}
|
extends ISnapshotBuilder<PaymentMethod, GetPaymentMethodByIdResponseDTO> {}
|
||||||
|
|
||||||
export class PaymentMethodFullSnapshotBuilder implements IPaymentMethodFullSnapshotBuilder {
|
export class PaymentMethodFullSnapshotBuilder implements IPaymentMethodFullSnapshotBuilder {
|
||||||
public toOutput(paymentMethod: PaymentMethod): PaymentMethodFullSnapshot {
|
public toOutput(paymentMethod: PaymentMethod): GetPaymentMethodByIdResponseDTO {
|
||||||
return {
|
return {
|
||||||
id: paymentMethod.id.toPrimitive(),
|
id: paymentMethod.id.toPrimitive(),
|
||||||
company_id: paymentMethod.companyId.toPrimitive(),
|
company_id: paymentMethod.companyId.toPrimitive(),
|
||||||
|
|
||||||
name: paymentMethod.name.toPrimitive(),
|
name: paymentMethod.name.toPrimitive(),
|
||||||
description: maybeToNullable(paymentMethod.description, (value) => value.toPrimitive()),
|
description: toNullable(paymentMethod.description, (value) => value.toPrimitive()),
|
||||||
|
|
||||||
is_active: paymentMethod.isActive,
|
is_active: paymentMethod.isActive,
|
||||||
is_system: paymentMethod.isSystem,
|
is_system: paymentMethod.isSystem,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -11,9 +11,7 @@ export class PaymentMethodSummarySnapshotBuilder implements IPaymentMethodSummar
|
|||||||
return {
|
return {
|
||||||
id: paymentMethod.id.toString(),
|
id: paymentMethod.id.toString(),
|
||||||
company_id: paymentMethod.companyId.toString(),
|
company_id: paymentMethod.companyId.toString(),
|
||||||
|
|
||||||
name: paymentMethod.name.toString(),
|
name: paymentMethod.name.toString(),
|
||||||
|
|
||||||
is_system: paymentMethod.isSystem,
|
is_system: paymentMethod.isSystem,
|
||||||
is_active: paymentMethod.isActive,
|
is_active: paymentMethod.isActive,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,3 +1,2 @@
|
|||||||
export * from "./request";
|
export * from "./request";
|
||||||
export * from "./response";
|
export * from "./response";
|
||||||
export * from "./shared";
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { SpainTaxCatalogProvider } from "@erp/core";
|
||||||
import { ErrorAlert, NotFoundCard, PageHeader } from "@erp/core/components";
|
import { ErrorAlert, NotFoundCard, PageHeader } from "@erp/core/components";
|
||||||
import {
|
import {
|
||||||
FormCommitButtonGroup,
|
FormCommitButtonGroup,
|
||||||
@ -6,6 +7,7 @@ import {
|
|||||||
} from "@erp/core/hooks";
|
} from "@erp/core/hooks";
|
||||||
import { SelectCustomerDialog } from "@erp/customers";
|
import { SelectCustomerDialog } from "@erp/customers";
|
||||||
import { AppContent, AppHeader, BackHistoryButton } from "@repo/rdx-ui/components";
|
import { AppContent, AppHeader, BackHistoryButton } from "@repo/rdx-ui/components";
|
||||||
|
import { useMemo } from "react";
|
||||||
import { FormProvider } from "react-hook-form";
|
import { FormProvider } from "react-hook-form";
|
||||||
|
|
||||||
import { useTranslation } from "../../../../i18n";
|
import { useTranslation } from "../../../../i18n";
|
||||||
@ -15,6 +17,7 @@ import { ProformaUpdateEditorForm } from "../editors";
|
|||||||
|
|
||||||
export const ProformaUpdatePage = () => {
|
export const ProformaUpdatePage = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const taxCatalog = useMemo(() => SpainTaxCatalogProvider(), []);
|
||||||
|
|
||||||
const { updateCtrl, selectCustomerCtrl, returnTo } = useUpdateProformaPageController();
|
const { updateCtrl, selectCustomerCtrl, returnTo } = useUpdateProformaPageController();
|
||||||
|
|
||||||
|
|||||||
@ -16,9 +16,8 @@ export const CustomerCreatePage = () => {
|
|||||||
const { form, formId, onSubmit, resetForm, isCreating, isCreateError, createError } = createCtrl;
|
const { form, formId, onSubmit, resetForm, isCreating, isCreateError, createError } = createCtrl;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FormProvider {...form}>
|
|
||||||
<UnsavedChangesProvider isDirty={form.formState.isDirty}>
|
<UnsavedChangesProvider isDirty={form.formState.isDirty}>
|
||||||
<AppHeader className="mx-auto max-w-7xl space-y-4">
|
<AppHeader>
|
||||||
<PageHeader
|
<PageHeader
|
||||||
description={t("pages.create.description")}
|
description={t("pages.create.description")}
|
||||||
onBackClick={() => navigate("/customers/list")}
|
onBackClick={() => navigate("/customers/list")}
|
||||||
@ -39,7 +38,7 @@ export const CustomerCreatePage = () => {
|
|||||||
/>
|
/>
|
||||||
</AppHeader>
|
</AppHeader>
|
||||||
|
|
||||||
<AppContent className="mx-auto max-w-7xl space-y-4">
|
<AppContent>
|
||||||
{isCreateError && (
|
{isCreateError && (
|
||||||
<ErrorAlert
|
<ErrorAlert
|
||||||
message={(createError as Error)?.message ?? t("pages.create.errorMsg")}
|
message={(createError as Error)?.message ?? t("pages.create.errorMsg")}
|
||||||
@ -47,13 +46,14 @@ export const CustomerCreatePage = () => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<FormProvider {...form}>
|
||||||
<CustomerCreateEditorForm
|
<CustomerCreateEditorForm
|
||||||
className="bg-white rounded-xl border shadow-xl max-w-7xl mx-auto mt-6"
|
className="bg-white rounded-xl border shadow-xl max-w-7xl mx-auto mt-6"
|
||||||
formId={formId}
|
formId={formId}
|
||||||
onSubmit={onSubmit}
|
onSubmit={onSubmit}
|
||||||
/>
|
/>
|
||||||
|
</FormProvider>
|
||||||
</AppContent>
|
</AppContent>
|
||||||
</UnsavedChangesProvider>
|
</UnsavedChangesProvider>
|
||||||
</FormProvider>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user