2025-09-16 08:29:07 +00:00
|
|
|
"use client";
|
2025-10-11 10:07:14 +00:00
|
|
|
import React, { useEffect, useRef, useState } from "react";
|
2025-09-16 08:29:07 +00:00
|
|
|
import { useForm, Controller } from "react-hook-form";
|
|
|
|
|
import { Input } from "@/components/ui/input";
|
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
|
import { Label } from "@/components/ui/label";
|
|
|
|
|
import { Card } from "@/components/ui/card";
|
|
|
|
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
|
|
|
import * as z from "zod";
|
|
|
|
|
import Swal from "sweetalert2";
|
|
|
|
|
import withReactContent from "sweetalert2-react-content";
|
|
|
|
|
import { useParams, useRouter } from "next/navigation";
|
|
|
|
|
import {
|
|
|
|
|
Select,
|
|
|
|
|
SelectContent,
|
|
|
|
|
SelectItem,
|
|
|
|
|
SelectTrigger,
|
|
|
|
|
SelectValue,
|
|
|
|
|
} from "@/components/ui/select";
|
|
|
|
|
import { Checkbox } from "@/components/ui/checkbox";
|
|
|
|
|
import Cookies from "js-cookie";
|
|
|
|
|
import {
|
2025-10-11 10:07:14 +00:00
|
|
|
getArticleDetail,
|
|
|
|
|
publishMedia,
|
2025-09-16 08:29:07 +00:00
|
|
|
submitApproval,
|
|
|
|
|
} from "@/service/content/content";
|
2025-10-11 10:07:14 +00:00
|
|
|
import { getDataApprovalByMediaUpload } from "@/service/curated-content/curated-content";
|
2025-09-16 08:29:07 +00:00
|
|
|
import { Badge } from "@/components/ui/badge";
|
|
|
|
|
import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
|
|
import "swiper/css";
|
|
|
|
|
import "swiper/css/navigation";
|
|
|
|
|
import "swiper/css/pagination";
|
|
|
|
|
import "swiper/css/thumbs";
|
|
|
|
|
import { FreeMode, Navigation, Pagination, Thumbs } from "swiper/modules";
|
|
|
|
|
import {
|
|
|
|
|
DialogHeader,
|
|
|
|
|
DialogFooter,
|
|
|
|
|
Dialog,
|
|
|
|
|
DialogContent,
|
|
|
|
|
DialogTitle,
|
|
|
|
|
} from "@/components/ui/dialog";
|
|
|
|
|
import { Textarea } from "@/components/ui/textarea";
|
2025-10-11 10:07:14 +00:00
|
|
|
import { close, loading, successCallback } from "@/config/swal";
|
2025-09-16 08:29:07 +00:00
|
|
|
import { getCookiesDecrypt } from "@/lib/utils";
|
|
|
|
|
import { Icon } from "@iconify/react/dist/iconify.js";
|
|
|
|
|
import { error } from "@/lib/swal";
|
|
|
|
|
import dynamic from "next/dynamic";
|
|
|
|
|
import { formatDateToIndonesian } from "@/utils/globals";
|
|
|
|
|
import ApprovalHistoryModal from "@/components/modal/approval-history-modal";
|
2025-10-11 13:04:06 +00:00
|
|
|
import { listArticleCategories } from "@/service/content";
|
2025-09-16 08:29:07 +00:00
|
|
|
|
2025-10-11 10:07:14 +00:00
|
|
|
const videoSchema = z.object({
|
2025-09-16 08:29:07 +00:00
|
|
|
title: z.string().min(1, { message: "Judul diperlukan" }),
|
2025-10-11 10:07:14 +00:00
|
|
|
description: z.string().min(2, { message: "Deskripsi diperlukan" }),
|
2025-09-16 08:29:07 +00:00
|
|
|
creatorName: z.string().min(1, { message: "Creator diperlukan" }),
|
2025-10-11 10:07:14 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const ViewEditor = dynamic(() => import("@/components/editor/view-editor"), {
|
|
|
|
|
ssr: false,
|
2025-09-16 08:29:07 +00:00
|
|
|
});
|
|
|
|
|
|
2025-10-14 08:17:22 +00:00
|
|
|
type Category = { id: string; title: string };
|
2025-09-16 08:29:07 +00:00
|
|
|
type FileType = {
|
|
|
|
|
id: number;
|
|
|
|
|
fileName: string;
|
2025-10-11 10:07:14 +00:00
|
|
|
fileUrl?: string;
|
|
|
|
|
fileThumbnail?: string;
|
2025-09-16 08:29:07 +00:00
|
|
|
};
|
|
|
|
|
type Detail = {
|
2025-10-11 10:07:14 +00:00
|
|
|
id: number;
|
2025-09-16 08:29:07 +00:00
|
|
|
title: string;
|
|
|
|
|
description: string;
|
2025-10-11 10:07:14 +00:00
|
|
|
htmlDescription: string;
|
2025-09-16 08:29:07 +00:00
|
|
|
slug: string;
|
2025-10-11 10:07:14 +00:00
|
|
|
categoryId: number;
|
2025-09-16 08:29:07 +00:00
|
|
|
categoryName: string;
|
2025-10-11 10:07:14 +00:00
|
|
|
typeId: number;
|
2025-09-16 08:29:07 +00:00
|
|
|
tags: string;
|
2025-10-11 10:07:14 +00:00
|
|
|
thumbnailUrl: string;
|
|
|
|
|
pageUrl: string | null;
|
|
|
|
|
createdById: number;
|
|
|
|
|
createdByName: string;
|
|
|
|
|
shareCount: number;
|
|
|
|
|
viewCount: number;
|
|
|
|
|
commentCount: number;
|
|
|
|
|
aiArticleId: number | null;
|
|
|
|
|
oldId: number;
|
|
|
|
|
statusId: number;
|
|
|
|
|
isBanner: boolean;
|
2025-09-16 08:29:07 +00:00
|
|
|
isPublish: boolean;
|
2025-10-11 10:07:14 +00:00
|
|
|
publishedAt: string | null;
|
|
|
|
|
isActive: boolean;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
|
|
|
|
files: FileType[] | null;
|
|
|
|
|
categories: {
|
|
|
|
|
id: number;
|
|
|
|
|
title: string;
|
|
|
|
|
description: string;
|
|
|
|
|
thumbnailUrl: string;
|
|
|
|
|
slug: string | null;
|
|
|
|
|
tags: string[];
|
|
|
|
|
thumbnailPath: string | null;
|
|
|
|
|
parentId: number;
|
|
|
|
|
oldCategoryId: number | null;
|
|
|
|
|
createdById: number;
|
|
|
|
|
statusId: number;
|
|
|
|
|
isPublish: boolean;
|
|
|
|
|
publishedAt: string | null;
|
|
|
|
|
isEnabled: boolean | null;
|
|
|
|
|
isActive: boolean;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
|
|
|
|
}[];
|
|
|
|
|
// Legacy fields for backward compatibility
|
|
|
|
|
category?: {
|
|
|
|
|
id: number;
|
|
|
|
|
name: string;
|
|
|
|
|
};
|
|
|
|
|
creatorName?: string;
|
|
|
|
|
thumbnailLink?: string;
|
|
|
|
|
statusName?: string;
|
|
|
|
|
needApprovalFromLevel?: number;
|
|
|
|
|
uploadedById?: number;
|
2025-09-16 08:29:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default function FormVideoDetail() {
|
|
|
|
|
const MySwal = withReactContent(Swal);
|
|
|
|
|
const router = useRouter();
|
2025-10-11 10:07:14 +00:00
|
|
|
const { id } = useParams() as { id: string };
|
2025-10-14 08:17:22 +00:00
|
|
|
|
2025-09-16 08:29:07 +00:00
|
|
|
const userId = getCookiesDecrypt("uie");
|
|
|
|
|
const userLevelId = getCookiesDecrypt("ulie");
|
2025-10-11 10:07:14 +00:00
|
|
|
const userLevelName = Cookies.get("state");
|
2025-09-16 08:29:07 +00:00
|
|
|
const roleId = getCookiesDecrypt("urie");
|
2025-10-14 08:17:22 +00:00
|
|
|
|
2025-10-11 10:07:14 +00:00
|
|
|
const [detail, setDetail] = useState<Detail | null>(null);
|
2025-09-16 08:29:07 +00:00
|
|
|
const [categories, setCategories] = useState<Category[]>([]);
|
2025-10-11 10:07:14 +00:00
|
|
|
const [files, setFiles] = useState<FileType[]>([]);
|
|
|
|
|
const [thumbsSwiper, setThumbsSwiper] = useState<any>(null);
|
|
|
|
|
const [approval, setApproval] = useState<any>();
|
2025-09-16 08:29:07 +00:00
|
|
|
const [selectedPublishers, setSelectedPublishers] = useState<number[]>([]);
|
2025-10-14 08:17:22 +00:00
|
|
|
const [isUserMabesApprover, setIsUserMabesApprover] = useState(false);
|
2025-10-11 10:07:14 +00:00
|
|
|
const [modalOpen, setModalOpen] = useState(false);
|
|
|
|
|
const [status, setStatus] = useState("");
|
2025-09-16 08:29:07 +00:00
|
|
|
const [description, setDescription] = useState("");
|
|
|
|
|
const [filePlacements, setFilePlacements] = useState<string[][]>([]);
|
2025-10-14 08:17:22 +00:00
|
|
|
|
|
|
|
|
const { control } = useForm({ resolver: zodResolver(videoSchema) });
|
2025-09-16 08:29:07 +00:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-10-14 08:17:22 +00:00
|
|
|
if (userLevelId == "216" && roleId == "3") setIsUserMabesApprover(true);
|
2025-09-16 08:29:07 +00:00
|
|
|
}, [userLevelId, roleId]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-10-11 10:07:14 +00:00
|
|
|
async function fetchCategories() {
|
2025-10-11 13:04:06 +00:00
|
|
|
const categoryRes = await listArticleCategories(1, 100);
|
|
|
|
|
setCategories(categoryRes?.data.data || []);
|
2025-09-16 08:29:07 +00:00
|
|
|
}
|
2025-10-11 10:07:14 +00:00
|
|
|
fetchCategories();
|
2025-09-16 08:29:07 +00:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-10-11 10:07:14 +00:00
|
|
|
async function fetchDetail() {
|
|
|
|
|
if (!id) return;
|
|
|
|
|
try {
|
|
|
|
|
const response = await getArticleDetail(Number(id));
|
2025-09-16 08:29:07 +00:00
|
|
|
const details = response?.data?.data;
|
2025-10-11 10:07:14 +00:00
|
|
|
const mappedDetail: Detail = {
|
|
|
|
|
...details,
|
2025-10-14 08:17:22 +00:00
|
|
|
statusId: details?.statusId,
|
2025-10-11 13:04:06 +00:00
|
|
|
categoryId: details?.categories?.[0]?.id,
|
2025-10-11 10:07:14 +00:00
|
|
|
htmlDescription: details?.htmlDescription,
|
|
|
|
|
uploadedById: details?.createdById,
|
|
|
|
|
files: details?.files || [],
|
|
|
|
|
};
|
|
|
|
|
setDetail(mappedDetail);
|
2025-10-14 08:17:22 +00:00
|
|
|
setFiles(details?.files || []);
|
2025-10-11 10:07:14 +00:00
|
|
|
const approvals = await getDataApprovalByMediaUpload(mappedDetail.id);
|
2025-09-16 08:29:07 +00:00
|
|
|
setApproval(approvals?.data?.data);
|
2025-10-11 10:07:14 +00:00
|
|
|
} catch (err) {
|
|
|
|
|
console.error("Error fetching video detail:", err);
|
2025-09-16 08:29:07 +00:00
|
|
|
}
|
|
|
|
|
}
|
2025-10-11 10:07:14 +00:00
|
|
|
fetchDetail();
|
2025-10-14 08:17:22 +00:00
|
|
|
}, [id]);
|
|
|
|
|
|
|
|
|
|
const getStatusName = (statusId: number) => {
|
|
|
|
|
const map: Record<number, string> = {
|
|
|
|
|
1: "Menunggu Review",
|
|
|
|
|
2: "Diterima",
|
|
|
|
|
3: "Minta Update",
|
|
|
|
|
4: "Ditolak",
|
|
|
|
|
};
|
|
|
|
|
return map[statusId] || "Unknown";
|
|
|
|
|
};
|
2025-10-11 10:07:14 +00:00
|
|
|
|
|
|
|
|
const handleCheckboxChange = (id: number) => {
|
|
|
|
|
setSelectedPublishers((prev) =>
|
2025-10-14 08:17:22 +00:00
|
|
|
prev.includes(id) ? prev.filter((i) => i !== id) : [...prev, id]
|
2025-10-11 10:07:14 +00:00
|
|
|
);
|
|
|
|
|
};
|
2025-09-16 08:29:07 +00:00
|
|
|
|
2025-10-14 08:17:22 +00:00
|
|
|
const actionApproval = (type: string) => {
|
|
|
|
|
const placements = files.map(() => []);
|
|
|
|
|
setFilePlacements(placements);
|
|
|
|
|
setStatus(type);
|
2025-09-16 08:29:07 +00:00
|
|
|
setDescription("");
|
|
|
|
|
setModalOpen(true);
|
|
|
|
|
};
|
|
|
|
|
|
2025-10-11 10:07:14 +00:00
|
|
|
const save = async () => {
|
2025-09-16 08:29:07 +00:00
|
|
|
const data = {
|
2025-10-01 22:20:12 +00:00
|
|
|
action: status == "2" ? "approve" : status == "3" ? "revision" : "reject",
|
2025-09-16 08:29:07 +00:00
|
|
|
message: description,
|
|
|
|
|
};
|
|
|
|
|
setModalOpen(false);
|
|
|
|
|
loading();
|
2025-10-14 08:17:22 +00:00
|
|
|
const res = await submitApproval(id, data);
|
|
|
|
|
if (res?.error) return error(res.message);
|
2025-09-16 08:29:07 +00:00
|
|
|
close();
|
|
|
|
|
MySwal.fire({
|
|
|
|
|
title: "Sukses",
|
|
|
|
|
text: "Data berhasil disimpan.",
|
|
|
|
|
icon: "success",
|
2025-10-11 10:07:14 +00:00
|
|
|
}).then(() => router.push("/admin/content/video"));
|
2025-09-16 08:29:07 +00:00
|
|
|
};
|
|
|
|
|
|
2025-10-11 10:07:14 +00:00
|
|
|
const publishToMabes = async () => {
|
|
|
|
|
const res = await publishMedia(id);
|
|
|
|
|
successCallback();
|
|
|
|
|
};
|
|
|
|
|
|
2025-10-14 08:17:22 +00:00
|
|
|
if (!detail) return <div className="p-10 text-gray-500">Memuat data...</div>;
|
2025-10-11 10:07:14 +00:00
|
|
|
|
2025-09-16 08:29:07 +00:00
|
|
|
return (
|
|
|
|
|
<form>
|
2025-10-11 10:07:14 +00:00
|
|
|
<div className="flex flex-col lg:flex-row gap-10 border rounded-lg">
|
|
|
|
|
<Card className="w-full lg:w-8/12 m-2">
|
|
|
|
|
<div className="px-6 py-6">
|
|
|
|
|
<p className="text-lg font-semibold mb-3">Form Video</p>
|
|
|
|
|
|
|
|
|
|
<div className="space-y-2 py-3">
|
|
|
|
|
<Label>Title</Label>
|
|
|
|
|
<Controller
|
|
|
|
|
control={control}
|
|
|
|
|
name="title"
|
|
|
|
|
render={({ field }) => (
|
|
|
|
|
<Input
|
2025-10-14 08:17:22 +00:00
|
|
|
value={detail.title}
|
2025-10-11 10:07:14 +00:00
|
|
|
onChange={field.onChange}
|
2025-10-14 08:17:22 +00:00
|
|
|
disabled
|
2025-09-16 08:29:07 +00:00
|
|
|
/>
|
2025-10-11 10:07:14 +00:00
|
|
|
)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2025-09-16 08:29:07 +00:00
|
|
|
|
2025-10-11 10:07:14 +00:00
|
|
|
<div className="py-3 w-full space-y-2">
|
|
|
|
|
<Label>Category</Label>
|
2025-10-14 08:17:22 +00:00
|
|
|
<Select disabled value={String(detail.categoryId)}>
|
2025-10-11 10:07:14 +00:00
|
|
|
<SelectTrigger>
|
2025-10-11 13:04:06 +00:00
|
|
|
<SelectValue placeholder="Pilih kategori" />
|
2025-10-11 10:07:14 +00:00
|
|
|
</SelectTrigger>
|
|
|
|
|
<SelectContent>
|
2025-10-14 08:17:22 +00:00
|
|
|
{categories.map((cat) => (
|
2025-10-11 13:04:06 +00:00
|
|
|
<SelectItem key={cat.id} value={String(cat.id)}>
|
|
|
|
|
{cat.title}
|
2025-10-11 10:07:14 +00:00
|
|
|
</SelectItem>
|
|
|
|
|
))}
|
|
|
|
|
</SelectContent>
|
|
|
|
|
</Select>
|
2025-09-16 08:29:07 +00:00
|
|
|
</div>
|
2025-10-11 10:07:14 +00:00
|
|
|
|
|
|
|
|
<div className="py-3 space-y-2">
|
|
|
|
|
<Label>Description</Label>
|
|
|
|
|
<ViewEditor initialData={detail.htmlDescription} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="space-y-2">
|
|
|
|
|
<Label className="text-xl">File Media</Label>
|
|
|
|
|
<Swiper
|
|
|
|
|
thumbs={{ swiper: thumbsSwiper }}
|
|
|
|
|
modules={[FreeMode, Navigation, Thumbs]}
|
|
|
|
|
navigation={false}
|
|
|
|
|
className="h-[480px]"
|
|
|
|
|
>
|
|
|
|
|
{files.map((file) => (
|
|
|
|
|
<SwiperSlide key={file.id}>
|
|
|
|
|
<video
|
|
|
|
|
className="object-contain w-full h-[480px]"
|
|
|
|
|
src={file.fileUrl}
|
|
|
|
|
controls
|
|
|
|
|
title={file.fileName}
|
2025-09-16 08:29:07 +00:00
|
|
|
/>
|
2025-10-11 10:07:14 +00:00
|
|
|
</SwiperSlide>
|
|
|
|
|
))}
|
|
|
|
|
</Swiper>
|
|
|
|
|
<Swiper
|
|
|
|
|
onSwiper={setThumbsSwiper}
|
|
|
|
|
slidesPerView={6}
|
|
|
|
|
spaceBetween={8}
|
|
|
|
|
modules={[Pagination, Thumbs]}
|
|
|
|
|
className="mt-2"
|
|
|
|
|
>
|
|
|
|
|
{files.map((file) => (
|
|
|
|
|
<SwiperSlide key={file.id}>
|
|
|
|
|
<video
|
|
|
|
|
className="object-cover h-[60px] w-[100px] border-2"
|
|
|
|
|
src={file.fileUrl}
|
|
|
|
|
muted
|
2025-09-16 08:29:07 +00:00
|
|
|
/>
|
2025-10-11 10:07:14 +00:00
|
|
|
</SwiperSlide>
|
|
|
|
|
))}
|
|
|
|
|
</Swiper>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Card>
|
|
|
|
|
|
|
|
|
|
<div className="w-full lg:w-4/12 m-2">
|
|
|
|
|
<Card className="pb-3">
|
|
|
|
|
<div className="px-3 py-3">
|
|
|
|
|
<Label>Creator</Label>
|
2025-10-14 08:17:22 +00:00
|
|
|
<Input value={detail.createdByName} disabled />
|
2025-10-11 10:07:14 +00:00
|
|
|
</div>
|
2025-09-16 08:29:07 +00:00
|
|
|
|
2025-10-11 10:07:14 +00:00
|
|
|
<div className="mt-3 px-3 space-y-2">
|
|
|
|
|
<Label>Preview</Label>
|
|
|
|
|
<Card className="mt-2 w-fit">
|
|
|
|
|
<img
|
2025-10-14 08:17:22 +00:00
|
|
|
src={detail.thumbnailUrl || detail.thumbnailLink}
|
|
|
|
|
alt="Thumbnail Gambar Utama"
|
2025-10-11 10:07:14 +00:00
|
|
|
className="h-[200px] rounded"
|
|
|
|
|
/>
|
|
|
|
|
</Card>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="px-3 py-3">
|
|
|
|
|
<Label>Tags</Label>
|
|
|
|
|
<div className="flex flex-wrap gap-2">
|
2025-10-14 08:17:22 +00:00
|
|
|
{detail.tags?.split(",").map((tag, i) => (
|
2025-10-11 10:07:14 +00:00
|
|
|
<Badge
|
2025-10-14 08:17:22 +00:00
|
|
|
key={i}
|
|
|
|
|
className="border bg-black text-white px-2 py-2"
|
2025-09-16 08:29:07 +00:00
|
|
|
>
|
2025-10-11 10:07:14 +00:00
|
|
|
{tag.trim()}
|
|
|
|
|
</Badge>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="px-3 py-3">
|
|
|
|
|
<Label>Publish Target</Label>
|
|
|
|
|
{[5, 6].map((target) => (
|
|
|
|
|
<div key={target} className="flex items-center gap-2">
|
|
|
|
|
<Checkbox
|
|
|
|
|
id={String(target)}
|
|
|
|
|
checked={selectedPublishers.includes(target)}
|
|
|
|
|
onChange={() => handleCheckboxChange(target)}
|
|
|
|
|
/>
|
|
|
|
|
<Label htmlFor={String(target)}>
|
2025-10-14 08:17:22 +00:00
|
|
|
{target === 5 ? "UMUM" : "JOURNALIS"}
|
2025-10-11 10:07:14 +00:00
|
|
|
</Label>
|
2025-09-16 08:29:07 +00:00
|
|
|
</div>
|
2025-10-11 10:07:14 +00:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="px-3 py-3 border mx-3">
|
|
|
|
|
<p>Information:</p>
|
|
|
|
|
<p className="text-sm text-slate-400">
|
2025-10-14 08:17:22 +00:00
|
|
|
{detail.statusId && getStatusName(detail.statusId)}
|
2025-10-11 10:07:14 +00:00
|
|
|
</p>
|
|
|
|
|
<p>Komentar</p>
|
|
|
|
|
<p>{approval?.message}</p>
|
|
|
|
|
<p className="text-right text-sm">
|
|
|
|
|
{approval?.approvalBy?.fullname} |{" "}
|
|
|
|
|
{formatDateToIndonesian(approval?.approvalDate)}
|
|
|
|
|
</p>
|
|
|
|
|
<ApprovalHistoryModal id={Number(id)} />
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{userLevelName?.includes("MABES") && !detail.isPublish && (
|
|
|
|
|
<div className="p-3">
|
|
|
|
|
<Button onClick={() => publishToMabes()} type="button">
|
|
|
|
|
<Icon icon="fa:check" className="mr-3" /> Publish
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2025-09-16 08:29:07 +00:00
|
|
|
)}
|
2025-10-14 08:17:22 +00:00
|
|
|
|
|
|
|
|
{(Number(detail.needApprovalFromLevel || 0) ==
|
|
|
|
|
Number(userLevelId) ||
|
|
|
|
|
(detail.isPublish === false && detail.statusId == 1)) &&
|
|
|
|
|
Number(detail.uploadedById || detail.createdById) !=
|
|
|
|
|
Number(userId) ? (
|
|
|
|
|
<div className="flex flex-col gap-2 p-3">
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() => actionApproval("2")}
|
|
|
|
|
color="primary"
|
|
|
|
|
type="button"
|
|
|
|
|
>
|
|
|
|
|
<Icon icon="fa:check" className="mr-3" /> Accept
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() => actionApproval("3")}
|
|
|
|
|
className="bg-orange-400 hover:bg-orange-300"
|
|
|
|
|
type="button"
|
|
|
|
|
>
|
|
|
|
|
<Icon icon="fa:comment-o" className="mr-3" /> Revision
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
onClick={() => actionApproval("4")}
|
|
|
|
|
color="destructive"
|
|
|
|
|
type="button"
|
|
|
|
|
>
|
|
|
|
|
<Icon icon="fa:times" className="mr-3" /> Reject
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
|
|
<Dialog open={modalOpen} onOpenChange={setModalOpen}>
|
|
|
|
|
<DialogContent className="max-h-[600px] overflow-y-auto">
|
|
|
|
|
<DialogHeader>
|
|
|
|
|
<DialogTitle>Leave Comment</DialogTitle>
|
|
|
|
|
</DialogHeader>
|
|
|
|
|
|
|
|
|
|
{status === "2" &&
|
|
|
|
|
files.map((file, i) => (
|
|
|
|
|
<div key={i} className="flex items-center gap-4 mb-3">
|
|
|
|
|
<video
|
|
|
|
|
src={file.fileUrl}
|
|
|
|
|
className="w-[200px] h-[120px]"
|
|
|
|
|
controls
|
|
|
|
|
/>
|
|
|
|
|
<span>{file.fileName}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
|
|
|
|
|
<Textarea
|
|
|
|
|
placeholder="Tulis komentar Anda..."
|
|
|
|
|
value={description}
|
|
|
|
|
onChange={(e) => setDescription(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<div className="flex flex-wrap gap-2 mt-2">
|
|
|
|
|
{status === "3" || status === "4" ? (
|
|
|
|
|
<>
|
|
|
|
|
{[
|
|
|
|
|
"Kualitas media kurang baik",
|
|
|
|
|
"Deskripsi kurang lengkap",
|
|
|
|
|
"Judul kurang tepat",
|
|
|
|
|
].map((text) => (
|
|
|
|
|
<Button
|
|
|
|
|
key={text}
|
|
|
|
|
size="sm"
|
|
|
|
|
variant={description === text ? "default" : "outline"}
|
|
|
|
|
onClick={() => setDescription(text)}
|
|
|
|
|
>
|
|
|
|
|
{text}
|
|
|
|
|
</Button>
|
|
|
|
|
))}
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<>
|
|
|
|
|
{["Konten sangat bagus", "Konten menarik"].map((text) => (
|
|
|
|
|
<Button
|
|
|
|
|
key={text}
|
|
|
|
|
size="sm"
|
|
|
|
|
variant={description === text ? "default" : "outline"}
|
|
|
|
|
onClick={() => setDescription(text)}
|
|
|
|
|
>
|
|
|
|
|
{text}
|
|
|
|
|
</Button>
|
|
|
|
|
))}
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<DialogFooter className="mt-4 flex justify-end gap-3">
|
|
|
|
|
<Button onClick={() => save()} color="primary">
|
|
|
|
|
Submit
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
|
|
|
|
color="destructive"
|
|
|
|
|
onClick={() => setModalOpen(false)}
|
|
|
|
|
>
|
|
|
|
|
Cancel
|
|
|
|
|
</Button>
|
|
|
|
|
</DialogFooter>
|
|
|
|
|
</DialogContent>
|
|
|
|
|
</Dialog>
|
2025-10-11 10:07:14 +00:00
|
|
|
</Card>
|
2025-09-16 08:29:07 +00:00
|
|
|
</div>
|
2025-10-11 10:07:14 +00:00
|
|
|
</div>
|
2025-09-16 08:29:07 +00:00
|
|
|
</form>
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-10-11 10:07:14 +00:00
|
|
|
|
|
|
|
|
// "use client";
|
|
|
|
|
// import React, { ChangeEvent, useEffect, useRef, useState } from "react";
|
|
|
|
|
// import { useForm, Controller } from "react-hook-form";
|
|
|
|
|
// import { Input } from "@/components/ui/input";
|
|
|
|
|
// import { Button } from "@/components/ui/button";
|
|
|
|
|
// import { Label } from "@/components/ui/label";
|
|
|
|
|
// import { Card } from "@/components/ui/card";
|
|
|
|
|
// import { zodResolver } from "@hookform/resolvers/zod";
|
|
|
|
|
// import * as z from "zod";
|
|
|
|
|
// import Swal from "sweetalert2";
|
|
|
|
|
// import withReactContent from "sweetalert2-react-content";
|
|
|
|
|
// import { useParams, useRouter } from "next/navigation";
|
|
|
|
|
// import {
|
|
|
|
|
// Select,
|
|
|
|
|
// SelectContent,
|
|
|
|
|
// SelectItem,
|
|
|
|
|
// SelectTrigger,
|
|
|
|
|
// SelectValue,
|
|
|
|
|
// } from "@/components/ui/select";
|
|
|
|
|
// import { Checkbox } from "@/components/ui/checkbox";
|
|
|
|
|
// import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
|
|
|
|
|
|
|
|
|
// import { register } from "module";
|
|
|
|
|
// import { Switch } from "@/components/ui/switch";
|
|
|
|
|
// import Cookies from "js-cookie";
|
|
|
|
|
// import {
|
|
|
|
|
// createMedia,
|
|
|
|
|
// getTagsBySubCategoryId,
|
|
|
|
|
// listEnableCategory,
|
|
|
|
|
// rejectFiles,
|
|
|
|
|
// submitApproval,
|
|
|
|
|
// } from "@/service/content/content";
|
|
|
|
|
// import {
|
|
|
|
|
// detailMedia,
|
|
|
|
|
// getDataApprovalByMediaUpload,
|
|
|
|
|
// } from "@/service/curated-content/curated-content";
|
|
|
|
|
// import { Badge } from "@/components/ui/badge";
|
|
|
|
|
// import { MailIcon } from "lucide-react";
|
|
|
|
|
// import { Swiper, SwiperSlide } from "swiper/react";
|
|
|
|
|
// import "swiper/css";
|
|
|
|
|
// import "swiper/css/free-mode";
|
|
|
|
|
// import "swiper/css/navigation";
|
|
|
|
|
// import "swiper/css/pagination";
|
|
|
|
|
// import "swiper/css/thumbs";
|
|
|
|
|
// import "swiper/css";
|
|
|
|
|
// import "swiper/css/navigation";
|
|
|
|
|
// import { FreeMode, Navigation, Pagination, Thumbs } from "swiper/modules";
|
|
|
|
|
// import {
|
|
|
|
|
// DialogHeader,
|
|
|
|
|
// DialogFooter,
|
|
|
|
|
// Dialog,
|
|
|
|
|
// DialogContent,
|
|
|
|
|
// DialogTitle,
|
|
|
|
|
// } from "@/components/ui/dialog";
|
|
|
|
|
// import { Textarea } from "@/components/ui/textarea";
|
|
|
|
|
// import { loading } from "@/config/swal";
|
|
|
|
|
// import { getCookiesDecrypt } from "@/lib/utils";
|
|
|
|
|
// import { Icon } from "@iconify/react/dist/iconify.js";
|
|
|
|
|
// import { error } from "@/lib/swal";
|
|
|
|
|
// import dynamic from "next/dynamic";
|
|
|
|
|
// import SuggestionModal from "@/components/modal/suggestions-modal";
|
|
|
|
|
// import { formatDateToIndonesian } from "@/utils/globals";
|
|
|
|
|
// import ApprovalHistoryModal from "@/components/modal/approval-history-modal";
|
|
|
|
|
|
|
|
|
|
// const imageSchema = z.object({
|
|
|
|
|
// title: z.string().min(1, { message: "Judul diperlukan" }),
|
|
|
|
|
// description: z
|
|
|
|
|
// .string()
|
|
|
|
|
// .min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter." }),
|
|
|
|
|
// creatorName: z.string().min(1, { message: "Creator diperlukan" }),
|
|
|
|
|
// // tags: z.string().min(1, { message: "Judul diperlukan" }),
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// type Category = {
|
|
|
|
|
// id: string;
|
|
|
|
|
// name: string;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// type FileType = {
|
|
|
|
|
// id: number;
|
|
|
|
|
// url: string;
|
|
|
|
|
// thumbnailFileUrl: string;
|
|
|
|
|
// fileName: string;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// type Detail = {
|
|
|
|
|
// id: string;
|
|
|
|
|
// title: string;
|
|
|
|
|
// description: string;
|
|
|
|
|
// slug: string;
|
|
|
|
|
// category: {
|
|
|
|
|
// id: number;
|
|
|
|
|
// name: string;
|
|
|
|
|
// };
|
|
|
|
|
// categoryName: string;
|
|
|
|
|
// creatorName: string;
|
|
|
|
|
// thumbnailLink: string;
|
|
|
|
|
// url: string;
|
|
|
|
|
// tags: string;
|
|
|
|
|
// statusName: string;
|
|
|
|
|
// isPublish: boolean;
|
|
|
|
|
// needApprovalFromLevel: number;
|
|
|
|
|
// files: FileType[];
|
|
|
|
|
// uploadedById: number;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// const ViewEditor = dynamic(
|
|
|
|
|
// () => {
|
|
|
|
|
// return import("@/components/editor/view-editor");
|
|
|
|
|
// },
|
|
|
|
|
// { ssr: false }
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
// export default function FormVideoDetail() {
|
|
|
|
|
// const MySwal = withReactContent(Swal);
|
|
|
|
|
// const router = useRouter();
|
|
|
|
|
// const userId = getCookiesDecrypt("uie");
|
|
|
|
|
// const userLevelId = getCookiesDecrypt("ulie");
|
|
|
|
|
// const roleId = getCookiesDecrypt("urie");
|
|
|
|
|
// const [modalOpen, setModalOpen] = useState(false);
|
|
|
|
|
// const { id } = useParams() as { id: string };
|
|
|
|
|
// console.log(id);
|
|
|
|
|
// const editor = useRef(null);
|
|
|
|
|
// type ImageSchema = z.infer<typeof imageSchema>;
|
|
|
|
|
// const [selectedFiles, setSelectedFiles] = useState<File[]>([]);
|
|
|
|
|
// const taskId = Cookies.get("taskId");
|
|
|
|
|
// const scheduleId = Cookies.get("scheduleId");
|
|
|
|
|
// const scheduleType = Cookies.get("scheduleType");
|
|
|
|
|
// const [status, setStatus] = useState("");
|
|
|
|
|
// const [categories, setCategories] = useState<Category[]>([]);
|
|
|
|
|
// const [selectedCategory, setSelectedCategory] = useState<any>();
|
|
|
|
|
// const [tags, setTags] = useState<any[]>([]);
|
|
|
|
|
// const [detail, setDetail] = useState<any>();
|
|
|
|
|
// const [refresh, setRefresh] = useState(false);
|
|
|
|
|
// const [selectedPublishers, setSelectedPublishers] = useState<number[]>([]);
|
|
|
|
|
// const [description, setDescription] = useState("");
|
|
|
|
|
// const [main, setMain] = useState<any>([]);
|
|
|
|
|
// const [detailVideo, setDetailVideo] = useState<any>([]);
|
|
|
|
|
// const [thumbsSwiper, setThumbsSwiper] = useState<any>(null);
|
|
|
|
|
// const [filePlacements, setFilePlacements] = useState<string[][]>([]);
|
|
|
|
|
// const [selectedTarget, setSelectedTarget] = useState("");
|
|
|
|
|
// const [files, setFiles] = useState<FileType[]>([]);
|
|
|
|
|
// const [rejectedFiles, setRejectedFiles] = useState<number[]>([]);
|
|
|
|
|
// const [isUserMabesApprover, setIsUserMabesApprover] = useState(false);
|
|
|
|
|
// const [approval, setApproval] = useState<any>();
|
|
|
|
|
|
|
|
|
|
// let fileTypeId = "2";
|
|
|
|
|
|
|
|
|
|
// const {
|
|
|
|
|
// control,
|
|
|
|
|
// handleSubmit,
|
|
|
|
|
// setValue,
|
|
|
|
|
// formState: { errors },
|
|
|
|
|
// } = useForm<ImageSchema>({
|
|
|
|
|
// resolver: zodResolver(imageSchema),
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// // const handleKeyDown = (e: any) => {
|
|
|
|
|
// // const newTag = e.target.value.trim(); // Ambil nilai input
|
|
|
|
|
// // if (e.key === "Enter" && newTag) {
|
|
|
|
|
// // e.preventDefault(); // Hentikan submit form
|
|
|
|
|
// // if (!tags.includes(newTag)) {
|
|
|
|
|
// // setTags((prevTags) => [...prevTags, newTag]); // Tambah tag baru
|
|
|
|
|
// // setValue("tags", ""); // Kosongkan input
|
|
|
|
|
// // }
|
|
|
|
|
// // }
|
|
|
|
|
// // };
|
|
|
|
|
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
// if (
|
|
|
|
|
// userLevelId != undefined &&
|
|
|
|
|
// roleId != undefined &&
|
|
|
|
|
// userLevelId == "216" &&
|
|
|
|
|
// roleId == "3"
|
|
|
|
|
// ) {
|
|
|
|
|
// setIsUserMabesApprover(true);
|
|
|
|
|
// }
|
|
|
|
|
// }, [userLevelId, roleId]);
|
|
|
|
|
|
|
|
|
|
// const handleCheckboxChange = (id: number) => {
|
|
|
|
|
// setSelectedPublishers((prev) =>
|
|
|
|
|
// prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id]
|
|
|
|
|
// );
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
// async function initState() {
|
|
|
|
|
// getCategories();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// initState();
|
|
|
|
|
// }, []);
|
|
|
|
|
|
|
|
|
|
// const getCategories = async () => {
|
|
|
|
|
// try {
|
|
|
|
|
// const category = await listEnableCategory(fileTypeId);
|
|
|
|
|
// const resCategory: Category[] = category?.data?.data?.content;
|
|
|
|
|
|
|
|
|
|
// setCategories(resCategory);
|
|
|
|
|
// console.log("data category", resCategory);
|
|
|
|
|
|
|
|
|
|
// if (scheduleId && scheduleType === "3") {
|
|
|
|
|
// const findCategory = resCategory.find((o) =>
|
|
|
|
|
// o.name.toLowerCase().includes("pers rilis")
|
|
|
|
|
// );
|
|
|
|
|
|
|
|
|
|
// if (findCategory) {
|
|
|
|
|
// // setValue("categoryId", findCategory.id);
|
|
|
|
|
// setSelectedCategory(findCategory.id);
|
|
|
|
|
// const response = await getTagsBySubCategoryId(findCategory.id);
|
|
|
|
|
// setTags(response?.data?.data);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } catch (error) {
|
|
|
|
|
// console.error("Failed to fetch categories:", error);
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// useEffect(() => {
|
|
|
|
|
// async function initState() {
|
|
|
|
|
// if (id) {
|
|
|
|
|
// const response = await detailMedia(id);
|
|
|
|
|
// const details = response?.data?.data;
|
|
|
|
|
// console.log("detail", details);
|
|
|
|
|
// setFiles(details?.files);
|
|
|
|
|
// setDetail(details);
|
|
|
|
|
// setMain({
|
|
|
|
|
// type: details?.fileType.name,
|
|
|
|
|
// url: details?.files[0]?.url,
|
|
|
|
|
// names: details?.files[0]?.fileName,
|
|
|
|
|
// format: details?.files[0]?.format,
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// if (details?.publishedForObject) {
|
|
|
|
|
// const publisherIds = details.publishedForObject.map(
|
|
|
|
|
// (obj: any) => obj.id
|
|
|
|
|
// );
|
|
|
|
|
// setSelectedPublishers(publisherIds);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// // Set the selected target to the category ID from details
|
|
|
|
|
// setSelectedTarget(String(details.category.id));
|
|
|
|
|
|
|
|
|
|
// const filesData = details?.files || [];
|
|
|
|
|
// const fileUrls = filesData.map((files: { url: string }) =>
|
|
|
|
|
// files.url ? files.url : "default-image.jpg"
|
|
|
|
|
// );
|
|
|
|
|
// setDetailVideo(fileUrls);
|
|
|
|
|
|
|
|
|
|
// const approvals = await getDataApprovalByMediaUpload(details?.id);
|
|
|
|
|
// setApproval(approvals?.data?.data);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// initState();
|
|
|
|
|
// }, [refresh, setValue]);
|
|
|
|
|
|
|
|
|
|
// const actionApproval = (e: string) => {
|
|
|
|
|
// const temp = [];
|
|
|
|
|
// for (const element of detail.files) {
|
|
|
|
|
// temp.push([]);
|
|
|
|
|
// }
|
|
|
|
|
// setFilePlacements(temp);
|
|
|
|
|
// setStatus(e);
|
|
|
|
|
// setFiles(detail.files);
|
|
|
|
|
|
|
|
|
|
// setDescription("");
|
|
|
|
|
// setModalOpen(true);
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// const submit = async () => {
|
|
|
|
|
// if (
|
|
|
|
|
// (description?.length > 1 && Number(status) == 3) ||
|
|
|
|
|
// Number(status) == 2 ||
|
|
|
|
|
// Number(status) == 4
|
|
|
|
|
// ) {
|
|
|
|
|
// save();
|
|
|
|
|
|
|
|
|
|
// // MySwal.fire({
|
|
|
|
|
// // title: "Simpan Approval",
|
|
|
|
|
// // text: "",
|
|
|
|
|
// // icon: "warning",
|
|
|
|
|
// // showCancelButton: true,
|
|
|
|
|
// // cancelButtonColor: "#d33",
|
|
|
|
|
// // confirmButtonColor: "#3085d6",
|
|
|
|
|
// // confirmButtonText: "Simpan",
|
|
|
|
|
// // }).then((result) => {
|
|
|
|
|
// // if (result.isConfirmed) {
|
|
|
|
|
// // }
|
|
|
|
|
// // });
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// async function save() {
|
|
|
|
|
// const data = {
|
|
|
|
|
// action: status == "2" ? "approve" : status == "3" ? "revision" : "reject",
|
|
|
|
|
// message: description,
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// setModalOpen(false);
|
|
|
|
|
// loading();
|
|
|
|
|
// const response = await submitApproval(id, data);
|
|
|
|
|
|
|
|
|
|
// if (response?.error) {
|
|
|
|
|
// error(response.message);
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// close();
|
|
|
|
|
// submitApprovalSuccesss();
|
|
|
|
|
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// const getPlacement = () => {
|
|
|
|
|
// console.log("getPlaa", filePlacements);
|
|
|
|
|
// const temp = [];
|
|
|
|
|
// for (let i = 0; i < filePlacements?.length; i++) {
|
|
|
|
|
// if (filePlacements[i].length !== 0) {
|
|
|
|
|
// const now = filePlacements[i].filter((a) => a !== "all");
|
|
|
|
|
// const data = { mediaFileId: files[i].id, placements: now.join(",") };
|
|
|
|
|
// temp.push(data);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return temp;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// const setupPlacement = (
|
|
|
|
|
// index: number,
|
|
|
|
|
// placement: string,
|
|
|
|
|
// checked: boolean
|
|
|
|
|
// ) => {
|
|
|
|
|
// let temp = [...filePlacements];
|
|
|
|
|
// if (checked) {
|
|
|
|
|
// if (placement === "all") {
|
|
|
|
|
// temp[index] = ["all", "mabes", "polda", "international"];
|
|
|
|
|
// } else {
|
|
|
|
|
// const now = temp[index];
|
|
|
|
|
// now.push(placement);
|
|
|
|
|
// if (now.length === 3 && !now.includes("all")) {
|
|
|
|
|
// now.push("all");
|
|
|
|
|
// }
|
|
|
|
|
// temp[index] = now;
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// if (placement === "all") {
|
|
|
|
|
// temp[index] = [];
|
|
|
|
|
// } else {
|
|
|
|
|
// const now = temp[index].filter((a) => a !== placement);
|
|
|
|
|
// console.log("now", now);
|
|
|
|
|
// temp[index] = now;
|
|
|
|
|
// if (now.length === 3 && now.includes("all")) {
|
|
|
|
|
// const newData = now.filter((b) => b !== "all");
|
|
|
|
|
// temp[index] = newData;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// setFilePlacements(temp);
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// function handleDeleteFileApproval(id: number) {
|
|
|
|
|
// const selectedFiles = files.filter((file) => file.id != id);
|
|
|
|
|
// setFiles(selectedFiles);
|
|
|
|
|
// const rejects = rejectedFiles;
|
|
|
|
|
// rejects.push(id);
|
|
|
|
|
// setRejectedFiles(rejects);
|
|
|
|
|
// }
|
|
|
|
|
// const handleMain = (
|
|
|
|
|
// type: string,
|
|
|
|
|
// url: string,
|
|
|
|
|
// names: string,
|
|
|
|
|
// format: string
|
|
|
|
|
// ) => {
|
|
|
|
|
// console.log("Test 3 :", type, url, names, format);
|
|
|
|
|
// setMain({
|
|
|
|
|
// type,
|
|
|
|
|
// url,
|
|
|
|
|
// names,
|
|
|
|
|
// format,
|
|
|
|
|
// });
|
|
|
|
|
// return false;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// const submitApprovalSuccesss = () => {
|
|
|
|
|
// MySwal.fire({
|
|
|
|
|
// title: "Sukses",
|
|
|
|
|
// text: "Data berhasil disimpan.",
|
|
|
|
|
// icon: "success",
|
|
|
|
|
// confirmButtonColor: "#3085d6",
|
|
|
|
|
// confirmButtonText: "OK",
|
|
|
|
|
// }).then((result) => {
|
|
|
|
|
// if (result.isConfirmed) {
|
|
|
|
|
// router.push("/admin/content/video");
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// return (
|
|
|
|
|
// <form>
|
|
|
|
|
// {detail !== undefined ? (
|
|
|
|
|
// <div className="flex flex-col lg:flex-row gap-10">
|
|
|
|
|
// <Card className="w-full lg:w-8/12">
|
|
|
|
|
// <div className="px-6 py-6">
|
|
|
|
|
// <p className="text-lg font-semibold mb-3">Form Video</p>
|
|
|
|
|
// <div className="gap-5 mb-5">
|
|
|
|
|
// {/* Input Title */}
|
|
|
|
|
// <div className="space-y-2 py-3">
|
|
|
|
|
// <Label>Title</Label>
|
|
|
|
|
// <Controller
|
|
|
|
|
// control={control}
|
|
|
|
|
// name="title"
|
|
|
|
|
// render={({ field }) => (
|
|
|
|
|
// <Input
|
|
|
|
|
// type="text"
|
|
|
|
|
// value={detail?.title}
|
|
|
|
|
// onChange={field.onChange}
|
|
|
|
|
// placeholder="Enter Title"
|
|
|
|
|
// />
|
|
|
|
|
// )}
|
|
|
|
|
// />
|
|
|
|
|
// {errors.title?.message && (
|
|
|
|
|
// <p className="text-red-400 text-sm">
|
|
|
|
|
// {errors.title.message}
|
|
|
|
|
// </p>
|
|
|
|
|
// )}
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="flex items-center">
|
|
|
|
|
// <div className="py-3 w-full space-y-2">
|
|
|
|
|
// <Label>Category</Label>
|
|
|
|
|
// <Select
|
|
|
|
|
// disabled
|
|
|
|
|
// value={String(detail?.category?.id)}
|
|
|
|
|
// // onValueChange={(id) => {
|
|
|
|
|
// // console.log("Selected Category:", id);
|
|
|
|
|
// // setSelectedTarget(id);
|
|
|
|
|
// // }}
|
|
|
|
|
// >
|
|
|
|
|
// <SelectTrigger>
|
|
|
|
|
// <SelectValue placeholder="Pilih" />
|
|
|
|
|
// </SelectTrigger>
|
|
|
|
|
// <SelectContent>
|
|
|
|
|
// {/* Show the category from details if it doesn't exist in categories list */}
|
|
|
|
|
// {detail &&
|
|
|
|
|
// !categories?.find(
|
|
|
|
|
// (cat) =>
|
|
|
|
|
// String(cat.id) === String(detail?.category?.id)
|
|
|
|
|
// ) && (
|
|
|
|
|
// <SelectItem
|
|
|
|
|
// key={String(detail?.category?.id)}
|
|
|
|
|
// value={String(detail?.category?.id)}
|
|
|
|
|
// >
|
|
|
|
|
// {detail?.category?.name}
|
|
|
|
|
// </SelectItem>
|
|
|
|
|
// )}
|
|
|
|
|
// {categories?.map((category) => (
|
|
|
|
|
// <SelectItem
|
|
|
|
|
// key={String(category.id)}
|
|
|
|
|
// value={String(category.id)}
|
|
|
|
|
// >
|
|
|
|
|
// {category.name}
|
|
|
|
|
// </SelectItem>
|
|
|
|
|
// ))}
|
|
|
|
|
// </SelectContent>
|
|
|
|
|
// </Select>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
|
|
|
|
|
// <div className="py-3 space-y-2">
|
|
|
|
|
// <Label>Description</Label>
|
|
|
|
|
// <Controller
|
|
|
|
|
// control={control}
|
|
|
|
|
// name="description"
|
|
|
|
|
// render={({ field: { onChange, value } }) => (
|
|
|
|
|
// <ViewEditor initialData={detail?.htmlDescription} />
|
|
|
|
|
// )}
|
|
|
|
|
// />
|
|
|
|
|
// {errors.description?.message && (
|
|
|
|
|
// <p className="text-red-400 text-sm">
|
|
|
|
|
// {errors.description.message}
|
|
|
|
|
// </p>
|
|
|
|
|
// )}
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="space-y-2">
|
|
|
|
|
// <Label className="text-xl "> File Media</Label>
|
|
|
|
|
// <div className="w-full">
|
|
|
|
|
// <Swiper
|
|
|
|
|
// thumbs={{ swiper: thumbsSwiper }}
|
|
|
|
|
// modules={[FreeMode, Navigation, Thumbs]}
|
|
|
|
|
// navigation={false}
|
|
|
|
|
// className="w-full"
|
|
|
|
|
// >
|
|
|
|
|
// {files?.map((data: any) => (
|
|
|
|
|
// <SwiperSlide key={data.id}>
|
|
|
|
|
// <video
|
|
|
|
|
// className="object-fill h-full w-full"
|
|
|
|
|
// src={data.secondaryUrl}
|
|
|
|
|
// controls
|
|
|
|
|
// title={`Video ${data.id}`}
|
|
|
|
|
// />
|
|
|
|
|
// </SwiperSlide>
|
|
|
|
|
// ))}
|
|
|
|
|
// </Swiper>
|
|
|
|
|
// <div className="mt-2">
|
|
|
|
|
// <Swiper
|
|
|
|
|
// onSwiper={setThumbsSwiper}
|
|
|
|
|
// slidesPerView={8}
|
|
|
|
|
// spaceBetween={8}
|
|
|
|
|
// pagination={{
|
|
|
|
|
// clickable: true,
|
|
|
|
|
// }}
|
|
|
|
|
// modules={[Pagination, Thumbs]}
|
|
|
|
|
// // className="mySwiper2"
|
|
|
|
|
// >
|
|
|
|
|
// {files?.map((data: any) => (
|
|
|
|
|
// <SwiperSlide key={data.id}>
|
|
|
|
|
// <video
|
|
|
|
|
// className="object-cover h-[60px] w-[80px] cursor-pointer"
|
|
|
|
|
// src={data.secondaryUrl}
|
|
|
|
|
// muted
|
|
|
|
|
// title={`Video ${data.id}`}
|
|
|
|
|
// />
|
|
|
|
|
// </SwiperSlide>
|
|
|
|
|
// ))}
|
|
|
|
|
// </Swiper>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// </Card>
|
|
|
|
|
// <div className="w-full lg:w-4/12">
|
|
|
|
|
// <Card className="pb-3">
|
|
|
|
|
// <div className="px-3 py-3">
|
|
|
|
|
// <div className="space-y-2">
|
|
|
|
|
// <Label>Creator</Label>
|
|
|
|
|
// <Controller
|
|
|
|
|
// control={control}
|
|
|
|
|
// name="creatorName"
|
|
|
|
|
// render={({ field }) => (
|
|
|
|
|
// <Input
|
|
|
|
|
// type="text"
|
|
|
|
|
// value={detail?.creatorName}
|
|
|
|
|
// onChange={field.onChange}
|
|
|
|
|
// placeholder="Enter Title"
|
|
|
|
|
// />
|
|
|
|
|
// )}
|
|
|
|
|
// />
|
|
|
|
|
// {errors.creatorName?.message && (
|
|
|
|
|
// <p className="text-red-400 text-sm">
|
|
|
|
|
// {errors.creatorName.message}
|
|
|
|
|
// </p>
|
|
|
|
|
// )}
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="mt-3 px-3 space-y-2">
|
|
|
|
|
// <Label>Preview</Label>
|
|
|
|
|
// <Card className="mt-2">
|
|
|
|
|
// <img
|
|
|
|
|
// src={detail.thumbnailLink}
|
|
|
|
|
// alt="Thumbnail Gambar Utama"
|
|
|
|
|
// className="w-full h-auto rounded"
|
|
|
|
|
// />
|
|
|
|
|
// </Card>
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="px-3 py-3">
|
|
|
|
|
// <div className="space-y-2">
|
|
|
|
|
// <Label>Tags</Label>
|
|
|
|
|
// <div className="flex flex-wrap gap-2">
|
|
|
|
|
// {detail?.tags
|
|
|
|
|
// ?.split(",")
|
|
|
|
|
// .map((tag: string, index: number) => (
|
|
|
|
|
// <Badge
|
|
|
|
|
// key={index}
|
|
|
|
|
// className="border rounded-md px-2 py-2"
|
|
|
|
|
// >
|
|
|
|
|
// {tag.trim()}
|
|
|
|
|
// </Badge>
|
|
|
|
|
// ))}
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="px-3 py-3">
|
|
|
|
|
// <div className="flex flex-col gap-6 space-y-2">
|
|
|
|
|
// <Label>Publish Target</Label>
|
|
|
|
|
// <div className="flex gap-2 items-center">
|
|
|
|
|
// <Checkbox
|
|
|
|
|
// id="5"
|
|
|
|
|
// checked={selectedPublishers.includes(5)}
|
|
|
|
|
// onChange={() => handleCheckboxChange(5)}
|
|
|
|
|
// />
|
|
|
|
|
// <Label htmlFor="5">UMUM</Label>
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="flex gap-2 items-center">
|
|
|
|
|
// <Checkbox
|
|
|
|
|
// id="6"
|
|
|
|
|
// checked={selectedPublishers.includes(6)}
|
|
|
|
|
// onChange={() => handleCheckboxChange(6)}
|
|
|
|
|
// />
|
|
|
|
|
// <Label htmlFor="6">JOURNALIS</Label>
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="flex gap-2 items-center">
|
|
|
|
|
// <Checkbox
|
|
|
|
|
// id="7"
|
|
|
|
|
// checked={selectedPublishers.includes(7)}
|
|
|
|
|
// onChange={() => handleCheckboxChange(7)}
|
|
|
|
|
// />
|
|
|
|
|
// <Label htmlFor="7">POLRI</Label>
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="flex gap-2 items-center">
|
|
|
|
|
// <Checkbox
|
|
|
|
|
// id="8"
|
|
|
|
|
// checked={selectedPublishers.includes(8)}
|
|
|
|
|
// onChange={() => handleCheckboxChange(8)}
|
|
|
|
|
// />
|
|
|
|
|
// <Label htmlFor="8">KSP</Label>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// <SuggestionModal
|
|
|
|
|
// id={Number(id)}
|
|
|
|
|
// numberOfSuggestion={detail?.numberOfSuggestion}
|
|
|
|
|
// />
|
|
|
|
|
// <div className="px-3 py-3 border mx-3">
|
|
|
|
|
// <p>Information:</p>
|
|
|
|
|
// <p className="text-sm text-slate-400">{detail?.statusName}</p>
|
|
|
|
|
// <p>Komentar</p>
|
|
|
|
|
// <p>{approval?.message}</p>
|
|
|
|
|
// <p className="text-right text-sm">
|
|
|
|
|
// {" "}
|
|
|
|
|
// {approval?.approvalBy?.fullname} |{" "}
|
|
|
|
|
// {formatDateToIndonesian(approval?.approvalDate)}
|
|
|
|
|
// </p>
|
|
|
|
|
// <ApprovalHistoryModal id={Number(id)} />
|
|
|
|
|
// </div>
|
|
|
|
|
// {/* {detail?.isPublish == false ? (
|
|
|
|
|
// <div className="p-3">
|
|
|
|
|
// <Button className="bg-blue-600">Publish</Button>
|
|
|
|
|
// </div>
|
|
|
|
|
// ) : (
|
|
|
|
|
// ""
|
|
|
|
|
// )} */}
|
|
|
|
|
|
|
|
|
|
// <Dialog open={modalOpen} onOpenChange={setModalOpen}>
|
|
|
|
|
// <DialogContent>
|
|
|
|
|
// <DialogHeader>
|
|
|
|
|
// <DialogTitle>Leave Comment</DialogTitle>
|
|
|
|
|
// </DialogHeader>
|
|
|
|
|
// {status == "2"
|
|
|
|
|
// ? files?.map((file, index) => (
|
|
|
|
|
// <div
|
|
|
|
|
// key={file.id}
|
|
|
|
|
// className="flex flex-row gap-2 items-center"
|
|
|
|
|
// >
|
|
|
|
|
// {/* <img src={file.url} className="w-[200px]" /> */}
|
|
|
|
|
// <svg
|
|
|
|
|
// xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
// width="48"
|
|
|
|
|
// height="48"
|
|
|
|
|
// viewBox="0 0 24 24"
|
|
|
|
|
// >
|
|
|
|
|
// <g fill="none" fill-rule="evenodd">
|
|
|
|
|
// <path d="m12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.018-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z" />
|
|
|
|
|
// <path
|
|
|
|
|
// fill="currentColor"
|
|
|
|
|
// d="M20 3a2 2 0 0 1 1.995 1.85L22 5v14a2 2 0 0 1-1.85 1.995L20 21H4a2 2 0 0 1-1.995-1.85L2 19V5a2 2 0 0 1 1.85-1.995L4 3zm0 2H4v14h16zm-9.66 2.638l.518.23l.338.16l.387.19l.43.218l.47.25l.507.28l.266.152l.518.305l.474.292l.43.273l.38.253l.48.33l.364.263l.095.07a1.234 1.234 0 0 1 0 1.98l-.323.235l-.44.308l-.356.239l-.405.263l-.453.283l-.499.3l-.534.309l-.509.282l-.471.25l-.43.22l-.386.188l-.622.288l-.23.1a1.234 1.234 0 0 1-1.714-.99l-.058-.565l-.032-.374l-.042-.664l-.023-.508l-.015-.555l-.004-.294l-.002-.305q0-.31.006-.6l.015-.555l.023-.507l.027-.457l.03-.401l.075-.744a1.235 1.235 0 0 1 1.715-.992m.611 2.501l-.436-.218l-.029.487l-.022.551l-.013.61l-.002.325l.002.325l.013.609l.01.283l.026.52l.015.235l.434-.218l.487-.256l.535-.294l.284-.162l.551-.326l.494-.306l.436-.28l.196-.13l-.407-.27l-.466-.294a30 30 0 0 0-.803-.48l-.283-.161l-.534-.294z"
|
|
|
|
|
// />
|
|
|
|
|
// </g>
|
|
|
|
|
// </svg>
|
|
|
|
|
// <div className="flex flex-col gap-2 w-full">
|
|
|
|
|
// <div className="flex justify-between text-sm">
|
|
|
|
|
// {file.fileName}
|
|
|
|
|
// <a
|
|
|
|
|
// onClick={() =>
|
|
|
|
|
// handleDeleteFileApproval(file.id)
|
|
|
|
|
// }
|
|
|
|
|
// >
|
|
|
|
|
// <Icon icon="humbleicons:times" color="red" />
|
|
|
|
|
// </a>
|
|
|
|
|
// </div>
|
|
|
|
|
// {isUserMabesApprover && (
|
|
|
|
|
// <div className="flex flex-row gap-2">
|
|
|
|
|
// <div className="flex items-center space-x-2">
|
|
|
|
|
// <Checkbox
|
|
|
|
|
// id="terms"
|
|
|
|
|
// value="all"
|
|
|
|
|
// checked={filePlacements[index]?.includes(
|
|
|
|
|
// "all"
|
|
|
|
|
// )}
|
|
|
|
|
// onCheckedChange={(e) =>
|
|
|
|
|
// setupPlacement(index, "all", Boolean(e))
|
|
|
|
|
// }
|
|
|
|
|
// />
|
|
|
|
|
// <label
|
|
|
|
|
// htmlFor="terms"
|
|
|
|
|
// className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
|
|
|
// >
|
|
|
|
|
// All
|
|
|
|
|
// </label>
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="flex items-center space-x-2">
|
|
|
|
|
// <Checkbox
|
|
|
|
|
// id="terms"
|
|
|
|
|
// checked={filePlacements[index]?.includes(
|
|
|
|
|
// "mabes"
|
|
|
|
|
// )}
|
|
|
|
|
// onCheckedChange={(e) =>
|
|
|
|
|
// setupPlacement(index, "mabes", Boolean(e))
|
|
|
|
|
// }
|
|
|
|
|
// />
|
|
|
|
|
// <label
|
|
|
|
|
// htmlFor="terms"
|
|
|
|
|
// className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
|
|
|
// >
|
|
|
|
|
// Nasional
|
|
|
|
|
// </label>
|
|
|
|
|
// </div>
|
|
|
|
|
// <div className="flex items-center space-x-2">
|
|
|
|
|
// <Checkbox
|
|
|
|
|
// id="terms"
|
|
|
|
|
// checked={filePlacements[index]?.includes(
|
|
|
|
|
// "polda"
|
|
|
|
|
// )}
|
|
|
|
|
// onCheckedChange={(e) =>
|
|
|
|
|
// setupPlacement(index, "polda", Boolean(e))
|
|
|
|
|
// }
|
|
|
|
|
// />
|
|
|
|
|
// <label
|
|
|
|
|
// htmlFor="terms"
|
|
|
|
|
// className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
|
|
|
// >
|
|
|
|
|
// Wilayah
|
|
|
|
|
// </label>
|
|
|
|
|
// </div>
|
|
|
|
|
|
|
|
|
|
// <div className="flex items-center space-x-2">
|
|
|
|
|
// <Checkbox
|
|
|
|
|
// id="terms"
|
|
|
|
|
// checked={filePlacements[index]?.includes(
|
|
|
|
|
// "international"
|
|
|
|
|
// )}
|
|
|
|
|
// onCheckedChange={(e) =>
|
|
|
|
|
// setupPlacement(
|
|
|
|
|
// index,
|
|
|
|
|
// "international",
|
|
|
|
|
// Boolean(e)
|
|
|
|
|
// )
|
|
|
|
|
// }
|
|
|
|
|
// />
|
|
|
|
|
// <label
|
|
|
|
|
// htmlFor="terms"
|
|
|
|
|
// className="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
|
|
|
// >
|
|
|
|
|
// Internasional
|
|
|
|
|
// </label>
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// )}
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// ))
|
|
|
|
|
// : ""}
|
|
|
|
|
// <div className="flex flex-col gap-4">
|
|
|
|
|
// <Textarea
|
|
|
|
|
// placeholder="Type your message here."
|
|
|
|
|
// value={description}
|
|
|
|
|
// onChange={(e) => setDescription(e.target.value)}
|
|
|
|
|
// />
|
|
|
|
|
// </div>
|
|
|
|
|
// {status == "3" || status == "4" ? (
|
|
|
|
|
// <div className="flex flex-row gap-2">
|
|
|
|
|
// <Badge
|
|
|
|
|
// color={
|
|
|
|
|
// description === "Kualitas media kurang baik"
|
|
|
|
|
// ? "primary"
|
|
|
|
|
// : "default"
|
|
|
|
|
// }
|
|
|
|
|
// className="cursor-pointer"
|
|
|
|
|
// onClick={() =>
|
|
|
|
|
// setDescription("Kualitas media kurang baik")
|
|
|
|
|
// }
|
|
|
|
|
// >
|
|
|
|
|
// Kualitas media kurang baik
|
|
|
|
|
// </Badge>
|
|
|
|
|
|
|
|
|
|
// <Badge
|
|
|
|
|
// color={
|
|
|
|
|
// description === "Deskripsi kurang lengkap"
|
|
|
|
|
// ? "primary"
|
|
|
|
|
// : "default"
|
|
|
|
|
// }
|
|
|
|
|
// className="cursor-pointer"
|
|
|
|
|
// onClick={() =>
|
|
|
|
|
// setDescription("Deskripsi kurang lengkap")
|
|
|
|
|
// }
|
|
|
|
|
// >
|
|
|
|
|
// Deskripsi kurang lengkap
|
|
|
|
|
// </Badge>
|
|
|
|
|
// <Badge
|
|
|
|
|
// color={
|
|
|
|
|
// description === "Judul kurang tepat"
|
|
|
|
|
// ? "primary"
|
|
|
|
|
// : "default"
|
|
|
|
|
// }
|
|
|
|
|
// className="cursor-pointer"
|
|
|
|
|
// onClick={() => setDescription("Judul kurang tepat")}
|
|
|
|
|
// >
|
|
|
|
|
// Judul kurang tepat
|
|
|
|
|
// </Badge>
|
|
|
|
|
// </div>
|
|
|
|
|
// ) : (
|
|
|
|
|
// <div className="flex flex-row gap-2">
|
|
|
|
|
// <Badge
|
|
|
|
|
// color={
|
|
|
|
|
// description === "Konten sangat bagus"
|
|
|
|
|
// ? "primary"
|
|
|
|
|
// : "default"
|
|
|
|
|
// }
|
|
|
|
|
// className="cursor-pointer"
|
|
|
|
|
// onClick={() => setDescription("Konten sangat bagus")}
|
|
|
|
|
// >
|
|
|
|
|
// Konten sangat bagus
|
|
|
|
|
// </Badge>
|
|
|
|
|
// <Badge
|
|
|
|
|
// color={
|
|
|
|
|
// description === "Konten menarik"
|
|
|
|
|
// ? "primary"
|
|
|
|
|
// : "default"
|
|
|
|
|
// }
|
|
|
|
|
// className="cursor-pointer"
|
|
|
|
|
// onClick={() => setDescription("Konten menarik")}
|
|
|
|
|
// >
|
|
|
|
|
// Konten menarik
|
|
|
|
|
// </Badge>
|
|
|
|
|
// </div>
|
|
|
|
|
// )}
|
|
|
|
|
// <DialogFooter>
|
|
|
|
|
// <Button
|
|
|
|
|
// type="button"
|
|
|
|
|
// color="primary"
|
|
|
|
|
// onClick={() => submit()}
|
|
|
|
|
// >
|
|
|
|
|
// Submit
|
|
|
|
|
// </Button>
|
|
|
|
|
// <Button
|
|
|
|
|
// type="button"
|
|
|
|
|
// color="destructive"
|
|
|
|
|
// onClick={() => setModalOpen(false)}
|
|
|
|
|
// >
|
|
|
|
|
// Cancel
|
|
|
|
|
// </Button>
|
|
|
|
|
// </DialogFooter>
|
|
|
|
|
// </DialogContent>
|
|
|
|
|
// </Dialog>
|
|
|
|
|
// </Card>
|
|
|
|
|
// {Number(detail?.needApprovalFromLevel) == Number(userLevelId) ? (
|
|
|
|
|
// Number(detail?.uploadedById) == Number(userId) ? (
|
|
|
|
|
// ""
|
|
|
|
|
// ) : (
|
|
|
|
|
// <div className="flex flex-col gap-2 p-3">
|
|
|
|
|
// <Button
|
|
|
|
|
// onClick={() => actionApproval("2")}
|
|
|
|
|
// color="primary"
|
|
|
|
|
// type="button"
|
|
|
|
|
// >
|
|
|
|
|
// <Icon icon="fa:check" className="mr-3" /> Accept
|
|
|
|
|
// </Button>
|
|
|
|
|
// <Button
|
|
|
|
|
// onClick={() => actionApproval("3")}
|
|
|
|
|
// className="bg-orange-400 hover:bg-orange-300"
|
|
|
|
|
// type="button"
|
|
|
|
|
// >
|
|
|
|
|
// <Icon icon="fa:comment-o" className="mr-3" /> Revision
|
|
|
|
|
// </Button>
|
|
|
|
|
// <Button
|
|
|
|
|
// onClick={() => actionApproval("4")}
|
|
|
|
|
// color="destructive"
|
|
|
|
|
// type="button"
|
|
|
|
|
// >
|
|
|
|
|
// <Icon icon="fa:times" className="mr-3" />
|
|
|
|
|
// Reject
|
|
|
|
|
// </Button>
|
|
|
|
|
// </div>
|
|
|
|
|
// )
|
|
|
|
|
// ) : (
|
|
|
|
|
// ""
|
|
|
|
|
// )}
|
|
|
|
|
// </div>
|
|
|
|
|
// </div>
|
|
|
|
|
// ) : (
|
|
|
|
|
// ""
|
|
|
|
|
// )}
|
|
|
|
|
// </form>
|
|
|
|
|
// );
|
|
|
|
|
// }
|