This commit is contained in:
David Arranz 2026-06-26 12:28:52 +02:00
parent ad066b1ad0
commit d5438e2f4e
9 changed files with 72 additions and 12 deletions

View File

@ -123,10 +123,10 @@ export class UpdateCustomerInputMapper implements IUpdateCustomerInputMapper {
);
});
toPatchField(dto.payment_method_id).ifSetOrNull((paymentMethodId) => {
customerPatchProps.paymentMethodId = extractOrPushError(
maybeFromNullableResult(paymentMethodId, (value) => UniqueID.create(value)),
"payment_method_id",
toPatchField(dto.payment_term_id).ifSetOrNull((paymentTermId) => {
customerPatchProps.paymentTermId = extractOrPushError(
maybeFromNullableResult(paymentTermId, (value) => UniqueID.create(value)),
"payment_term_id",
errors
);
});
@ -167,6 +167,7 @@ export class UpdateCustomerInputMapper implements IUpdateCustomerInputMapper {
return Result.ok(customerPatchProps);
} catch (err: unknown) {
console.error(err);
return Result.fail(new DomainError("Customer props mapping failed (update)", { cause: err }));
}
}

View File

@ -138,6 +138,10 @@
"description": "Customer contact details.",
"title": "Contact information"
},
"fiscal_info": {
"description": "Customer fiscal details.",
"title": "Fiscal information"
},
"preferences": {
"description": "Additional customer settings.",
"title": "Preferences"
@ -261,6 +265,31 @@
"description": "The customer's website.",
"label": "Website",
"placeholder": "Enter the website URL"
},
"payment_method": {
"description": "The customer's default payment method.",
"label": "Payment method",
"placeholder": "Select the payment method"
},
"payment_term": {
"description": "The customer's default payment terms.",
"label": "Payment terms",
"placeholder": "Select the payment terms"
},
"tax_regime": {
"description": "The customer's tax regime.",
"label": "Tax regime",
"placeholder": "Select the tax regime"
},
"uses_equivalence_surcharge": {
"description": "Apply equivalence surcharge",
"label": "Equivalence surcharge",
"placeholder": "Equivalence surcharge"
},
"uses_retention": {
"description": "Include default withholding",
"label": "Withholding / Personal income tax",
"placeholder": "Withholding / Personal income tax"
}
},
"dialogs": {
@ -302,4 +331,4 @@
"placeholder": "Select taxes"
}
}
}
}

View File

@ -138,6 +138,10 @@
"description": "Detalles de contacto del cliente.",
"title": "Información de contacto"
},
"fiscal_info": {
"description": "Detalles fiscales del cliente.",
"title": "Información fiscal"
},
"preferences": {
"description": "Configuraciones adicionales del cliente.",
"title": "Preferencias"
@ -261,6 +265,31 @@
"description": "El sitio web del cliente.",
"label": "Sitio web",
"placeholder": "Introduce la URL del sitio web"
},
"payment_method": {
"description": "El método de pago predeterminado del cliente.",
"label": "Método de pago",
"placeholder": "Selecciona la forma de pago"
},
"payment_term": {
"description": "Plazos de pago predeterminado del cliente.",
"label": "Plazos de pago",
"placeholder": "Selecciona los plazos de pago"
},
"tax_regime": {
"description": "Régimen fiscal del cliente.",
"label": "Regimen fiscal",
"placeholder": "Selecciona el régimen fiscal"
},
"uses_equivalence_surcharge": {
"description": "Aplicar recargo de equivalencia",
"label": "Recargo de equivalencia",
"placeholder": "Recargo de equivalencia"
},
"uses_retention": {
"description": "Incluir retención por defecto",
"label": "Retención / IRPF",
"placeholder": "Retención / IRPF"
}
},
"dialogs": {
@ -302,4 +331,4 @@
"placeholder": "Selecciona los impuestos"
}
}
}
}

View File

@ -17,8 +17,6 @@ export const defaultCustomerCreateForm: CustomerCreateForm = {
tradeName: "",
tin: "",
defaultTaxes: [],
street: "",
street2: "",
city: "",

View File

@ -1,4 +1,5 @@
import { FormSectionCard, FormSectionGrid, SelectField } from "@repo/rdx-ui/components";
import { Settings2Icon } from "lucide-react";
import { useTranslation } from "../../../i18n";
import { CURRENCY_OPTIONS, LANGUAGE_OPTIONS } from "../../../shared";
@ -17,6 +18,7 @@ export const CustomerAdditionalConfigEditor = ({
return (
<FormSectionCard
description={t("form_groups.preferences.description")}
icon={<Settings2Icon className="size-5" />}
title={t("form_groups.preferences.title")}
>
<FormSectionGrid>

View File

@ -25,6 +25,7 @@ export const CustomerContactEditor = ({
return (
<FormSectionCard
description={t("form_groups.contact_info.description")}
icon={<PhoneIcon className="size-5" />}
title={t("form_groups.contact_info.title")}
>
<FormSectionGrid>

View File

@ -41,12 +41,12 @@ export const CustomerUpdateEditorForm = ({
>
<CustomerBasicInfoEditor disabled={isSubmitting} />
<CustomerAddressEditor />
<CustomerContactEditor />
<CustomerFiscalEditor
paymentMethodOptions={fiscalCtrl.paymentMethodOptions}
paymentTermOptions={fiscalCtrl.paymentTermOptions}
taxRegimeOptions={fiscalCtrl.taxRegimeOptions}
/>
<CustomerContactEditor />
<CustomerAdditionalConfigEditor />
</form>
</div>

View File

@ -28,9 +28,9 @@ export const CustomerFiscalEditor = ({
return (
<FormSectionCard
description={t("form_groups.fiscal.description")}
description={t("form_groups.fiscal_info.description")}
icon={<LandmarkIcon className="size-5" />}
title={t("form_groups.fiscal.title")}
title={t("form_groups.fiscal_info.title")}
>
<FormSectionGrid className="md:grid-cols-2">
<SelectField

View File

@ -91,7 +91,7 @@ export const CustomerUpdatePage = () => {
)}
<div className="flex-1 overflow-y-auto">
<CustomerUpdateEditorForm
className="max-w-5xl mx-auto"
className="max-w-5xl mx-auto mb-12"
fiscalCtrl={updateCtrl.fiscalCtrl}
formId={updateCtrl.formId}
isSubmitting={updateCtrl.isUpdating}