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

View File

@ -138,6 +138,10 @@
"description": "Customer contact details.", "description": "Customer contact details.",
"title": "Contact information" "title": "Contact information"
}, },
"fiscal_info": {
"description": "Customer fiscal details.",
"title": "Fiscal information"
},
"preferences": { "preferences": {
"description": "Additional customer settings.", "description": "Additional customer settings.",
"title": "Preferences" "title": "Preferences"
@ -261,6 +265,31 @@
"description": "The customer's website.", "description": "The customer's website.",
"label": "Website", "label": "Website",
"placeholder": "Enter the website URL" "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": { "dialogs": {
@ -302,4 +331,4 @@
"placeholder": "Select taxes" "placeholder": "Select taxes"
} }
} }
} }

View File

@ -138,6 +138,10 @@
"description": "Detalles de contacto del cliente.", "description": "Detalles de contacto del cliente.",
"title": "Información de contacto" "title": "Información de contacto"
}, },
"fiscal_info": {
"description": "Detalles fiscales del cliente.",
"title": "Información fiscal"
},
"preferences": { "preferences": {
"description": "Configuraciones adicionales del cliente.", "description": "Configuraciones adicionales del cliente.",
"title": "Preferencias" "title": "Preferencias"
@ -261,6 +265,31 @@
"description": "El sitio web del cliente.", "description": "El sitio web del cliente.",
"label": "Sitio web", "label": "Sitio web",
"placeholder": "Introduce la URL del 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": { "dialogs": {
@ -302,4 +331,4 @@
"placeholder": "Selecciona los impuestos" "placeholder": "Selecciona los impuestos"
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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