diff --git a/app/[locale]/(protected)/admin/add-experts/component/column.tsx b/app/[locale]/(protected)/admin/add-experts/component/column.tsx index f4c66c85..dad8eee6 100644 --- a/app/[locale]/(protected)/admin/add-experts/component/column.tsx +++ b/app/[locale]/(protected)/admin/add-experts/component/column.tsx @@ -11,6 +11,12 @@ import { } from "@/components/ui/dropdown-menu"; import { Button } from "@/components/ui/button"; import { Link } from "@/components/navigation"; +import { useToast } from "@/components/ui/use-toast"; +import withReactContent from "sweetalert2-react-content"; +import Swal from "sweetalert2"; +import { useRouter } from "next/navigation"; +import { deleteUser } from "@/service/management-user/management-user"; +import { stringify } from "querystring"; const columns: ColumnDef[] = [ { @@ -30,9 +36,21 @@ const columns: ColumnDef[] = [ cell: ({ row }) => MABES, }, { - accessorKey: "experience", + accessorKey: "userRolePlacements", header: "Posisi", - cell: ({ row }) => {row.getValue("experience")}, + cell: ({ row }) => { + const placements = row.original.userRolePlacements || []; + const placement = placements.find( + (p: any) => p.roleId === 11 || p.roleId === 12 + ); + + let posisi = "-"; + if (placement) { + posisi = placement.roleId === 11 ? "Koorkurator" : "Kurator"; + } + + return {posisi}; + }, }, { accessorKey: "role.name", @@ -67,6 +85,37 @@ const columns: ColumnDef[] = [ header: "Actions", enableHiding: false, cell: ({ row }) => { + const { toast } = useToast(); + const MySwal = withReactContent(Swal); + const router = useRouter(); + const doDelete = async (id: number) => { + const response = await deleteUser(id); + if (response?.error) { + toast({ + title: stringify(response?.message), + variant: "destructive", + }); + } + toast({ + title: "Success delete", + }); + + router.push("?dataChange=true"); + }; + + const handleDelete = (id: number) => { + MySwal.fire({ + title: "Apakah anda ingin menghapus data user?", + showCancelButton: true, + confirmButtonColor: "#dc3545", + confirmButtonText: "Iya", + cancelButtonText: "Tidak", + }).then((result) => { + if (result.isConfirmed) { + doDelete(id); + } + }); + }; return ( @@ -92,7 +141,7 @@ const columns: ColumnDef[] = [ handleDeleteMedia(row.original.id)} + onClick={() => handleDelete(row.original.userKeycloakId)} className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none" > diff --git a/app/[locale]/(protected)/admin/add-experts/create/page.tsx b/app/[locale]/(protected)/admin/add-experts/create/page.tsx index ab33ac6e..ca70af09 100644 --- a/app/[locale]/(protected)/admin/add-experts/create/page.tsx +++ b/app/[locale]/(protected)/admin/add-experts/create/page.tsx @@ -472,14 +472,14 @@ export default function AddExpertForm() { )} ))} - + */}
diff --git a/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx b/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx index 0213be3c..ad0a8864 100644 --- a/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx @@ -159,7 +159,7 @@ const useTableColumns = () => { - {(roleId == 11 || roleId == 12) && ( + {(roleId == 11 || roleId == 12 || roleId == 19) && ( @@ -175,7 +175,7 @@ const useTableColumns = () => { )} - {roleId == 12 && ( + {(roleId == 11 || roleId == 12 || roleId == 19) && ( diff --git a/app/[locale]/(protected)/contributor/task-ta/detail-upload/image/[id]/page.tsx b/app/[locale]/(protected)/contributor/task-ta/detail-upload/image/[id]/page.tsx new file mode 100644 index 00000000..4713ac39 --- /dev/null +++ b/app/[locale]/(protected)/contributor/task-ta/detail-upload/image/[id]/page.tsx @@ -0,0 +1,15 @@ +import FormImageDetail from "@/components/form/content/task-ta/image-detail-form"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; + +const ImageDetailPage = async () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default ImageDetailPage; diff --git a/app/[locale]/(protected)/contributor/task-ta/page.tsx b/app/[locale]/(protected)/contributor/task-ta/page.tsx index d891a3e7..b1b9a4c5 100644 --- a/app/[locale]/(protected)/contributor/task-ta/page.tsx +++ b/app/[locale]/(protected)/contributor/task-ta/page.tsx @@ -38,7 +38,7 @@ const TaskTaPage = () => { {t("tabel")} {t("task-ta")}
- {roleId !== 12 && roleId !== 19 && ( + {roleId !== 12 && ( +
+ + + + +
+ +
+
+ + ( + + )} + /> + {errors.creatorName?.message && ( +

+ {errors.creatorName.message} +

+ )} +
+
+ +
+
+ +
+ {detail?.tags + ?.split(",") + .map((tag: string, index: number) => ( + + {tag.trim()} + + ))} +
+
+
+
+
+ +
+ handleCheckboxChange(5)} + /> + +
+
+ handleCheckboxChange(6)} + /> + +
+
+ handleCheckboxChange(7)} + /> + +
+
+ handleCheckboxChange(8)} + /> + +
+
+
+ +
+

{t("information")}:

+

{detail?.statusName}

+

Komentar

+

{approval?.message}

+

+ {" "} + {approval?.approvalBy?.fullname} |{" "} + {formatDateToIndonesian(approval?.approvalDate)} +

+ +
+ {/* {detail?.isPublish == false ? ( +
+ +
+ ) : ( + "" + )} */} + + + + + {t("leave-comment")} + + {status == "2" + ? files?.map((file, index) => ( +
+ {/* */} + + + {" "} +
+ + {isUserMabesApprover && ( +
+
+ + setupPlacement(index, "all", Boolean(e)) + } + /> + +
+
+ + setupPlacement(index, "mabes", Boolean(e)) + } + /> + +
+
+ + setupPlacement(index, "polda", Boolean(e)) + } + /> + +
+ +
+ + setupPlacement( + index, + "international", + Boolean(e) + ) + } + /> + +
+
+ )} +
+
+ )) + : ""} +
+