feat: update image detail

This commit is contained in:
hanif salafi 2025-08-25 12:16:14 +07:00
parent 285bcad1d8
commit f21a5ae389
1 changed files with 21 additions and 14 deletions

View File

@ -978,12 +978,21 @@ export default function FormImageDetail() {
};
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(",") };
const now = filePlacements[i]?.filter((a) => a !== "semua");
let nowArr = now?.join(",")?.replaceAll("wilayah", "polda");
nowArr = nowArr?.replaceAll("nasional", "mabes");
// Dapatkan checked levels untuk file ini
const currentFileCheckedLevels = fileCheckedLevels[i] ? Array.from(fileCheckedLevels[i]) : [];
const data = {
mediaFileId: files[i]?.id,
placements: nowArr,
assignedToLevel: currentFileCheckedLevels.join(",")
};
temp.push(data);
}
}
@ -1004,16 +1013,16 @@ export default function FormImageDetail() {
statusId: status,
message: description,
files: isUserMabesApprover ? getPlacement() : [],
customLocationPlacement: Array.from(allCheckedLevels).join(","),
};
setModalOpen(false);
loading();
const response = await submitApproval(data);
if (response?.error) {
error(response.message);
return false;
}
console.log("Data Approval : ", data);
setModalOpen(false);
// loading();
// const response = await submitApproval(data);
// if (response?.error) {
// error(response.message);
// return false;
// }
const dataReject = {
listFiles: rejectedFiles,
@ -1891,9 +1900,7 @@ export default function FormImageDetail() {
</DialogClose>
<DialogClose asChild>
<Button>
{t("save", {
defaultValue: "Simpan",
})}
Simpan
</Button>
</DialogClose>
</div>