fix: rollback url admin breakdown and fixing page convert spit
This commit is contained in:
commit
b151325bc0
|
|
@ -5,7 +5,7 @@ export default function CreateEmailBlast() {
|
|||
return (
|
||||
<div>
|
||||
<SiteBreadcrumb />
|
||||
<ContentBlast />
|
||||
<ContentBlast />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ export default function CreateWABlast() {
|
|||
return (
|
||||
<div>
|
||||
<SiteBreadcrumb />
|
||||
{/* <ContentBlast type="wa" /> */}
|
||||
{/* <ContentBlast /> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,10 +210,57 @@ export default function FormConvertSPIT() {
|
|||
const roleId = getCookiesDecrypt("urie");
|
||||
const [isUserMabesApprover, setIsUserMabesApprover] = useState(false);
|
||||
|
||||
// Gunakan channel untuk sync antar tab
|
||||
const publishChannel = useRef<BroadcastChannel | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
initializeComponent();
|
||||
// Init broadcast channel
|
||||
publishChannel.current = new BroadcastChannel("spit-publish-channel");
|
||||
|
||||
// Listener untuk update dari tab lain
|
||||
publishChannel.current.onmessage = (event) => {
|
||||
if (event.data === "SPIT_PUBLISHED") {
|
||||
setIsAlreadySaved(true);
|
||||
|
||||
MySwal.fire({
|
||||
title: "Konten Sudah Dipublish",
|
||||
text: "Konten ini sudah dipublish dari tab lain. Halaman akan di-refresh.",
|
||||
icon: "info",
|
||||
confirmButtonColor: "#3085d6",
|
||||
}).then(() => {
|
||||
loadDetail(); // Refresh data terbaru
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return () => {
|
||||
publishChannel.current?.close();
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(async () => {
|
||||
if (detail?.id) {
|
||||
const response = await detailSPIT(detail.id);
|
||||
const latest = response?.data?.data;
|
||||
|
||||
if (latest?.isPublish && !isAlreadySaved) {
|
||||
setIsAlreadySaved(true);
|
||||
|
||||
MySwal.fire({
|
||||
title: "Konten Sudah Dipublish",
|
||||
text: "Konten ini sudah dipublish dari tab lain. Halaman akan di-refresh.",
|
||||
icon: "info",
|
||||
confirmButtonColor: "#3085d6",
|
||||
}).then(() => loadDetail());
|
||||
}
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [detail, isAlreadySaved]);
|
||||
|
||||
useEffect(() => {
|
||||
checkUserPermissions();
|
||||
}, [userLevelId, roleId]);
|
||||
|
|
@ -624,6 +671,9 @@ export default function FormConvertSPIT() {
|
|||
|
||||
await convertSPIT(requestData);
|
||||
|
||||
// Broadcast ke semua tab bahwa konten ini sudah publish
|
||||
publishChannel.current?.postMessage("SPIT_PUBLISHED");
|
||||
|
||||
MySwal.fire({
|
||||
title: "Success",
|
||||
text: "Data saved successfully",
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ export type taskDetail = {
|
|||
title: string;
|
||||
fileTypeOutput: string;
|
||||
assignedToRole: string;
|
||||
assignedToLevel: string;
|
||||
assignedToTopLevel: string;
|
||||
assignmentType: {
|
||||
id: number;
|
||||
|
|
@ -824,6 +825,34 @@ export default function FormTaskDetail() {
|
|||
)}&embedded=true`;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!detail) return;
|
||||
|
||||
// Ambil dari API
|
||||
let role = detail?.assignedToRole;
|
||||
|
||||
// Kalau API tidak punya assignedToRole → fallback dari assignedToLevel
|
||||
if (!role || role === "") {
|
||||
if (
|
||||
detail?.assignedToLevel?.includes("3") &&
|
||||
detail?.assignedToLevel?.includes("4")
|
||||
) {
|
||||
role = "3,4";
|
||||
} else if (detail?.assignedToLevel?.includes("4")) {
|
||||
role = "4";
|
||||
} else if (detail?.assignedToLevel?.includes("3")) {
|
||||
role = "3";
|
||||
}
|
||||
}
|
||||
|
||||
// Jika tetap tidak ada → fallback default
|
||||
if (!role || role === "") {
|
||||
role = "3,4";
|
||||
}
|
||||
|
||||
setSelectedTarget(role);
|
||||
}, [detail]);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
{detail !== undefined ? (
|
||||
|
|
@ -929,9 +958,16 @@ export default function FormTaskDetail() {
|
|||
defaultValue: "Assignment Selection",
|
||||
})}
|
||||
</Label>
|
||||
<Select
|
||||
{/* <Select
|
||||
onValueChange={setSelectedTarget}
|
||||
value={detail.assignedToRole}
|
||||
> */}
|
||||
<Select
|
||||
disabled
|
||||
value={selectedTarget}
|
||||
onValueChange={(value) => {
|
||||
setSelectedTarget(value === "" || !value ? "3,4" : value);
|
||||
}}
|
||||
>
|
||||
<SelectTrigger size="md">
|
||||
<SelectValue placeholder="Pilih" />
|
||||
|
|
|
|||
|
|
@ -338,9 +338,14 @@ export default function FormTask() {
|
|||
.map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping])
|
||||
.join(",");
|
||||
|
||||
let roleTargets = selectedTarget
|
||||
? selectedTarget.split(",").map((x) => Number(x))
|
||||
: [];
|
||||
// let roleTargets = selectedTarget
|
||||
// ? selectedTarget.split(",").map((x) => Number(x))
|
||||
// : [];
|
||||
|
||||
let roleTargets =
|
||||
selectedTarget && selectedTarget !== ""
|
||||
? selectedTarget.split(",").map((x) => Number(x))
|
||||
: [3, 4];
|
||||
|
||||
if (!roleTargets.includes(11)) {
|
||||
roleTargets.push(11);
|
||||
|
|
@ -812,6 +817,33 @@ export default function FormTask() {
|
|||
defaultValue: "Assignment Selection",
|
||||
})}
|
||||
</Label>
|
||||
|
||||
<Select
|
||||
value={selectedTarget}
|
||||
defaultValue="3,4"
|
||||
onValueChange={(value) => {
|
||||
// Jika value kosong → fallback default Semua Pengguna
|
||||
setSelectedTarget(value && value !== "" ? value : "3,4");
|
||||
}}
|
||||
>
|
||||
<SelectTrigger size="md">
|
||||
<SelectValue placeholder="Choose" />
|
||||
</SelectTrigger>
|
||||
|
||||
<SelectContent>
|
||||
<SelectItem value="3,4">Semua Pengguna</SelectItem>
|
||||
<SelectItem value="4">Kontributor</SelectItem>
|
||||
<SelectItem value="3">Approver</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{/* <div className="mt-5 space-y-2">
|
||||
<Label>
|
||||
{t("assignment-selection", {
|
||||
defaultValue: "Assignment Selection",
|
||||
})}
|
||||
</Label>
|
||||
<Select onValueChange={setSelectedTarget}>
|
||||
<SelectTrigger size="md">
|
||||
<SelectValue placeholder="Choose" />
|
||||
|
|
@ -822,7 +854,7 @@ export default function FormTask() {
|
|||
<SelectItem value="3">Approver</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="flex flex-wrap gap-3 mt-5 lg:pt-7 lg:ml-3 ">
|
||||
{/* {Object.keys(unitSelection).map((key) => {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -24,28 +24,36 @@ export default function DashboardVisualization() {
|
|||
const view1 =
|
||||
safeLevelName === "MABES POLRI"
|
||||
? isInternational[0]
|
||||
? // "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-content-monitor?"
|
||||
"views/2025_10_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?"
|
||||
: // "views/2023_09_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?"
|
||||
"views/2025_10_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?"
|
||||
?
|
||||
"views/2023_04_MediaHUB-Viz_INTL_Rev202/db-content-monitor?"
|
||||
// "views/2025_10_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?"
|
||||
:
|
||||
"views/2023_09_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?"
|
||||
// "views/2025_10_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?"
|
||||
: safeLevelName.includes("POLDA")
|
||||
? // `views/2023_09_MediaHUB-Viz-ADMIN-POLDA-content-monitor_Rev100/db-content-monitor?provinsi-polda=${state}&`
|
||||
`views/2025_10_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?provinsi-polda=${state}&`
|
||||
: // `views/2023_09_MediaHUB-Viz-ADMIN-POLDA-content-monitor_Rev100/db-content-monitor?satker-selected=${state}&`;
|
||||
`views/2025_10_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?provinsi-polda=${state}&`;
|
||||
?
|
||||
`views/2023_09_MediaHUB-Viz-ADMIN-POLDA-content-monitor_Rev100/db-content-monitor?provinsi-polda=${state}&`
|
||||
// `views/2025_10_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?provinsi-polda=${state}&`
|
||||
:
|
||||
`views/2023_09_MediaHUB-Viz-ADMIN-POLDA-content-monitor_Rev100/db-content-monitor?satker-selected=${state}&`;
|
||||
// `views/2025_10_MediaHUB-Viz-POLDA-content-monitor_Rev100/db-content-monitor?provinsi-polda=${state}&`;
|
||||
|
||||
const view2 =
|
||||
levelName == "MABES POLRI"
|
||||
? isInternational[1]
|
||||
? // "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-content-interaction-konten?"
|
||||
"views/2025_10_MediaHUB-Viz-POLDA_Rev201/db-content-interaction?"
|
||||
: // "views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-content-interaction-konten?"
|
||||
"views/2025_10_MediaHUB-Viz-POLDA_Rev201/db-content-interaction?"
|
||||
?
|
||||
"views/2023_04_MediaHUB-Viz_INTL_Rev202/db-content-interaction-konten?"
|
||||
// "views/2025_10_MediaHUB-Viz-POLDA_Rev201/db-content-interaction?"
|
||||
:
|
||||
"views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-content-interaction-konten?"
|
||||
// "views/2025_10_MediaHUB-Viz-POLDA_Rev201/db-content-interaction?"
|
||||
: safeLevelName.includes("POLDA")
|
||||
? // `views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-content-interaction-konten-polda?provinsi-polda=${state}&`
|
||||
`views/2025_10_MediaHUB-Viz-POLDA_Rev201/db-content-interaction?provinsi-polda=${state}&`
|
||||
: // `views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-konten-polda?polda-selected=${state}&`;
|
||||
`views/2025_10_MediaHUB-Viz-POLDA_Rev201/db-content-interaction?provinsi-polda=${state}&`;
|
||||
?
|
||||
`views/2023_04_MediaHUB-Viz-POLDA_Rev201/db-content-interaction-konten-polda?provinsi-polda=${state}&`
|
||||
// `views/2025_10_MediaHUB-Viz-POLDA_Rev201/db-content-interaction?provinsi-polda=${state}&`
|
||||
:
|
||||
`views/2023_04_MediaHUB-Viz-POLDA_Rev200/db-content-interaction-konten-polda?polda-selected=${state}&`;
|
||||
// `views/2025_10_MediaHUB-Viz-POLDA_Rev201/db-content-interaction?provinsi-polda=${state}&`;
|
||||
|
||||
const view3 =
|
||||
levelName == "MABES POLRI"
|
||||
|
|
|
|||
Loading…
Reference in New Issue