add logout logic and wip recap

This commit is contained in:
Julien Aldon
2026-02-18 18:08:30 +01:00
parent aca24ca560
commit acbaadff67
29 changed files with 363 additions and 100 deletions

View File

@@ -28,6 +28,14 @@ export default function ContractRow({ contract }: ContractRowProps) {
<Table.Td>
{contract.cheque_quantity > 0 && contract.cheque_quantity} {contract.payment_method}
</Table.Td>
<Table.Td>
{
`${Intl.NumberFormat("fr-FR", {
style: "currency",
currency: "EUR",
}).format(contract.total_price)}`
}
</Table.Td>
<Table.Td>
<Tooltip label={t("download contract", { capfirst: true })}>
<ActionIcon

View File

@@ -41,7 +41,6 @@ export function Navbar() {
href={`${Config.backend_uri}/auth/logout`}
className={"navLink"}
aria-label={t("logout", { capfirst: true })}
>
{t("logout", { capfirst: true })}
</a>

View File

@@ -1,6 +1,6 @@
import { t } from "@/config/i18n";
import type { ContractInputs } from "@/services/resources/contracts";
import { Group, NumberInput, Stack, TextInput, Title } from "@mantine/core";
import { Group, NumberInput, Stack, Text, TextInput, Title } from "@mantine/core";
import type { UseFormReturnType } from "@mantine/form";
import { useEffect } from "react";
@@ -56,13 +56,18 @@ export function ContractCheque({ inputForm, price, chequeOrder }: ContractCheque
{...inputForm.getInputProps(`cheque_quantity`)}
/>
<Group grow>
{inputForm.values.cheques.map((_cheque, index) => (
{inputForm.values.cheques.map((cheque, index) => (
<Stack key={`${index}`}>
<TextInput
label={t("cheque id", { capfirst: true })}
placeholder={t("cheque id", { capfirst: true })}
{...inputForm.getInputProps(`cheques.${index}.name`)}
/>
error={
cheque.name == "" ?
<Text size="sm" c="red">{inputForm?.errors.cheques}</Text> :
null
}
/>
<NumberInput
readOnly
label={t("cheque value", { capfirst: true })}

View File

@@ -21,7 +21,6 @@ export default function ProductorsFilter({
const defaultTypes = useMemo(() => {
return filters.getAll("types");
}, [filters]);
return (
<Group>
<MultiSelect

View File

@@ -46,6 +46,12 @@ export function ProductorModal({
!value ? `${t("address", { capfirst: true })} ${t("is required")}` : null,
type: (value) =>
!value ? `${t("type", { capfirst: true })} ${t("is required")}` : null,
payment_methods: (value) =>
value.length === 0 || value.some(
(payment) =>
payment.name === "cheque" &&
payment.details === "") ?
`${t("a payment method", { capfirst: true })} ${t("is required")}` : null,
},
});
@@ -89,6 +95,7 @@ export function ProductorModal({
clearable
searchable
value={form.values.payment_methods.map((p) => p.name)}
error={form.errors.payment_methods}
onChange={(names) => {
form.setFieldValue(
"payment_methods",