feat: update detail task

This commit is contained in:
hanif salafi 2025-02-04 15:04:57 +07:00
parent 42d9ce4fc0
commit 3ec4b1f223
1 changed files with 13 additions and 8 deletions

View File

@ -176,6 +176,7 @@ interface UploadResult {
fileType: { name: string };
uploadStatus: { name: string };
creatorName: string;
creatorGroup: string;
}
interface FileUploaded {
@ -327,14 +328,17 @@ export default function FormTaskDetail() {
fetchPoldaPolres();
}, []);
const fetchFilteredData = async (selectedLevels: any[]) => {
const fetchFilteredData = async (selectedLevels?: any[]) => {
try {
const levels =
if (selectedLevels) {
const levels =
selectedLevels.length === 0 ? userLevelId : selectedLevels.join(",");
const response = await getMediaUpload(id, levels);
setUploadResults(response?.data?.data || []);
const response = await getMediaUpload(id, levels);
setUploadResults(response?.data?.data || []);
} else {
const response = await getMediaUpload(id, '');
setUploadResults(response?.data?.data || []);
}
} catch (error) {
console.error("Error fetching filtered data:", error);
}
@ -383,6 +387,7 @@ export default function FormTaskDetail() {
}
}
initState();
fetchFilteredData();
}, [id, refresh]);
const handleUrlChange = (index: number, newUrl: string) => {
@ -1524,7 +1529,7 @@ export default function FormTaskDetail() {
<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">Kategori</th>
<th className="px-4 py-2 text-left">Diupload Oleh</th>
</tr>
</thead>
@ -1536,7 +1541,7 @@ export default function FormTaskDetail() {
</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>
<td className="px-4 py-2">{item.creatorGroup}</td>
</tr>
))}
</tbody>