diff --git a/app/[locale]/(protected)/contributor/blog/page.tsx b/app/[locale]/(protected)/contributor/blog/page.tsx index 6cfc19b4..71849fb4 100644 --- a/app/[locale]/(protected)/contributor/blog/page.tsx +++ b/app/[locale]/(protected)/contributor/blog/page.tsx @@ -15,7 +15,7 @@ const BlogPage = async () => {
- Table Indeks + Tabel Indeks
diff --git a/app/[locale]/(protected)/contributor/schedule/media/audio/create/page.tsx b/app/[locale]/(protected)/contributor/schedule/media/audio/create/page.tsx new file mode 100644 index 00000000..245ddf9f --- /dev/null +++ b/app/[locale]/(protected)/contributor/schedule/media/audio/create/page.tsx @@ -0,0 +1,15 @@ +import FormAudio from "@/components/form/content/audio-form"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; + +const AudioScheduleCreatePage = async () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default AudioScheduleCreatePage; diff --git a/app/[locale]/(protected)/contributor/schedule/media/image/create/page.tsx b/app/[locale]/(protected)/contributor/schedule/media/image/create/page.tsx new file mode 100644 index 00000000..73082e9a --- /dev/null +++ b/app/[locale]/(protected)/contributor/schedule/media/image/create/page.tsx @@ -0,0 +1,17 @@ +import { Card, CardContent } from "@/components/ui/card"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; +import FormTask from "@/components/form/task/task-form"; +import FormImage from "@/components/form/content/image-form"; + +const ImageScheduleCreatePage = async () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default ImageScheduleCreatePage; diff --git a/app/[locale]/(protected)/contributor/schedule/media/text/create/page.tsx b/app/[locale]/(protected)/contributor/schedule/media/text/create/page.tsx new file mode 100644 index 00000000..905e8275 --- /dev/null +++ b/app/[locale]/(protected)/contributor/schedule/media/text/create/page.tsx @@ -0,0 +1,16 @@ +import FormAudio from "@/components/form/content/audio-form"; +import FormTeks from "@/components/form/content/teks-form"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; + +const TeksScheduleCreatePage = async () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default TeksScheduleCreatePage; diff --git a/app/[locale]/(protected)/contributor/schedule/media/video/create/page.tsx b/app/[locale]/(protected)/contributor/schedule/media/video/create/page.tsx new file mode 100644 index 00000000..7c5eb0fc --- /dev/null +++ b/app/[locale]/(protected)/contributor/schedule/media/video/create/page.tsx @@ -0,0 +1,15 @@ +import FormVideo from "@/components/form/content/video-form"; +import SiteBreadcrumb from "@/components/site-breadcrumb"; + +const VideoScheduleCreatePage = async () => { + return ( +
+ +
+ +
+
+ ); +}; + +export default VideoScheduleCreatePage; diff --git a/app/[locale]/(protected)/contributor/task/page.tsx b/app/[locale]/(protected)/contributor/task/page.tsx index 0d91735d..54d82f79 100644 --- a/app/[locale]/(protected)/contributor/task/page.tsx +++ b/app/[locale]/(protected)/contributor/task/page.tsx @@ -27,7 +27,7 @@ const TaskPage = () => {
- Table Penugasan + Tabel Penugasan
diff --git a/app/[locale]/(protected)/shared/contest/page.tsx b/app/[locale]/(protected)/shared/contest/page.tsx index 72fbd099..77f8ed14 100644 --- a/app/[locale]/(protected)/shared/contest/page.tsx +++ b/app/[locale]/(protected)/shared/contest/page.tsx @@ -15,7 +15,7 @@ const ContestPage = () => {
- Table Lomba + Tabel Lomba
diff --git a/components/form/contest/contest-detail-form.tsx b/components/form/contest/contest-detail-form.tsx index 8cefbfc5..723d7c1d 100644 --- a/components/form/contest/contest-detail-form.tsx +++ b/components/form/contest/contest-detail-form.tsx @@ -51,9 +51,14 @@ import { AudioRecorder } from "react-audio-voice-recorder"; import { error, loading } from "@/lib/swal"; import { Upload } from "tus-js-client"; import { getCsrfToken } from "@/service/auth"; +import { getOnlyDate } from "@/utils/globals"; +import { duration } from "moment"; const contestSchema = z.object({ theme: z.string().min(1, { message: "Judul diperlukan" }), + duration: z + .array(z.string().min(1)) // Gunakan array string untuk menyimpan range tanggal + .min(1, { message: "Tanggal diperlukan" }), hastagCode: z.string().min(1, { message: "Judul diperlukan" }), description: z.string().min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter.", @@ -76,7 +81,7 @@ export type contestDetail = { id: number; name: string; }; - createdAt: string; + duration: string; platformType: string | null; assignmentTypeId: string; targetOutput: string; @@ -190,9 +195,12 @@ export default function FormContestDetail() { const details = response?.data?.data; setDetail(details); - if (details?.createdAt) { - const parsedDate = parseISO(details.createdAt); - setDate({ from: parsedDate, to: parsedDate }); + if (details?.duration) { + const [start, end] = details.duration.split(" - "); // Pisahkan tanggal + setDate({ + from: parseISO(start), + to: end ? parseISO(end) : undefined, // Pastikan `to` bisa undefined jika hanya satu tanggal + }); } } } @@ -212,19 +220,19 @@ export default function FormContestDetail() { } }, [detail?.targetOutput]); - // useEffect(() => { - // if (detail?.targetParticipantTopLevel) { - // const outputSet = new Set( - // detail.targetParticipantTopLevel.split(",").map(Number) - // ); - // setUnitSelection({ - // allUnit: outputSet.has(0), - // mabes: outputSet.has(1), - // polda: outputSet.has(2), - // polres: outputSet.has(3), - // }); - // } - // }, [detail?.targetParticipantTopLevel]); + useEffect(() => { + if (detail?.targetParticipantTopLevel) { + const outputSet = new Set( + detail.targetParticipantTopLevel.split(",").map(Number) + ); + setUnitSelection({ + allUnit: outputSet.has(0), + mabes: outputSet.has(1), + polda: outputSet.has(2), + polres: outputSet.has(3), + }); + } + }, [detail?.targetParticipantTopLevel]); const handleCheckboxChange = (levelId: number) => { setCheckedLevels((prev) => { @@ -244,11 +252,11 @@ export default function FormContestDetail() { const save = async (data: ContestSchema) => { const fileTypeMapping = { - all: "1", + all: "0", video: "2", - audio: "3", - image: "4", - text: "5", + audio: "4", + image: "1", + text: "3", }; const unitMapping = { @@ -268,26 +276,38 @@ export default function FormContestDetail() { .map((key) => fileTypeMapping[key as keyof typeof fileTypeMapping]) // Konversi ke nilai string .join(","); + // Pastikan `data.duration` ada dan dikonversi ke `Date` + const startDate = data.duration?.[0] ? new Date(data.duration[0]) : null; + const endDate = data.duration?.[1] ? new Date(data.duration[1]) : null; + + const formattedDuration = startDate + ? endDate + ? `${getOnlyDate(startDate)} - ${getOnlyDate(endDate)}` + : getOnlyDate(startDate) + : ""; + const requestData: { id?: any; theme: string; - assignedToLevel: any; - assignmentPurpose: any; + duration: string; + targetParticipantTopLevel: any; + targetParticipant: any; hastagCode: string; description: string; - assignmentMainTypeId: any; scoringFormula: string; - fileTypeOutput: any; + targetOutput: any; + attachmentUrl: string[]; } = { ...data, hastagCode: data.hastagCode, theme: data.theme, + duration: formattedDuration, description: data.description, scoringFormula: data.scoringFormula, - assignmentMainTypeId: mainType, - assignedToLevel: handlePoldaPolresChange(), - assignmentPurpose: assignmentPurposeString, - fileTypeOutput: selectedOutputs, + targetParticipantTopLevel: handlePoldaPolresChange(), + targetParticipant: assignmentPurposeString, + targetOutput: selectedOutputs, + attachmentUrl: links, }; // if (id != undefined) { @@ -299,7 +319,7 @@ export default function FormContestDetail() { console.log("Form Data Submitted:", requestData); console.log("response", response); - const id = response?.data?.data.id; + const id = response?.data?.data?.id; loading(); if (imageFiles?.length == 0) { setIsImageUploadFinish(true); @@ -334,16 +354,6 @@ export default function FormContestDetail() { "0" // Optional: Replace with actual duration if available ); }); - - // MySwal.fire({ - // title: "Sukses", - // text: "Data berhasil disimpan.", - // icon: "success", - // confirmButtonColor: "#3085d6", - // confirmButtonText: "OK", - // }).then(() => { - // router.push("/en/shared/contest"); - // }); }; const onSubmit = (data: ContestSchema) => { @@ -584,43 +594,67 @@ export default function FormContestDetail() {
- - - - - - - - + ( + + + + + + { + setDate(newDate); // Update state lokal + if (newDate?.from) { + const formattedDate = [ + format(newDate.from, "yyyy-MM-dd"), + newDate.to + ? format(newDate.to, "yyyy-MM-dd") + : "", + ].filter(Boolean); // Hanya menyimpan yang tidak undefined + onChange(formattedDate); // Simpan ke React Hook Form + } else { + onChange([]); // Reset jika tidak ada tanggal + } + }} + numberOfMonths={1} + /> + + + )} + /> + {errors.duration?.message && ( +

+ {errors.duration.message} +

+ )}
@@ -763,7 +797,7 @@ export default function FormContestDetail() { )}
- +
+ + +
+ +

0 Lampiran

+
+
+ +

+ Pilih Jenis Lampiran +

+
+ +
+
+ {"item.label"} +

+ Audio Visual +

+
+
+

+ 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. +

+
+
+ +
+
+
) : ( "" )} - {/* Submit Button -
- -
*/} +
+
+
diff --git a/components/form/schedule/event-form.tsx b/components/form/schedule/event-form.tsx index b3b9de11..9c86364e 100644 --- a/components/form/schedule/event-form.tsx +++ b/components/form/schedule/event-form.tsx @@ -26,7 +26,7 @@ import { PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; -import { CalendarIcon } from "lucide-react"; +import { CalendarIcon, Plus } from "lucide-react"; import { Calendar } from "@/components/ui/calendar"; import { addDays, format, setDate } from "date-fns"; import { DateRange } from "react-day-picker"; @@ -149,6 +149,23 @@ export default function FormEvent() { }); }; + const handleUploadAttachment = () => { + const scheduleId = Cookies.get("scheduleId"); + + if (scheduleId == undefined) { + MySwal.fire({ + title: "Simpan Jadwal Terlebih Dahulu", + icon: "info", + confirmButtonColor: "#3085d6", + confirmButtonText: "Ok", + }).then((result) => { + if (result.isConfirmed) { + return true; + } + }); + } + }; + return (
@@ -351,8 +368,19 @@ export default function FormEvent() {
- {/* Submit Button */} -
+
+ +

0 Llampiran

+
+
diff --git a/components/form/schedule/event-update-form.tsx b/components/form/schedule/event-update-form.tsx index 8ae2ebfa..bfd6bb6c 100644 --- a/components/form/schedule/event-update-form.tsx +++ b/components/form/schedule/event-update-form.tsx @@ -17,7 +17,7 @@ import { PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; -import { CalendarIcon } from "lucide-react"; +import { CalendarIcon, Plus } from "lucide-react"; import { Calendar } from "@/components/ui/calendar"; import { addDays, format, parseISO, setDate } from "date-fns"; import { DateRange } from "react-day-picker"; @@ -29,6 +29,8 @@ import { Textarea } from "@/components/ui/textarea"; import { error, loading } from "@/lib/swal"; import Cookies from "js-cookie"; import { detailSchedule, postSchedule } from "@/service/schedule/schedule"; +import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; +import { Link } from "@/i18n/routing"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -48,6 +50,7 @@ interface Detail { } export default function FormEventUpdate() { + const [open, setOpen] = useState(false); const { id } = useParams() as { id: string }; console.log(id); const router = useRouter(); @@ -379,12 +382,107 @@ export default function FormEventUpdate() { )}
+ + +
+ +

0 Lampiran

+
+
+ +

+ Pilih Jenis Lampiran +

+
+ +
+
+ {"item.label"} +

+ Audio Visual +

+
+
+

+ 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. +

+
+
+ +
+
+
) : ( "" )} - {/* Submit Button */} -
+ +
diff --git a/components/form/schedule/pers-release--detail-form.tsx b/components/form/schedule/pers-release--detail-form.tsx index 253d0b9e..10e4eeaa 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, User2 } from "lucide-react"; +import { CalendarIcon, Clock1, 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"; @@ -48,6 +48,8 @@ import { AccordionTrigger, } from "@/components/ui/accordion"; import { formatDate } from "@fullcalendar/core/index.js"; +import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; +import { Link } from "@/i18n/routing"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -67,7 +69,9 @@ interface Detail { } export default function FormDetailPressRillis() { + const [open, setOpen] = useState(false); const { id } = useParams() as { id: string }; + const MySwal = withReactContent(Swal); console.log(id); const router = useRouter(); const [isLiveStreamingEnabled, setIsLiveStreamingEnabled] = useState(false); @@ -135,6 +139,23 @@ export default function FormDetailPressRillis() { setEndTime(e.target.value); }; + const handleUploadAttachment = () => { + const scheduleId = Cookies.get("scheduleId"); + + if (scheduleId == undefined) { + MySwal.fire({ + title: "Simpan Jadwal Terlebih Dahulu", + icon: "info", + confirmButtonColor: "#3085d6", + confirmButtonText: "Ok", + }).then((result) => { + if (result.isConfirmed) { + return true; + } + }); + } + }; + return (
@@ -352,16 +373,110 @@ export default function FormDetailPressRillis() { )}
+ + +
+ +

0 Lampiran

+
+
+ +

+ Pilih Jenis Lampiran +

+
+ +
+
+ {"item.label"} +

+ Audio Visual +

+
+
+

+ 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. +

+
+
+ +
+
+
) : ( "" )} - {/* Submit Button -
- -
*/} +
+ +
diff --git a/components/form/schedule/pers-release--update-form.tsx b/components/form/schedule/pers-release--update-form.tsx index 079dfdf7..af3df3a4 100644 --- a/components/form/schedule/pers-release--update-form.tsx +++ b/components/form/schedule/pers-release--update-form.tsx @@ -17,7 +17,7 @@ import { PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; -import { CalendarIcon } from "lucide-react"; +import { CalendarIcon, Plus } from "lucide-react"; import { Calendar } from "@/components/ui/calendar"; import { addDays, format, parseISO, setDate } from "date-fns"; import { DateRange } from "react-day-picker"; @@ -36,6 +36,8 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select"; +import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; +import { Link } from "@/i18n/routing"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -55,6 +57,7 @@ interface Detail { } export default function FormUpdatePressRelease() { + const [open, setOpen] = useState(false); const { id } = useParams() as { id: string }; console.log(id); const router = useRouter(); @@ -403,6 +406,101 @@ export default function FormUpdatePressRelease() { )} + + +
+ +

0 Lampiran

+
+
+ +

+ Pilih Jenis Lampiran +

+
+ +
+
+ {"item.label"} +

+ Audio Visual +

+
+
+

+ 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. +

+
+
+ +
+
+
) : ( "" diff --git a/components/form/schedule/pers-release-form.tsx b/components/form/schedule/pers-release-form.tsx index 3628d9c2..ffca8506 100644 --- a/components/form/schedule/pers-release-form.tsx +++ b/components/form/schedule/pers-release-form.tsx @@ -27,7 +27,7 @@ import { PopoverTrigger, } from "@/components/ui/popover"; import { cn } from "@/lib/utils"; -import { CalendarIcon } from "lucide-react"; +import { CalendarIcon, Plus } from "lucide-react"; import { Calendar } from "@/components/ui/calendar"; import { addDays, format, setDate } from "date-fns"; import { DateRange } from "react-day-picker"; @@ -133,6 +133,23 @@ export default function FormPressRelease() { }); }; + const handleUploadAttachment = () => { + const scheduleId = Cookies.get("scheduleId"); + + if (scheduleId == undefined) { + MySwal.fire({ + title: "Simpan Jadwal Terlebih Dahulu", + icon: "info", + confirmButtonColor: "#3085d6", + confirmButtonText: "Ok", + }).then((result) => { + if (result.isConfirmed) { + return true; + } + }); + } + }; + const onSubmit = (data: TaskSchema) => { MySwal.fire({ title: "Simpan Data", @@ -367,9 +384,19 @@ export default function FormPressRelease() { - - {/* Submit Button */} -
+
+ +

0 Llampiran

+
+
diff --git a/lib/menus.ts b/lib/menus.ts index 5e369193..25a025ee 100644 --- a/lib/menus.ts +++ b/lib/menus.ts @@ -1599,7 +1599,7 @@ export function getMenuList(pathname: string, t: any): Group[] { { id: "contest", href: "/shared/contest", - label: t("contest"), + label: t("lomba"), active: pathname.includes("/contest"), icon: "ic:outline-emoji-events", submenus: [], @@ -1783,7 +1783,7 @@ export function getMenuList(pathname: string, t: any): Group[] { { id: "contest", href: "/shared/contest", - label: t("contest"), + label: t("lomba"), active: pathname.includes("/contest"), icon: "ic:outline-emoji-events", submenus: [], @@ -1949,7 +1949,7 @@ export function getMenuList(pathname: string, t: any): Group[] { { id: "contest", href: "/shared/contest", - label: t("contest"), + label: t("lomba"), active: pathname.includes("/contest"), icon: "ic:outline-emoji-events", submenus: [], @@ -2177,7 +2177,7 @@ export function getMenuList(pathname: string, t: any): Group[] { { id: "contest", href: "/shared/contest", - label: t("contest"), + label: t("lomba"), active: pathname.includes("/contest"), icon: "ic:outline-emoji-events", submenus: [], @@ -2386,7 +2386,7 @@ export function getMenuList(pathname: string, t: any): Group[] { { id: "contest", href: "/shared/contest", - label: t("contest"), + label: "Lomba", active: pathname.includes("/contest"), icon: "ic:outline-emoji-events", submenus: [], @@ -2669,7 +2669,7 @@ export function getMenuList(pathname: string, t: any): Group[] { { id: "contest", href: "/shared/contest", - label: t("contest"), + label: t("Lomba"), active: pathname.includes("/contest"), icon: "ic:outline-emoji-events", submenus: [], @@ -2873,7 +2873,7 @@ export function getMenuList(pathname: string, t: any): Group[] { { id: "contest", href: "/shared/contest", - label: t("contest"), + label: "Lomba", active: pathname.includes("/contest"), icon: "ic:outline-emoji-events", submenus: [], diff --git a/public/assets/img/upload-audio.png b/public/assets/img/upload-audio.png new file mode 100644 index 00000000..88978967 Binary files /dev/null and b/public/assets/img/upload-audio.png differ diff --git a/public/assets/img/upload-image.png b/public/assets/img/upload-image.png new file mode 100644 index 00000000..f9be61b5 Binary files /dev/null and b/public/assets/img/upload-image.png differ diff --git a/public/assets/img/upload-text.png b/public/assets/img/upload-text.png new file mode 100644 index 00000000..1e18f22d Binary files /dev/null and b/public/assets/img/upload-text.png differ diff --git a/public/assets/img/upload-video.png b/public/assets/img/upload-video.png new file mode 100644 index 00000000..2a67da14 Binary files /dev/null and b/public/assets/img/upload-video.png differ