feat:upload contest
This commit is contained in:
parent
3f89d63d20
commit
212a544765
|
|
@ -15,7 +15,7 @@ const BlogPage = async () => {
|
|||
<CardTitle>
|
||||
<div className="flex items-center">
|
||||
<div className="flex-1 text-xl font-medium text-default-900">
|
||||
Table Indeks
|
||||
Tabel Indeks
|
||||
</div>
|
||||
<div className="flex-none">
|
||||
<Link href={"/contributor/blog/create"}>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import FormAudio from "@/components/form/content/audio-form";
|
||||
import SiteBreadcrumb from "@/components/site-breadcrumb";
|
||||
|
||||
const AudioScheduleCreatePage = async () => {
|
||||
return (
|
||||
<div>
|
||||
<SiteBreadcrumb />
|
||||
<div className="space-y-4">
|
||||
<FormAudio />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AudioScheduleCreatePage;
|
||||
|
|
@ -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 (
|
||||
<div>
|
||||
<SiteBreadcrumb />
|
||||
<div className="space-y-4">
|
||||
<FormImage />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ImageScheduleCreatePage;
|
||||
|
|
@ -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 (
|
||||
<div>
|
||||
<SiteBreadcrumb />
|
||||
<div className="space-y-4">
|
||||
<FormTeks />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TeksScheduleCreatePage;
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import FormVideo from "@/components/form/content/video-form";
|
||||
import SiteBreadcrumb from "@/components/site-breadcrumb";
|
||||
|
||||
const VideoScheduleCreatePage = async () => {
|
||||
return (
|
||||
<div>
|
||||
<SiteBreadcrumb />
|
||||
<div className="space-y-4">
|
||||
<FormVideo />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default VideoScheduleCreatePage;
|
||||
|
|
@ -27,7 +27,7 @@ const TaskPage = () => {
|
|||
<CardTitle>
|
||||
<div className="flex flex-col sm:flex-row lg:flex-row lg:items-center">
|
||||
<div className="flex-1 text-xl font-medium text-default-900">
|
||||
Table Penugasan
|
||||
Tabel Penugasan
|
||||
</div>
|
||||
<div className="flex-none">
|
||||
<Link href={"/contributor/task/create"}>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const ContestPage = () => {
|
|||
<CardTitle>
|
||||
<div className="flex items-center">
|
||||
<div className="flex-1 text-xl font-medium text-default-900">
|
||||
Table Lomba
|
||||
Tabel Lomba
|
||||
</div>
|
||||
<div className="flex-none">
|
||||
<Link href={"/shared/contest/create"}>
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
</div>
|
||||
<div className="flex flex-col mt-5">
|
||||
<Label className="mr-3 mb-1">Tanggal</Label>
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
value={detail?.createdAt}
|
||||
id="date"
|
||||
variant={"outline"}
|
||||
className={cn(
|
||||
"w-[280px] lg:w-[300px] justify-start text-left font-normal",
|
||||
!date && "text-muted-foreground"
|
||||
)}
|
||||
>
|
||||
<CalendarIcon />
|
||||
{date?.from ? (
|
||||
date.to ? (
|
||||
<>
|
||||
{format(date.from, "LLL dd, y")} -{" "}
|
||||
{format(date.to, "LLL dd, y")}
|
||||
</>
|
||||
) : (
|
||||
format(date.from, "LLL dd, y")
|
||||
)
|
||||
) : (
|
||||
<span>Pick a date</span>
|
||||
)}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-auto p-0" align="start">
|
||||
<Calendar
|
||||
initialFocus
|
||||
mode="range"
|
||||
defaultMonth={date?.from}
|
||||
selected={date}
|
||||
onSelect={setDate}
|
||||
numberOfMonths={1}
|
||||
/>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
<Controller
|
||||
control={control}
|
||||
name="duration"
|
||||
render={({ field: { onChange, value } }) => (
|
||||
<Popover>
|
||||
<PopoverTrigger asChild>
|
||||
<Button
|
||||
id="date"
|
||||
variant={"outline"}
|
||||
className={cn(
|
||||
"w-[280px] lg:w-[300px] justify-start text-left font-normal",
|
||||
!date && "text-muted-foreground"
|
||||
)}
|
||||
value={detail?.duration}
|
||||
>
|
||||
<CalendarIcon />
|
||||
{date?.from ? (
|
||||
date.to ? (
|
||||
<>
|
||||
{format(date.from, "yyyy-MM-dd")} -{" "}
|
||||
{format(date.to, "yyyy-MM-dd")}
|
||||
</>
|
||||
) : (
|
||||
format(date.from, "yyyy-MM-dd")
|
||||
)
|
||||
) : (
|
||||
<span>Pilih Tanggal</span>
|
||||
)}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="w-auto p-0" align="start">
|
||||
<Calendar
|
||||
initialFocus
|
||||
mode="range"
|
||||
defaultMonth={date?.from}
|
||||
selected={date}
|
||||
onSelect={(newDate) => {
|
||||
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}
|
||||
/>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
)}
|
||||
/>
|
||||
{errors.duration?.message && (
|
||||
<p className="text-red-400 text-sm">
|
||||
{errors.duration.message}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="mt-5">
|
||||
<Label>Output Lomba</Label>
|
||||
|
|
@ -763,7 +797,7 @@ export default function FormContestDetail() {
|
|||
)}
|
||||
</div>
|
||||
<div className="mt-7">
|
||||
<Label>Rumus Penilaian</Label>
|
||||
<Label>Panduan Penilaian</Label>
|
||||
<Controller
|
||||
control={control}
|
||||
name="scoringFormula"
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -41,6 +41,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" }),
|
||||
|
|
@ -60,6 +62,7 @@ interface Detail {
|
|||
}
|
||||
|
||||
export default function FormEventDetail() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const { id } = useParams() as { id: string };
|
||||
console.log(id);
|
||||
const router = useRouter();
|
||||
|
|
@ -327,16 +330,110 @@ export default function FormEventDetail() {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<div className="flex justify-between">
|
||||
<Button color="primary" size="sm" type="button">
|
||||
<Plus /> Tambah Lampiran
|
||||
</Button>
|
||||
<p>0 Lampiran</p>
|
||||
</div>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="max-w-md p-6 bg-white rounded-lg shadow-lg h-[420px] w-[700px]">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Pilih Jenis Lampiran
|
||||
</h2>
|
||||
<div className=" space-y-4 gap-y-4">
|
||||
<Link href={"/contributor/schedule/media/video/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-video.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">
|
||||
Audio Visual
|
||||
</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/image/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-image.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Foto</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/text/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-text.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Teks</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/audio/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-audio.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Audio</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{/* Submit Button
|
||||
<div className="mt-4">
|
||||
<Button type="submit" color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
</div> */}
|
||||
</div>
|
||||
<div className="mt-4 flex justify-end">
|
||||
<Button type="submit" color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
<Card className="w-full lg:w-3/12">
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<div className="flex flex-col lg:flex-row gap-2">
|
||||
<Card className="w-full lg:w-9/12">
|
||||
|
|
@ -351,8 +368,19 @@ export default function FormEvent() {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
{/* Submit Button */}
|
||||
<div className="mt-4">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<Button
|
||||
onClick={() => handleUploadAttachment()}
|
||||
color="primary"
|
||||
size="sm"
|
||||
type="button"
|
||||
>
|
||||
<Plus />
|
||||
Tambah Lampiran
|
||||
</Button>
|
||||
<p>0 Llampiran</p>
|
||||
</div>
|
||||
<div className="mt-4 flex justify-end">
|
||||
<Button type="submit" color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<div className="flex justify-between">
|
||||
<Button color="primary" size="sm" type="button">
|
||||
<Plus /> Tambah Lampiran
|
||||
</Button>
|
||||
<p>0 Lampiran</p>
|
||||
</div>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="max-w-md p-6 bg-white rounded-lg shadow-lg h-[420px] w-[700px]">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Pilih Jenis Lampiran
|
||||
</h2>
|
||||
<div className=" space-y-4 gap-y-4">
|
||||
<Link href={"/contributor/schedule/media/video/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-video.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">
|
||||
Audio Visual
|
||||
</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/image/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-image.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Foto</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/text/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-text.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Teks</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/audio/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-audio.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Audio</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{/* Submit Button */}
|
||||
<div className="mt-4">
|
||||
|
||||
<div className="mt-4 flex justify-end">
|
||||
<Button type="submit" color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<div className="flex flex-col lg:flex-row gap-2">
|
||||
<Card className="w-full lg:w-9/12">
|
||||
|
|
@ -352,16 +373,110 @@ export default function FormDetailPressRillis() {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<div className="flex justify-between">
|
||||
<Button color="primary" size="sm" type="button">
|
||||
<Plus /> Tambah Lampiran
|
||||
</Button>
|
||||
<p>0 Lampiran</p>
|
||||
</div>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="max-w-md p-6 bg-white rounded-lg shadow-lg h-[420px] w-[700px]">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Pilih Jenis Lampiran
|
||||
</h2>
|
||||
<div className=" space-y-4 gap-y-4">
|
||||
<Link href={"/contributor/schedule/media/video/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-video.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">
|
||||
Audio Visual
|
||||
</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/image/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-image.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Foto</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/text/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-text.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Teks</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/audio/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-audio.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Audio</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
{/* Submit Button
|
||||
<div className="mt-4">
|
||||
<Button type="submit" color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
</div> */}
|
||||
<div className="mt-4 flex justify-end">
|
||||
<Button type="submit" color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card className="w-full lg:w-3/12">
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Dialog open={open} onOpenChange={setOpen}>
|
||||
<DialogTrigger asChild>
|
||||
<div className="flex justify-between">
|
||||
<Button color="primary" size="sm" type="button">
|
||||
<Plus /> Tambah Lampiran
|
||||
</Button>
|
||||
<p>0 Lampiran</p>
|
||||
</div>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="max-w-md p-6 bg-white rounded-lg shadow-lg h-[420px] w-[700px]">
|
||||
<h2 className="text-lg font-semibold">
|
||||
Pilih Jenis Lampiran
|
||||
</h2>
|
||||
<div className=" space-y-4 gap-y-4">
|
||||
<Link href={"/contributor/schedule/media/video/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-video.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">
|
||||
Audio Visual
|
||||
</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/image/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-image.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Foto</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/text/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-text.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Teks</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
<Link href={"/contributor/schedule/media/audio/create"}>
|
||||
<div className="flex flex-row items-center space-x-4">
|
||||
<div className="flex flex-col w-4/12 items-center">
|
||||
<img
|
||||
src={"/assets/img/upload-audio.png"}
|
||||
alt={"item.label"}
|
||||
className="w-12 h-12"
|
||||
/>
|
||||
<h3 className="text-base font-semibold">Audio</h3>
|
||||
</div>
|
||||
<div className="w-8/12">
|
||||
<p className="text-sm text-gray-600">
|
||||
Unggah media berupa video dengan format avi, wmv,
|
||||
atau mp4 dengan ukuran minimal 2mb dan maksimal
|
||||
500mb.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
) : (
|
||||
""
|
||||
|
|
|
|||
|
|
@ -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() {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Submit Button */}
|
||||
<div className="mt-4">
|
||||
<div className="flex flex-row items-center justify-between">
|
||||
<Button
|
||||
onClick={() => handleUploadAttachment()}
|
||||
color="primary"
|
||||
size="sm"
|
||||
type="button"
|
||||
>
|
||||
<Plus />
|
||||
Tambah Lampiran
|
||||
</Button>
|
||||
<p>0 Llampiran</p>
|
||||
</div>
|
||||
<div className="mt-4 flex justify-end">
|
||||
<Button type="submit" color="primary">
|
||||
Submit
|
||||
</Button>
|
||||
|
|
|
|||
14
lib/menus.ts
14
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: [],
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.0 KiB |
Loading…
Reference in New Issue