From e77b8f405efeedbab289e0a1e223b1ee4ebdaed4 Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Tue, 19 May 2026 12:40:29 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=9A=A8=20resolve=20eslint=20error?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Layout/Sidebar/Links/InvoiceCompanies.tsx | 4 ++- .../Layout/Sidebar/Links/InvoicePackages.tsx | 4 ++- .../Table/RenderTranslationCell.tsx | 10 ++++-- .../ts/back/Pages/Auth/ResetPassword.tsx | 2 +- .../ts/back/Pages/InvoiceCompanies/Create.tsx | 3 +- .../ts/back/Pages/InvoiceCompanies/Edit.tsx | 3 +- .../ts/back/Pages/InvoiceCompanies/Form.tsx | 4 +-- .../ts/back/Pages/InvoiceCompanies/Index.tsx | 8 ++--- .../ts/back/Pages/InvoiceCompanies/Show.tsx | 6 +--- .../ts/back/Pages/InvoicePackages/Create.tsx | 3 +- .../ts/back/Pages/InvoicePackages/Edit.tsx | 3 +- .../ts/back/Pages/InvoicePackages/Index.tsx | 23 ++++++++------ .../ts/back/Pages/InvoicePackages/Show.tsx | 12 ++----- resources/ts/back/Pages/Notices/Form.tsx | 12 ++----- resources/ts/back/Pages/Notices/Index.tsx | 16 +++------- resources/ts/back/Pages/Notices/Show.tsx | 14 ++------- resources/ts/back/Pages/Users/Form.tsx | 31 ++++++++++--------- resources/ts/back/Pages/Users/Index.tsx | 4 ++- resources/ts/back/Pages/Users/Show.tsx | 4 ++- resources/ts/back/types/project.d.ts | 15 ++++----- 20 files changed, 84 insertions(+), 97 deletions(-) diff --git a/resources/ts/back/Components/Layout/Sidebar/Links/InvoiceCompanies.tsx b/resources/ts/back/Components/Layout/Sidebar/Links/InvoiceCompanies.tsx index cc21ca1..3c65d01 100644 --- a/resources/ts/back/Components/Layout/Sidebar/Links/InvoiceCompanies.tsx +++ b/resources/ts/back/Components/Layout/Sidebar/Links/InvoiceCompanies.tsx @@ -17,7 +17,9 @@ import { GetTranslation } from "@/lib/utils"; import useTrans from "@/hooks/use-translations"; import Views from "@/back/lib/actions"; -export default function SidebarLinkInvoiceCompanies(auth: AuthProp): SidebarGroupLink { +export default function SidebarLinkInvoiceCompanies( + auth: AuthProp, +): SidebarGroupLink { const modelName = "invoice-companies"; // Translations. diff --git a/resources/ts/back/Components/Layout/Sidebar/Links/InvoicePackages.tsx b/resources/ts/back/Components/Layout/Sidebar/Links/InvoicePackages.tsx index 1470a13..ffe52eb 100644 --- a/resources/ts/back/Components/Layout/Sidebar/Links/InvoicePackages.tsx +++ b/resources/ts/back/Components/Layout/Sidebar/Links/InvoicePackages.tsx @@ -17,7 +17,9 @@ import { GetTranslation } from "@/lib/utils"; import useTrans from "@/hooks/use-translations"; import Views from "@/back/lib/actions"; -export default function SidebarLinkInvoicePackages(auth: AuthProp): SidebarGroupLink { +export default function SidebarLinkInvoicePackages( + auth: AuthProp, +): SidebarGroupLink { const modelName = "invoice-packages"; // Translations. diff --git a/resources/ts/back/Components/Table/RenderTranslationCell.tsx b/resources/ts/back/Components/Table/RenderTranslationCell.tsx index d6c848e..5c0f38e 100644 --- a/resources/ts/back/Components/Table/RenderTranslationCell.tsx +++ b/resources/ts/back/Components/Table/RenderTranslationCell.tsx @@ -29,7 +29,13 @@ function useGetTranslationValue( return { value: fallback[1], locale: fallback[0] }; } -function RenderValue({ value, renderHtml }: { value: string; renderHtml: boolean }): ReactNode { +function RenderValue({ + value, + renderHtml, +}: { + value: string; + renderHtml: boolean; +}): ReactNode { const preview = normalizePreview(value); return renderHtml ? ( @@ -64,4 +70,4 @@ export default function RenderTranslationCell({ ); -} \ No newline at end of file +} diff --git a/resources/ts/back/Pages/Auth/ResetPassword.tsx b/resources/ts/back/Pages/Auth/ResetPassword.tsx index cab5f64..a854565 100644 --- a/resources/ts/back/Pages/Auth/ResetPassword.tsx +++ b/resources/ts/back/Pages/Auth/ResetPassword.tsx @@ -71,7 +71,7 @@ export default function ResetPassword({ token, email }: ResetPasswordProps) { wordCounter={false} value={email} setData={() => {}} - disabled={true} + disabled /> { accessorKey: "name", header: ({ column }: { column: { id: string } }) => ( { field={column.id} /> ), - cell: ({ row }: { row: Row }) => ( + cell: ({ row }: { row: Row }) => ( {GetFormatedDate(row.getValue("updated_at"))} diff --git a/resources/ts/back/Pages/InvoiceCompanies/Show.tsx b/resources/ts/back/Pages/InvoiceCompanies/Show.tsx index af026a3..674ed0f 100644 --- a/resources/ts/back/Pages/InvoiceCompanies/Show.tsx +++ b/resources/ts/back/Pages/InvoiceCompanies/Show.tsx @@ -21,11 +21,7 @@ const getColumns = () => { return [ { accessorKey: "name", - header: str( - GetTranslation("validation.custom.name"), - ) - .ucFirst() - .value(), + header: str(GetTranslation("validation.custom.name")).ucFirst().value(), cell: ({ value }: { value: TranslationField }) => ( ), diff --git a/resources/ts/back/Pages/InvoicePackages/Create.tsx b/resources/ts/back/Pages/InvoicePackages/Create.tsx index 880ac64..3d951c2 100644 --- a/resources/ts/back/Pages/InvoicePackages/Create.tsx +++ b/resources/ts/back/Pages/InvoicePackages/Create.tsx @@ -17,7 +17,8 @@ export default function Create({ data: SingleResource; modelName: string; }) { - const { viewAny } = (usePage().props.auth as AuthProp).policies.invoicePackages; + const { viewAny } = (usePage().props.auth as AuthProp).policies + .invoicePackages; const model = data.data as DefaultModel; // Translations. diff --git a/resources/ts/back/Pages/InvoicePackages/Edit.tsx b/resources/ts/back/Pages/InvoicePackages/Edit.tsx index 854ce5b..e84bd8e 100644 --- a/resources/ts/back/Pages/InvoicePackages/Edit.tsx +++ b/resources/ts/back/Pages/InvoicePackages/Edit.tsx @@ -19,7 +19,8 @@ export default function Edit({ data: SingleResource; modelName: string; }) { - const { viewAny } = (usePage().props.auth as AuthProp).policies.invoicePackages; + const { viewAny } = (usePage().props.auth as AuthProp).policies + .invoicePackages; const model = data.data as DefaultModel; const actionModels = [ Views.VISUALIZATION, diff --git a/resources/ts/back/Pages/InvoicePackages/Index.tsx b/resources/ts/back/Pages/InvoicePackages/Index.tsx index 145f280..dee02a5 100644 --- a/resources/ts/back/Pages/InvoicePackages/Index.tsx +++ b/resources/ts/back/Pages/InvoicePackages/Index.tsx @@ -2,7 +2,13 @@ import { route } from "ziggy-js"; import { usePage } from "@inertiajs/react"; import { Row } from "@tanstack/react-table"; -import { ArchiveIcon, ArrowLeftIcon, CheckIcon, PlusIcon, XIcon } from "lucide-react"; +import { + ArchiveIcon, + ArrowLeftIcon, + CheckIcon, + PlusIcon, + XIcon, +} from "lucide-react"; // * Components shadcn import { Badge } from "@/components/ui/badge"; // * Other @@ -15,7 +21,7 @@ import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithT import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell"; import { GetFormatedDate, GetTranslation } from "@/lib/utils"; import { Views } from "@/back/lib/actions"; -import { AuthProp, DefaultModel, Resource } from "@/back/types/global"; +import { AuthProp, Resource } from "@/back/types/global"; import str from "@/hooks/use-string"; import useTrans from "@/hooks/use-translations"; import { InvoicePackageModel } from "@/back/types/project"; @@ -26,9 +32,7 @@ const getColumns = () => { accessorKey: "name", header: ({ column }: { column: { id: string } }) => ( { accessorKey: "amount", header: ({ column }: { column: { id: string } }) => ( ), - cell: ({ row }: { row: Row }) => row.getValue("amount"), + cell: ({ row }: { row: Row }) => + row.getValue("amount"), }, { accessorKey: "published", @@ -102,7 +105,7 @@ const getColumns = () => { field={column.id} /> ), - cell: ({ row }: { row: Row }) => ( + cell: ({ row }: { row: Row }) => ( {GetFormatedDate(row.getValue("updated_at"))} diff --git a/resources/ts/back/Pages/InvoicePackages/Show.tsx b/resources/ts/back/Pages/InvoicePackages/Show.tsx index b8bc7e5..1090133 100644 --- a/resources/ts/back/Pages/InvoicePackages/Show.tsx +++ b/resources/ts/back/Pages/InvoicePackages/Show.tsx @@ -21,22 +21,14 @@ const getColumns = () => { return [ { accessorKey: "name", - header: str( - GetTranslation("validation.custom.name"), - ) - .ucFirst() - .value(), + header: str(GetTranslation("validation.custom.name")).ucFirst().value(), cell: ({ value }: { value: TranslationField }) => ( ), }, { accessorKey: "amount", - header: str( - GetTranslation("validation.custom.amount"), - ) - .ucFirst() - .value(), + header: str(GetTranslation("validation.custom.amount")).ucFirst().value(), cell: ({ value }: { value: number }) => value, }, { diff --git a/resources/ts/back/Pages/Notices/Form.tsx b/resources/ts/back/Pages/Notices/Form.tsx index e866b53..e92750b 100644 --- a/resources/ts/back/Pages/Notices/Form.tsx +++ b/resources/ts/back/Pages/Notices/Form.tsx @@ -66,9 +66,7 @@ export default function Form({ label={str( useTrans("uwil-backend::back.form_associate_to", { params: { - attribute: useTrans( - "validation.custom.title", - ), + attribute: useTrans("validation.custom.title"), }, choice: 1, }), @@ -85,9 +83,7 @@ export default function Form({ label={str( useTrans("uwil-backend::back.form_associate_to", { params: { - attribute: useTrans( - "validation.custom.type", - ), + attribute: useTrans("validation.custom.type"), }, choice: 1, }), @@ -104,9 +100,7 @@ export default function Form({ label={str( useTrans("uwil-backend::back.form_associate_to", { params: { - attribute: useTrans( - "validation.custom.message", - ), + attribute: useTrans("validation.custom.message"), }, choice: 1, }), diff --git a/resources/ts/back/Pages/Notices/Index.tsx b/resources/ts/back/Pages/Notices/Index.tsx index be1ff3b..9b976c4 100644 --- a/resources/ts/back/Pages/Notices/Index.tsx +++ b/resources/ts/back/Pages/Notices/Index.tsx @@ -14,7 +14,7 @@ import SoftdeleteWarning from "@/back/Components/SoftdeleteWarning"; import BtnOptionnalLinkWithTooltip from "@/back/Components/BtnOptionnalLinkWithTooltip"; import { GetFormatedDate, GetTranslation } from "@/lib/utils"; import { Views } from "@/back/lib/actions"; -import { AuthProp, DefaultModel, Resource } from "@/back/types/global"; +import { AuthProp, Resource } from "@/back/types/global"; import str from "@/hooks/use-string"; import useTrans from "@/hooks/use-translations"; import RenderTranslationCell from "@/back/Components/Table/RenderTranslationCell"; @@ -27,9 +27,7 @@ const getColumns = (noticeTypeEnum: LaravelEnum) => { accessorKey: "title", header: ({ column }: { column: { id: string } }) => ( { accessorKey: "message", header: ({ column }: { column: { id: string } }) => ( { accessorKey: "type", header: ({ column }: { column: { id: string } }) => ( { field={column.id} /> ), - cell: ({ row }: { row: Row }) => ( + cell: ({ row }: { row: Row }) => ( {GetFormatedDate(row.getValue("updated_at"))} diff --git a/resources/ts/back/Pages/Notices/Show.tsx b/resources/ts/back/Pages/Notices/Show.tsx index 6ee3cdb..7685882 100644 --- a/resources/ts/back/Pages/Notices/Show.tsx +++ b/resources/ts/back/Pages/Notices/Show.tsx @@ -22,20 +22,14 @@ const getColumns = (noticeTypeEnum: LaravelEnum) => { return [ { accessorKey: "title", - header: str( - GetTranslation("validation.custom.title"), - ) - .ucFirst() - .value(), + header: str(GetTranslation("validation.custom.title")).ucFirst().value(), cell: ({ value }: { value: TranslationField }) => ( ), }, { accessorKey: "message", - header: str( - GetTranslation("validation.custom.message"), - ) + header: str(GetTranslation("validation.custom.message")) .ucFirst() .value(), cell: ({ value }: { value: TranslationField }) => ( @@ -44,9 +38,7 @@ const getColumns = (noticeTypeEnum: LaravelEnum) => { }, { accessorKey: "type", - header: str(GetTranslation("validation.custom.type")) - .ucFirst() - .value(), + header: str(GetTranslation("validation.custom.type")).ucFirst().value(), cell: ({ value }: { value: number }) => ( {str( diff --git a/resources/ts/back/Pages/Users/Form.tsx b/resources/ts/back/Pages/Users/Form.tsx index e94c2de..dbe51c5 100644 --- a/resources/ts/back/Pages/Users/Form.tsx +++ b/resources/ts/back/Pages/Users/Form.tsx @@ -159,21 +159,22 @@ export default function Form({ /> )} - {userModel.role.value === isConceptor!.value && ( - } - description={transFormSubtitleVisibility} - inline - > - - - )} + {userModel.role.value === isConceptor!.value && + userModel.email !== model?.email && ( + } + description={transFormSubtitleVisibility} + inline + > + + + )}
{ const rowRole = row.getValue("role") as UserModel["role"]; return ( - {str(String(rowRole?.label ?? '')).ucFirst().value()} + {str(String(rowRole?.label ?? "")) + .ucFirst() + .value()} ); }, diff --git a/resources/ts/back/Pages/Users/Show.tsx b/resources/ts/back/Pages/Users/Show.tsx index 0fb58ff..5eecf2b 100644 --- a/resources/ts/back/Pages/Users/Show.tsx +++ b/resources/ts/back/Pages/Users/Show.tsx @@ -55,7 +55,9 @@ const getColumns = () => { .value(), cell: ({ value }: { value: UserModel["role"] }) => ( - {str(String(value?.label ?? '')).ucFirst().value()} + {str(String(value?.label ?? "")) + .ucFirst() + .value()} ), }, diff --git a/resources/ts/back/types/project.d.ts b/resources/ts/back/types/project.d.ts index fc99f24..a0005dc 100644 --- a/resources/ts/back/types/project.d.ts +++ b/resources/ts/back/types/project.d.ts @@ -1,18 +1,19 @@ import { LaravelEnum } from "@/types/global"; import { DefaultModel } from "@/back/types/global"; +import { TranslationField } from "@/back/types/i18n"; type NoticeModel = DefaultModel & { - title: TranslationField; - message: TranslationField; - type: LaravelEnum; + title: TranslationField; + message: TranslationField; + type: LaravelEnum; }; type InvoicePackageModel = DefaultModel & { - name: TranslationField; - amount: number; - published: boolean; + name: TranslationField; + amount: number; + published: boolean; }; type InvoiceCompanyModel = DefaultModel & { - name: TranslationField; + name: TranslationField; };