diff --git a/app/[locale]/(protected)/supervisor/knowledge-base/create-category.tsx b/app/[locale]/(protected)/supervisor/knowledge-base/create-category.tsx new file mode 100644 index 00000000..0de9a8a2 --- /dev/null +++ b/app/[locale]/(protected)/supervisor/knowledge-base/create-category.tsx @@ -0,0 +1,110 @@ +"use client" +import { Button } from "@/components/ui/button" +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog" +import { CalendarIcon, Plus } from "lucide-react"; +import { zodResolver } from "@hookform/resolvers/zod" +import { useForm } from "react-hook-form" +import { z } from "zod" + +import { + Form, + FormControl, + FormField, + FormItem, + FormLabel, + FormMessage, +} from "@/components/ui/form" +import { Input } from "@/components/ui/input" +import { toast } from "@/components/ui/use-toast" +import { Textarea } from "@/components/ui/textarea"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import Image from "next/image"; +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { Calendar } from "@/components/ui/calendar"; +import { cn } from "@/lib/utils"; +import { format } from "date-fns"; +import { useState } from "react"; +import { useTranslations } from "next-intl"; +import { saveKnowledgeBaseCategory } from "@/service/master/knowledge-base"; + +const FormSchema = z.object({ + name: z.string().min(2, { + message: "Name must be at least 2 characters.", + }), +}) + +const CreateCategory = ({ onSuccess } : { onSuccess?: () => void } ) => { + const t = useTranslations("TodoApp") + const [isDialogOpen, setIsDialogOpen] = useState(false); + const form = useForm>({ + resolver: zodResolver(FormSchema), + defaultValues: { + name: "", + }, + }) + + async function save(data: any) { + const reqData = { + name: data.name + } + const response = await saveKnowledgeBaseCategory(reqData); + if (response?.error) { + return false; + } + toast({ + title: "Task created successfully.", + }); + if (onSuccess) { + onSuccess(); + } + } + + function onSubmit(data: z.infer) { + save(data); + setIsDialogOpen(false); + } + + return ( + + + + + + + Add Category + +
+ + ( + + Name + + + + + + )} + /> +
+ +
+ + +
+
+ ); +}; + +export default CreateCategory; \ No newline at end of file diff --git a/app/[locale]/(protected)/supervisor/knowledge-base/page.tsx b/app/[locale]/(protected)/supervisor/knowledge-base/page.tsx index 55edf433..fca7d79a 100644 --- a/app/[locale]/(protected)/supervisor/knowledge-base/page.tsx +++ b/app/[locale]/(protected)/supervisor/knowledge-base/page.tsx @@ -11,8 +11,9 @@ import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs"; import SiteBreadcrumb from "@/components/site-breadcrumb"; import {getKnowledgeBaseCategoryList, getKnowledgeBaseList} from "@/service/master/knowledge-base"; import React from "react"; -import {Plus} from "lucide-react"; +import {Plus, Trash2} from "lucide-react"; import {Button} from "@/components/ui/button"; +import CreateCategory from "./create-category"; const KnowledgeBase = () => { const [categories, setCategories] = React.useState([]); @@ -47,25 +48,26 @@ const KnowledgeBase = () => { - + {categories?.map((category: any, index: number) => ( - + { fetchQuestions(category?.id); }} className="data-[state=active]:bg-secondary data-[state=active]:text-default rounded-md px-6 py-3 w-full justify-start" - > - {category?.name} - + > + {category?.name} +
deleteCategory(category?.id)} + > + +
+
+ ))}
diff --git a/app/[locale]/(public)/audio/filter/page.tsx b/app/[locale]/(public)/audio/filter/page.tsx index bcf720de..6390f9b7 100644 --- a/app/[locale]/(public)/audio/filter/page.tsx +++ b/app/[locale]/(public)/audio/filter/page.tsx @@ -113,7 +113,7 @@ const FilterPage = () => {
{/* Sidebar Kiri */} -
+

Filter @@ -185,7 +185,7 @@ const FilterPage = () => { {/* Konten Kanan */} -
+

Urutkan berdasarkan

- {/* Card */} -
- {audioData?.map((audio: any) => ( - -
- - - -
-
-
- {formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | 518 -
-
{audio?.title}
-
-
-
- -
-
- # -
{audio?.duration}
- - + {/* Card */} + {audioData?.length > 0 ? ( +
+ {audioData?.map((audio: any) => ( + +
+ +
-
- - ))} -
+ +
+
+ {formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | 518 +
+
{audio?.title}
+
+
+
+ +
+
+ # +
{audio?.duration}
+ + + +
+
+ + ))} +
+ ) : ( +

+ empty +

+ )} +
diff --git a/app/[locale]/(public)/content-management/layout.tsx b/app/[locale]/(public)/content-management/layout.tsx new file mode 100644 index 00000000..fab820cf --- /dev/null +++ b/app/[locale]/(public)/content-management/layout.tsx @@ -0,0 +1,22 @@ +import LayoutProvider from "@/providers/layout.provider"; +import LayoutContentProvider from "@/providers/content.provider"; +import DashCodeSidebar from "@/components/partials/sidebar"; +import DashCodeFooter from "@/components/partials/footer"; +import ThemeCustomize from "@/components/partials/customizer"; +import DashCodeHeader from "@/components/partials/header"; + +import { redirect } from "@/components/navigation"; +import Footer from "@/components/landing-page/footer"; +import Navbar from "@/components/landing-page/navbar"; + +const layout = async ({ children }: { children: React.ReactNode }) => { + return ( + <> + + {children} +
+ + ); +}; + +export default layout; diff --git a/app/[locale]/(public)/content-management/page.tsx b/app/[locale]/(public)/content-management/page.tsx new file mode 100644 index 00000000..fe4c2f99 --- /dev/null +++ b/app/[locale]/(public)/content-management/page.tsx @@ -0,0 +1,377 @@ +"use client"; + +import { Link } from "@/i18n/routing"; +import { getInfoProfile, getListPorvinces, getUsersTeams } from "@/service/landing/landing"; +import { Icon } from "@iconify/react/dist/iconify.js"; +import React, { useEffect, useState } from "react"; +import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; +import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { formatDateToIndonesian } from "@/utils/globals"; +import { useParams } from "next/navigation"; +import { Card, CardContent } from "@/components/ui/card"; + +const dummyContent = [ + { title: "Operasi Zebra Nataru", thumbnail: "/assets/img-header-blog.png", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, + { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-2.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, + { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, + { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, + { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, + { title: "Operasi Zebra Nataru", thumbnail: "/assets/hot-topik-1.jpg", createdAt: "17 Agustus 2025", timezone: "14:20 WIB", clickCount: "28" }, +]; + +const ContentManagement = (props: { type: string }) => { + const [profile, setProfile] = useState(); + const [province, setProvince] = useState([]); + const [, setUser] = useState(); + const [selectedTab, setSelectedTab] = useState("video"); + const params = useParams(); + + // const currentRoute = router.pathname; + // const profilePicture = Cookies.get("profile_picture"); + + useEffect(() => { + async function initState() { + const response = await getInfoProfile(); + setProfile(response?.data?.data); + } + + async function getProvinces() { + const response = await getListPorvinces(); + + // console.log(response?.data.data); + setProvince(response?.data?.data); + } + + // async function getDisticts() { + // const response = await getListDistricts(); + // console.log(response?.data.data); + // setDistrict(response?.data.data); + // } + initState(); + getProvinces(); // getDisticts(); + }, []); + + useEffect(() => { + async function initState() { + if (profile != undefined) { + const response = await getUsersTeams(profile?.instituteId); + + // console.log(response?.data?.data); + setUser(response?.data?.data); + } + } + + initState(); + }, [profile]); + + function addDefaultProfile(ev: any) { + ev.target.src = "/assets/avatar-profile.png"; + } + + const [hasMounted, setHasMounted] = useState(false); + // Hooks + useEffect(() => { + setHasMounted(true); + }, []); + + // Render + if (!hasMounted) return null; + + return ( + <> +
+ {/* Header */} +
+
+
+ avatar +

{profile?.fullname}

+

{profile?.username}

+

+ Aktif Sejak + {`${new Date(profile?.createdAt).getDate()}/${new Date(profile?.createdAt).getMonth() + 1}/${new Date(profile?.createdAt).getFullYear()} ${new Date(profile?.createdAt).getHours()}:${new Date( + profile?.createdAt + ).getMinutes()}`} +

+
+ + + Pengaturan + +
+
+
+ +
+ {/* Konten Kiri */} +
+
+

Tentang Saya

+
+
    +
  • +

    Email

    +

    msabdayagra@gmail.com

    + {/*

    {profile?.email}

    */} +
  • +
  • +

    No Handphone

    +

    0812-7561-7204

    + {/*

    {profile?.phoneNumber}

    */} +
  • +
  • +

    Alamat

    +

    Jl. Besar Tembung no.12

    + {/*

    {profile?.address}

    */} +
  • +
  • +

    Kategori

    +

    POLRI

    + {/*

    {profile?.institute?.categoryRole?.name}

    */} +
  • +
  • +

    Instansi/Perusahaan

    +

    Div Humas Polri

    + {/*

    {profile?.institute?.name}

    */} +
  • +
+
+
+ +
+
+
+
+ +

Galeri Div Humas

+
+
+ +
+
+
+
+
+
+ +

Galeri Saya

+
+
+ +
+
+
+
+
+
+ +

Galeri Rewrite

+
+
+ +
+
+
+
+
+
+ +

Tim Pengguna

+
+
+ +
+
+
+
+
+ + {/* Kontent Kanan */} +
+
+

Galeri Div Humas

+
+
+
+
+ + + + Audio Visual + +
|
+ + Audio + +
|
+ + Foto + +
|
+ + Teks + +
+
+
+
+ {selectedTab == "video" ? ( + dummyContent?.length > 0 ? ( +
+ {dummyContent?.map((video: any) => ( + + + + +
+ {formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| + {video?.clickCount}{" "} + + + {" "} +
+
{video?.title}
+ +
+
+ ))} +
+ ) : ( +

+ empty +

+ ) + ) : selectedTab == "audio" ? ( + dummyContent?.length > 0 ? ( +
+ {dummyContent?.map((audio: any) => ( + +
+ + + +
+ +
+
+ {formatDateToIndonesian(new Date(audio?.createdAt))} {audio?.timezone ? audio?.timezone : "WIB"} | 518 +
+
{audio?.title}
+
+
+
+ +
+
+ # +
{audio?.duration}
+ + + +
+
+ + ))} +
+ ) : ( +

+ empty +

+ ) + ) : selectedTab == "image" ? ( + dummyContent?.length > 0 ? ( +
+ {dummyContent?.map((video: any) => ( + + + + +
+ {formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| + {video?.clickCount}{" "} + + + {" "} +
+
{video?.title}
+ +
+
+ ))} +
+ ) : ( +

+ empty +

+ ) + ) : dummyContent.length > 0 ? ( +
+ {dummyContent?.map((document: any) => ( + +
+ + + +
+ +
+
+ {formatDateToIndonesian(new Date(document?.createdAt))} {document?.timezone ? document?.timezone : "WIB"} | 518 +
+
{document?.title}
+
+ + + + Download Dokumen +
+
+ + ))} +
+ ) : ( +

+ empty +

+ )} +
+
+
+
+
+ + ); +}; + +export default ContentManagement; diff --git a/app/[locale]/(public)/document/filter/page.tsx b/app/[locale]/(public)/document/filter/page.tsx index b39e4df4..65326a74 100644 --- a/app/[locale]/(public)/document/filter/page.tsx +++ b/app/[locale]/(public)/document/filter/page.tsx @@ -503,33 +503,39 @@ const FilterPage = () => {
-
- {documentData?.map((document: any) => ( - -
- - - -
- -
-
- {formatDateToIndonesian(new Date(document?.createdAt))} {document?.timezone ? document?.timezone : "WIB"} | 518 -
-
{document?.title}
-
- - + {documentData?.length > 0 ? ( +
+ {documentData?.map((document: any) => ( + +
+ + - Download Dokumen
-
- - ))} -
+
+
+ {formatDateToIndonesian(new Date(document?.createdAt))} {document?.timezone ? document?.timezone : "WIB"} | 518 +
+
{document?.title}
+
+ + + + Download Dokumen +
+
+ + ))} +
+ ) : ( +

+ empty +

+ )} +
diff --git a/app/[locale]/(public)/image/filter/page.tsx b/app/[locale]/(public)/image/filter/page.tsx index eca5cb0d..e6017d29 100644 --- a/app/[locale]/(public)/image/filter/page.tsx +++ b/app/[locale]/(public)/image/filter/page.tsx @@ -478,28 +478,35 @@ const FilterPage = () => {
-
- {imageData?.map((image: any) => ( - - - - -
- {formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| - {image?.clickCount}{" "} - - - {" "} -
-
{image?.title}
- -
-
- ))} -
+ {imageData?.length > 0 ? ( +
+ {imageData?.map((image: any) => ( + + + + +
+ {formatDateToIndonesian(new Date(image?.createdAt))} {image?.timezone ? image?.timezone : "WIB"}| + {image?.clickCount}{" "} + + + {" "} +
+
{image?.title}
+ +
+
+ ))} +
+ ) : ( +

+ empty +

+ )} +

diff --git a/app/[locale]/(public)/polda/[polda_name]/page.tsx b/app/[locale]/(public)/polda/[polda_name]/page.tsx new file mode 100644 index 00000000..327fe918 --- /dev/null +++ b/app/[locale]/(public)/polda/[polda_name]/page.tsx @@ -0,0 +1,21 @@ +"use client"; + +import ContentCategory from "@/components/landing-page/content-category"; +import HeaderBanner from "@/components/landing-page/header-banner"; +import NewContent from "@/components/landing-page/new-content"; +import WelcomePolda from "@/components/landing-page/welcome-polda"; +import React from "react"; + +const page = () => { + return ( +
+ + + + + +
+ ); +}; + +export default page; diff --git a/app/[locale]/(public)/polda/layout.tsx b/app/[locale]/(public)/polda/layout.tsx new file mode 100644 index 00000000..fab820cf --- /dev/null +++ b/app/[locale]/(public)/polda/layout.tsx @@ -0,0 +1,22 @@ +import LayoutProvider from "@/providers/layout.provider"; +import LayoutContentProvider from "@/providers/content.provider"; +import DashCodeSidebar from "@/components/partials/sidebar"; +import DashCodeFooter from "@/components/partials/footer"; +import ThemeCustomize from "@/components/partials/customizer"; +import DashCodeHeader from "@/components/partials/header"; + +import { redirect } from "@/components/navigation"; +import Footer from "@/components/landing-page/footer"; +import Navbar from "@/components/landing-page/navbar"; + +const layout = async ({ children }: { children: React.ReactNode }) => { + return ( + <> + + {children} +
+ + ); +}; + +export default layout; diff --git a/app/[locale]/(public)/video/filter/page.tsx b/app/[locale]/(public)/video/filter/page.tsx index de017d24..e2a758bf 100644 --- a/app/[locale]/(public)/video/filter/page.tsx +++ b/app/[locale]/(public)/video/filter/page.tsx @@ -503,28 +503,35 @@ const FilterPage = () => {
-
- {videoData?.map((video: any) => ( - - - - -
- {formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| - {video?.clickCount}{" "} - - - {" "} -
-
{video?.title}
- -
-
- ))} -
+ {videoData?.length > 0 ? ( +
+ {videoData?.map((video: any) => ( + + + + +
+ {formatDateToIndonesian(new Date(video?.createdAt))} {video?.timezone ? video?.timezone : "WIB"}| + {video?.clickCount}{" "} + + + {" "} +
+
{video?.title}
+ +
+
+ ))} +
+ ) : ( +

+ empty +

+ )} +
diff --git a/components/landing-page/coverage.tsx b/components/landing-page/coverage.tsx index 8701aba2..b65280b7 100644 --- a/components/landing-page/coverage.tsx +++ b/components/landing-page/coverage.tsx @@ -2,48 +2,49 @@ import React, { useState } from "react"; import { Button } from "../ui/button"; import { Reveal } from "./Reveal"; import { Icon } from "@iconify/react/dist/iconify.js"; +import { Link } from "@/i18n/routing"; const Coverage: React.FC = () => { const [searchTerm, setSearchTerm] = useState(""); const [seeAllValue, setSeeAllValue] = useState(false); const regions = [ - { name: "Polda Metro Jaya", logo: "/assets/polda/polda-metro.png" }, - { name: "Polda Jawa Barat", logo: "/assets/polda/polda-jabar.png" }, - { name: "Polda Banten", logo: "/assets/polda/polda-banten.png" }, - { name: "Polda Jawa Tengah", logo: "/assets/polda/polda-jateng.png" }, - { name: "Polda D.I Yogyakarta", logo: "/assets/polda/polda-diy.png" }, - { name: "Polda Jawa Timur", logo: "/assets/polda/polda-jatim.png" }, - { name: "Polda Aceh", logo: "/assets/polda/polda-aceh.png" }, - { name: "Polda Sumatera Utara", logo: "/assets/polda/polda-sumut.png" }, - { name: "Polda Sumatera Barat", logo: "/assets/polda/polda-sumbar.png" }, - { name: "Polda Riau", logo: "/assets/polda/polda-riau.png" }, - { name: "Polda Kep. Riau", logo: "/assets/polda/polda-kepri.png" }, - { name: "Polda Jambi", logo: "/assets/polda/polda-jambi.png" }, - { name: "Polda Sumatera Selatan", logo: "/assets/polda/polda-sumsel.png" }, - { name: "Polda Kep. Bangka Belitung", logo: "/assets/polda/polda-bangkabelitung.png" }, - { name: "Polda Bengkulu", logo: "/assets/polda/polda-bengkulu.png" }, - { name: "Polda Lampung", logo: "/assets/polda/polda-lampung.png" }, - { name: "Polda Nusa Tenggara Barat", logo: "/assets/polda/polda-ntb.png" }, - { name: "Polda Nusa Tenggara Timur", logo: "/assets/polda/polda-ntt.png" }, - { name: "Polda Bali", logo: "/assets/polda/polda-bali.png" }, - { name: "Polda Kalimantan Barat", logo: "/assets/polda/polda-kalbar.png" }, - { name: "Polda Kalimantan Tengah", logo: "/assets/polda/polda-kalteng.png" }, - { name: "Polda Kalimantan Selatan", logo: "/assets/polda/polda-kalsel.png" }, - { name: "Polda Kalimantan Timur", logo: "/assets/polda/polda-kaltim.png" }, - { name: "Polda Kalimantan Utara", logo: "/assets/polda/polda-kalut.png" }, - { name: "Polda Sulawesi Tengah", logo: "/assets/polda/polda-sulteng.png" }, - { name: "Polda Sulawesi Utara", logo: "/assets/polda/polda-sulut.png" }, - { name: "Polda Gorontalo", logo: "/assets/polda/polda-gorontalo.png" }, - { name: "Polda Sulawesi Barat", logo: "/assets/polda/polda-sulbar.png" }, - { name: "Polda Sulawesi Selatan", logo: "/assets/polda/polda-sulsel.png" }, - { name: "Polda Sulawesi Tenggara", logo: "/assets/polda/polda-sultenggara.png" }, - { name: "Polda Maluku Utara", logo: "/assets/polda/polda-malut.png" }, - { name: "Polda Maluku", logo: "/assets/polda/polda-maluku.png" }, - { name: "Polda Papua Barat", logo: "/assets/polda/polda-papbar.png" }, - { name: "Polda Papua", logo: "/assets/polda/polda-papua.png" }, - { name: "Satuan Kerja POLRI", logo: "/assets/polda/polda-satker.jpeg" }, - { name: "Internasional", logo: "/assets/polda/internasional.png" }, + { name: "Polda Metro Jaya", slug: "metro-jaya", logo: "/assets/polda/polda-metro.png" }, + { name: "Polda Jawa Barat", slug: "jawa-barat", logo: "/assets/polda/polda-jabar.png" }, + { name: "Polda Banten", slug: "banten", logo: "/assets/polda/polda-banten.png" }, + { name: "Polda Jawa Tengah", slug: "jawa-tengah", logo: "/assets/polda/polda-jateng.png" }, + { name: "Polda D.I Yogyakarta", slug: "di-yogyakarta", logo: "/assets/polda/polda-diy.png" }, + { name: "Polda Jawa Timur", slug: "jawa-timur", logo: "/assets/polda/polda-jatim.png" }, + { name: "Polda Aceh", slug: "aceh", logo: "/assets/polda/polda-aceh.png" }, + { name: "Polda Sumatera Utara", slug: "sumatera-utara", logo: "/assets/polda/polda-sumut.png" }, + { name: "Polda Sumatera Barat", slug: "sumatera-barat", logo: "/assets/polda/polda-sumbar.png" }, + { name: "Polda Riau", slug: "riau", logo: "/assets/polda/polda-riau.png" }, + { name: "Polda Kep. Riau", slug: "kepulauan-riau", logo: "/assets/polda/polda-kepri.png" }, + { name: "Polda Jambi", slug: "jambi", logo: "/assets/polda/polda-jambi.png" }, + { name: "Polda Sumatera Selatan", slug: "sumatera-selatan", logo: "/assets/polda/polda-sumsel.png" }, + { name: "Polda Kep. Bangka Belitung", slug: "bangka-belitung", logo: "/assets/polda/polda-bangkabelitung.png" }, + { name: "Polda Bengkulu", slug: "bengkulu", logo: "/assets/polda/polda-bengkulu.png" }, + { name: "Polda Lampung", slug: "lampung", logo: "/assets/polda/polda-lampung.png" }, + { name: "Polda Nusa Tenggara Barat", slug: "ntb", logo: "/assets/polda/polda-ntb.png" }, + { name: "Polda Nusa Tenggara Timur", slug: "ntt", logo: "/assets/polda/polda-ntt.png" }, + { name: "Polda Bali", slug: "bali", logo: "/assets/polda/polda-bali.png" }, + { name: "Polda Kalimantan Barat", slug: "kalimantan-barat", logo: "/assets/polda/polda-kalbar.png" }, + { name: "Polda Kalimantan Tengah", slug: "kalimantan-tengah", logo: "/assets/polda/polda-kalteng.png" }, + { name: "Polda Kalimantan Selatan", slug: "kalimantan-selatan", logo: "/assets/polda/polda-kalsel.png" }, + { name: "Polda Kalimantan Timur", slug: "kalimantan-timur", logo: "/assets/polda/polda-kaltim.png" }, + { name: "Polda Kalimantan Utara", slug: "kalimantan-utara", logo: "/assets/polda/polda-kalut.png" }, + { name: "Polda Sulawesi Tengah", slug: "sulawesi-tengah", logo: "/assets/polda/polda-sulteng.png" }, + { name: "Polda Sulawesi Utara", slug: "sulawesi-utara", logo: "/assets/polda/polda-sulut.png" }, + { name: "Polda Gorontalo", slug: "gorontalo", logo: "/assets/polda/polda-gorontalo.png" }, + { name: "Polda Sulawesi Barat", slug: "sulawesi-barat", logo: "/assets/polda/polda-sulbar.png" }, + { name: "Polda Sulawesi Selatan", slug: "sulawesi-selatan", logo: "/assets/polda/polda-sulsel.png" }, + { name: "Polda Sulawesi Tenggara", slug: "sulawesi-tenggara", logo: "/assets/polda/polda-sultenggara.png" }, + { name: "Polda Maluku Utara", slug: "maluku-utara", logo: "/assets/polda/polda-malut.png" }, + { name: "Polda Maluku", slug: "maluku", logo: "/assets/polda/polda-maluku.png" }, + { name: "Polda Papua Barat", slug: "papua-barat", logo: "/assets/polda/polda-papbar.png" }, + { name: "Polda Papua", slug: "papua", logo: "/assets/polda/polda-papua.png" }, + { name: "Satuan Kerja POLRI", slug: "satker-polri", logo: "/assets/polda/polda-satker.jpeg" }, + { name: "Internasional", slug: "internasional", logo: "/assets/polda/internasional.png" }, ]; return ( @@ -68,22 +69,22 @@ const Coverage: React.FC = () => { {regions.map((region, index) => !seeAllValue ? ( index < 9 ? ( -
+
{region.name}

{region.name}

-
+ ) : ( "" ) ) : ( -
+
{region.name}

{region.name}

-
+ ) )} diff --git a/components/landing-page/header-banner.tsx b/components/landing-page/header-banner.tsx new file mode 100644 index 00000000..df0696b7 --- /dev/null +++ b/components/landing-page/header-banner.tsx @@ -0,0 +1,121 @@ +"use client"; +import { listData } from "@/service/landing/landing"; +import { useParams, usePathname, useRouter } from "next/navigation"; +import React, { useEffect, useState } from "react"; +import Skeleton, { SkeletonTheme } from "react-loading-skeleton"; +import { Link } from "@/i18n/routing"; +import { getPublicLocaleTimestamp } from "@/utils/globals"; +import { Icon } from "@iconify/react/dist/iconify.js"; +import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; + +const HeaderBanner = () => { + const router = useRouter(); + const params = useParams(); + const poldaName: any = params?.polda_name; + const asPath: any = usePathname(); + const [content, setContent] = useState([]); + + const [isBannerLoading, setIsBannerLoading] = useState(true); + const [centerPadding, setCenterPadding] = useState(); + + useEffect(() => { + // async function initState() { + // const res = await listCarousel(); + // setContent(res.data?.data); + // setCenterPadding(`${Math.trunc(Number(window.innerWidth) / 10 + 40)}px`); + // } + + async function fetchData() { + const res = await listData("1", "", "", 5, 0, "createdAt", "", "", poldaName); + let data = res?.data?.data?.content; + setContent(data); + setCenterPadding(`${Math.trunc(Number(window.innerWidth) / 10 + 40)}px`); + setIsBannerLoading(false); + console.log("Done"); + } + + fetchData(); + }, [params?.page]); + + const settings = { + className: "center", + // centerMode: true, + infinite: true, + centerPadding, + slidesToShow: 2, + autoplay: true, + speed: 1500, + autoplaySpeed: 15_000, + focusOnSelect: true, + responsive: [ + { + breakpoint: 768, + settings: { + arrows: false, + centerMode: true, + centerPadding: "60px", + slidesToShow: 1, + }, + }, + { + breakpoint: 480, + settings: { + arrows: false, + centerMode: true, + centerPadding: "20px", + slidesToShow: 1, + }, + }, + ], + }; + return ( +
+ {/* Header */} +
+ {isBannerLoading ? ( + + + + ) : ( +
+ + + {content?.map((row: any) => ( + +
+ +
+ {row?.categoryName} + +

{row.title}

+ +

+ {getPublicLocaleTimestamp(new Date(row?.createdAt))} WIB {" | "} + {row?.clickCount} +

+
+
+
+ ))} +
+ + +
+
+ )} +
+
+ ); +}; + +export default HeaderBanner; diff --git a/components/landing-page/navbar.tsx b/components/landing-page/navbar.tsx index 5723b4cf..39029e31 100644 --- a/components/landing-page/navbar.tsx +++ b/components/landing-page/navbar.tsx @@ -6,23 +6,8 @@ import { FiFile, FiImage, FiMusic, FiYoutube } from "react-icons/fi"; import { useParams, usePathname, useRouter } from "next/navigation"; import { generateLocalizedPath } from "@/utils/globals"; import { Link } from "@/i18n/routing"; -import { - NavigationMenu, - NavigationMenuContent, - NavigationMenuItem, - NavigationMenuLink, - NavigationMenuList, - NavigationMenuTrigger, - navigationMenuTriggerStyle, -} from "@/components/ui/navigation-menu"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuGroup, - DropdownMenuItem, - DropdownMenuSeparator, - DropdownMenuTrigger, -} from "../ui/dropdown-menu"; +import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, navigationMenuTriggerStyle } from "@/components/ui/navigation-menu"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu"; import Image from "next/image"; import { Icon } from "../ui/icon"; import { getCookiesDecrypt } from "@/lib/utils"; @@ -51,7 +36,6 @@ const Navbar = () => { const [language, setLanguage] = useState<"id" | "en">("id"); const [isOpen, setIsOpen] = useState(false); const fullname = getCookiesDecrypt("ufne"); - const roleName = getCookiesDecrypt("urne"); const levelName = getCookiesDecrypt("ulnae"); const roleId = getCookiesDecrypt("urie"); const [detail, setDetail] = useState(); @@ -64,11 +48,15 @@ const Navbar = () => { router.push("/"); }; + // const profilePicture = Cookies.get("profile_picture"); + const fullName = getCookiesDecrypt("ufne"); + const roleName = getCookiesDecrypt("urne"); + const handleLanguageChange = (lang: "id" | "en") => { setLanguage(lang); setIsOpen(false); }; - + useEffect(() => { async function initState() { const response = await getInfoProfile(); @@ -80,47 +68,25 @@ const Navbar = () => { initState(); }, []); + return (
{/* Logo */} - Media Hub Logo + Media Hub Logo {/* Mobile Menu Toggle */} - @@ -133,14 +99,7 @@ const Navbar = () => { - + { - - router.push( - generateLocalizedPath("/video/filter", String(locale)) - ) - } - className="flex items-start gap-1.5 p-2 " - > + router.push(generateLocalizedPath("/video/filter", String(locale)))} className="flex items-start gap-1.5 p-2 ">

Video

- - router.push( - generateLocalizedPath("/audio/filter", String(locale)) - ) - } - className="flex place-items-start gap-1.5 p-2 " - > + router.push(generateLocalizedPath("/audio/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2 ">

Audio

- - router.push( - generateLocalizedPath("/image/filter", String(locale)) - ) - } - className="flex place-items-start gap-1.5 p-2" - > + router.push(generateLocalizedPath("/image/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2">

Foto

- - router.push( - generateLocalizedPath( - "/document/filter", - String(locale) - ) - ) - } - className="flex place-items-start gap-1.5 p-2" - > + router.push(generateLocalizedPath("/document/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2">

Teks @@ -211,14 +139,7 @@ const Navbar = () => { - + { - + {

{/* Tombol Utama */} - @@ -303,30 +199,12 @@ const Navbar = () => { {/* Dropdown Menu */} {isOpen && (
- -
@@ -334,18 +212,9 @@ const Navbar = () => {
- + - + {
+
+ {fullName ? ( + <> + + + avatar-profile + +

{fullName}

+

{`(${roleName})`}

+
+
+ + + + + Profile + + + + + + Kelola Konten + + + + + + Keluar + + + +
+ + ) : ( + <> + + Masuk + + + Daftar + {" "} + + )} +
- {roleId === "5" || - roleId === "6" || - roleId === "7" || - roleId === "8" ? ( + {/* {roleId === "5" || roleId === "6" || roleId === "7" || roleId === "8" ? ( {detail !== undefined ? (
- {"Image"} + {"Image"}
-
- {detail?.fullname} -
+
{detail?.fullname}

({detail?.fullname})

@@ -399,11 +301,7 @@ const Navbar = () => { href: "/dashboard", }, ].map((item, index) => ( - + {item.name} @@ -415,11 +313,7 @@ const Navbar = () => {
- @@ -428,30 +322,15 @@ const Navbar = () => { - ) : roleId === "2" || - roleId === "3" || - roleId === "4" || - roleId === "9" || - roleId === "10" || - roleId === "11" || - roleId === "12" || - roleId === "13" ? ( + ) : roleId === "2" || roleId === "3" || roleId === "4" || roleId === "9" || roleId === "10" || roleId === "11" || roleId === "12" || roleId === "13" ? ( // Dropdown menu for roleId === 3 {detail !== undefined ? (
- {"Image"} + {"Image"}
-
- {detail?.fullname} -
+
{detail?.fullname}

({detail?.fullname})

@@ -476,11 +355,7 @@ const Navbar = () => { href: "/dashboard", }, ].map((item, index) => ( - + {item.name} @@ -492,11 +367,7 @@ const Navbar = () => {
- @@ -508,20 +379,14 @@ const Navbar = () => { ) : ( // Masuk and Daftar buttons for roleId === null
- + Masuk - + Daftar
- )} + )} */}
@@ -533,14 +398,7 @@ const Navbar = () => { - + { - - router.push( - generateLocalizedPath("/video/filter", String(locale)) - ) - } - className="flex items-start gap-1.5 p-2 hover:bg-white" - > + router.push(generateLocalizedPath("/video/filter", String(locale)))} className="flex items-start gap-1.5 p-2 hover:bg-white">

Video

- - router.push( - generateLocalizedPath("/audio/filter", String(locale)) - ) - } - className="flex place-items-start gap-1.5 p-2 hover:bg-white" - > + router.push(generateLocalizedPath("/audio/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2 hover:bg-white">

Audio

- - router.push( - generateLocalizedPath("/image/filter", String(locale)) - ) - } - className="flex place-items-start gap-1.5 p-2 hover:bg-white" - > + router.push(generateLocalizedPath("/image/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2 hover:bg-white">

Foto

- - router.push( - generateLocalizedPath( - "/document/filter", - String(locale) - ) - ) - } - className="flex place-items-start gap-1.5 p-2 hover:bg-white" - > + router.push(generateLocalizedPath("/document/filter", String(locale)))} className="flex place-items-start gap-1.5 p-2 hover:bg-white">

Teks @@ -611,14 +438,7 @@ const Navbar = () => { - + { - + {

{/* Tombol Utama Bahasa */} - @@ -702,30 +497,12 @@ const Navbar = () => { {/* Dropdown Menu */} {isOpen && (
- -
@@ -734,23 +511,25 @@ const Navbar = () => {
- +
- + {fullName ? ( +

{fullName}

+ ) : ( + <> + + Masuk + + + Daftar + {" "} + + )} + Masuk - + Daftar
diff --git a/components/landing-page/new-content.tsx b/components/landing-page/new-content.tsx index 88cdbf64..b586da7d 100644 --- a/components/landing-page/new-content.tsx +++ b/components/landing-page/new-content.tsx @@ -97,7 +97,9 @@ const NewContent = (props: { type: string }) => { ) : ( -

No Data

+

+ empty +

) ) : selectedTab == "audio" ? ( newContent?.length > 0 ? ( @@ -131,7 +133,9 @@ const NewContent = (props: { type: string }) => { ) : ( -

No Data

+

+ empty +

) ) : selectedTab == "image" ? ( newContent?.length > 0 ? ( @@ -155,7 +159,9 @@ const NewContent = (props: { type: string }) => { ) : ( -

No Data

+

+ empty +

) ) : newContent.length > 0 ? ( @@ -196,7 +202,9 @@ const NewContent = (props: { type: string }) => { ) : ( -

No Data

+

+ empty +

)}
diff --git a/components/landing-page/popular-polda.tsx b/components/landing-page/popular-polda.tsx new file mode 100644 index 00000000..2bf50272 --- /dev/null +++ b/components/landing-page/popular-polda.tsx @@ -0,0 +1,22 @@ +import React, { useEffect, useState } from "react"; +import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "@/components/ui/carousel"; +import { useParams, usePathname, useRouter } from "next/navigation"; +import { Icon } from "@iconify/react/dist/iconify.js"; +import { formatDateToIndonesian } from "@/utils/globals"; +import { getListContent } from "@/service/landing/landing"; +import { Link } from "@/i18n/routing"; +import { Reveal } from "./Reveal"; + +const PopularPolda = () => { + const [newContent, setNewContent] = useState(); + const [selectedTab, setSelectedTab] = useState("video"); + const router = useRouter(); + const pathname = usePathname(); + const params = useParams(); + const locale = params?.locale; + + return
popular-polda
; +}; + +export default PopularPolda; diff --git a/components/landing-page/welcome-polda.tsx b/components/landing-page/welcome-polda.tsx new file mode 100644 index 00000000..41236231 --- /dev/null +++ b/components/landing-page/welcome-polda.tsx @@ -0,0 +1,107 @@ +import { useParams, usePathname, useRouter } from "next/navigation"; +import React, { useEffect, useState } from "react"; +import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../ui/dropdown-menu"; +import { FiFile, FiImage, FiMusic, FiYoutube } from "react-icons/fi"; +import { Icon } from "@iconify/react/dist/iconify.js"; +import { capitalize } from "@/utils/globals"; + +const WelcomePolda = () => { + const router = useRouter(); + const asPath: any = usePathname(); + const params = useParams(); + const poldaName: any = params?.polda_name; + const [categorySelect, setCategorySelect] = useState("0"); + const [search, setSearch] = useState(); + + useEffect(() => { + function initState() { + console.log(categorySelect); + } + + initState(); + }, [categorySelect]); + + return ( +
+
+ {/* Heading */} +

+ Selamat Datang di Polda {poldaName.replace("-", " ")} +

+
+

+ Liputan resmi yang bersumber dari kegiatan Polri di Polda {poldaName.replace("-", " ")} +

+ + {/* Search Form */} +
+ {/* Dropdown */} +
+ + + + + + + Konten + + + + + + + + + + Audio Visual + + + + + + Audio + + + + + + Foto + + + + + + Teks + + + + +
+ + + + + + +
+
+ + {/* Search Input */} + + {/* Button */} + +
+
+
+ ); +}; + +export default WelcomePolda; diff --git a/components/loader.tsx b/components/loader.tsx index 5abf7705..aeb81237 100644 --- a/components/loader.tsx +++ b/components/loader.tsx @@ -4,15 +4,23 @@ import React from "react"; import { Loader2 } from "lucide-react"; import DashCodeLogo from "./dascode-logo"; import { useMounted } from "@/hooks/use-mounted"; +import Image from "next/image"; const Loader = () => { const mounted = useMounted() return ( mounted ? null :
- -

+ {/* */} + + {/*

DashCode -

+

*/}
diff --git a/components/partials/auth/login-form.tsx b/components/partials/auth/login-form.tsx index 09aba4f0..f968c3b5 100644 --- a/components/partials/auth/login-form.tsx +++ b/components/partials/auth/login-form.tsx @@ -19,9 +19,7 @@ import { warning } from "@/lib/swal"; // Schema validasi menggunakan zod const schema = z.object({ username: z.string().min(1, { message: "Judul diperlukan" }), - password: z - .string() - .min(4, { message: "Password must be at least 4 characters." }), + password: z.string().min(4, { message: "Password must be at least 4 characters." }), }); // Tipe untuk form values @@ -36,9 +34,7 @@ const LoginForm = () => { const [passwordType, setPasswordType] = React.useState("password"); const togglePasswordType = () => { - setPasswordType((prevType) => - prevType === "password" ? "text" : "password" - ); + setPasswordType((prevType) => (prevType === "password" ? "text" : "password")); }; const { @@ -84,29 +80,18 @@ const LoginForm = () => { const profile = await getProfile(access_token); console.log("PROFILE : ", profile?.data?.data); - if ( - profile?.data?.data?.isInternational == true || - profile?.data?.data?.isActive == false || - profile?.data?.data?.isDelete == true - ) { + if (profile?.data?.data?.isInternational == true || profile?.data?.data?.isActive == false || profile?.data?.data?.isDelete == true) { Object.keys(Cookies.get()).forEach((cookieName) => { Cookies.remove(cookieName); }); - warning( - "Akun Anda tidak dapat digunakan untuk masuk ke MediaHub Polri", - "/auth/login" - ); + warning("Akun Anda tidak dapat digunakan untuk masuk ke MediaHub Polri", "/auth/login"); } else { Cookies.set("home_path", profile.data?.data?.homePath, { expires: 1, }); - Cookies.set( - "profile_picture", - profile.data?.data?.profilePictureUrl, - { - expires: 1, - } - ); + Cookies.set("profile_picture", profile.data?.data?.profilePictureUrl, { + expires: 1, + }); Cookies.set("state", profile.data?.data?.userLevel?.name, { expires: 1, }); @@ -122,13 +107,9 @@ const LoginForm = () => { setCookiesEncrypt("ulie", profile.data.data?.userLevel?.id, { expires: 1, }); - setCookiesEncrypt( - "ulplie", - profile.data.data?.userLevel?.parentLevelId, - { - expires: 1, - } - ); + setCookiesEncrypt("ulplie", profile.data.data?.userLevel?.parentLevelId, { + expires: 1, + }); setCookiesEncrypt("ulne", profile.data.data?.userLevel?.levelNumber, { expires: 1, }); @@ -151,10 +132,7 @@ const LoginForm = () => { Number(profile.data.data?.roleId) == 11 || Number(profile.data.data?.roleId) == 12 ) { - if ( - profile.data.data?.userLevel?.id == 761 || - profile.data.data?.userLevel?.parentLevelId == 761 - ) { + if (profile.data.data?.userLevel?.id == 761 || profile.data.data?.userLevel?.parentLevelId == 761) { window.location.href = "/admin/welcome"; // router.push('/admin/dashboard'); Cookies.set("status", "login", { @@ -168,7 +146,7 @@ const LoginForm = () => { }); } } else { - // window.location.href = "/"; + window.location.href = "/"; Cookies.set("status", "login", { expires: 1, }); @@ -199,11 +177,7 @@ const LoginForm = () => { "border-destructive": errors.username, })} /> - {errors.username?.message && ( -
- {errors.username.message} -
- )} + {errors.username?.message &&
{errors.username.message}
}
@@ -211,33 +185,12 @@ const LoginForm = () => { Password
- -
- {passwordType === "password" ? ( - - ) : ( - - )} + +
+ {passwordType === "password" ? : }
- {errors.password?.message && ( -
- {errors.password.message} -
- )} + {errors.password?.message &&
{errors.password.message}
}
@@ -245,10 +198,7 @@ const LoginForm = () => {
- + Forgot Password?
diff --git a/components/table/task-plan/expand-list-view.tsx b/components/table/task-plan/expand-list-view.tsx new file mode 100644 index 00000000..0a7fd166 --- /dev/null +++ b/components/table/task-plan/expand-list-view.tsx @@ -0,0 +1,170 @@ +"use client"; +import { Button } from "@/components/ui/button"; +import { Collapsible, CollapsibleContent } from "@/components/ui/collapsible"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { close, loading } from "@/config/swal"; +import { Link } from "@/i18n/routing"; +import { + getPlanningDailyByTypeId, + getPlanningPagination, +} from "@/service/agenda-setting/agenda-setting"; +import { htmlToString, textEllipsis } from "@/utils/globals"; +import { MoreVertical } from "lucide-react"; +import { useEffect, useState } from "react"; + +export default function ExpandedData(props: { datas: any }) { + const { datas } = props; + const [isOpen, setIsOpen] = useState(""); + const [getData, setGetData] = useState(); + + const handleIsOpen = (id: string) => { + setIsOpen(id); + }; + + useEffect(() => { + if (isOpen !== "") { + fetchData(); + } + }, [isOpen]); + + async function fetchData() { + loading(); + const response = await getPlanningPagination(0, "", 10, 1, 1, isOpen); + + close(); + setupData(response.data?.data); + } + + function setupData(rawData: any) { + if (rawData != undefined) { + const dataContent = rawData?.content; + const data = []; + + for (const [i, element] of dataContent.entries()) { + element.no = i + 1; + data.push(element); + } + + setGetData(data); + } + } + return ( + + + + + + + + {datas?.map((data: any) => ( + <> + + + + + + + handleIsOpen(data.id)} + > + + + + + + + + + + {getData?.map((row: any) => ( + + + + + + + + + ))} + + + + ))} +
Judul PerencanaanBatas WaktuStatusAksi
+ handleIsOpen(data.id)}>{data.title} + + `disinni igninn membuat state untuk mennyimpan data isOpen` + } + > + {data.date} + {data.status} + + + + + + + + Detail + + + + + Edit + + + + Delete + + + +
NoJudul PerencanaanNama PembuatBatas WaktuStatusAksi
{row.no}{row.title}{row.createdByName}{row.date}{row.status} + + + + + + + + Detail + + + + + Edit + + + + Delete + + + +
+ ); +} diff --git a/components/table/task-plan/list-view-column.tsx b/components/table/task-plan/list-view-column.tsx index a8ff693a..f492caaf 100644 --- a/components/table/task-plan/list-view-column.tsx +++ b/components/table/task-plan/list-view-column.tsx @@ -26,6 +26,8 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; +import { Collapsible, CollapsibleContent } from "@/components/ui/collapsible"; +import ExpandedData from "./expand-list-view"; const columns: ColumnDef[] = [ { @@ -33,11 +35,7 @@ const columns: ColumnDef[] = [ header: "No", cell: ({ row }) => {row.getValue("no")}, }, - // { - // accessorKey: "title", - // header: "Judul Perencanaan", - // cell: ({ row }) => {row.getValue("title")}, - // }, + { accessorKey: "title", header: "Judul Perencanaan", @@ -52,54 +50,7 @@ const columns: ColumnDef[] = [ Rencanaan Mingguan - - - - - - - - {datas?.map((data: any) => ( - - - - - - - ))} -
Judul PerencanaanBatas WaktuStatusAksi
- {data.title} - {data.date}{data.status} - - - - - - - - Detail - - - - - Edit - - - - Delete - - - -
+ ); diff --git a/components/table/task-plan/list-view-social-media-column.tsx b/components/table/task-plan/list-view-social-media-column.tsx index 73bdc584..12cd60e3 100644 --- a/components/table/task-plan/list-view-social-media-column.tsx +++ b/components/table/task-plan/list-view-social-media-column.tsx @@ -26,6 +26,7 @@ import { DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; +import ExpandedData from "./expand-list-view"; const columns: ColumnDef[] = [ { @@ -52,54 +53,7 @@ const columns: ColumnDef[] = [ Rencanaan Mingguan - - - - - - - - {datas?.map((data: any) => ( - - - - - - - ))} -
Judul PerencanaanBatas WaktuStatusAksi
- {data.title} - {data.date}{data.status} - - - - - - - - Detail - - - - - Edit - - - - Hapus - - - -
+ ); diff --git a/lib/menus.ts b/lib/menus.ts index 5a5d16ac..94793001 100644 --- a/lib/menus.ts +++ b/lib/menus.ts @@ -32,6 +32,7 @@ export type Group = { export function getMenuList(pathname: string, t: any): Group[] { const roleId = getCookiesDecrypt("urie"); + console.log("roleId"); const levelNumber = getCookiesDecrypt("ulne"); const userLevelId = getCookiesDecrypt("ulie"); @@ -1676,6 +1677,265 @@ export function getMenuList(pathname: string, t: any): Group[] { ], }, ]; + } else if (Number(roleId) === 2) { + menusSelected = [ + { + groupLabel: t("apps"), + id: "dashboard", + menus: [ + { + id: "dashboard", + href: "/dashboard", + label: t("dashboard"), + active: pathname.includes("/dashboard"), + icon: "material-symbols:dashboard", + submenus: [ + { + href: "/dashboard", + label: "Executive", + active: pathname === "/dashboard", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/dashboard/breakdown", + label: "Breakdown", + active: pathname === "/dashboard/breakdown", + icon: "heroicons:arrow-trending-up", + children: [], + }, + ], + }, + ], + }, + { + groupLabel: "", + id: "agenda-setting", + menus: [ + { + id: "agenda-setting", + href: "/contributor/agenda-setting", + label: t("agenda-setting"), + active: pathname.includes("/agenda-setting"), + icon: "iconoir:journal-page", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "management-user", + menus: [ + { + id: "management-user-menu", + href: "/adminn/management-user", + label: "Management User", + active: pathname.includes("/management-user"), + icon: "clarity:users-solid", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "content-production", + menus: [ + { + id: "content-production", + href: "/curator/content-production", + label: t("content-production"), + active: pathname.includes("/content-production"), + icon: "fluent:content-view-gallery-16-regular", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "pattern-relation", + menus: [ + { + id: "pattern-relation", + href: "/curator/pattern-relation", + label: t("pattern-relation"), + active: pathname.includes("/pattern-relation"), + icon: "oui:app-index-pattern", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "performance-polda", + menus: [ + { + id: "performance-polda", + href: "/admin/performance-polda", + label: t("performance-polda"), + active: pathname.includes("/admin/performance-polda"), + icon: "ant-design:signal-filled", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "analysis", + menus: [ + { + id: "analysis", + href: "/admin/analysis", + label: t("analysis"), + active: pathname.includes("/task-plan"), + icon: "mdi:chart-line", + submenus: [ + { + href: "/admin/analysis/magement-content", + label: t("management-content"), + active: pathname === "/admin/analysis/magement-content", + icon: "", + children: [], + }, + { + href: "/admin/analysis/schedule", + label: t("schedule"), + active: pathname === "/admin/analysis/schedule", + icon: "heroicons:shopping-cart", + children: [], + }, + { + href: "/admin/analysis/feedback-center", + label: "Feedback Center", + active: pathname === "/admin/analysis/feedback-center", + icon: "heroicons:shopping-cart", + children: [], + }, + { + href: "/admin/analysis/emergency-issue", + label: "Emergency Issue", + active: pathname === "/admin/analysis/emergency-issue", + icon: "heroicons:shopping-cart", + children: [], + }, + ], + }, + ], + }, + + { + groupLabel: "", + id: "media-tracking", + menus: [ + { + id: "media-tracking", + href: "/curator/media-tracking", + label: t("media-tracking"), + active: pathname.includes("/media-tracking"), + icon: "material-symbols:map-search-outline", + submenus: [ + { + href: "/admin/media-tracking/media-online", + label: "Media Onlinne", + active: pathname === "/media-tracking/media-online", + icon: "heroicons:arrow-trending-up", + children: [], + }, + { + href: "/admin/media-tracking/news", + label: "Tracking Beritra Hari Ini", + active: pathname === "/media-tracking/news", + icon: "heroicons:arrow-trending-up", + children: [], + }, + ], + }, + ], + }, + { + groupLabel: "", + id: "contest", + menus: [ + { + id: "contest", + href: "/shared/contest", + label: t("contest"), + active: pathname.includes("/contest"), + icon: "ic:outline-emoji-events", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "communication", + menus: [ + { + id: "communication", + href: "/shared/communication", + label: t("communication"), + active: pathname.includes("/communication"), + icon: "token:chat", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "feedback", + menus: [ + { + id: "feedback", + href: "/curator/feedback", + label: t("feedback"), + active: pathname.includes("/feedback"), + icon: "mdi:feedback-outline", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "broadcast", + menus: [ + { + id: "broadcast", + href: "/admin/broadcast", + label: "Broadcast", + active: pathname.includes("/broadcast"), + icon: "mdi:broadcast", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "experts", + menus: [ + { + id: "experts", + href: "/admin/add-experts", + label: t("add-experts"), + active: pathname.includes("/add-experts"), + icon: "majesticons:user", + submenus: [], + }, + ], + }, + { + groupLabel: "", + id: "settings", + menus: [ + { + id: "settings", + href: "/admin/settings", + label: t("settings"), + active: pathname.includes("/settinng"), + icon: "material-symbols:settings", + submenus: [], + }, + ], + }, + ]; } return menusSelected; diff --git a/messages/en.json b/messages/en.json index 7428b5bf..b88b12f9 100644 --- a/messages/en.json +++ b/messages/en.json @@ -294,7 +294,11 @@ "purchaseList": "Purchase List", "sellers": "Sellers", "typography": "Typography", - "colors": "Colors" + "colors": "Colors", + "performance-polda": "Performance Polda", + "analysis": "Analysis", + "management-content": "Management Content", + "add-experts": "Add Experts" }, "Changelog": { "version": "Version's", diff --git a/messages/in.json b/messages/in.json index 6faa946b..f057ae12 100644 --- a/messages/in.json +++ b/messages/in.json @@ -146,7 +146,7 @@ "forward": "Forward", "collaboration": "Collaboration", "account-report": "Account Report", - "settings": "Settings", + "settings": "Pengaturan", "feedback": "Feedback", "content-production": "Produksi Konten", "pattern-relation": "Pola & Relasi", @@ -294,7 +294,11 @@ "purchaseList": "Purchase List", "sellers": "Sellers", "typography": "Typography", - "colors": "Colors" + "colors": "Colors", + "performance-polda": "Performa Polda", + "analysis": "Analisa", + "management-content": "Manajemen Konten", + "add-experts": "Tambah Tenaga Ahli" }, "Changelog": { "version": "Version's", diff --git a/package-lock.json b/package-lock.json index 1a187878..15eef23e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -111,6 +111,7 @@ "react-hot-toast": "^2.4.1", "react-icons": "^5.3.0", "react-leaflet": "^4.2.1", + "react-loading-skeleton": "^3.5.0", "react-player": "^2.16.0", "react-quill": "^0.0.2", "react-resizable-panels": "^2.0.19", @@ -11137,6 +11138,14 @@ "react-dom": "^18.0.0" } }, + "node_modules/react-loading-skeleton": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/react-loading-skeleton/-/react-loading-skeleton-3.5.0.tgz", + "integrity": "sha512-gxxSyLbrEAdXTKgfbpBEFZCO/P153DnqSCQau2+o6lNy1jgMRr2MmRmOzMmyrwSaSYLRB8g7b0waYPmUjz7IhQ==", + "peerDependencies": { + "react": ">=16.8.0" + } + }, "node_modules/react-player": { "version": "2.16.0", "resolved": "https://registry.npmjs.org/react-player/-/react-player-2.16.0.tgz", diff --git a/package.json b/package.json index 9bf2ee77..71c8239a 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,7 @@ "react-hot-toast": "^2.4.1", "react-icons": "^5.3.0", "react-leaflet": "^4.2.1", + "react-loading-skeleton": "^3.5.0", "react-player": "^2.16.0", "react-quill": "^0.0.2", "react-resizable-panels": "^2.0.19", diff --git a/public/assets/avatar-profile.png b/public/assets/avatar-profile.png new file mode 100644 index 00000000..8ccc4faf Binary files /dev/null and b/public/assets/avatar-profile.png differ diff --git a/public/assets/download.svg b/public/assets/download.svg new file mode 100644 index 00000000..a5b9301e --- /dev/null +++ b/public/assets/download.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/assets/empty-data.png b/public/assets/empty-data.png new file mode 100644 index 00000000..4970e7df Binary files /dev/null and b/public/assets/empty-data.png differ diff --git a/public/assets/mediahub-logo-min.png b/public/assets/mediahub-logo-min.png new file mode 100644 index 00000000..01007c53 Binary files /dev/null and b/public/assets/mediahub-logo-min.png differ diff --git a/service/agenda-setting/agenda-setting.ts b/service/agenda-setting/agenda-setting.ts index 4057fe6e..d6c34d98 100644 --- a/service/agenda-setting/agenda-setting.ts +++ b/service/agenda-setting/agenda-setting.ts @@ -22,7 +22,7 @@ export async function getPlanningDailyByTypeId( date: string, typeId: number ) { - const url = `planning/pagination/daily?enablePage=1&size=${size}&page=${page}&date=${date}&typeId=${typeId}${ + const url = `planning/pagination/daily?enablePage=1&time=1&size=${size}&page=${page}&date=${date}&typeId=${typeId}${ parentId ? `&parentId=${parentId}` : "" }`; return getAPIInterceptor(url); diff --git a/service/landing/landing.ts b/service/landing/landing.ts index 9bb95d37..203b9c7d 100644 --- a/service/landing/landing.ts +++ b/service/landing/landing.ts @@ -63,3 +63,15 @@ export async function listDataRegional(type: string, search: string, category: s export async function getUserLevelListByParent(id: any) { return await httpGetInterceptor(`users/user-levels/list?userLevelId=${id}`); } + +export async function getInfoProfile() { + return await httpGetInterceptor(`users/info`); +} + +export async function getListPorvinces() { + return await httpGetInterceptor(`public/users/provinces`) +} + +export async function getUsersTeams(id: any) { + return await httpGetInterceptor(`users?instituteId=${id}`) +} \ No newline at end of file diff --git a/service/master/knowledge-base.ts b/service/master/knowledge-base.ts index 5f9b5ec8..2d842711 100644 --- a/service/master/knowledge-base.ts +++ b/service/master/knowledge-base.ts @@ -1,5 +1,6 @@ import { httpGetInterceptor, + httpPostInterceptor, } from "../http-config/http-interceptor-service"; export async function getKnowledgeBaseCategoryList() { @@ -11,3 +12,8 @@ export async function getKnowledgeBaseList(id: number) { const url = `knowledge-base?categoryId=${id}`; return httpGetInterceptor(url); } + +export async function saveKnowledgeBaseCategory(data: any) { + const url = 'knowledge-base/category'; + return httpPostInterceptor(url, data); +} \ No newline at end of file diff --git a/utils/globals.tsx b/utils/globals.tsx index 4a62535e..aed43ec7 100644 --- a/utils/globals.tsx +++ b/utils/globals.tsx @@ -8,11 +8,7 @@ export const generateLocalizedPath = (href: string, locale: string): string => { return `/${locale}${href}`; }; -export function textEllipsis( - str: string, - maxLength: number, - { side = "end", ellipsis = "..." } = {} -) { +export function textEllipsis(str: string, maxLength: number, { side = "end", ellipsis = "..." } = {}) { if (str !== undefined && str?.length > maxLength) { switch (side) { case "start": @@ -69,3 +65,17 @@ export function getOnlyMonthAndYear(d: Date) { return `${pad(d.getMonth() + 1)}/${pad(d.getFullYear(), 4)}`; } +export function getPublicLocaleTimestamp(d: any) { + const pad = (n: any, s = 2) => `${new Array(s).fill(0)}${n}`.slice(-s); + return `${pad(d.getDate())}/${pad(d.getMonth() + 1)}/${pad(d.getFullYear(), 4)} ${pad(d.getHours())}:${pad(d.getMinutes())}`; +} + +export function capitalize(s: any) { + // return s[0].toUpperCase() + s.slice(1); + const splitStr = s.toLowerCase().split(" "); + for (let i = 0; i < splitStr.length; i++) { + splitStr[i] = splitStr[i].charAt(0).toUpperCase() + splitStr[i].slice(1); + } + return splitStr.join(" "); +} +