fix i18n add help page

This commit is contained in:
Julien Aldon
2026-02-16 16:38:34 +01:00
parent be8e32ebed
commit 5354a74cac
21 changed files with 524 additions and 224 deletions

View File

@@ -77,6 +77,7 @@ export default function FormModal({ opened, onClose, currentForm, handleSubmit }
<TextInput
label={t("form name", { capfirst: true })}
placeholder={t("form name", { capfirst: true })}
description={t("form name recommandation", { capfirst: true })}
radius="sm"
withAsterisk
{...form.getInputProps("name")}

View File

@@ -14,7 +14,7 @@ export function Navbar() {
<NavLink
className={"navLink"}
aria-label={t("dashboard")}
to="/dashboard/productors"
to="/dashboard/help"
>
{t("dashboard", { capfirst: true })}
</NavLink>

View File

@@ -35,7 +35,7 @@ export function ProductForm({ inputForm, product, shipment }: ProductFormProps)
placeholder={`${t("enter quantity", { capfirst: true })} ${t("in")} ${t(ProductUnit[product.unit])}`}
{...inputForm.getInputProps(
shipment
? `products.planned-${shipment.id}-${product.id}`
? `products.occasional-${shipment.id}-${product.id}`
: `products.recurrent-${product.id}`,
)}
/>

View File

@@ -41,19 +41,19 @@ export function ProductModal({ opened, onClose, currentProduct, handleSubmit }:
},
validate: {
name: (value) =>
!value ? `${t("name", { capfirst: true })} ${t("is required")}` : null,
!value ? `${t("a name", { capfirst: true })} ${t("is required")}` : null,
unit: (value) =>
!value ? `${t("unit", { capfirst: true })} ${t("is required")}` : null,
!value ? `${t("a sell unit", { capfirst: true })} ${t("is required")}` : null,
price: (value, values) =>
!value && !values.price_kg
? `${t("price or price_kg", { capfirst: true })} ${t("is required")}`
? `${t("a price or priceKg", { capfirst: true })} ${t("is required")}`
: null,
price_kg: (value, values) =>
!value && !values.price
? `${t("price or price_kg", { capfirst: true })} ${t("is required")}`
? `${t("a price or priceKg", { capfirst: true })} ${t("is required")}`
: null,
type: (value) =>
!value ? `${t("type", { capfirst: true })} ${t("is required")}` : null,
!value ? `${t("a type", { capfirst: true })} ${t("is required")}` : null,
productor_id: (value) =>
!value ? `${t("productor", { capfirst: true })} ${t("is required")}` : null,
},
@@ -79,35 +79,27 @@ export function ProductModal({ opened, onClose, currentProduct, handleSubmit }:
data={productorsSelect || []}
{...form.getInputProps("productor_id")}
/>
<Group grow>
<TextInput
label={t("product name", { capfirst: true })}
placeholder={t("product name", { capfirst: true })}
radius="sm"
{...form.getInputProps("name")}
/>
<Select
label={
<InputLabel
label={t("product type", { capfirst: true })}
info={t(
"recurrent product is for all shipments, planned product is for a specific shipment (see shipment form)",
{ capfirst: true },
)}
isRequired
/>
}
placeholder={t("product type", { capfirst: true })}
radius="sm"
searchable
clearable
data={[
{ value: "1", label: t("planned", { capfirst: true }) },
{ value: "2", label: t("recurrent", { capfirst: true }) },
]}
{...form.getInputProps("type")}
/>
</Group>
<TextInput
label={t("product name", { capfirst: true })}
placeholder={t("product name", { capfirst: true })}
radius="sm"
withAsterisk
{...form.getInputProps("name")}
/>
<Select
label={t("product type", { capfirst: true })}
placeholder={t("product type", { capfirst: true })}
radius="sm"
description={t("a product type define the way it will be organized on the final contract form (showed to users) it can be reccurent or occassional. Recurrent products will be set for all shipments if selected by user, Occasional products can be choosen for each shipments", {capfirst: true})}
searchable
clearable
withAsterisk
data={[
{ value: "1", label: t("occasional", { capfirst: true }) },
{ value: "2", label: t("recurrent", { capfirst: true }) },
]}
{...form.getInputProps("type")}
/>
<Select
label={t("product unit", { capfirst: true })}
placeholder={t("product unit", { capfirst: true })}

View File

@@ -22,7 +22,7 @@ export default function ShipmentForm({
}: ShipmentFormProps) {
const shipmentPrice = useMemo(() => {
const values = Object.entries(inputForm.getValues().products).filter(
([key]) => key.includes("planned") && key.split("-")[1] === String(shipment.id),
([key]) => key.includes("occasional") && key.split("-")[1] === String(shipment.id),
);
return computePrices(values, shipment.products);
}, [inputForm, shipment.products, shipment.id]);

View File

@@ -101,7 +101,7 @@ export default function ShipmentModal({
label={t("shipment products", { capfirst: true })}
placeholder={t("shipment products", { capfirst: true })}
description={t(
"shipment products is necessary only for planned products (if all products are recurrent leave empty)",
"shipment products is necessary only for occasional products (if all products are recurrent leave empty)",
{ capfirst: true },
)}
data={productsSelect || []}