From 54633d8936e0d17d1b4427896f0cdac119467b59 Mon Sep 17 00:00:00 2001 From: Sabda Yagra Date: Wed, 6 Aug 2025 22:24:30 +0700 Subject: [PATCH] fixing --- .../admin/settings/iklan/component/column.tsx | 33 ++++++++++++-- .../admin/settings/iklan/component/table.tsx | 43 +++++++++++-------- .../content/spit/table-spit/columns.tsx | 24 +++++++---- .../contributor/task/components/columns.tsx | 30 ++++++++++++- .../form/setting/form-add-iklan-detail.tsx | 17 +++++++- components/form/setting/form-add-iklan.tsx | 4 +- components/landing-page/navbar.tsx | 2 +- 7 files changed, 119 insertions(+), 34 deletions(-) diff --git a/app/[locale]/(protected)/admin/settings/iklan/component/column.tsx b/app/[locale]/(protected)/admin/settings/iklan/component/column.tsx index ed75ad08..194d4e74 100644 --- a/app/[locale]/(protected)/admin/settings/iklan/component/column.tsx +++ b/app/[locale]/(protected)/admin/settings/iklan/component/column.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { ColumnDef } from "@tanstack/react-table"; import { Eye, MoreVertical, SquarePen, Trash2 } from "lucide-react"; -import { cn } from "@/lib/utils"; +import { cn, getCookiesDecrypt } from "@/lib/utils"; import { DropdownMenu, DropdownMenuContent, @@ -78,7 +78,7 @@ const columns: ColumnDef[] = [ enableHiding: false, cell: ({ row }) => { const MySwal = withReactContent(Swal); - + const levelNumber = getCookiesDecrypt("ulne"); async function doDelete(id: any) { // loading(); const data = { @@ -132,7 +132,7 @@ const columns: ColumnDef[] = [ - + {/* @@ -152,6 +152,33 @@ const columns: ColumnDef[] = [ Delete + */} + + + + + View + + + + {levelNumber === "1" && ( + <> + + + + Edit + + + + handleDeleteAdvertisements(row.original.id)} + className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none" + > + + Delete + + + )} ); diff --git a/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx b/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx index 87fc408b..7d3ba29b 100644 --- a/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx +++ b/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx @@ -39,7 +39,7 @@ import { UploadIcon, UserIcon, } from "lucide-react"; -import { cn } from "@/lib/utils"; +import { cn, getCookiesDecrypt } from "@/lib/utils"; import { DropdownMenu, DropdownMenuContent, @@ -94,6 +94,9 @@ const AdvertisementsList = () => { const [statusFilter, setStatusFilter] = React.useState([]); const [page, setPage] = React.useState(1); const [totalPage, setTotalPage] = React.useState(1); + const roleId = getCookiesDecrypt("urie"); + const levelNumber = getCookiesDecrypt("ulne"); + const userLevelId = getCookiesDecrypt("ulie"); const table = useReactTable({ data: dataTable, columns, @@ -203,23 +206,27 @@ const AdvertisementsList = () => { return ( <>
-
- - {dataTable.length == 4 && ( -

- Jumlah Iklan Sudah Maksimal (4) -

- )} -
+ {levelNumber === "1" && ( +
+ + + + {dataTable.length == 4 && ( +

+ Jumlah Iklan Sudah Maksimal (4) +

+ )} +
+ )} + {/* */}
diff --git a/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx b/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx index 3cdc0f66..15de93c8 100644 --- a/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx +++ b/app/[locale]/(protected)/contributor/content/spit/table-spit/columns.tsx @@ -8,7 +8,7 @@ import { Trash2, } from "lucide-react"; import { Button } from "@/components/ui/button"; -import { Checkbox } from "@/components/ui/checkbox"; +import { Checkbox } from "@/components/ui/checkbox"; import { DropdownMenu, DropdownMenuContent, @@ -20,6 +20,7 @@ import { Link } from "@/components/navigation"; import { useTranslations } from "next-intl"; import withReactContent from "sweetalert2-react-content"; import Swal from "sweetalert2"; +import { useState } from "react"; const useTableColumns = () => { const t = useTranslations("Table"); @@ -37,7 +38,6 @@ const useTableColumns = () => { onCheckedChange={(val) => table.toggleAllPageRowsSelected(!!val)} aria-label="Pilih semua pada halaman ini" /> - ), cell: ({ row }) => ( { enableHiding: false, cell: ({ row }) => { const isDisabled = row.original.isPublish; + const [open, setOpen] = useState(false); + + const handleClick = (e: React.MouseEvent) => { + if (e.ctrlKey) { + console.log("Ctrl + Click detected"); + } + // Paksa buka menu meskipun ctrl ditekan + setOpen(true); + }; + return ( - +