From 08f01e2b3b7fb9de466cfa10095559b6ad89b2a8 Mon Sep 17 00:00:00 2001 From: David Arranz Date: Thu, 8 Oct 2026 12:35:37 +0200 Subject: [PATCH] =?UTF-8?q?Selector=20para=20idioma=20al=20genera=20el=20P?= =?UTF-8?q?DF,=20tanto=20en=20alta=20como=20en=20modificaci=C3=B3n=20de=20?= =?UTF-8?q?cotizaciones.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/LoginPageWithLanguageSelector.tsx | 23 ++++------ .../editors/QuoteGeneralCardEditor.tsx | 42 ++++++++++++++----- client/src/app/quotes/create.tsx | 30 ++++++++++++- client/src/lib/languages.tsx | 7 ++++ client/src/locales/en.json | 7 ++-- client/src/locales/es.json | 7 ++-- .../application/Quote/CreateQuote.useCase.ts | 2 +- .../application/Quote/UpdateQuote.useCase.ts | 4 +- .../infrastructure/mappers/quote.mapper.ts | 6 ++- 9 files changed, 93 insertions(+), 35 deletions(-) create mode 100644 client/src/lib/languages.tsx diff --git a/client/src/app/auth/LoginPageWithLanguageSelector.tsx b/client/src/app/auth/LoginPageWithLanguageSelector.tsx index 732d428..480f660 100644 --- a/client/src/app/auth/LoginPageWithLanguageSelector.tsx +++ b/client/src/app/auth/LoginPageWithLanguageSelector.tsx @@ -2,6 +2,7 @@ import { Container, FormTextField } from "@/components"; import { FormSubmitButton } from "@/components/Forms/FormSubmitButton"; import { UeckoLogo } from "@/components/UeckoLogo/UeckoLogo"; import { useLogin } from "@/lib/hooks"; +import { documentedLanguages } from "@/lib/languages"; import { Alert, AlertDescription, @@ -29,17 +30,8 @@ import { SubmitHandler, useForm } from "react-hook-form"; import { Trans, useTranslation } from "react-i18next"; import { Link, useNavigate } from "react-router-dom"; import SpanishJoiMessages from "../../spanish-joi-messages.json"; -import "/node_modules/flag-icons/css/flag-icons.min.css"; - type LoginDataForm = ILogin_DTO; -const languages = [ - { code: "en", name: "English", flag: () => }, - { code: "es", name: "Español", flag: () => }, - //{ code: "fr", name: "Français", flag: () => }, - //{ code: "it", name: "Italiano", flag: () => }, -]; - export const LoginPageWithLanguageSelector = () => { const { t, i18n } = useTranslation(); @@ -49,7 +41,7 @@ export const LoginPageWithLanguageSelector = () => { useEffect(() => { const browserLang = navigator.language.split("-")[0]; - const supportedLang = languages.find((lang) => lang.code === browserLang); + const supportedLang = documentedLanguages.find((lang) => lang.code === browserLang); if (supportedLang) { changeLanguage(supportedLang.code); } @@ -113,16 +105,19 @@ export const LoginPageWithLanguageSelector = () => { - {languages.map((lang) => ( + {documentedLanguages.map((lang) => ( changeLanguage(lang.code)}> - {lang.flag()} + ))} diff --git a/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx b/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx index db16ac4..f7c8d43 100644 --- a/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx +++ b/client/src/app/quotes/components/editors/QuoteGeneralCardEditor.tsx @@ -1,10 +1,11 @@ import { FormDatePickerField, FormGroup, FormTextAreaField, FormTextField } from "@/components"; import { Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/ui"; +import { documentedLanguages } from "@/lib/languages"; import { t } from "i18next"; -import { useFormContext } from "react-hook-form"; +import { Controller, useFormContext } from "react-hook-form"; export const QuoteGeneralCardEditor = () => { - const { formState } = useFormContext(); + const { formState, control } = useFormContext(); return (
@@ -12,6 +13,35 @@ export const QuoteGeneralCardEditor = () => { className='md:col-span-6' title={t("quotes.create.form_groups.general.title")} description={t("quotes.create.form_groups.general.desc")} + actions={ +
+ + ( + + )} + /> +
+ } >
{
- { const defaultValues = useMemo( () => ({ date: new Date(Date.now()).toUTCString(), + lang_code: "es", customer_reference: "", customer_information: "", //reference: "", @@ -141,6 +143,30 @@ export const QuoteCreate = () => { name='date' /> +
+ + ( + + )} + /> +

{t("quotes.form_fields.lang_code.desc")}

+
+ Language.createFromCode(value || Language.DEFAULT_LANGUAGE_CODE) + ), customerReference: this.mapsValue( source, "customer_reference",