feat: update image detail
This commit is contained in:
parent
285bcad1d8
commit
f21a5ae389
|
|
@ -978,12 +978,21 @@ export default function FormImageDetail() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getPlacement = () => {
|
const getPlacement = () => {
|
||||||
console.log("getPlaa", filePlacements);
|
|
||||||
const temp = [];
|
const temp = [];
|
||||||
for (let i = 0; i < filePlacements?.length; i++) {
|
for (let i = 0; i < filePlacements?.length; i++) {
|
||||||
if (filePlacements[i]?.length !== 0) {
|
if (filePlacements[i]?.length !== 0) {
|
||||||
const now = filePlacements[i]?.filter((a) => a !== "all");
|
const now = filePlacements[i]?.filter((a) => a !== "semua");
|
||||||
const data = { mediaFileId: files[i]?.id, placements: now?.join(",") };
|
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);
|
temp.push(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1004,16 +1013,16 @@ export default function FormImageDetail() {
|
||||||
statusId: status,
|
statusId: status,
|
||||||
message: description,
|
message: description,
|
||||||
files: isUserMabesApprover ? getPlacement() : [],
|
files: isUserMabesApprover ? getPlacement() : [],
|
||||||
customLocationPlacement: Array.from(allCheckedLevels).join(","),
|
|
||||||
};
|
};
|
||||||
setModalOpen(false);
|
|
||||||
loading();
|
|
||||||
const response = await submitApproval(data);
|
|
||||||
|
|
||||||
if (response?.error) {
|
console.log("Data Approval : ", data);
|
||||||
error(response.message);
|
setModalOpen(false);
|
||||||
return false;
|
// loading();
|
||||||
}
|
// const response = await submitApproval(data);
|
||||||
|
// if (response?.error) {
|
||||||
|
// error(response.message);
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
const dataReject = {
|
const dataReject = {
|
||||||
listFiles: rejectedFiles,
|
listFiles: rejectedFiles,
|
||||||
|
|
@ -1891,9 +1900,7 @@ export default function FormImageDetail() {
|
||||||
</DialogClose>
|
</DialogClose>
|
||||||
<DialogClose asChild>
|
<DialogClose asChild>
|
||||||
<Button>
|
<Button>
|
||||||
{t("save", {
|
Simpan
|
||||||
defaultValue: "Simpan",
|
|
||||||
})}
|
|
||||||
</Button>
|
</Button>
|
||||||
</DialogClose>
|
</DialogClose>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue