fix: url in analytics and fix task-ta for, task detail form

This commit is contained in:
Sabda Yagra 2025-11-25 12:17:48 +07:00
parent 8c07105c80
commit c7af4d1f48
4 changed files with 74 additions and 24 deletions

View File

@ -131,14 +131,23 @@ export default function ExecutiveDataDashboard() {
? `views/2025_10_MediaHUB-Viz-POLDA_Rev200/db-hm-satker?provinsi-polda=${provState}&` ? `views/2025_10_MediaHUB-Viz-POLDA_Rev200/db-hm-satker?provinsi-polda=${provState}&`
: ""; : "";
// const view7 =
// levelName == "MABES POLRI"
// ? isInternational[2]
// ? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-penugasan-vertical-bar?"
// : "views/2025_11_db-penugasan_rev100/db-penugasan-mabes?"
// : safeLevelName.includes("POLDA")
// ? `views/2023_09_db-penugasan_rev200_17635638922590/db-penugasan-vertical-bar?polda-selected=${provState}&`
// : `views/2025_11_db-penugasan_rev100/db-penugasan-mabes?provinsi-polda=${provState}&`;
const view7 = const view7 =
levelName == "MABES POLRI" levelNumber === "1"
? isInternational[2] ? "views/2025_11_db-penugasan_rev100/db-penugasan-mabes?"
? "views/2023_04_MediaHUB-Viz_INTL_Rev202/db-penugasan-vertical-bar?" : levelNumber === "2"
: "views/2025_11_db-penugasan_rev100/db-penugasan-mabes?" ? `views/2025_11_db-penugasan_rev100/db-penugasan-polda?provinsi-polda=${state}&`
: safeLevelName.includes("POLDA") : levelNumber === "3"
? `views/2023_09_db-penugasan_rev200_17635638922590/db-penugasan-vertical-bar?polda-selected=${provState}&` ? `views/2025_11_db-penugasan_rev100/db-penugasan-satker?provinsi-polda=${state}&`
: `views/2025_11_db-penugasan_rev100/db-penugasan-mabes?provinsi-polda=${provState}&`; : "";
const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true"; const param = ":embed=yes&:toolbar=yes&:iframeSizedToWindow=true";

View File

@ -552,8 +552,8 @@ export default function FormTaskTa() {
> >
<RadioGroupItem value="atensi-khusus" id="khusus" /> <RadioGroupItem value="atensi-khusus" id="khusus" />
<Label htmlFor="atensi-khusus">Atensi Khusus</Label> <Label htmlFor="atensi-khusus">Atensi Khusus</Label>
{/* <RadioGroupItem value="tugas-harian" id="harian" /> <RadioGroupItem value="tugas-harian" id="harian" />
<Label htmlFor="tugas-harian">Tugas Harian</Label> */} <Label htmlFor="tugas-harian">Tugas Harian</Label>
</RadioGroup> </RadioGroup>
</div> </div>
<div className="flex flex-col space-y-2 mt-5"> <div className="flex flex-col space-y-2 mt-5">
@ -772,7 +772,7 @@ export default function FormTaskTa() {
echoCancellation: true, echoCancellation: true,
}} }}
downloadOnSavePress={true} downloadOnSavePress={true}
downloadFileExtension="webm" downloadFileExtension="mp3"
/> />
<FileUploader <FileUploader
accept={{ accept={{

View File

@ -816,7 +816,7 @@ export default function FormTaskTaNew() {
</Button> </Button>
</div> </div>
<div className="mt-4"> <div className="mt-4">
<Link href={"/contributor/content/image"}> <Link href={"/contributor/task-ta"}>
<Button type="submit" color="primary" variant="outline"> <Button type="submit" color="primary" variant="outline">
{t("cancel", { defaultValue: "Cancel" })} {t("cancel", { defaultValue: "Cancel" })}
</Button> </Button>

View File

@ -648,6 +648,19 @@ export default function FormTaskDetail() {
setReplyingTo(id); setReplyingTo(id);
}; };
const getViewerUrl = (url: string) => {
const ext = url.split(".").pop()?.toLowerCase();
if (ext === "pdf") {
return url; // langsung tampilkan PDF
}
// doc / docx → pakai Google Viewer, lebih compatible
return `https://docs.google.com/viewer?url=${encodeURIComponent(
url
)}&embedded=true`;
};
const getModalContent = (type: "terkirim" | "diterima") => ( const getModalContent = (type: "terkirim" | "diterima") => (
<div className="overflow-x-auto overflow-y-auto "> <div className="overflow-x-auto overflow-y-auto ">
{Isloading ? ( {Isloading ? (
@ -816,7 +829,9 @@ export default function FormTaskDetail() {
{detail !== undefined ? ( {detail !== undefined ? (
<div className="px-6 py-6"> <div className="px-6 py-6">
<div className="flex flex-col sm:flex-row lg:flex-row justify-between"> <div className="flex flex-col sm:flex-row lg:flex-row justify-between">
<p className="text-lg font-semibold mb-3">{t("detail-task", { defaultValue: "Detail Task" })}</p> <p className="text-lg font-semibold mb-3">
{t("detail-task", { defaultValue: "Detail Task" })}
</p>
<div <div
className="flex gap-3" className="flex gap-3"
style={ style={
@ -834,7 +849,8 @@ export default function FormTaskDetail() {
color="primary" color="primary"
onClick={() => setModalType("terkirim")} onClick={() => setModalType("terkirim")}
> >
{sentAcceptance?.length} {t("sent", { defaultValue: "Sent" })} {sentAcceptance?.length}{" "}
{t("sent", { defaultValue: "Sent" })}
</Button> </Button>
</DialogTrigger> </DialogTrigger>
@ -844,14 +860,17 @@ export default function FormTaskDetail() {
onClick={() => setModalType("diterima")} onClick={() => setModalType("diterima")}
className="ml-3" className="ml-3"
> >
{acceptAcceptance?.length} {t("accepted", { defaultValue: "Accepted" })} {acceptAcceptance?.length}{" "}
{t("accepted", { defaultValue: "Accepted" })}
</Button> </Button>
</DialogTrigger> </DialogTrigger>
<DialogContent className="sm:max-w-[425px] md:max-w-[500px] lg:max-w-[1500px] overflow-y-auto max-h-[500px]"> <DialogContent className="sm:max-w-[425px] md:max-w-[500px] lg:max-w-[1500px] overflow-y-auto max-h-[500px]">
<DialogHeader> <DialogHeader>
<DialogTitle> <DialogTitle>
{t("assignment-status-details", { defaultValue: "Assignment Status Details" })} {t("assignment-status-details", {
defaultValue: "Assignment Status Details",
})}
</DialogTitle> </DialogTitle>
</DialogHeader> </DialogHeader>
@ -866,7 +885,9 @@ export default function FormTaskDetail() {
<form> <form>
<div className="gap-5 mb-5"> <div className="gap-5 mb-5">
<div className="space-y-2"> <div className="space-y-2">
<Label>{t("unique-code", { defaultValue: "Unique Code" })}</Label> <Label>
{t("unique-code", { defaultValue: "Unique Code" })}
</Label>
<Controller <Controller
control={control} control={control}
name="uniqueCode" name="uniqueCode"
@ -903,7 +924,11 @@ export default function FormTaskDetail() {
</div> </div>
<div className="flex flex-col sm:flex-row lg:flex-row sm:items-center lg:items-center"> <div className="flex flex-col sm:flex-row lg:flex-row sm:items-center lg:items-center">
<div className="mt-6 space-y-2"> <div className="mt-6 space-y-2">
<Label>{t("assignment-selection", { defaultValue: "Assignment Selection" })}</Label> <Label>
{t("assignment-selection", {
defaultValue: "Assignment Selection",
})}
</Label>
<Select <Select
onValueChange={setSelectedTarget} onValueChange={setSelectedTarget}
value={detail.assignedToRole} value={detail.assignedToRole}
@ -1040,7 +1065,9 @@ export default function FormTaskDetail() {
</RadioGroup> </RadioGroup>
</div> </div>
<div className="mt-6 space-y-2"> <div className="mt-6 space-y-2">
<Label>{t("assigment-type", { defaultValue: "Assigment Type" })} </Label> <Label>
{t("assigment-type", { defaultValue: "Assigment Type" })}{" "}
</Label>
<RadioGroup <RadioGroup
value={detail.taskType.toString()} value={detail.taskType.toString()}
onValueChange={(value) => setTaskType(String(value))} onValueChange={(value) => setTaskType(String(value))}
@ -1054,7 +1081,9 @@ export default function FormTaskDetail() {
</div> </div>
{/* RadioGroup Assignment Category */} {/* RadioGroup Assignment Category */}
<div className="mt-6 space-y-2"> <div className="mt-6 space-y-2">
<Label>{t("type-of-task", { defaultValue: "Type Of Task" })}</Label> <Label>
{t("type-of-task", { defaultValue: "Type Of Task" })}
</Label>
<RadioGroup <RadioGroup
value={detail.assignmentType.id.toString()} value={detail.assignmentType.id.toString()}
onValueChange={(value) => setType(value)} onValueChange={(value) => setType(value)}
@ -1075,7 +1104,9 @@ export default function FormTaskDetail() {
</RadioGroup> </RadioGroup>
</div> </div>
<div className="mt-6 space-y-2"> <div className="mt-6 space-y-2">
<Label>{t("output-task", { defaultValue: "Output Task" })}</Label> <Label>
{t("output-task", { defaultValue: "Output Task" })}
</Label>
<div className="flex flex-wrap gap-3"> <div className="flex flex-wrap gap-3">
{Object.keys(taskOutput).map((key) => ( {Object.keys(taskOutput).map((key) => (
<div className="flex items-center gap-2" key={key}> <div className="flex items-center gap-2" key={key}>
@ -1096,7 +1127,9 @@ export default function FormTaskDetail() {
</div> </div>
<div className="mt-6 space-y-2"> <div className="mt-6 space-y-2">
<Label>{t("description", { defaultValue: "Description" })}</Label> <Label>
{t("description", { defaultValue: "Description" })}
</Label>
<Controller <Controller
control={control} control={control}
name="naration" name="naration"
@ -1111,11 +1144,15 @@ export default function FormTaskDetail() {
)} */} )} */}
</div> </div>
<div className=" mt-5 space-y-2"> <div className=" mt-5 space-y-2">
<Label htmlFor="attachment">{t("attachment", { defaultValue: "Attachment" })}</Label> <Label htmlFor="attachment">
{t("attachment", { defaultValue: "Attachment" })}
</Label>
<div className="space-y-3"> <div className="space-y-3">
<div> <div>
{videoUploadedFiles?.length > 0 && ( {videoUploadedFiles?.length > 0 && (
<Label>{t("audio-visual", { defaultValue: "Audio Visual" })}</Label> <Label>
{t("audio-visual", { defaultValue: "Audio Visual" })}
</Label>
)} )}
<div> <div>
{selectedVideo && ( {selectedVideo && (
@ -1216,12 +1253,16 @@ export default function FormTaskDetail() {
<div> <div>
{selectedText && ( {selectedText && (
<Card className="mt-2"> <Card className="mt-2">
<iframe {/* <iframe
className="w-full h-96 rounded-md" className="w-full h-96 rounded-md"
src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent( src={`https://view.officeapps.live.com/op/embed.aspx?src=${encodeURIComponent(
selectedText selectedText
)}`} )}`}
title={"Document"} title={"Document"}
/> */}
<iframe
className="w-full h-96"
src={getViewerUrl(selectedText)}
/> />
</Card> </Card>
)} )}