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