diff --git a/app/[locale]/(protected)/admin/add-experts/component/column.tsx b/app/[locale]/(protected)/admin/add-experts/component/column.tsx index 37b97cab..309e8f46 100644 --- a/app/[locale]/(protected)/admin/add-experts/component/column.tsx +++ b/app/[locale]/(protected)/admin/add-experts/component/column.tsx @@ -61,6 +61,12 @@ const columns: ColumnDef[] = [ cell: ({ row }) => {row.getValue("experience")}, }, + { + accessorKey: "experience", + header: "Posisi", + cell: ({ row }) => {row.getValue("experience")}, + }, + { id: "actions", accessorKey: "action", diff --git a/app/[locale]/(protected)/admin/add-experts/create/page.tsx b/app/[locale]/(protected)/admin/add-experts/create/page.tsx index 3612d814..f0421ff4 100644 --- a/app/[locale]/(protected)/admin/add-experts/create/page.tsx +++ b/app/[locale]/(protected)/admin/add-experts/create/page.tsx @@ -24,7 +24,13 @@ import { SelectValue, } from "@/components/ui/select"; import { useEffect, useState } from "react"; -import { AdministrationLevelList, getListCompetencies, getListExperiences, saveUserInternal, saveUserRolePlacements } from "@/service/management-user/management-user"; +import { + AdministrationLevelList, + getListCompetencies, + getListExperiences, + saveUserInternal, + saveUserRolePlacements, +} from "@/service/management-user/management-user"; import { loading } from "@/config/swal"; const FormSchema = z.object({ @@ -58,7 +64,7 @@ export type Placements = { index: number; roleId?: string; userLevelId?: number; -} +}; export default function AddExpertForm() { const MySwal = withReactContent(Swal); @@ -67,7 +73,9 @@ export default function AddExpertForm() { resolver: zodResolver(FormSchema), }); const [incrementId, setIncrementId] = useState(1); - const [placementRows, setPlacementRows] = useState([{ index: 0, roleId: "", userLevelId: 0 }]); + const [placementRows, setPlacementRows] = useState([ + { index: 0, roleId: "", userLevelId: 0 }, + ]); const [userCompetencies, setUserCompetencies] = useState(); const [userExperiences, setUserExperiences] = useState(); const [userLevels, setUserLevels] = useState(); @@ -80,7 +88,7 @@ export default function AddExpertForm() { { id: "12", name: "Kurator", - } + }, ]; const onSubmit = async (data: z.infer) => { @@ -113,12 +121,12 @@ export default function AddExpertForm() { userCompetencyId: data.skills, userExperienceId: data.experiences, companyName: data.company, - } + }; loading(); const res = await saveUserInternal(dataReq); const resData = res?.data?.data; - const userProfileId = resData.id; + const userProfileId = resData?.id; var placementArr: any[] = []; placementRows.forEach((row: any) => { @@ -131,15 +139,14 @@ export default function AddExpertForm() { const dataReq2 = { userId: userProfileId, - placements: placementArr - } + placements: placementArr, + }; const res2 = await saveUserRolePlacements(dataReq2); const resData2 = res2?.data?.data; success("/admin/add-experts"); }; - function success(redirect: string): void { MySwal.fire({ title: '

Sukses

', @@ -180,7 +187,6 @@ export default function AddExpertForm() { setUserLevels(levelsArr); } - function successSubmit() { MySwal.fire({ title: "Sukses", @@ -194,7 +200,11 @@ export default function AddExpertForm() { }); } - const handleSelectionChange = (index: number, type: "roleId" | "userLevelId", value: string) => { + const handleSelectionChange = ( + index: number, + type: "roleId" | "userLevelId", + value: string + ) => { setPlacementRows((prevRows) => prevRows.map((row) => row.index === index ? { ...row, [type]: value } : row @@ -202,7 +212,6 @@ export default function AddExpertForm() { ); }; - const handleRemoveRow = (index: number) => { console.log(index); console.log(placementRows); @@ -212,7 +221,10 @@ export default function AddExpertForm() { }; const handleAddRow = () => { - setPlacementRows((prevRows: any) => [...prevRows, { index: incrementId, roleId: "", userLevelId: 0 }]); + setPlacementRows((prevRows: any) => [ + ...prevRows, + { index: incrementId, roleId: "", userLevelId: 0 }, + ]); setIncrementId((prevId) => prevId + 1); }; @@ -375,7 +387,11 @@ export default function AddExpertForm() { Penempatan {placementRows?.map((row: any) => (
- + handleSelectionChange(row.index, "roleId", e) + } + > @@ -389,7 +405,11 @@ export default function AddExpertForm() { ))} - + handleSelectionChange(row.index, "userLevelId", e) + } + > @@ -415,11 +435,7 @@ export default function AddExpertForm() { )}
))} - diff --git a/app/[locale]/auth/page.tsx b/app/[locale]/auth/page.tsx index c5eef2eb..145ffcc4 100644 --- a/app/[locale]/auth/page.tsx +++ b/app/[locale]/auth/page.tsx @@ -25,11 +25,23 @@ const Login = ({ params: { locale } }: { params: { locale: string } }) => {
- +
- +
@@ -40,12 +52,12 @@ const Login = ({ params: { locale } }: { params: { locale: string } }) => {
*/} -
+ {/*

{t("logInPlease")}

{t("acc")} {t("reg")}
-
+
*/} {/*
diff --git a/components/form/content/spit-convert-form.tsx b/components/form/content/spit-convert-form.tsx index f272446e..54ea4b48 100644 --- a/components/form/content/spit-convert-form.tsx +++ b/components/form/content/spit-convert-form.tsx @@ -813,7 +813,7 @@ export default function FormConvertSPIT() {
{files?.length > 1 && ( -
+
-
+
-
{ const router = useRouter(); @@ -52,7 +71,7 @@ const Hero: React.FC = () => { console.log(response); setHeroData(response?.data?.data?.content); }; - + return (
{/* Section Gambar Utama */} @@ -70,15 +89,31 @@ const Hero: React.FC = () => { {heroData?.map((list: any) => (
- gambar-utama + gambar-utama
- {list?.categoryName} + + {list?.categoryName} + -

{list?.title}

+

+ {list?.title} +

- {formatDateToIndonesian(new Date(list?.createdAt))} {list?.timezone ? list?.timezone : "WIB"}|{" "} - + {formatDateToIndonesian(new Date(list?.createdAt))}{" "} + {list?.timezone ? list?.timezone : "WIB"}|{" "} + {

) : ( -
    - {heroData?.map((item: any) => ( -
  • -
    - {item?.title} -
    -
    - {item?.categoryName} - -

    {item?.title}

    - -

    - {formatDateToIndonesian(new Date(item?.createdAt))} {item?.timezone ? item?.timezone : "WIB"} |{" "} - - - {" "} - {item?.clickCount} -

    -
    -
  • - ))} -
+
+
+ + + Nasional + Polda + Satker + + + + + +
+
    + {heroData?.map((item: any) => ( +
  • +
    + {item?.title} +
    +
    + + {item?.categoryName} + + +

    + {item?.title} +

    + +

    + {formatDateToIndonesian(new Date(item?.createdAt))}{" "} + {item?.timezone ? item?.timezone : "WIB"} |{" "} + + + {" "} + {item?.clickCount} +

    +
    +
  • + ))} +
+
)}
diff --git a/components/landing-page/news-tickers.tsx b/components/landing-page/news-tickers.tsx index 72b01cdc..85d00090 100644 --- a/components/landing-page/news-tickers.tsx +++ b/components/landing-page/news-tickers.tsx @@ -8,7 +8,7 @@ import { useTranslations } from "next-intl"; export default function NewsTicker() { const [article, setArticle] = useState([]); - const [currentNewsIndex, setCurrentNewsIndex] = useState(0); + const [currentNewsIndex, setCurrentNewsIndex] = useState(0); const [animate, setAnimate] = useState(false); const t = useTranslations("LandingPage"); @@ -38,13 +38,13 @@ export default function NewsTicker() { triggerAnimation(newIndex); }; - useEffect(() => { - const interval = setInterval(() => { - triggerAnimation((currentNewsIndex + 1) % article.length); - }, 7000); + // useEffect(() => { + // const interval = setInterval(() => { + // triggerAnimation((currentNewsIndex + 1) % article.length); + // }, 7000); - return () => clearInterval(interval); - }, [article?.length]); + // return () => clearInterval(interval); + // }, [article?.length]); return (
@@ -52,20 +52,42 @@ export default function NewsTicker() { {t("breakingNews")}
-
- -

{article[currentNewsIndex]?.title}

+ {/*
+ +

+ {article[currentNewsIndex]?.title} +

- -

{textEllipsis(article[currentNewsIndex]?.title, 28)}

+ +

+ {textEllipsis(article[currentNewsIndex]?.title, 28)} +

-

{formatDateToIndonesian(article[currentNewsIndex]?.createdAt)}

-
+

+ {formatDateToIndonesian(article[currentNewsIndex]?.createdAt)} +

+
*/} diff --git a/components/partials/auth/login-form.tsx b/components/partials/auth/login-form.tsx index 654a2860..a5481c7c 100644 --- a/components/partials/auth/login-form.tsx +++ b/components/partials/auth/login-form.tsx @@ -1,5 +1,5 @@ "use client"; -import React from "react"; +import React, { useState } from "react"; import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { Input } from "@/components/ui/input"; @@ -11,12 +11,19 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { z } from "zod"; import { cn, setCookiesEncrypt } from "@/lib/utils"; import { Loader2 } from "lucide-react"; -import { getProfile, login } from "@/service/auth"; +import { getProfile, login, requestOTP } from "@/service/auth"; import { toast } from "sonner"; import { useRouter } from "@/components/navigation"; import { warning } from "@/lib/swal"; import { Link } from "@/i18n/routing"; import { useTranslations } from "next-intl"; +import { + InputOTP, + InputOTPGroup, + InputOTPSeparator, + InputOTPSlot, +} from "@/components/ui/input-otp"; +import { error, loading } from "@/config/swal"; // Schema validasi menggunakan zod const schema = z.object({ @@ -38,6 +45,24 @@ const LoginForm = () => { const [passwordType, setPasswordType] = React.useState("password"); const t = useTranslations("LandingPage"); + const [isOtpStep, setIsOtpStep] = useState(false); + const [otpValue, setOtpValue] = useState(""); + const [userIdentity] = useState(); + const [email, setEmail] = useState(); + const [category, setCategory] = useState("5"); + + const handleSignInClick = () => { + handleSendOTP(); + setIsOtpStep(true); + }; + + const [otp1, setOtp1] = useState(); + const [otp2, setOtp2] = useState(); + const [otp3, setOtp3] = useState(); + const [otp4, setOtp4] = useState(); + const [otp5, setOtp5] = useState(); + const [otp6, setOtp6] = useState(); + const togglePasswordType = () => { setPasswordType((prevType) => prevType === "password" ? "text" : "password" @@ -53,6 +78,40 @@ const LoginForm = () => { mode: "all", }); + const handleTypeOTP = (event: any) => { + const { form } = event.target; + const index = [...form].indexOf(event.target); + form.elements[index + 1].focus(); + event.preventDefault(); + }; + + // const handleNextStep = () => { + // setIsOtpStep(true); + // }; + + const handleSendOTP = async () => { + console.log(userIdentity, email); + + console.log("UMUM"); + if (email != "") { + const data = { + memberIdentity: null, + email: "", + category, + }; + + // loading(); + const response = await requestOTP(data); + + if (response.error) { + error(response.message); + return false; + } + + close(); + } + }; + // Fungsi submit form const onSubmit: SubmitHandler = async (data) => { try { @@ -202,77 +261,129 @@ const LoginForm = () => { return (
-
- - - {errors.username?.message && ( -
- {errors.username.message} + {!isOtpStep && ( + <> +
+

+ {t("logInPlease")} +

+
+ {t("acc")} {t("reg")} +
- )} -
- -
- -
- -
- {passwordType === "password" ? ( - - ) : ( - +
+ + + {errors.username?.message && ( +
+ {errors.username.message} +
)}
-
- {errors.password?.message && ( -
- {errors.password.message} -
- )} -
-
-
- - -
- - {t("forgotPass")} - -
- +
+ +
+ +
+ {errors.password?.message && ( +
+ {errors.password.message} +
+ )} +
+
+
+ + +
+ + {t("forgotPass")} + +
+ + + )} + + {isOtpStep && ( + <> +
+

+ {t("pleaseEnterOtp")} +

+
+
+ setOtpValue(e)}> + + setOtp1(e.target.value)} + onKeyUp={handleTypeOTP} + /> + setOtp2(e.target.value)} + onKeyUp={handleTypeOTP} + /> + + + + setOtp3(e.target.value)} + onKeyUp={handleTypeOTP} + /> + setOtp4(e.target.value)} + onKeyUp={handleTypeOTP} + /> + + + + setOtp5(e.target.value)} + onKeyUp={handleTypeOTP} + /> + setOtp6(e.target.value)} + onKeyUp={handleTypeOTP} + /> + + +
+ + + )} ); }; diff --git a/lib/menus.ts b/lib/menus.ts index 3a46061f..d03f9fd7 100644 --- a/lib/menus.ts +++ b/lib/menus.ts @@ -2312,6 +2312,70 @@ export function getMenuList(pathname: string, t: any): Group[] { }, ], }, + { + groupLabel: "", + id: "settings", + menus: [ + { + id: "settings", + href: "/admin/settings", + label: t("settings"), + active: pathname.includes("/settinng"), + icon: "material-symbols:settings", + submenus: [ + { + href: "/admin/settings/category", + label: t("category"), + active: pathname === "/admin/settings/category", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/tag", + label: "Tag", + active: pathname === "/admin/settings/tag", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/banner", + label: "Banner", + active: pathname === "/admin/settings/banner", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/feedback", + label: "Feedback", + active: pathname === "/admin/settings/feedback", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/faq", + label: "FAQ", + active: pathname === "/admin/settings/faq", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "https://nat-mediahub.polri.go.id/", + label: "Mediahub 2022", + active: pathname === "/admin/settings/mediahub-2022", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/privacy", + label: t("privacy"), + active: pathname === "/admin/settings/privacy", + icon: "heroicons:arrow-trending-up", + children: [], + }, + ], + }, + ], + }, ]; } else if (Number(userParentLevelId) == 761) { menusSelected = [ @@ -2521,6 +2585,70 @@ export function getMenuList(pathname: string, t: any): Group[] { }, ], }, + { + groupLabel: "", + id: "settings", + menus: [ + { + id: "settings", + href: "/admin/settings", + label: t("settings"), + active: pathname.includes("/settinng"), + icon: "material-symbols:settings", + submenus: [ + { + href: "/admin/settings/category", + label: t("category"), + active: pathname === "/admin/settings/category", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/tag", + label: "Tag", + active: pathname === "/admin/settings/tag", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/banner", + label: "Banner", + active: pathname === "/admin/settings/banner", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/feedback", + label: "Feedback", + active: pathname === "/admin/settings/feedback", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/faq", + label: "FAQ", + active: pathname === "/admin/settings/faq", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "https://nat-mediahub.polri.go.id/", + label: "Mediahub 2022", + active: pathname === "/admin/settings/mediahub-2022", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/settings/privacy", + label: t("privacy"), + active: pathname === "/admin/settings/privacy", + icon: "heroicons:arrow-trending-up", + children: [], + }, + ], + }, + ], + }, ]; } } else if (Number(roleId) == 9) { diff --git a/messages/en.json b/messages/en.json index bde88e71..36d622b5 100644 --- a/messages/en.json +++ b/messages/en.json @@ -420,6 +420,7 @@ "audioSize": "Audio Size Options", "relatedPosts": "Related Posts", "logInPlease": "Please Log In to Your Account First", + "pleaseEnterOtp": "Please enter the OTP code first", "acc": "Don't have an account yet?", "reg": "Register", "password": "Password", diff --git a/messages/in.json b/messages/in.json index 69d234dd..36199c24 100644 --- a/messages/in.json +++ b/messages/in.json @@ -421,6 +421,7 @@ "audioSize": "Opsi Ukuran Audio", "relatedPosts": "Post Terkait", "logInPlease": "Silahkan masuk ke akun Anda terlebih dahulu", + "pleaseEnterOtp": "Silahkan masukan Kode OTP terlebih dahulu", "acc": "Belum Punya Akun?", "reg": "Daftar", "password": "Kata Sandi",