fixing detail form all content

This commit is contained in:
Sabda Yagra 2025-08-25 21:25:15 +07:00
parent 5cdde1a75b
commit 8ba5499378
3 changed files with 64 additions and 14 deletions

View File

@ -588,8 +588,24 @@ export default function FormAudioDetail() {
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 !== "all");
// const data = { mediaFileId: files[i]?.id, placements: now.join(",") };
const now = filePlacements[i];
let nowArr = now?.join(",")?.replaceAll("wilayah", "polda");
nowArr = nowArr?.replaceAll("nasional", "mabes");
nowArr = nowArr?.replaceAll("semua", "all");
// 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);
}
}
@ -1623,9 +1639,10 @@ export default function FormAudioDetail() {
</DialogClose>
<DialogClose asChild>
<Button>
{t("save", {
{/* {t("save", {
defaultValue: "Simpan",
})}
})} */}
Simpan
</Button>
</DialogClose>
</div>

View File

@ -538,12 +538,27 @@ export default function FormTeksDetail() {
};
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 !== "all");
// const data = { mediaFileId: files[i]?.id, placements: now?.join(",") };
const now = filePlacements[i];
let nowArr = now?.join(",")?.replaceAll("wilayah", "polda");
nowArr = nowArr?.replaceAll("nasional", "mabes");
nowArr = nowArr?.replaceAll("semua", "all");
// 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);
}
}
@ -1591,9 +1606,10 @@ export default function FormTeksDetail() {
</DialogClose>
<DialogClose asChild>
<Button>
{t("save", {
{/* {t("save", {
defaultValue: "Simpan",
})}
})} */}
Simpan
</Button>
</DialogClose>
</div>

View File

@ -561,12 +561,28 @@ export default function FormVideoDetail() {
}
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 !== "all");
// const data = { mediaFileId: files[i].id, placements: now.join(",") };
// const now = filePlacements[i]?.filter((a) => a !== "semua");
const now = filePlacements[i];
let nowArr = now?.join(",")?.replaceAll("wilayah", "polda");
nowArr = nowArr?.replaceAll("nasional", "mabes");
nowArr = nowArr?.replaceAll("semua", "all");
// 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);
}
}
@ -1584,9 +1600,10 @@ export default function FormVideoDetail() {
</DialogClose>
<DialogClose asChild>
<Button>
{t("save", {
{/* {t("save", {
defaultValue: "Simpan",
})}
})} */}
Simpan
</Button>
</DialogClose>
</div>