From 6ebea4da2d0bc187bbee8dcfbcfa5e00edd7b1d5 Mon Sep 17 00:00:00 2001 From: Rama Priyanto Date: Mon, 30 Dec 2024 20:23:15 +0700 Subject: [PATCH 1/5] feat:detail list task plan, admin view --- .../table/task-plan/expand-list-view.tsx | 170 ++++++++++++ .../table/task-plan/list-view-column.tsx | 57 +--- .../list-view-social-media-column.tsx | 50 +--- lib/menus.ts | 260 ++++++++++++++++++ messages/en.json | 6 +- messages/in.json | 8 +- service/agenda-setting/agenda-setting.ts | 2 +- 7 files changed, 448 insertions(+), 105 deletions(-) create mode 100644 components/table/task-plan/expand-list-view.tsx 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 eef2b3bf..06f13a35 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/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); From 032b3e647178a4cba8455dba33e9ded232ae182b Mon Sep 17 00:00:00 2001 From: sabdayagra Date: Mon, 30 Dec 2024 23:00:25 +0700 Subject: [PATCH 2/5] feat: add content-management section --- .../(public)/content-management/layout.tsx | 22 + .../(public)/content-management/page.tsx | 377 ++++++++++++++++++ .../(public)/polda/metro-jaya/page.tsx | 7 + components/landing-page/coverage.tsx | 5 +- components/landing-page/navbar.tsx | 83 +++- components/landing-page/new-content.tsx | 16 +- components/partials/auth/login-form.tsx | 86 +--- public/assets/avatar-profile.png | Bin 0 -> 34428 bytes public/assets/download.svg | 3 + public/assets/empty-data.png | Bin 0 -> 152475 bytes service/landing/landing.ts | 12 + 11 files changed, 526 insertions(+), 85 deletions(-) create mode 100644 app/[locale]/(public)/content-management/layout.tsx create mode 100644 app/[locale]/(public)/content-management/page.tsx create mode 100644 app/[locale]/(public)/polda/metro-jaya/page.tsx create mode 100644 public/assets/avatar-profile.png create mode 100644 public/assets/download.svg create mode 100644 public/assets/empty-data.png 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} +