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

@@ -58,14 +58,14 @@ export function useCreateShipment() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully created shipment", { capfirst: true }),
message: t("success create", { capfirst: true, entity: t("shipment") }),
});
await queryClient.invalidateQueries({ queryKey: ["shipments"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing shipment`, { capfirst: true }),
message: error?.message || t(`error create`, { capfirst: true, entity: t("of the shipment") }),
color: "red",
});
},
@@ -88,14 +88,14 @@ export function useEditShipment() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully edited shipment", { capfirst: true }),
message: t("success edit", { capfirst: true, entity: t("shipment") }),
});
await queryClient.invalidateQueries({ queryKey: ["shipments"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing shipment`, { capfirst: true }),
message: error?.message || t(`error edit`, { capfirst: true, entity: t("of the shipment") }),
color: "red",
});
},
@@ -116,14 +116,14 @@ export function useDeleteShipment() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully deleted shipment", { capfirst: true }),
message: t("success delete", { capfirst: true, entity: t("shipment") }),
});
await queryClient.invalidateQueries({ queryKey: ["shipments"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error deleting shipment`, { capfirst: true }),
message: error?.message || t(`error delete`, { capfirst: true, entity: t("of the contract") }),
color: "red",
});
},
@@ -169,14 +169,14 @@ export function useCreateProductor() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully created productor", { capfirst: true }),
message: t("success create", { capfirst: true, entity: t("productor") }),
});
await queryClient.invalidateQueries({ queryKey: ["productors"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing productor`, { capfirst: true }),
message: error?.message || t(`error create`, { capfirst: true, entity: t("of the productor") }),
color: "red",
});
},
@@ -199,14 +199,14 @@ export function useEditProductor() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully edited productor", { capfirst: true }),
message: t("success edit", { capfirst: true, entity: t("productor") }),
});
await queryClient.invalidateQueries({ queryKey: ["productors"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing productor`, { capfirst: true }),
message: error?.message || t(`error edit`, { capfirst: true, entity: t("of the productor") }),
color: "red",
});
},
@@ -227,14 +227,14 @@ export function useDeleteProductor() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully deleted productor", { capfirst: true }),
message: t("success delete", { capfirst: true, entity: t("productor") }),
});
await queryClient.invalidateQueries({ queryKey: ["productors"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error deleting productor`, { capfirst: true }),
message: error?.message || t(`error delete`, { capfirst: true, entity: t("of the productor") }),
color: "red",
});
},
@@ -297,14 +297,14 @@ export function useDeleteForm() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully deleted form", { capfirst: true }),
message: t("success delete", { capfirst: true, entity: t("form") }),
});
await queryClient.invalidateQueries({ queryKey: ["forms"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error deleting form`, { capfirst: true }),
message: error?.message || t(`error delete`, { capfirst: true, entity: t("of the form") }),
color: "red",
});
},
@@ -327,14 +327,14 @@ export function useEditForm() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully edited form", { capfirst: true }),
message: t("success edit", { capfirst: true, entity: t("form") }),
});
await queryClient.invalidateQueries({ queryKey: ["forms"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing form`, { capfirst: true }),
message: error?.message || t(`error edit`, { capfirst: true, entity: t("of the form") }),
color: "red",
});
},
@@ -380,14 +380,14 @@ export function useCreateProduct() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully created product", { capfirst: true }),
message: t("success create", { capfirst: true, entity: t("product") }),
});
await queryClient.invalidateQueries({ queryKey: ["products"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing product`, { capfirst: true }),
message: error?.message || t(`error create`, { capfirst: true, entity: t("of the productor") }),
color: "red",
});
},
@@ -408,14 +408,14 @@ export function useDeleteProduct() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully deleted product", { capfirst: true }),
message: t("success delete", { capfirst: true, entity: t("product") }),
});
await queryClient.invalidateQueries({ queryKey: ["products"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error deleting product`, { capfirst: true }),
message: error?.message || t(`error delete`, { capfirst: true, entity: t("of the product") }),
color: "red",
});
},
@@ -438,14 +438,14 @@ export function useEditProduct() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully edited product", { capfirst: true }),
message: t("success edit", { capfirst: true, entity: t("product") }),
});
await queryClient.invalidateQueries({ queryKey: ["products"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing product`, { capfirst: true }),
message: error?.message || t(`error edit`, { capfirst: true, entity: t("of the product") }),
color: "red",
});
},
@@ -491,14 +491,14 @@ export function useCreateUser() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully created user", { capfirst: true }),
message: t("success create", { capfirst: true, entity: t("user") }),
});
await queryClient.invalidateQueries({ queryKey: ["users"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing user`, { capfirst: true }),
message: error?.message || t(`error create`, { capfirst: true, entity: t("of the user") }),
color: "red",
});
},
@@ -519,14 +519,14 @@ export function useDeleteUser() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully deleted user", { capfirst: true }),
message: t("success delete", { capfirst: true, entity: t("user") }),
});
await queryClient.invalidateQueries({ queryKey: ["users"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error deleting user`, { capfirst: true }),
message: error?.message || t(`error delete`, { capfirst: true, entity: t("of the user") }),
color: "red",
});
},
@@ -549,14 +549,14 @@ export function useEditUser() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully edited user", { capfirst: true }),
message: t("success edit", { capfirst: true, entity: t("user") }),
});
await queryClient.invalidateQueries({ queryKey: ["users"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error editing user`, { capfirst: true }),
message: error?.message || t(`error edit`, { capfirst: true, entity: t("of the user") }),
color: "red",
});
},
@@ -625,14 +625,14 @@ export function useDeleteContract() {
onSuccess: async () => {
notifications.show({
title: t("success", { capfirst: true }),
message: t("successfully deleted contract", { capfirst: true }),
message: t("success delete", { capfirst: true, entity: t("contract") }),
});
await queryClient.invalidateQueries({ queryKey: ["contracts"] });
},
onError: (error) => {
notifications.show({
title: t("error", { capfirst: true }),
message: error?.message || t(`error deleting contract`, { capfirst: true }),
message: error?.message || t(`error delete`, { capfirst: true, entity: t("of the contract") }),
color: "red",
});
},

View File

@@ -61,8 +61,8 @@ export function tranformProducts(
return Object.entries(products).map(([key, value]) => {
const quantity = value;
const parts = key.split("-");
const shipment_id = parts[0] === "planned" ? Number(parts[1]) : null;
const product_id = parts[0] === "planned" ? Number(parts[2]) : Number(parts[1]);
const shipment_id = parts[0] === "occasional" ? Number(parts[1]) : null;
const product_id = parts[0] === "occasional" ? Number(parts[2]) : Number(parts[1]);
return {
quantity: Number(quantity),
shipment_id: shipment_id,

View File

@@ -5,7 +5,7 @@ type ProductTypeKey = "1" | "2";
type ProductUnitKey = "1" | "2" | "3";
export const ProductType = {
"1": "planned",
"1": "occasional",
"2": "recurrent",
};