Merge branch 'dev-anang' of https://gitlab.com/hanifsalafi/mediahub_redesign
This commit is contained in:
commit
31e3b6f218
|
|
@ -151,6 +151,17 @@ interface FileWithPreview extends File {
|
||||||
preview: string;
|
preview: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface UploadResult {
|
||||||
|
id: number;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
createdAt: string;
|
||||||
|
category: { name: string };
|
||||||
|
fileType: { name: string };
|
||||||
|
uploadStatus: { name: string };
|
||||||
|
creatorName: string;
|
||||||
|
}
|
||||||
|
|
||||||
export default function FormTaskDetail() {
|
export default function FormTaskDetail() {
|
||||||
const MySwal = withReactContent(Swal);
|
const MySwal = withReactContent(Swal);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -171,8 +182,9 @@ export default function FormTaskDetail() {
|
||||||
text: false,
|
text: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// const [assignmentType, setAssignmentType] = useState("mediahub");
|
const [uploadResults, setUploadResults] = useState<UploadResult[]>([]);
|
||||||
// const [assignmentCategory, setAssignmentCategory] = useState("publication");
|
const [isTableResult, setIsTableResult] = useState(false);
|
||||||
|
const [isSentResult] = useState(false);
|
||||||
const [mainType, setMainType] = useState<string>("1");
|
const [mainType, setMainType] = useState<string>("1");
|
||||||
const [taskType, setTaskType] = useState<string>("atensi-khusus");
|
const [taskType, setTaskType] = useState<string>("atensi-khusus");
|
||||||
const [broadcastType, setBroadcastType] = useState<string>(""); // untuk Tipe Penugasan
|
const [broadcastType, setBroadcastType] = useState<string>(""); // untuk Tipe Penugasan
|
||||||
|
|
@ -267,6 +279,10 @@ export default function FormTaskDetail() {
|
||||||
|
|
||||||
setDetail(details);
|
setDetail(details);
|
||||||
|
|
||||||
|
if (details) {
|
||||||
|
setUploadResults(details.uploadResults || []);
|
||||||
|
}
|
||||||
|
|
||||||
if (details?.assignedToLevel) {
|
if (details?.assignedToLevel) {
|
||||||
const levels = new Set(
|
const levels = new Set(
|
||||||
details.assignedToLevel.split(",").map(Number)
|
details.assignedToLevel.split(",").map(Number)
|
||||||
|
|
@ -1140,7 +1156,7 @@ export default function FormTaskDetail() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-row justify-end gap-3">
|
<div className="flex flex-row justify-end gap-3 my-3">
|
||||||
<div className="">
|
<div className="">
|
||||||
<Button
|
<Button
|
||||||
color="primary"
|
color="primary"
|
||||||
|
|
@ -1165,12 +1181,47 @@ export default function FormTaskDetail() {
|
||||||
Terima Tugas
|
Terima Tugas
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="">
|
<div
|
||||||
<Button color="primary" variant={"default"}>
|
className="task-response w-100 px-3 "
|
||||||
|
style={
|
||||||
|
isSentResult || detail?.createdBy?.id == Number(userId)
|
||||||
|
? {}
|
||||||
|
: {
|
||||||
|
display: "none",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
color="primary"
|
||||||
|
variant={"default"}
|
||||||
|
onClick={() => setIsTableResult(!isTableResult)}
|
||||||
|
>
|
||||||
Hasil Upload
|
Hasil Upload
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{isTableResult && (
|
||||||
|
<table className="w-full border-collapse border border-gray-300">
|
||||||
|
<thead>
|
||||||
|
<tr className="bg-gray-100 border-b">
|
||||||
|
<th className="px-4 py-2 text-left">Judul</th>
|
||||||
|
<th className="px-4 py-2 text-left">Konten</th>
|
||||||
|
<th className="px-4 py-2 text-left">Kategory</th>
|
||||||
|
<th className="px-4 py-2 text-left">Diupload Oleh</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{uploadResults.map((item) => (
|
||||||
|
<tr key={item.id} className="border-b">
|
||||||
|
<td className="px-4 py-2">{item.title}</td>
|
||||||
|
<td className="px-4 py-2">{item.fileType.name}</td>
|
||||||
|
<td className="px-4 py-2">{item.category.name}</td>
|
||||||
|
<td className="px-4 py-2">{item.creatorName}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
)}
|
||||||
{showInput && (
|
{showInput && (
|
||||||
<div className="mt-4 border p-4 rounded bg-gray-50">
|
<div className="mt-4 border p-4 rounded bg-gray-50">
|
||||||
<Textarea
|
<Textarea
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue