diff --git a/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx b/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx index c72dfaef..7068813f 100644 --- a/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx +++ b/app/[locale]/(protected)/contributor/agenda-setting/calender-view.tsx @@ -119,6 +119,9 @@ const CalendarView = ({ categories }: CalendarViewProps) => { ); const [selectedEventDate, setSelectedEventDate] = useState(null); const roleId = Number(getCookiesDecrypt("urie")) || 0; + const userLevelId = Number(getCookiesDecrypt("ulie")) || 0; + console.log("roleId", roleId); + console.log("userlevel", userLevelId); const [apiEvents, setApiEvents] = useState([]); const [Isloading, setLoading] = useState(false); const [draggableInitialized, setDraggableInitialized] = @@ -574,11 +577,11 @@ const CalendarView = ({ categories }: CalendarViewProps) => {
- + {roleId == 3 || roleId == 11 || roleId == 2 || roleId == 12 ? ( diff --git a/app/[locale]/(protected)/contributor/content/image/components/columns.tsx b/app/[locale]/(protected)/contributor/content/image/components/columns.tsx index 48819b15..e6afa317 100644 --- a/app/[locale]/(protected)/contributor/content/image/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/content/image/components/columns.tsx @@ -110,53 +110,29 @@ const columns: ColumnDef[] = [ ); }, }, + // { - accessorKey: "statusId", + accessorKey: "statusName", header: "Status", cell: ({ row }) => { - const userLevelId = 2; // Gantilah sesuai dengan konteks aplikasi - const statusId = Number(row.getValue("statusId")); - const reviewedAtLevel = row.original.reviewedAtLevel as string | null; - const needApprovalFromLevel = Number(row.original.needApprovalFromLevel); + const statusColors: Record = { + diterima: "bg-green-100 text-green-600", + "menunggu review": "bg-orange-100 text-orange-600", + }; - let statusName = row.getValue("statusName") as string; - let icon = "fa:times-circle"; - let statusClass = "bg-gray-100 text-gray-600"; - - if ( - (statusId === 2 && - reviewedAtLevel !== null && - !reviewedAtLevel.includes(`:${userLevelId}:`)) || - (statusId === 1 && needApprovalFromLevel === userLevelId) - ) { - statusName = "Menunggu Review"; - icon = "fa:hourglass-end"; - statusClass = "bg-orange-100 text-orange-600"; - } else if ( - statusId === 2 && - reviewedAtLevel?.includes(`:${userLevelId}:`) - ) { - icon = "fa:check-circle"; - statusClass = "bg-green-100 text-green-600"; - } else if (statusId === 2) { - icon = "fa:check-circle"; - statusClass = "bg-green-100 text-green-600"; - } else if (statusId === 3) { - icon = "fa:comment"; - statusClass = "bg-blue-100 text-blue-600"; - } else if (statusId === 1) { - icon = "fa:hourglass-end"; - statusClass = "bg-orange-100 text-orange-600"; - } + const status = row.getValue("statusName") as string; + const statusName = status?.toLocaleLowerCase(); + const statusStyles = + statusColors[statusName] || "bg-red-200 text-red-600"; return ( - {statusName} + {status} {/* Tetap tampilkan nilai asli */} ); }, diff --git a/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx b/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx index 01ed5e95..edb57893 100644 --- a/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx +++ b/app/[locale]/(protected)/contributor/content/spit/table-spit/table-spit.tsx @@ -47,6 +47,8 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Label } from "@/components/ui/label"; +import { useTranslations } from "next-intl"; +import { format } from "date-fns"; // export type CompanyData = { // no: number; @@ -77,7 +79,8 @@ const TableSPIT = () => { const [search, setSearch] = React.useState(""); const userId = getCookiesDecrypt("uie"); const userLevelId = getCookiesDecrypt("ulie"); - + const t = useTranslations("AnalyticsDashboard"); + const [dateFilter, setDateFilter] = React.useState(""); const [totalData, setTotalData] = React.useState(1); const [sorting, setSorting] = React.useState([]); const [columnFilters, setColumnFilters] = React.useState( @@ -117,7 +120,7 @@ const TableSPIT = () => { React.useEffect(() => { fetchData(); - }, [page, limit, search, statusFilter]); + }, [page, limit, search, statusFilter, dateFilter]); async function fetchData() { let isPublish; @@ -129,8 +132,18 @@ const TableSPIT = () => { isPublish = statusFilter.includes(1) ? false : true; } + const formattedStartDate = dateFilter + ? format(new Date(dateFilter), "yyyy-MM-dd") + : ""; + try { - const res = await listSPIT(page - 1, limit, search, isPublish); + const res = await listSPIT( + page - 1, + limit, + search, + formattedStartDate, + isPublish + ); const data = res?.data?.data; const contentData = data?.content || []; @@ -192,6 +205,15 @@ const TableSPIT = () => {

Filter

+
+ + setDateFilter(e.target.value)} + className="max-w-sm" + /> +
[] = [ const userRoleId: number = Number(getCookiesDecrypt("urie")); const userLevelNumber: number = Number(getCookiesDecrypt("ulne")); - // Mengambil data dari row.original agar lebih aman const isPublishForAll: boolean = Boolean(row.original.isPublishForAll); const isPublishForMabes: boolean = Boolean( row.original.isPublishForMabes ); - // Logika status berdasarkan role dan data dari API const isPending: boolean = - (userRoleId === 3 && userLevelNumber === 1 && !isPublishForAll) || // Role 3 dengan level 1 hanya publish jika isPublishForAll true - ((userRoleId === 11 || userRoleId === 12) && !isPublishForMabes); // Role 11 dan 12 hanya publish jika isPublishForMabes true + (userRoleId === 3 && userLevelNumber === 1 && !isPublishForAll) || + ((userRoleId === 11 || userRoleId === 12) && !isPublishForMabes); + + const isTerkirim: boolean = isPublishForMabes && !isPublishForAll; return ( - {isPending ? "Pending" : "Publish"} + {isPending ? "Pending" : isTerkirim ? "Terkirim" : "Publish"} ); }, diff --git a/app/[locale]/(protected)/shared/curated-content/giat-routine/image/detail/[id]/page.tsx b/app/[locale]/(protected)/shared/curated-content/giat-routine/image/detail/[id]/page.tsx index 133d85c1..8158413b 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-routine/image/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-routine/image/detail/[id]/page.tsx @@ -543,16 +543,25 @@ export default function DetailImage() { {/* Polda Checkbox */} + {/* Satker Checkbox */} + + {/* International Checkbox */}