feat: 🚨 resolve eslint errors
This commit is contained in:
parent
6e6f3d55b5
commit
e77b8f405e
20 changed files with 84 additions and 97 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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({
|
|||
<RenderValue value={result.value} renderHtml={renderHtml} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ export default function ResetPassword({ token, email }: ResetPasswordProps) {
|
|||
wordCounter={false}
|
||||
value={email}
|
||||
setData={() => {}}
|
||||
disabled={true}
|
||||
disabled
|
||||
/>
|
||||
<SimpleString
|
||||
id="password"
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ export default function Create({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.invoiceCompanies;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies
|
||||
.invoiceCompanies;
|
||||
const model = data.data as DefaultModel;
|
||||
|
||||
// Translations.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ export default function Edit({
|
|||
data: SingleResource;
|
||||
modelName: string;
|
||||
}) {
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies.invoiceCompanies;
|
||||
const { viewAny } = (usePage().props.auth as AuthProp).policies
|
||||
.invoiceCompanies;
|
||||
const model = data.data as DefaultModel;
|
||||
const actionModels = [
|
||||
Views.VISUALIZATION,
|
||||
|
|
|
|||
|
|
@ -61,9 +61,7 @@ export default function Form({
|
|||
label={str(
|
||||
useTrans("uwil-backend::back.form_associate_to", {
|
||||
params: {
|
||||
attribute: useTrans(
|
||||
"validation.custom.name",
|
||||
),
|
||||
attribute: useTrans("validation.custom.name"),
|
||||
},
|
||||
choice: 1,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -26,9 +26,7 @@ const getColumns = () => {
|
|||
accessorKey: "name",
|
||||
header: ({ column }: { column: { id: string } }) => (
|
||||
<DataTableFilterButton
|
||||
label={str(
|
||||
GetTranslation(`validation.custom.${column.id}`),
|
||||
)
|
||||
label={str(GetTranslation(`validation.custom.${column.id}`))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
field={column.id}
|
||||
|
|
@ -50,7 +48,7 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<DefaultModel> }) => (
|
||||
cell: ({ row }: { row: Row<InvoicePackageModel> }) => (
|
||||
<Badge variant="secondary">
|
||||
{GetFormatedDate(row.getValue("updated_at"))}
|
||||
</Badge>
|
||||
|
|
|
|||
|
|
@ -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 }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 } }) => (
|
||||
<DataTableFilterButton
|
||||
label={str(
|
||||
GetTranslation(`validation.custom.${column.id}`),
|
||||
)
|
||||
label={str(GetTranslation(`validation.custom.${column.id}`))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
field={column.id}
|
||||
|
|
@ -42,15 +46,14 @@ const getColumns = () => {
|
|||
accessorKey: "amount",
|
||||
header: ({ column }: { column: { id: string } }) => (
|
||||
<DataTableFilterButton
|
||||
label={str(
|
||||
GetTranslation(`validation.custom.${column.id}`),
|
||||
)
|
||||
label={str(GetTranslation(`validation.custom.${column.id}`))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<InvoicePackageModel> }) => row.getValue("amount"),
|
||||
cell: ({ row }: { row: Row<InvoicePackageModel> }) =>
|
||||
row.getValue("amount"),
|
||||
},
|
||||
{
|
||||
accessorKey: "published",
|
||||
|
|
@ -102,7 +105,7 @@ const getColumns = () => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<DefaultModel> }) => (
|
||||
cell: ({ row }: { row: Row<InvoicePackageModel> }) => (
|
||||
<Badge variant="secondary">
|
||||
{GetFormatedDate(row.getValue("updated_at"))}
|
||||
</Badge>
|
||||
|
|
|
|||
|
|
@ -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 }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
accessorKey: "amount",
|
||||
header: str(
|
||||
GetTranslation("validation.custom.amount"),
|
||||
)
|
||||
.ucFirst()
|
||||
.value(),
|
||||
header: str(GetTranslation("validation.custom.amount")).ucFirst().value(),
|
||||
cell: ({ value }: { value: number }) => value,
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -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 } }) => (
|
||||
<DataTableFilterButton
|
||||
label={str(
|
||||
GetTranslation(`validation.custom.${column.id}`),
|
||||
)
|
||||
label={str(GetTranslation(`validation.custom.${column.id}`))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
field={column.id}
|
||||
|
|
@ -43,9 +41,7 @@ const getColumns = (noticeTypeEnum: LaravelEnum) => {
|
|||
accessorKey: "message",
|
||||
header: ({ column }: { column: { id: string } }) => (
|
||||
<DataTableFilterButton
|
||||
label={str(
|
||||
GetTranslation(`validation.custom.${column.id}`),
|
||||
)
|
||||
label={str(GetTranslation(`validation.custom.${column.id}`))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
field={column.id}
|
||||
|
|
@ -59,9 +55,7 @@ const getColumns = (noticeTypeEnum: LaravelEnum) => {
|
|||
accessorKey: "type",
|
||||
header: ({ column }: { column: { id: string } }) => (
|
||||
<DataTableFilterButton
|
||||
label={str(
|
||||
GetTranslation(`validation.custom.${column.id}`),
|
||||
)
|
||||
label={str(GetTranslation(`validation.custom.${column.id}`))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
field={column.id}
|
||||
|
|
@ -93,7 +87,7 @@ const getColumns = (noticeTypeEnum: LaravelEnum) => {
|
|||
field={column.id}
|
||||
/>
|
||||
),
|
||||
cell: ({ row }: { row: Row<DefaultModel> }) => (
|
||||
cell: ({ row }: { row: Row<NoticeModel> }) => (
|
||||
<Badge variant="secondary">
|
||||
{GetFormatedDate(row.getValue("updated_at"))}
|
||||
</Badge>
|
||||
|
|
|
|||
|
|
@ -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 }) => (
|
||||
<RenderTranslationCell value={value} />
|
||||
),
|
||||
},
|
||||
{
|
||||
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 }) => (
|
||||
<Badge variant="outline">
|
||||
{str(
|
||||
|
|
|
|||
|
|
@ -159,21 +159,22 @@ export default function Form({
|
|||
/>
|
||||
)}
|
||||
</FieldsetWrapper>
|
||||
{userModel.role.value === isConceptor!.value && (
|
||||
<FieldsetWrapper
|
||||
className="gap-4"
|
||||
title={transFormTitleVisibility}
|
||||
icon={<EyeIcon className="mr-1" />}
|
||||
description={transFormSubtitleVisibility}
|
||||
inline
|
||||
>
|
||||
<SimpleSwitch
|
||||
name="published"
|
||||
checked={data.published}
|
||||
setData={setData}
|
||||
/>
|
||||
</FieldsetWrapper>
|
||||
)}
|
||||
{userModel.role.value === isConceptor!.value &&
|
||||
userModel.email !== model?.email && (
|
||||
<FieldsetWrapper
|
||||
className="gap-4"
|
||||
title={transFormTitleVisibility}
|
||||
icon={<EyeIcon className="mr-1" />}
|
||||
description={transFormSubtitleVisibility}
|
||||
inline
|
||||
>
|
||||
<SimpleSwitch
|
||||
name="published"
|
||||
checked={data.published}
|
||||
setData={setData}
|
||||
/>
|
||||
</FieldsetWrapper>
|
||||
)}
|
||||
<div className="text-center">
|
||||
<SubmitButton
|
||||
modelTrans={useTrans(`uwil-backend::models.classes.${modelName}`, {
|
||||
|
|
|
|||
|
|
@ -83,7 +83,9 @@ const getColumns = () => {
|
|||
const rowRole = row.getValue("role") as UserModel["role"];
|
||||
return (
|
||||
<Badge variant="outline">
|
||||
{str(String(rowRole?.label ?? '')).ucFirst().value()}
|
||||
{str(String(rowRole?.label ?? ""))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ const getColumns = () => {
|
|||
.value(),
|
||||
cell: ({ value }: { value: UserModel["role"] }) => (
|
||||
<Badge variant="outline">
|
||||
{str(String(value?.label ?? '')).ucFirst().value()}
|
||||
{str(String(value?.label ?? ""))
|
||||
.ucFirst()
|
||||
.value()}
|
||||
</Badge>
|
||||
),
|
||||
},
|
||||
|
|
|
|||
15
resources/ts/back/types/project.d.ts
vendored
15
resources/ts/back/types/project.d.ts
vendored
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue