diff --git a/resources/ts/back/Pages/DynamicPages/Form.tsx b/resources/ts/back/Pages/DynamicPages/Form.tsx
index 7eda1317..3f600404 100644
--- a/resources/ts/back/Pages/DynamicPages/Form.tsx
+++ b/resources/ts/back/Pages/DynamicPages/Form.tsx
@@ -1,6 +1,6 @@
// * Packages
import { useForm, usePage } from "@inertiajs/react";
-import { BookTextIcon, CogIcon, EyeIcon, ShieldAlertIcon } from "lucide-react";
+import { BookTextIcon, CogIcon, EyeIcon, GavelIcon, ShieldAlertIcon } from "lucide-react";
import { route } from "ziggy-js";
import { FormEvent, useEffect, useState } from "react";
// * Components shadcn
@@ -303,23 +303,35 @@ export default function Form({
setData={setData}
onSelectValue={(value) => setSelectedGroup(value)}
/>
-
+
+
+ }
+ tooltipContent={str(useTrans('back.slugify')).ucFirst().value()}
+ type="button"
+ variant="secondary"
+ onClick={() => {
+ console.log("test");
+ setData("slug", str(data.title).slug().value());
+ }}
+ />
+
{
- if (model?.picture && typeof model.picture === "string") {
- return model.picture.toLowerCase().endsWith(".gif");
- }
- if (isFile(data.picture)) {
- return data.picture.name.toLowerCase().endsWith(".gif");
- }
- return false;
- });
-
+ const [isGif, setIsGif] = useState(false);
const [dynamicKey, setDynamicKey] = useState(null);
const enumDynamicFieldTypes = usePage().props.enumDynamicFieldTypes as DynamicFieldTypes;
const enumNewsStatus = usePage().props.enumNewsStatus as LaravelEnum;
const enumNewsCategory = usePage().props.enumNewsCategory as LaravelEnum;
const { options, defaultValue } = mapLaravelEnumOptions(enumNewsCategory, model?.categories, "category");
+
/** Set messages success/errors */
const messages = {} as Record;
messages.titleSuccess = useTrans(
@@ -103,7 +95,6 @@ export default function Form({
unpublished_at: model?.unpublished_at ? model?.unpublished_at : null
});
-
const refreshFileFromDb = () => {
if (model && model.picture) {
const isGif = typeof model.picture === "string" && model.picture.toLowerCase().endsWith(".gif");
@@ -152,27 +143,24 @@ export default function Form({
)
}
-
-
- const SlugiFyButton = () => {
- return (
-
- );
- };
-
-
-
-
+ useEffect(() => {
+ setIsGif(() => {
+ if (model && model?.picture && typeof model.picture === "string") {
+ return model.picture.toLowerCase().endsWith(".gif");
+ }
+ if (isFile(data.picture)) {
+ return data.picture.name.toLowerCase().endsWith(".gif");
+ }
+ return false;
+ });
+ }, []);
return (
}
+ icon={}
description={useTrans("back.form_subtitle_configuration")}
className="sm:grid-cols-2 gap-4"
>
@@ -306,7 +300,7 @@ export default function Form({
}
+ icon={}
description={useTrans("back.form_subtitle_display")}
className="sm:grid-cols-2 gap-4"
>
@@ -340,20 +334,13 @@ export default function Form({
-
- {/*
-
-
-
-
-
*/}
}
+ icon={}
description={useTrans("back.form_subtitle_content")}
className="gap-4"
>
@@ -376,13 +363,12 @@ export default function Form({
setDynamicKey(Date.now());
}}
/>
-
{model && model.picture && (
+
}
tooltipContent="Remettre à l'état d'origine"
/>
@@ -390,7 +376,7 @@ export default function Form({
-
}
+ icon={}
description={useTrans("back.form_subtitle_additional_files")}
className="sm:grid-cols-2 gap-4"
>