diff --git a/app/[locale]/(protected)/admin/performance-polres/page.tsx b/app/[locale]/(protected)/admin/performance-polres/page.tsx index 7301a74e..79f22bce 100644 --- a/app/[locale]/(protected)/admin/performance-polres/page.tsx +++ b/app/[locale]/(protected)/admin/performance-polres/page.tsx @@ -5,7 +5,7 @@ export default function PerformancePolda() { return (
-

PERFORMANCE KUMULATIF PER POLDA

+

PERFORMANCE KUMULATIF PER POLRES

); diff --git a/app/[locale]/(protected)/admin/performance-satker/page.tsx b/app/[locale]/(protected)/admin/performance-satker/page.tsx new file mode 100644 index 00000000..1296113c --- /dev/null +++ b/app/[locale]/(protected)/admin/performance-satker/page.tsx @@ -0,0 +1,13 @@ +import SiteBreadcrumb from "@/components/site-breadcrumb"; +import PerformancePolresViz from "@/components/visualization/performance-polres"; +import PerformanceSatkerViz from "@/components/visualization/performance-satker"; + +export default function PerformanceSatker() { + return ( +
+ +

PERFORMANCE KUMULATIF PER SATKER

+ +
+ ); +} diff --git a/app/[locale]/(protected)/dashboard/executive/page.tsx b/app/[locale]/(protected)/dashboard/executive/page.tsx index e4e2c27f..5a34c8eb 100644 --- a/app/[locale]/(protected)/dashboard/executive/page.tsx +++ b/app/[locale]/(protected)/dashboard/executive/page.tsx @@ -383,7 +383,7 @@ export default function ExecutiveDashboard() {
- +

Emergency Issue

diff --git a/components/form/content/audio-form.tsx b/components/form/content/audio-form.tsx index d605f65b..79152771 100644 --- a/components/form/content/audio-form.tsx +++ b/components/form/content/audio-form.tsx @@ -442,7 +442,22 @@ export default function FormAudio() { return; } - const requestData = { + let requestData: { + title: string; + description: string; + htmlDescription: string; + fileTypeId: string; + categoryId: any; + subCategoryId: any; + uploadedBy: string; + statusId: string; + publishedFor: string; + creatorName: string; + tags: string; + isYoutube: boolean; + isInternationalMedia: boolean; + attachFromScheduleId?: number; // ✅ Tambahkan properti ini + } = { ...data, title: finalTitle, description: finalDescription, @@ -461,6 +476,10 @@ export default function FormAudio() { let id = Cookies.get("idCreate"); + if (scheduleId !== undefined) { + requestData.attachFromScheduleId = Number(scheduleId); // ✅ Tambahkan nilai ini + } + if (id == undefined) { const response = await createMedia(requestData); console.log("Form Data Submitted:", requestData); diff --git a/components/form/content/image-form.tsx b/components/form/content/image-form.tsx index 7ddedabb..dc763551 100644 --- a/components/form/content/image-form.tsx +++ b/components/form/content/image-form.tsx @@ -56,6 +56,7 @@ import { options } from "@fullcalendar/core/preact.js"; import dynamic from "next/dynamic"; import { getCsrfToken } from "@/service/auth"; import { Link } from "@/i18n/routing"; +import { request } from "http"; interface FileWithPreview extends File { preview: string; @@ -443,11 +444,28 @@ export default function FormImage() { const finalTags = tags.join(", "); const finalTitle = isSwitchOn ? title : data.title; const finalDescription = articleBody || data.description; + if (!finalDescription.trim()) { MySwal.fire("Error", "Deskripsi tidak boleh kosong.", "error"); return; } - const requestData = { + + let requestData: { + title: string; + description: string; + htmlDescription: string; + fileTypeId: string; + categoryId: any; + subCategoryId: any; + uploadedBy: string; + statusId: string; + publishedFor: string; + creatorName: string; + tags: string; + isYoutube: boolean; + isInternationalMedia: boolean; + attachFromScheduleId?: number; // ✅ Tambahkan properti ini + } = { ...data, title: finalTitle, description: finalDescription, @@ -466,14 +484,14 @@ export default function FormImage() { let id = Cookies.get("idCreate"); + if (scheduleId !== undefined) { + requestData.attachFromScheduleId = Number(scheduleId); // ✅ Tambahkan nilai ini + } + if (id == undefined) { const response = await createMedia(requestData); console.log("Form Data Submitted:", requestData); - // if (response?.error) { - // MySwal.fire("Error", response?.message, "error"); - // return; - // } Cookies.set("idCreate", response?.data?.data, { expires: 1 }); id = response?.data?.data; @@ -489,16 +507,15 @@ export default function FormImage() { } // Upload File - const progressInfoArr = []; - for (const item of files) { - progressInfoArr.push({ percentage: 0, fileName: item.name }); - } + const progressInfoArr = files.map((item) => ({ + percentage: 0, + fileName: item.name, + })); progressInfo = progressInfoArr; setIsStartUpload(true); setProgressList(progressInfoArr); close(); - // showProgress(); files.map(async (item: any, index: number) => { await uploadResumableFile( index, @@ -509,8 +526,6 @@ export default function FormImage() { }); Cookies.remove("idCreate"); - - // MySwal.fire("Sukses", "Data berhasil disimpan.", "success"); }; const onSubmit = (data: ImageSchema) => { diff --git a/components/form/content/teks-form.tsx b/components/form/content/teks-form.tsx index f9e3d43c..4cc0060a 100644 --- a/components/form/content/teks-form.tsx +++ b/components/form/content/teks-form.tsx @@ -441,7 +441,22 @@ export default function FormTeks() { MySwal.fire("Error", "Deskripsi tidak boleh kosong.", "error"); return; } - const requestData = { + let requestData: { + title: string; + description: string; + htmlDescription: string; + fileTypeId: string; + categoryId: any; + subCategoryId: any; + uploadedBy: string; + statusId: string; + publishedFor: string; + creatorName: string; + tags: string; + isYoutube: boolean; + isInternationalMedia: boolean; + attachFromScheduleId?: number; // ✅ Tambahkan properti ini + } = { ...data, title: finalTitle, description: finalDescription, @@ -460,6 +475,10 @@ export default function FormTeks() { let id = Cookies.get("idCreate"); + if (scheduleId !== undefined) { + requestData.attachFromScheduleId = Number(scheduleId); // ✅ Tambahkan nilai ini + } + if (id == undefined) { const response = await createMedia(requestData); console.log("Form Data Submitted:", requestData); diff --git a/components/form/content/video-form.tsx b/components/form/content/video-form.tsx index 667cc63e..de5a15f5 100644 --- a/components/form/content/video-form.tsx +++ b/components/form/content/video-form.tsx @@ -441,7 +441,22 @@ export default function FormVideo() { MySwal.fire("Error", "Deskripsi tidak boleh kosong.", "error"); return; } - const requestData = { + let requestData: { + title: string; + description: string; + htmlDescription: string; + fileTypeId: string; + categoryId: any; + subCategoryId: any; + uploadedBy: string; + statusId: string; + publishedFor: string; + creatorName: string; + tags: string; + isYoutube: boolean; + isInternationalMedia: boolean; + attachFromScheduleId?: number; // ✅ Tambahkan properti ini + } = { ...data, title: finalTitle, description: finalDescription, @@ -460,6 +475,10 @@ export default function FormVideo() { let id = Cookies.get("idCreate"); + if (scheduleId !== undefined) { + requestData.attachFromScheduleId = Number(scheduleId); // ✅ Tambahkan nilai ini + } + if (id == undefined) { const response = await createMedia(requestData); console.log("Form Data Submitted:", requestData); diff --git a/components/form/schedule/event-detail-form.tsx b/components/form/schedule/event-detail-form.tsx index 18fcd0ad..509edf46 100644 --- a/components/form/schedule/event-detail-form.tsx +++ b/components/form/schedule/event-detail-form.tsx @@ -17,7 +17,7 @@ import { PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; -import { CalendarIcon, Clock1, MapPin, Plus, User2 } from "lucide-react"; +import { CalendarIcon, Clock1, Eye, MapPin, Plus, User2 } from "lucide-react"; import { Calendar } from "@/components/ui/calendar"; import { addDays, format, parseISO, setDate } from "date-fns"; import { DateRange } from "react-day-picker"; @@ -30,6 +30,7 @@ import { error, loading } from "@/lib/swal"; import Cookies from "js-cookie"; import { detailSchedule, + getListScheduleAttachment, listScheduleNext, listScheduleToday, postSchedule, @@ -61,6 +62,14 @@ interface Detail { addressLong: number; } +interface Attachment { + id: any; + title: string; + fileTypeId: number; + type: number; + fileTypeName: string; +} + export default function FormEventDetail() { const [open, setOpen] = useState(false); const { id } = useParams() as { id: string }; @@ -89,6 +98,14 @@ export default function FormEventDetail() { }, }); + const [lampiran, setDataLampiran] = useState([]); + + async function getDataAttachment() { + const response = await getListScheduleAttachment(id); + console.log("data attach", response?.data?.data?.content); + setDataLampiran(response?.data?.data?.content); + } + async function getDataByDate() { const resToday = await listScheduleToday(); const today = resToday?.data?.data; @@ -120,6 +137,7 @@ export default function FormEventDetail() { } } initState(); + getDataAttachment(); }, [refresh, setValue]); const handleStartTime = (e: React.ChangeEvent) => { @@ -130,6 +148,29 @@ export default function FormEventDetail() { setEndTime(e.target.value); }; + const handleDestinationUpload = ( + type: number, + id: string | number, + setOpen: (open: boolean) => void, + router: any + ) => { + setOpen(false); // Tutup modal dialog + + if (id !== undefined) { + Cookies.set("scheduleId", id.toString(), { expires: 1 }); + Cookies.set("scheduleType", "3", { expires: 1 }); + + const routes: Record = { + 1: "/in/contributor/schedule/media/image/create", + 2: "/in/contributor/schedule/media/video/create", + 3: "/in/contributor/schedule/media/text/create", + 4: "/in/contributor/schedule/media/audio/create", + }; + + router.push(routes[type] || "/admin/schedule/media/audio/create"); + } + }; + return (
@@ -336,92 +377,67 @@ export default function FormEventDetail() { -

0 Lampiran

+

{lampiran?.length || 0} Lampiran

Pilih Jenis Lampiran

-
- -
-
- {"item.label"} -

- Audio Visual -

+
+ {[ + { + type: 2, + img: "/assets/img/upload-video.png", + label: "Audio Visual", + }, + { + type: 1, + img: "/assets/img/upload-image.png", + label: "Foto", + }, + { + type: 3, + img: "/assets/img/upload-text.png", + label: "Teks", + }, + { + type: 4, + img: "/assets/img/upload-audio.png", + label: "Audio", + }, + ].map((item) => ( + + handleDestinationUpload( + item.type, + id, + setOpen, + router + ) + } + > +
+
+ {item.label} +

+ {item.label} +

+
+
+

+ Unggah media berupa {item.label.toLowerCase()}{" "} + dengan format sesuai yang didukung. +

+
-
-

- Unggah media berupa video dengan format avi, wmv, - atau mp4 dengan ukuran minimal 2mb dan maksimal - 500mb. -

-
-
- - -
-
- {"item.label"} -

Foto

-
-
-

- Unggah media berupa video dengan format avi, wmv, - atau mp4 dengan ukuran minimal 2mb dan maksimal - 500mb. -

-
-
- - -
-
- {"item.label"} -

Teks

-
-
-

- Unggah media berupa video dengan format avi, wmv, - atau mp4 dengan ukuran minimal 2mb dan maksimal - 500mb. -

-
-
- - -
-
- {"item.label"} -

Audio

-
-
-

- Unggah media berupa video dengan format avi, wmv, - atau mp4 dengan ukuran minimal 2mb dan maksimal - 500mb. -

-
-
- +
+ ))}
@@ -430,7 +446,52 @@ export default function FormEventDetail() { "" )}
-
+
+ + + + + + + + + + + {lampiran.map((item, index) => ( + + + + + + + ))} + +
Judul KontenKontenTindakanAksi
+ {item.title} + {item.fileTypeName}Konfersi Ai + + + +
+
+
diff --git a/components/form/schedule/pers-release--detail-form.tsx b/components/form/schedule/pers-release--detail-form.tsx index 10e4eeaa..b13bf7af 100644 --- a/components/form/schedule/pers-release--detail-form.tsx +++ b/components/form/schedule/pers-release--detail-form.tsx @@ -17,7 +17,7 @@ import { PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; -import { CalendarIcon, Clock1, MapPin, Plus, User2 } from "lucide-react"; +import { CalendarIcon, Clock1, Eye, MapPin, Plus, User2 } from "lucide-react"; import { Calendar } from "@/components/ui/calendar"; import { addDays, format, parseISO, setDate } from "date-fns"; import { DateRange } from "react-day-picker"; @@ -30,6 +30,7 @@ import { error, loading } from "@/lib/swal"; import Cookies from "js-cookie"; import { detailSchedule, + getListScheduleAttachment, listScheduleNext, listScheduleToday, postSchedule, @@ -50,6 +51,7 @@ import { import { formatDate } from "@fullcalendar/core/index.js"; import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; import { Link } from "@/i18n/routing"; +import $ from "jquery"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -68,6 +70,14 @@ interface Detail { addressLong: number; } +interface Attachment { + id: any; + title: string; + fileTypeId: number; + type: number; + fileTypeName: string; +} + export default function FormDetailPressRillis() { const [open, setOpen] = useState(false); const { id } = useParams() as { id: string }; @@ -98,6 +108,14 @@ export default function FormDetailPressRillis() { }, }); + const [lampiran, setDataLampiran] = useState([]); + + async function getDataAttachment() { + const response = await getListScheduleAttachment(id); + console.log("data attach", response?.data?.data?.content); + setDataLampiran(response?.data?.data?.content); + } + async function getDataByDate() { const resToday = await listScheduleToday(); const today = resToday?.data?.data; @@ -129,6 +147,7 @@ export default function FormDetailPressRillis() { } } initState(); + getDataAttachment(); }, [refresh, setValue]); const handleStartTime = (e: React.ChangeEvent) => { @@ -139,20 +158,26 @@ export default function FormDetailPressRillis() { setEndTime(e.target.value); }; - const handleUploadAttachment = () => { - const scheduleId = Cookies.get("scheduleId"); + const handleDestinationUpload = ( + type: number, + id: string | number, + setOpen: (open: boolean) => void, + router: any + ) => { + setOpen(false); // Tutup modal dialog - if (scheduleId == undefined) { - MySwal.fire({ - title: "Simpan Jadwal Terlebih Dahulu", - icon: "info", - confirmButtonColor: "#3085d6", - confirmButtonText: "Ok", - }).then((result) => { - if (result.isConfirmed) { - return true; - } - }); + if (id !== undefined) { + Cookies.set("scheduleId", id.toString(), { expires: 1 }); + Cookies.set("scheduleType", "3", { expires: 1 }); + + const routes: Record = { + 1: "/in/contributor/schedule/media/image/create", + 2: "/in/contributor/schedule/media/video/create", + 3: "/in/contributor/schedule/media/text/create", + 4: "/in/contributor/schedule/media/audio/create", + }; + + router.push(routes[type] || "/admin/schedule/media/audio/create"); } }; @@ -379,92 +404,67 @@ export default function FormDetailPressRillis() { -

0 Lampiran

+

{lampiran?.length || 0} Lampiran

Pilih Jenis Lampiran

-
- -
-
- {"item.label"} -

- Audio Visual -

+
+ {[ + { + type: 2, + img: "/assets/img/upload-video.png", + label: "Audio Visual", + }, + { + type: 1, + img: "/assets/img/upload-image.png", + label: "Foto", + }, + { + type: 3, + img: "/assets/img/upload-text.png", + label: "Teks", + }, + { + type: 4, + img: "/assets/img/upload-audio.png", + label: "Audio", + }, + ].map((item) => ( + + handleDestinationUpload( + item.type, + id, + setOpen, + router + ) + } + > +
+
+ {item.label} +

+ {item.label} +

+
+
+

+ Unggah media berupa {item.label.toLowerCase()}{" "} + dengan format sesuai yang didukung. +

+
-
-

- Unggah media berupa video dengan format avi, wmv, - atau mp4 dengan ukuran minimal 2mb dan maksimal - 500mb. -

-
-
- - -
-
- {"item.label"} -

Foto

-
-
-

- Unggah media berupa video dengan format avi, wmv, - atau mp4 dengan ukuran minimal 2mb dan maksimal - 500mb. -

-
-
- - -
-
- {"item.label"} -

Teks

-
-
-

- Unggah media berupa video dengan format avi, wmv, - atau mp4 dengan ukuran minimal 2mb dan maksimal - 500mb. -

-
-
- - -
-
- {"item.label"} -

Audio

-
-
-

- Unggah media berupa video dengan format avi, wmv, - atau mp4 dengan ukuran minimal 2mb dan maksimal - 500mb. -

-
-
- +
+ ))}
@@ -472,6 +472,51 @@ export default function FormDetailPressRillis() { ) : ( "" )} +
+ + + + + + + + + + + {lampiran.map((item, index) => ( + + + + + + + ))} + +
Judul KontenKontenTindakanAksi
+ {item.title} + {item.fileTypeName}Konfersi Ai + + + +
+