diff --git a/app/[locale]/(protected)/admin/add-experts/create/page.tsx b/app/[locale]/(protected)/admin/add-experts/create/page.tsx index c9d865e9..994cd5eb 100644 --- a/app/[locale]/(protected)/admin/add-experts/create/page.tsx +++ b/app/[locale]/(protected)/admin/add-experts/create/page.tsx @@ -230,11 +230,13 @@ export default function AddExpertForm() { }; const handleAddRow = () => { - setPlacementRows((prevRows: any) => [ - ...prevRows, - { index: incrementId, roleId: "", userLevelId: 0 }, - ]); - setIncrementId((prevId) => prevId + 1); + if (placementRows.length < 2) { + setPlacementRows((prevRows) => [ + ...prevRows, + { index: incrementId, roleId: "", userLevelId: 0 }, + ]); + setIncrementId((prevId) => prevId + 1); + } }; return ( @@ -424,7 +426,7 @@ export default function AddExpertForm() { ))} - */} + {placementRows.length > 1 && ( diff --git a/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx b/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx index 48ee4e8c..e588bce4 100644 --- a/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx +++ b/app/[locale]/(protected)/admin/settings/iklan/component/table.tsx @@ -154,8 +154,6 @@ const AdvertisementsList = () => { page - 1, showData, "", - categoryFilter?.sort().join(","), - statusFilter?.sort().join(",") ); const data = res?.data?.data; const contentData = data?.content; diff --git a/app/[locale]/(protected)/contributor/schedule/calendar-polri/component/calendar-polri-table.tsx b/app/[locale]/(protected)/contributor/schedule/calendar-polri/component/calendar-polri-table.tsx index bc7254ce..2791eeaf 100644 --- a/app/[locale]/(protected)/contributor/schedule/calendar-polri/component/calendar-polri-table.tsx +++ b/app/[locale]/(protected)/contributor/schedule/calendar-polri/component/calendar-polri-table.tsx @@ -44,7 +44,7 @@ import { useRouter, useSearchParams } from "next/navigation"; import TablePagination from "@/components/table/table-pagination"; import columns from "./columns"; import { - paginationCalendar, + getCalendarPagination, paginationSchedule, } from "@/service/schedule/schedule"; import { CardHeader, CardTitle } from "@/components/ui/card"; @@ -120,10 +120,9 @@ const CalendarPolriTable = () => { async function fetchData() { try { - const res = await paginationCalendar( + const res = await getCalendarPagination( showData, page - 1, - 1, search, statusFilter ); diff --git a/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx b/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx index 7397b64c..0213be3c 100644 --- a/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx +++ b/app/[locale]/(protected)/contributor/task-ta/components/columns.tsx @@ -159,7 +159,7 @@ const useTableColumns = () => { - {roleId == 11 && ( + {(roleId == 11 || roleId == 12) && ( diff --git a/app/[locale]/(protected)/contributor/task-ta/components/task-ta-table.tsx b/app/[locale]/(protected)/contributor/task-ta/components/task-ta-table.tsx index f2815af2..4f5cddb7 100644 --- a/app/[locale]/(protected)/contributor/task-ta/components/task-ta-table.tsx +++ b/app/[locale]/(protected)/contributor/task-ta/components/task-ta-table.tsx @@ -73,7 +73,7 @@ const TaskTaTable = () => { const [columnVisibility, setColumnVisibility] = React.useState({}); const [rowSelection, setRowSelection] = React.useState({}); - const [showData, setShowData] = React.useState("50"); + const [showData, setShowData] = React.useState("10"); const [pagination, setPagination] = React.useState({ pageIndex: 0, pageSize: Number(showData), diff --git a/components/form/content/spit-convert-form.tsx b/components/form/content/spit-convert-form.tsx index 0222f302..102ebd17 100644 --- a/components/form/content/spit-convert-form.tsx +++ b/components/form/content/spit-convert-form.tsx @@ -55,6 +55,7 @@ import dynamic from "next/dynamic"; import { error } from "@/lib/swal"; import { useTranslations } from "next-intl"; import { contextType } from "cleave.js/react"; +import { Form } from "@/components/ui/form"; const imageSchema = z.object({ contentTitle: z.string().min(1, { message: "Judul diperlukan" }), @@ -182,13 +183,31 @@ export default function FormConvertSPIT() { let fileTypeId = "1"; - const { - control, - handleSubmit, - setValue, - formState: { errors }, - } = useForm({ + // const { + // control, + // handleSubmit, + // setValue, + // formState: { errors }, + // } = useForm({ + // resolver: zodResolver(imageSchema), + // defaultValues: { + // contentTitle: detail?.contentTitle || "", + // contentDescription: detail?.contentDescription || "", + // contentCreator: detail?.contentCreator || "", + // contentRewriteDescription: detail?.contentRewriteDescription || "", + // // dll + // }, + // }); + + const form = useForm>({ resolver: zodResolver(imageSchema), + defaultValues: { + contentTitle: detail?.contentTitle || "", + contentDescription: detail?.contentDescription || "", + contentCreator: detail?.contentCreator || "", + contentRewriteDescription: detail?.contentRewriteDescription || "", + // dll + }, }); const handleRemoveTag = (index: any) => { @@ -207,11 +226,10 @@ export default function FormConvertSPIT() { setSelectedFiles((prevImages) => prevImages.filter((_, i) => i !== index)); }; - // const handleCheckboxChange = (id: number) => { - // setSelectedPublishers((prev) => - // prev.includes(id) ? prev.filter((item) => item !== id) : [...prev, id] - // ); - // }; + const handleDirectSave = () => { + const values = form.getValues(); // ambil semua nilai tanpa validasi + onSubmit(values); // langsung submit + }; useEffect(() => { async function initState() { @@ -318,6 +336,13 @@ export default function FormConvertSPIT() { setDetail(details); setFiles(details?.contentList); setupPlacementCheck(details?.contentList?.length); + form.setValue("contentTitle", details?.contentTitle || ""); + form.setValue("contentDescription", details?.contentDescription || ""); + form.setValue("contentCreator", details?.contentCreator || ""); + form.setValue( + "contentRewriteDescription", + details?.contentRewriteDescription || "" + ); const filesData = details.contentList || []; const fileUrls = filesData.map((file: { contentFile: string }) => @@ -337,7 +362,7 @@ export default function FormConvertSPIT() { } } initState(); - }, [refresh, setValue]); + }, [refresh]); const [tempFile, setTempFile] = useState( detailThumb.map((data: any) => ({ @@ -472,20 +497,27 @@ export default function FormConvertSPIT() { }); }; - const onSubmit = (data: ImageSchema) => { - MySwal.fire({ - title: "Simpan Data", - text: "Apakah Anda yakin ingin menyimpan data ini?", - icon: "warning", - showCancelButton: true, - cancelButtonColor: "#d33", - confirmButtonColor: "#3085d6", - confirmButtonText: "Simpan", - }).then((result) => { - if (result.isConfirmed) { - save(data); - } - }); + const onSubmit = async (data: z.infer) => { + if (form.getValues("contentTitle") == "") { + form.setError("contentTitle", { + type: "manual", + message: "Required", + }); + } else { + MySwal.fire({ + title: "Simpan Data", + text: "Apakah Anda yakin ingin menyimpan data ini?", + icon: "warning", + showCancelButton: true, + cancelButtonColor: "#d33", + confirmButtonColor: "#3085d6", + confirmButtonText: "Simpan", + }).then((result) => { + if (result.isConfirmed) { + save(data); + } + }); + } }; const [showRewriteEditor, setShowRewriteEditor] = useState(false); @@ -561,6 +593,7 @@ export default function FormConvertSPIT() { setArticleBody(cleanArticleBody || ""); setDetailData(articleData); setSelectedArticleId(id); + // setArticleImages(articleImagesData || []); } catch (error) { console.error("Error fetching article details:", error); @@ -613,477 +646,472 @@ export default function FormConvertSPIT() { } return ( -
- {detail !== undefined ? ( -
- -
-

{t("form-spit")}

-
- {/* Input Title */} -
- - ( - - )} - /> - {errors.contentTitle?.message && ( -

- {errors.contentTitle.message} -

- )} -
-
-
- - -
-
-
- setSelectedFileType(value)} - value={selectedFileType} - className=" grid-cols-1" - > -
- - -
-
- + <> + + + {detail !== undefined ? ( +
+ +
+

{t("form-spit")}

+
+ {/* Input Title */} +
+ ( - // - ( + )} /> - {errors.contentDescription?.message && ( -

- {errors.contentDescription.message} -

- )}
-
- - -
-
- -
- {showRewriteEditor && ( -
- {isGeneratedArticle && ( -
- {articleIds.map((id: string, index: number) => ( - +
+ {showRewriteEditor && ( +
+ {isGeneratedArticle && ( +
+ {articleIds.map((id: string, index: number) => ( + + ))} +
+ )} +
+ + +
+
+ + + isLoadingData ? ( +
+

+ Loading Proses Data... +

+
+ ) : ( + + ) + } + /> +
+
+ )} + +
+
+ +
+ + {detailThumb?.map((data: any) => ( + + {` + + ))} + +
+ + {detailThumb?.map((data: any) => ( + + {` + + ))} +
- )} - -
-
- -
- - {detailThumb?.map((data: any) => ( - - {` - - ))} - -
- - {detailThumb?.map((data: any) => ( - - {` - - ))} -
-
-
-
- -
- {files?.length > 1 && ( -
-
- - handleSelectAll("all", Boolean(e)) - } - /> - +
+
-
- - handleSelectAll("mabes", Boolean(e)) - } - /> - -
-
- - handleSelectAll("polda", Boolean(e)) - } - /> - -
-
- - handleSelectAll("international", Boolean(e)) - } - /> - -
-
- )} - {files?.map((file, index) => ( -
- -
-
- {file.fileName} -
-
+ {files?.length > 1 && ( +
- setupPlacement(index, "all", Boolean(e)) + handleSelectAll("all", Boolean(e)) } />
- setupPlacement(index, "mabes", Boolean(e)) + handleSelectAll("mabes", Boolean(e)) } />
- setupPlacement(index, "polda", Boolean(e)) + handleSelectAll("polda", Boolean(e)) } />
-
- setupPlacement(index, "international", Boolean(e)) + handleSelectAll("international", Boolean(e)) } />
-
-
- ))} -
-
- -
- -
-
- - ( - )} - /> - {errors.contentCreator?.message && ( -

- {errors.contentCreator.message} -

- )} + {files?.map((file, index) => ( +
+ +
+
+ {file.fileName} +
+
+
+ + setupPlacement(index, "all", Boolean(e)) + } + /> + +
+
+ + setupPlacement(index, "mabes", Boolean(e)) + } + /> + +
+
+ + setupPlacement(index, "polda", Boolean(e)) + } + /> + +
+ +
+ + setupPlacement( + index, + "international", + Boolean(e) + ) + } + /> + +
+
+
+
+ ))} +
-
-
- - - Thumbnail Gambar Utama - -
-
-
- -
- {detail?.contentTag - ?.split(",") - .map((tag: any, index: any) => ( - +
+ +
+
+ + ( + + )} + /> +
+
+
+ + + Thumbnail Gambar Utama + +
+
+
+ +
+ {detail?.contentTag + ?.split(",") + .map((tag: any, index: any) => ( + + {tag.trim()} + + ))} +
+
+
+
+
+ + {options.map((option) => ( +
- {tag.trim()} - + opt.id !== "all") + .length + : publishedFor.includes(option.id) + } + onCheckedChange={() => + handleCheckboxChange(option.id) + } + /> + +
))} +
+
+
+
+
+ +
+
+
-
-
- - {options.map((option) => ( -
- opt.id !== "all") - .length - : publishedFor.includes(option.id) - } - onCheckedChange={() => handleCheckboxChange(option.id)} - /> - -
- ))} -
-
-
- -

{t("suggestion-box")} (0)

-
-
-

{t("information")}:

- {/*

{detail?.status}

*/} -
- -
-
- -
-
- -
-
-
- ) : ( - "" - )} - + ) : ( + "" + )} + + + ); } diff --git a/components/form/schedule/form-calendar-polri.tsx b/components/form/schedule/form-calendar-polri.tsx index 3b46563a..52e1c360 100644 --- a/components/form/schedule/form-calendar-polri.tsx +++ b/components/form/schedule/form-calendar-polri.tsx @@ -25,7 +25,6 @@ import DatePicker from "react-datepicker"; import { id } from "date-fns/locale"; import "react-datepicker/dist/react-datepicker.css"; import { zodResolver } from "@hookform/resolvers/zod"; -import router from "next/router"; import { Controller, useForm } from "react-hook-form"; import { date, z } from "zod"; import { error, loading } from "@/lib/swal"; @@ -51,6 +50,7 @@ import Image from "next/image"; import FileUploader from "../shared/file-uploader"; import { getCsrfToken } from "@/service/auth"; import { Upload } from "tus-js-client"; +import { useRouter } from "next/navigation"; const calendarSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -68,6 +68,7 @@ interface FileUploaded { export function CalendarPolriAdd() { const MySwal = withReactContent(Swal); + const router = useRouter(); const [open, setOpen] = React.useState(false); const t = useTranslations("Schedule"); type CalendarSchema = z.infer; @@ -212,9 +213,7 @@ export function CalendarPolriAdd() { return false; } - Cookies.set("scheduleId", response?.data?.data.id, { - expires: 1, - }); + const id = response?.data?.data?.id; loading(); if (imageFiles?.length === 0) { @@ -242,7 +241,7 @@ export function CalendarPolriAdd() { }; const upload = new Upload(file, { - endpoint: `${process.env.NEXT_PUBLIC_API}/agenda-settings/file/upload`, + endpoint: `${process.env.NEXT_PUBLIC_API}/calendars/file/upload`, headers: headers, retryDelays: [0, 3000, 6000, 12_000, 24_000], chunkSize: 20_000, diff --git a/components/form/setting/form-add-iklan.tsx b/components/form/setting/form-add-iklan.tsx index bcbb37ee..96459682 100644 --- a/components/form/setting/form-add-iklan.tsx +++ b/components/form/setting/form-add-iklan.tsx @@ -134,7 +134,7 @@ export function TambahIklanModal() { }; const handlePoldaPolresChange = () => { - return Array.from(checkedLevels).join(","); // Mengonversi Set ke string + return Array.from(checkedLevels).join(","); }; const handleUnitChange = ( @@ -185,34 +185,30 @@ export function TambahIklanModal() { .filter((key) => unitSelection[key as keyof typeof unitSelection]) .map((key) => unitMapping[key as keyof typeof unitMapping]) .join(","); - const requestData = { - title: data.title, - placements: selectedPlacement, - description: data.description, - redirectLink: "https://new.netidhub.com", - createdBy: assignmentToString, - assignedToLevel: handlePoldaPolresChange(), - }; - console.log("Form Data Submitted:", requestData); + + const formMedia = new FormData(); + formMedia.append("title", data.title); + formMedia.append("placements", selectedPlacement); + formMedia.append("description", data.description); + formMedia.append("redirectLink", "https://new.netidhub.com"); + formMedia.append("assignedToLevel", handlePoldaPolresChange()); + formMedia.append("file", imageFiles[0]); - const response = await postAdvertisements(requestData); + console.log("Form Data Submitted:", formMedia); + + loading(); + const response = await postAdvertisements(formMedia); if (response?.error) { error(response?.message); return false; } + close(); Cookies.set("scheduleId", response?.data?.data.id, { expires: 1, }); - loading(); - if (imageFiles?.length === 0) { - setIsImageUploadFinish(true); - } - imageFiles?.map(async (item: any, index: number) => { - await uploadResumableFile(index, String(id), item, "1", "0"); - }); }; async function uploadResumableFile( @@ -232,7 +228,7 @@ export function TambahIklanModal() { }; const upload = new Upload(file, { - endpoint: `${process.env.NEXT_PUBLIC_API}/advertisment/file/upload`, + endpoint: `${process.env.NEXT_PUBLIC_API}/advertisements/file/upload`, headers: headers, retryDelays: [0, 3000, 6000, 12_000, 24_000], chunkSize: 20_000, diff --git a/components/form/task-ta/task-ta-detail-form.tsx b/components/form/task-ta/task-ta-detail-form.tsx index 475d74d6..a5a96ed5 100644 --- a/components/form/task-ta/task-ta-detail-form.tsx +++ b/components/form/task-ta/task-ta-detail-form.tsx @@ -907,7 +907,7 @@ export default function FormTaskTaDetail() {

{t("detail-task")}

-
-
+
*/}
@@ -1320,7 +1320,7 @@ export default function FormTaskTaDetail() {
-
+ {/*
{detail?.isDone !== true && (Number(userLevelNumber) !== 3 || Number(userLevelNumber) == 2) ? ( @@ -1336,9 +1336,9 @@ export default function FormTaskTaDetail() { ) : ( "" )} -
+
*/}
-
+ {/*
-
-
+
*/} + {/*
-
+
*/}
- Hasil Upload {Number(userId)} + Hasil Upload
@@ -1406,7 +1406,7 @@ export default function FormTaskTaDetail() { />
- + {/*
- + */}
diff --git a/components/form/task-ta/task-ta-form.tsx b/components/form/task-ta/task-ta-form.tsx index 113a72ee..eb407f3c 100644 --- a/components/form/task-ta/task-ta-form.tsx +++ b/components/form/task-ta/task-ta-form.tsx @@ -157,7 +157,7 @@ export default function FormTaskTa() { const [isAudioUploadFinish, setIsAudioUploadFinish] = useState(false); const [voiceNoteLink, setVoiceNoteLink] = useState(""); const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), + from: new Date(), }); const [platformTypeVisible, setPlatformTypeVisible] = useState(false); @@ -400,7 +400,7 @@ export default function FormTaskTa() { fileTypeId: string, duration: string ) { - console.log(idx, id, file, fileTypeId, duration); + console.log("Tus Upload : ", idx, id, file, fileTypeId, duration); const resCsrf = await getCsrfToken(); const csrfToken = resCsrf?.data?.token; @@ -631,7 +631,10 @@ export default function FormTaskTa() { } className="mr-3" /> - {expert.fullname} +
+
{expert.fullname}
+
({expert.username})
+
))} @@ -639,6 +642,36 @@ export default function FormTaskTa() { + {checkedLevels.size > 0 && ( +
+ +
+ {Array.from(checkedLevels).map((expertId) => { + const expert = listExpert?.find((exp: any) => exp.id === expertId); + return expert ? ( +
+ {expert.fullname} + +
+ ) : null; + })} +
+
+ )}
diff --git a/components/landing-page/left-banner.tsx b/components/landing-page/advertisement-placements.tsx similarity index 58% rename from components/landing-page/left-banner.tsx rename to components/landing-page/advertisement-placements.tsx index 61b468e4..0435fd82 100644 --- a/components/landing-page/left-banner.tsx +++ b/components/landing-page/advertisement-placements.tsx @@ -31,34 +31,25 @@ interface Advertisement { // }; // } -const LeftBanner = () => { +const AdvertisementPlacements = (props: { placement?: string }) => { const [ads, setAds] = useState([]); const [loading, setLoading] = useState(false); - const [showData, setShowData] = React.useState("10"); - const [categories, setCategories] = React.useState(); - const [dataTable, setDataTable] = React.useState([]); - const [totalData, setTotalData] = React.useState(1); - const [categoryFilter, setCategoryFilter] = React.useState([]); - const [statusFilter, setStatusFilter] = React.useState([]); - const [page, setPage] = React.useState(1); - const fetchData = async () => { try { setLoading(true); - const res = await listDataAdvertisements( page - 1, - showData, - "", - categoryFilter?.sort().join(","), - statusFilter?.sort().join(",")); + const res = await listDataAdvertisements( + 0, + "4", + "" + ); const data = res?.data?.data; const contentData = data?.content; - - contentData.forEach((item: Advertisement, index: number) => { - item.no = index + 1; - }); - - setAds(contentData); + if (props.placement == "left") { + setAds(contentData.slice(0,2)); + } else { + setAds(contentData.slice(2)); + } } catch (error) { console.error("Error fetching advertisements:", error); } finally { @@ -71,13 +62,13 @@ const LeftBanner = () => { }, []); return ( -
+
{loading &&

Loading...

} - {ads.map((ad) => ( - {`Banner + {ads?.map((ad) => ( + {`Banner ))}
); }; -export default LeftBanner; +export default AdvertisementPlacements; diff --git a/components/landing-page/event-calender.tsx b/components/landing-page/event-calender.tsx index efd9553c..419fffa0 100644 --- a/components/landing-page/event-calender.tsx +++ b/components/landing-page/event-calender.tsx @@ -1,86 +1,285 @@ -import React from "react"; +import { getCalendarPagination } from "@/service/schedule/schedule"; +import React, { useEffect, useState } from "react"; + +interface CalendarItem { + id: number; + title: string; + description: string; + assignedTo: string; + assignedToLevel: string; + startDate: string; + endDate: string; + isActive: boolean; + createdById: number; + createdByName: string; + thumbnailUrl: string; + createdAt: string; + updatedAt: string; +} const EventCalender = () => { + // Get current date + const today = new Date(); + const currentMonth = today.getMonth(); + const currentYear = today.getFullYear(); + const currentDate = today.getDate(); + + const [events, setEvents] = useState([]); + const [selectedEvent, setSelectedEvent] = useState(null); + + // Month names in Indonesian + const monthNames = [ + "Januari", "Februari", "Maret", "April", "Mei", "Juni", + "Juli", "Agustus", "September", "Oktober", "November", "Desember" + ]; + + const fetchData = async () => { + try { + const res = await getCalendarPagination(100, 0); + const data = res?.data?.data; + const contentData = data?.content; + setEvents(contentData || []); + + // Set first event as selected by default + if (contentData && contentData.length > 0) { + setSelectedEvent(contentData[0]); + } + } catch (error) { + console.error("Error fetching calendar events:", error); + } + }; + + useEffect(() => { + fetchData(); + }, []); + + // Get first day of the month and number of days + const firstDayOfMonth = new Date(currentYear, currentMonth, 1); + const lastDayOfMonth = new Date(currentYear, currentMonth + 1, 0); + const daysInMonth = lastDayOfMonth.getDate(); + const startingDayOfWeek = firstDayOfMonth.getDay(); + + // Convert Sunday (0) to 7 for Monday-first week + const adjustedStartingDay = startingDayOfWeek === 0 ? 6 : startingDayOfWeek - 1; + + // Generate calendar days + const generateCalendarDays = () => { + const days = []; + + // Empty cells for days before the first day of month + for (let i = 0; i < adjustedStartingDay; i++) { + days.push(null); + } + + // Days of the month + for (let day = 1; day <= daysInMonth; day++) { + days.push(day); + } + + // Fill remaining cells to complete the grid (6 rows × 7 days = 42 cells) + while (days.length < 42) { + days.push(null); + } + + return days; + }; + + const calendarDays = generateCalendarDays(); + + // Helper function to extract day from date string + const getDateFromString = (dateString: string) => { + try { + const date = new Date(dateString); + if (date.getMonth() === currentMonth && date.getFullYear() === currentYear) { + return date.getDate(); + } + return null; + } catch { + return null; + } + }; + + // Helper function to format date range + const formatDateRange = (startDate: string, endDate: string) => { + try { + const start = new Date(startDate); + const end = new Date(endDate); + + const startDay = start.getDate(); + const endDay = end.getDate(); + const startMonth = monthNames[start.getMonth()]; + const endMonth = monthNames[end.getMonth()]; + + if (startDay === endDay && startMonth === endMonth) { + return `${startDay} ${startMonth}`; + } else { + return `${startDay} ${startMonth} - ${endDay} ${endMonth}`; + } + } catch { + return "Tanggal tidak valid"; + } + }; + + // Helper function to format time range + const formatTimeRange = (startDate: string, endDate: string) => { + try { + const start = new Date(startDate); + const end = new Date(endDate); + + const startTime = start.toLocaleTimeString('id-ID', { + hour: '2-digit', + minute: '2-digit', + timeZone: 'Asia/Jakarta' + }); + const endTime = end.toLocaleTimeString('id-ID', { + hour: '2-digit', + minute: '2-digit', + timeZone: 'Asia/Jakarta' + }); + + return `${startTime} - ${endTime} WIB`; + } catch { + return "Waktu tidak tersedia"; + } + }; + + // Get event dates for highlighting calendar + const eventDates = events + .map(event => getDateFromString(event.startDate)) + .filter(date => date !== null); + return (

KALENDER ACARA

-
-
-
-
Mei 2025
+
+ {/* Left Side - Calendar and Event List */} +
+ {/* Mini Calendar */} +
+
+ {monthNames[currentMonth]} {currentYear} +
{["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"].map((d) => ( -
+
{d}
))} - {[...Array(35)].map((_, i) => ( + {calendarDays?.map((day, index) => (
- {i >= 2 && i - 1} + {day}
))}
-
-
- HUT Polwan -
-
- HUT Polwan ke-76, Kapolri... -
-
- 16 Mei - 16 Mei -
-
-
-
- Olahraga -
-
- Olahraga Bersama Pad... -
-
- 22 Mei - 22 Mei -
+ {/* Event List */} +
+

+ Daftar Acara +

+ {events?.length === 0 ? ( +
+ Tidak ada acara yang tersedia
-
+ ) : ( + events.map((event) => ( +
setSelectedEvent(event)} + className={`flex items-center rounded-xl shadow-sm p-3 cursor-pointer transition-all duration-200 hover:shadow-md ${ + selectedEvent?.id === event.id + ? "bg-red-100 dark:bg-red-900/20 border-2 border-red-500" + : "bg-gray-200 dark:bg-zinc-800 hover:bg-gray-300 dark:hover:bg-zinc-700" + }`} + > + {event.title} { + const target = e.target as HTMLImageElement; + target.src = "/images/default-event.png"; + }} + /> +
+
+ {event.title} +
+
+ {formatDateRange(event.startDate, event.endDate)} +
+
+
+
+
+
+ )) + )}
- {/* Detail Acara */} -
-
- Detail Event -

- HUT Polwan ke-76, Kapolri Apresiasi Prestasi yang Diberikan -

-

- Kapolri Jenderal Pol. Listyo Sigit Prabowo memberikan apresiasi - kepada polisi wanita yang berprestasi... -

- - Lihat Selengkapnya - + {/* Right Side - Event Detail */} +
+
+

+ Detail Acara +

+ + {selectedEvent ? ( +
+ {selectedEvent.title} { + const target = e.target as HTMLImageElement; + target.src = "/images/default-event.png"; + }} + /> + +
+

+ {selectedEvent.title} +

+ +
+
+ Tanggal: + {formatDateRange(selectedEvent.startDate, selectedEvent.endDate)} +
+
+

+ {selectedEvent.description || "Tidak ada deskripsi tersedia."} +

+
+
+ +
+ +
+
+
+ ) : ( +
+ Pilih acara untuk melihat detail +
+ )}
@@ -88,4 +287,4 @@ const EventCalender = () => { ); }; -export default EventCalender; +export default EventCalender; \ No newline at end of file diff --git a/components/landing-page/search-section-polda.tsx b/components/landing-page/search-section-polda.tsx index 399333e7..1d6108b5 100644 --- a/components/landing-page/search-section-polda.tsx +++ b/components/landing-page/search-section-polda.tsx @@ -12,20 +12,7 @@ import AreaCoverageWorkUnits from "./area-coverage-and-work-units"; import EventCalender from "./event-calender"; import UserSurveyBox from "./survey-box"; import ScrollableContentPolda from "./scrollable-content-polda"; - -const LeftBanner = () => ( -
- Banner Kiri 1 - Banner Kiri 2 -
-); - -const RightBanner = () => ( -
- Banner Kanan 1 - Banner Kanan 2 -
-); +import AdvertisementPlacements from "./advertisement-placements"; const SearchSectionPolda = () => { const [contentType, setContentType] = useState("all"); @@ -35,7 +22,7 @@ const SearchSectionPolda = () => { return (
- +
@@ -49,7 +36,7 @@ const SearchSectionPolda = () => {
- +
); diff --git a/components/landing-page/search-section-satker.tsx b/components/landing-page/search-section-satker.tsx index 9d24a8a3..e9aefa93 100644 --- a/components/landing-page/search-section-satker.tsx +++ b/components/landing-page/search-section-satker.tsx @@ -13,20 +13,7 @@ import EventCalender from "./event-calender"; import UserSurveyBox from "./survey-box"; import ScrollableContentPolda from "./scrollable-content-polda"; import ScrollableContentSatker from "./scrollable-content-satker"; - -const LeftBanner = () => ( -
- Banner Kiri 1 - Banner Kiri 2 -
-); - -const RightBanner = () => ( -
- Banner Kanan 1 - Banner Kanan 2 -
-); +import AdvertisementPlacements from "./advertisement-placements"; const SearchSectionSatker = () => { const [contentType, setContentType] = useState("all"); @@ -36,7 +23,7 @@ const SearchSectionSatker = () => { return (
- +
@@ -50,7 +37,7 @@ const SearchSectionSatker = () => {
- +
); diff --git a/components/landing-page/search-section.tsx b/components/landing-page/search-section.tsx index 5307d836..9af0b96a 100644 --- a/components/landing-page/search-section.tsx +++ b/components/landing-page/search-section.tsx @@ -18,20 +18,7 @@ import ContentCategory from "./content-category"; import AreaCoverageWorkUnits from "./area-coverage-and-work-units"; import EventCalender from "./event-calender"; import UserSurveyBox from "./survey-box"; - -const LeftBanner = () => ( -
- Banner Kiri 1 - Banner Kiri 2 -
-); - -const RightBanner = () => ( -
- Banner Kanan 1 - Banner Kanan 2 -
-); +import AdvertisementPlacements from "./advertisement-placements"; const SearchSection = () => { const [contentType, setContentType] = useState("all"); @@ -44,7 +31,7 @@ const SearchSection = () => { style={{ backgroundImage: "url('/assets/background.png')" }} >
- +
@@ -58,7 +45,7 @@ const SearchSection = () => {
- +
); diff --git a/messages/in.json b/messages/in.json index e0af7ea4..a7720cdc 100644 --- a/messages/in.json +++ b/messages/in.json @@ -690,7 +690,7 @@ "type-task": "Tipe Penugasan", "category-task": "Kategori Penugasan", "areas-expertise": "Bidang Keahlian", - "choose-expert": "Pilih Tenaga Ahli", + "choose-expert": "Tenaga Ahli", "code": "Kode", "start-date": "Tanggal Mulai", "end-date": "Tanggal Selesai", diff --git a/service/broadcast/broadcast.ts b/service/broadcast/broadcast.ts index b1ca2176..745c124e 100644 --- a/service/broadcast/broadcast.ts +++ b/service/broadcast/broadcast.ts @@ -20,11 +20,9 @@ export async function listDataAdvertisements( page: number, limit: string, search: string, - categoryFilter: string, - statusFilter: string ) { const name = search || ""; - const url = `advertisements/pagination?title=${name}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=1&categoryId=${categoryFilter}&statusId=${statusFilter}`; + const url = `advertisements/pagination?title=${search}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}`; return httpGetInterceptor(url); } diff --git a/service/schedule/schedule.ts b/service/schedule/schedule.ts index 62024a8a..b18531e5 100644 --- a/service/schedule/schedule.ts +++ b/service/schedule/schedule.ts @@ -20,17 +20,16 @@ export async function paginationSchedule( ); } -export async function paginationCalendar( +export async function getCalendarPagination( size: any, page: number, - type: any, title: string = "", statusFilter: number[] = [] ) { const statusQuery = statusFilter.length > 0 ? `&statusId=${statusFilter.join(",")}` : ""; return await httpGetInterceptor( - `calendars/pagination?enablePage=1&scheduleTypeId=${type}&page=${page}&size=${size}&title=${title}${statusQuery}` + `calendars/pagination?enablePage=1&page=${page}&size=${size}&title=${title}${statusQuery}` ); } diff --git a/service/settings/settings.ts b/service/settings/settings.ts index 1d36d564..adc70c7d 100644 --- a/service/settings/settings.ts +++ b/service/settings/settings.ts @@ -132,5 +132,8 @@ export async function getTagsByParentId(parentId: string | number) { export async function postAdvertisements(data: any) { const url = "advertisements"; - return httpPostInterceptor(url, data); + const headers = { + "Content-Type": "multipart/form-data", + }; + return httpPostInterceptor(url, data, headers); } diff --git a/service/task.ts b/service/task.ts index a103a2e3..8c853a34 100644 --- a/service/task.ts +++ b/service/task.ts @@ -146,7 +146,7 @@ export async function listTaskTa( } return httpGetInterceptor( - `assignment-expert/pagination?enablePage=1&size=${size}&page=${page}&title=${title}&taskType=${taskType}&uniqueCode=${code}&createdAt=${createdAt}${statusQuery}` + `assignment-expert/pagination?enablePage=1&size=${size}&page=${page}&title=${title}&assignmentType=${taskType}&uniqueCode=${code}&createdAt=${createdAt}${statusQuery}` ); }