This commit is contained in:
hanif salafi 2025-08-04 08:47:58 +07:00
commit fd61c5311b
4 changed files with 114 additions and 17 deletions

View File

@ -23,7 +23,7 @@ import Swal from "sweetalert2";
import { useTranslations } from "next-intl";
const useTableColumns = () => {
const t = useTranslations("Table"); // Panggil di dalam hook
const t = useTranslations("Table");
const columns: ColumnDef<any>[] = [
{
accessorKey: "no",
@ -124,6 +124,85 @@ const useTableColumns = () => {
accessorKey: "action",
header: t("action", { defaultValue: "Action" }),
enableHiding: false,
// cell: ({ row }) => {
// const router = useRouter();
// const MySwal = withReactContent(Swal);
// async function deleteProcess(id: any) {
// loading();
// const resDelete = await deleteTask(id);
// if (resDelete?.error) {
// error(resDelete.message);
// return false;
// }
// success();
// }
// function success() {
// MySwal.fire({
// title: "Sukses",
// icon: "success",
// confirmButtonColor: "#3085d6",
// confirmButtonText: "OK",
// }).then((result) => {
// if (result.isConfirmed) {
// window.location.reload();
// }
// });
// }
// const TaskDelete = (id: any) => {
// MySwal.fire({
// title: "Hapus Data",
// text: "",
// icon: "warning",
// showCancelButton: true,
// cancelButtonColor: "#3085d6",
// confirmButtonColor: "#d33",
// confirmButtonText: "Hapus",
// }).then((result) => {
// if (result.isConfirmed) {
// deleteProcess(id);
// }
// });
// };
// return (
// <DropdownMenu>
// <DropdownMenuTrigger asChild>
// <Button
// size="icon"
// className="bg-transparent ring-offset-transparent hover:bg-transparent hover:ring-0 hover:ring-transparent"
// >
// <span className="sr-only">Open menu</span>
// <MoreVertical className="h-4 w-4 text-default-800" />
// </Button>
// </DropdownMenuTrigger>
// <DropdownMenuContent className="p-0" align="end">
// <Link href={`/contributor/task/detail/${row.original.id}`}>
// <DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
// <Eye className="w-4 h-4 me-1.5" />
// View
// </DropdownMenuItem>
// </Link>
// <Link href={`/contributor/task/update/${row.original.id}`}>
// <DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
// <SquarePen className="w-4 h-4 me-1.5" />
// Edit
// </DropdownMenuItem>
// </Link>
// <DropdownMenuItem
// onClick={() => TaskDelete(row.original.id)}
// className="p-2 border-b text-destructive bg-destructive/30 focus:bg-destructive focus:text-destructive-foreground rounded-none"
// >
// <Trash2 className="w-4 h-4 me-1.5" />
// Delete
// </DropdownMenuItem>
// </DropdownMenuContent>
// </DropdownMenu>
// );
// },
cell: ({ row }) => {
const router = useRouter();
const MySwal = withReactContent(Swal);
@ -168,6 +247,8 @@ const useTableColumns = () => {
});
};
const isDone = row.original.isDone;
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
@ -186,6 +267,9 @@ const useTableColumns = () => {
View
</DropdownMenuItem>
</Link>
{!isDone && (
<>
<Link href={`/contributor/task/update/${row.original.id}`}>
<DropdownMenuItem className="p-2 border-b text-default-700 group focus:bg-default focus:text-primary-foreground rounded-none">
<SquarePen className="w-4 h-4 me-1.5" />
@ -199,6 +283,8 @@ const useTableColumns = () => {
<Trash2 className="w-4 h-4 me-1.5" />
Delete
</DropdownMenuItem>
</>
)}
</DropdownMenuContent>
</DropdownMenu>
);

View File

@ -13,7 +13,7 @@ const TaskPage = () => {
const t = useTranslations("AnalyticsDashboard");
useEffect(() => {
function initState() {
checkAuthorization("admin"); // Specify the page, e.g., "admin" or another value
checkAuthorization("admin");
checkLoginSession();
}

View File

@ -1027,7 +1027,7 @@ export default function FormTaskDetail() {
<div className="mt-6 space-y-2">
<Label>{t("type-task", { defaultValue: "Type Task" })}</Label>
<RadioGroup
value={detail.assignmentMainType.id.toString()}
value={detail?.assignmentMainType?.id?.toString()}
onValueChange={(value) => setMainType(value)}
// value={String(mainType)}
// onValueChange={(value) => setMainType(Number(value))}

View File

@ -468,10 +468,21 @@ const DetailVideo = () => {
<div className="rounded-md overflow-hidden md:flex">
{/* Bagian Kiri */}
<div className="md:w-3/4">
<div className="relative">
{/* <div className="relative">
<VideoPlayer url={detailDataVideo?.files[selectedVideo]?.url} />
<div className="absolute top-4 left-4"></div>
</div> */}
<div className="relative max-h-screen overflow-hidden">
<div className="w-full max-h-screen aspect-video">
<div className="w-full h-full">
<VideoPlayer
url={detailDataVideo?.files[selectedVideo]?.url}
/>
</div>
</div>
<div className="absolute top-4 left-4"></div>
</div>
<div className="py-4 flex flex-row gap-3">
{detailDataVideo?.files?.map((file: any, index: number) => (
<div