feat: update image detail
This commit is contained in:
parent
285bcad1d8
commit
f21a5ae389
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue