Perencanaan MediaHub Bulanan
@@ -153,6 +168,7 @@ export default function DetailMonthly() {
value={field.value}
placeholder="Masukkan Judul Perencanaan"
onChange={field.onChange}
+ readOnly
/>
@@ -173,6 +189,7 @@ export default function DetailMonthly() {
"w-[280px] justify-start text-left font-normal",
!field.value && "text-muted-foreground"
)}
+ disabled
>
{field.value ? (
@@ -203,6 +220,7 @@ export default function DetailMonthly() {
Detail Perencanaan
-
-
diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/edit/[id]/page.tsx
index e69de29b..cee02ce1 100644
--- a/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/edit/[id]/page.tsx
+++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-monthly/edit/[id]/page.tsx
@@ -0,0 +1,250 @@
+"use client";
+import SiteBreadcrumb from "@/components/site-breadcrumb";
+import { Button } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Link, useRouter } from "@/i18n/routing";
+import { CalendarIcon } from "lucide-react";
+import React, { useEffect, useRef, useState } from "react";
+import { cn } from "@/lib/utils";
+import { format } from "date-fns";
+import JoditEditor from "jodit-react";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { z } from "zod";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { close, error, loading } from "@/config/swal";
+import { savePlanning } from "@/service/agenda-setting/agenda-setting";
+import { getPlanningById } from "@/service/planning/planning";
+import { useParams } from "next/navigation";
+
+const FormSchema = z.object({
+ month: z.date({
+ required_error: "Required",
+ }),
+ title: z.string({
+ required_error: "Required",
+ }),
+ detail: z.string({
+ required_error: "Required",
+ }),
+});
+export default function EditMonthly() {
+ const id = useParams()?.id;
+ const MySwal = withReactContent(Swal);
+ const router = useRouter();
+ const form = useForm
>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: {
+ detail: "",
+ },
+ });
+ const editor = useRef(null);
+
+ useEffect(() => {
+ async function getPlanning() {
+ if (id != undefined) {
+ const parseDate = (dateString: string): Date => {
+ const [month, year] = dateString.split("/").map(Number);
+ return new Date(year, month - 1);
+ };
+ loading();
+ const res = await getPlanningById(id);
+ close();
+ if (res?.data?.data != undefined) {
+ const data = res?.data?.data;
+ console.log("Data :", data);
+ form.setValue("title", data?.title);
+ form.setValue("detail", data.description);
+ const date = parseDate(data.date);
+ console.log("date", date);
+ form.setValue(
+ "month",
+ new Date(date.getFullYear(), date.getMonth(), 1)
+ );
+ }
+ }
+ }
+
+ getPlanning();
+ }, [id]);
+
+ const onSubmit = async (data: z.infer) => {
+ if (form.getValues("detail") == "") {
+ form.setError("detail", {
+ 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 save = async (data: z.infer) => {
+ const reqData = {
+ id: id,
+ planningTypeId: 1,
+ title: data.title,
+ time: "3",
+ description: data.detail,
+ username: "",
+ date: `${new Date(data.month).getMonth() + 1}/${new Date(
+ data.month
+ ).getFullYear()}`,
+ status: "Open",
+ };
+ console.log("req", reqData, data.month);
+ const response = await savePlanning(reqData);
+ close();
+ if (response.error) {
+ error(response.message);
+ return false;
+ }
+
+ MySwal.fire({
+ title: "Sukses",
+ icon: "success",
+ confirmButtonColor: "#3085d6",
+ confirmButtonText: "OK",
+ }).then((result) => {
+ if (result.isConfirmed) {
+ router.push("/curator/task-plan/mediahub");
+ }
+ });
+ };
+
+ const handleMonthSelect = (selectedDate: Date | undefined) => {
+ if (!selectedDate) return;
+ const newDate = new Date(
+ selectedDate.getFullYear(),
+ selectedDate.getMonth(),
+ 1
+ );
+ console.log("newDate", newDate, selectedDate);
+ form.setValue("month", newDate);
+ };
+ return (
+
+
+
+
+
Perencanaan MediaHub Bulanan
+
+
+
+
+
+
+ );
+}
diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/detail/[id]/page.tsx
new file mode 100644
index 00000000..1d3c4ff5
--- /dev/null
+++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/detail/[id]/page.tsx
@@ -0,0 +1,261 @@
+"use client";
+import SiteBreadcrumb from "@/components/site-breadcrumb";
+import { Button } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Link, useRouter } from "@/i18n/routing";
+import { CalendarIcon } from "lucide-react";
+import React, { useEffect, useRef, useState } from "react";
+import { cn } from "@/lib/utils";
+import { format } from "date-fns";
+import JoditEditor from "jodit-react";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { z } from "zod";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { close, error, loading } from "@/config/swal";
+import { getOnlyDate } from "@/utils/globals";
+import {
+ getMonthlyPlanList,
+ savePlanning,
+} from "@/service/agenda-setting/agenda-setting";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import dayjs from "dayjs";
+import { getPlanningById } from "@/service/planning/planning";
+import { useParams } from "next/navigation";
+
+const FormSchema = z.object({
+ week: z.object({
+ from: z.date({
+ required_error: "Start date (from) is required",
+ }),
+ to: z.date({
+ required_error: "End date (to) is required",
+ }),
+ }),
+ title: z.string({
+ required_error: "Required",
+ }),
+ detail: z.string({
+ required_error: "Required",
+ }),
+});
+export default function DetailMonthly() {
+ const id = useParams()?.id;
+ const MySwal = withReactContent(Swal);
+ const router = useRouter();
+ const [parentId, setParentId] = useState();
+ const form = useForm>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: {
+ detail: "",
+ },
+ });
+
+ const editor = useRef(null);
+
+ const onSubmit = async (data: z.infer) => {
+ if (form.getValues("detail") == "") {
+ form.setError("detail", {
+ 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 save = async (data: z.infer) => {
+ const reqData = {
+ id: id,
+ planningTypeId: 1,
+ title: data.title,
+ time: "2",
+ description: data.detail,
+ username: "",
+ date: `${getOnlyDate(data.week.from)} - ${getOnlyDate(data.week.to)}`,
+ status: "Open",
+ parentId: parentId,
+ };
+ console.log("req", reqData);
+ const response = await savePlanning(reqData);
+ close();
+ if (response.error) {
+ error(response.message);
+ return false;
+ }
+
+ MySwal.fire({
+ title: "Sukses",
+ icon: "success",
+ confirmButtonColor: "#3085d6",
+ confirmButtonText: "OK",
+ }).then((result) => {
+ if (result.isConfirmed) {
+ router.push("/curator/task-plan/mediahub");
+ }
+ });
+ };
+
+ useEffect(() => {
+ async function getPlanningData() {
+ if (id != undefined) {
+ loading();
+ const res = await getPlanningById(id);
+ close();
+ if (res?.data?.data != undefined) {
+ const data = res?.data?.data;
+ console.log("Data :", data);
+ form.setValue("title", data?.title);
+ form.setValue("week", {
+ from: new Date(data?.startDate),
+ to: new Date(data?.endDate),
+ });
+ form.setValue("detail", data.description);
+ setParentId(data?.parentId);
+ }
+ }
+ }
+
+ getPlanningData();
+ }, []);
+
+ return (
+
+
+
+
+
Perencanaan MediaHub Mingguan
+
+
+
+
+
+
+ );
+}
diff --git a/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/edit/[id]/page.tsx
new file mode 100644
index 00000000..de245202
--- /dev/null
+++ b/app/[locale]/(protected)/curator/task-plan/mediahub/create-weekly/edit/[id]/page.tsx
@@ -0,0 +1,261 @@
+"use client";
+import SiteBreadcrumb from "@/components/site-breadcrumb";
+import { Button } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Link, useRouter } from "@/i18n/routing";
+import { CalendarIcon } from "lucide-react";
+import React, { useEffect, useRef, useState } from "react";
+import { cn } from "@/lib/utils";
+import { format } from "date-fns";
+import JoditEditor from "jodit-react";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { z } from "zod";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { close, error, loading } from "@/config/swal";
+import { getOnlyDate } from "@/utils/globals";
+import {
+ getMonthlyPlanList,
+ savePlanning,
+} from "@/service/agenda-setting/agenda-setting";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import dayjs from "dayjs";
+import { getPlanningById } from "@/service/planning/planning";
+import { useParams } from "next/navigation";
+
+const FormSchema = z.object({
+ week: z.object({
+ from: z.date({
+ required_error: "Start date (from) is required",
+ }),
+ to: z.date({
+ required_error: "End date (to) is required",
+ }),
+ }),
+ title: z.string({
+ required_error: "Required",
+ }),
+ detail: z.string({
+ required_error: "Required",
+ }),
+});
+export default function EditMonthly() {
+ const id = useParams()?.id;
+ const MySwal = withReactContent(Swal);
+ const router = useRouter();
+ const [parentId, setParentId] = useState();
+ const form = useForm>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: {
+ detail: "",
+ },
+ });
+
+ const editor = useRef(null);
+
+ const onSubmit = async (data: z.infer) => {
+ if (form.getValues("detail") == "") {
+ form.setError("detail", {
+ 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 save = async (data: z.infer) => {
+ const reqData = {
+ id: id,
+ planningTypeId: 1,
+ title: data.title,
+ time: "2",
+ description: data.detail,
+ username: "",
+ date: `${getOnlyDate(data.week.from)} - ${getOnlyDate(data.week.to)}`,
+ status: "Open",
+ parentId: parentId,
+ };
+ console.log("req", reqData);
+ const response = await savePlanning(reqData);
+ close();
+ if (response.error) {
+ error(response.message);
+ return false;
+ }
+
+ MySwal.fire({
+ title: "Sukses",
+ icon: "success",
+ confirmButtonColor: "#3085d6",
+ confirmButtonText: "OK",
+ }).then((result) => {
+ if (result.isConfirmed) {
+ router.push("/curator/task-plan/mediahub");
+ }
+ });
+ };
+
+ useEffect(() => {
+ async function getPlanningData() {
+ if (id != undefined) {
+ loading();
+ const res = await getPlanningById(id);
+ close();
+ if (res?.data?.data != undefined) {
+ const data = res?.data?.data;
+ console.log("Data :", data);
+ form.setValue("title", data?.title);
+ form.setValue("week", {
+ from: new Date(data?.startDate),
+ to: new Date(data?.endDate),
+ });
+ form.setValue("detail", data.description);
+ setParentId(data?.parentId);
+ }
+ }
+ }
+
+ getPlanningData();
+ }, []);
+
+ return (
+
+
+
+
+
Perencanaan MediaHub Mingguan
+
+
+
+
+
+
+ );
+}
diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/detail/[id]/page.tsx
new file mode 100644
index 00000000..5c99af8b
--- /dev/null
+++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/detail/[id]/page.tsx
@@ -0,0 +1,249 @@
+"use client";
+import SiteBreadcrumb from "@/components/site-breadcrumb";
+import { Button } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Link, useRouter } from "@/i18n/routing";
+import { CalendarIcon } from "lucide-react";
+import React, { useEffect, useRef, useState } from "react";
+import { cn } from "@/lib/utils";
+import { format } from "date-fns";
+import JoditEditor from "jodit-react";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { z } from "zod";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { close, error, loading } from "@/config/swal";
+import { savePlanning } from "@/service/agenda-setting/agenda-setting";
+import { getPlanningById } from "@/service/planning/planning";
+import { useParams } from "next/navigation";
+
+const FormSchema = z.object({
+ month: z.date({
+ required_error: "Required",
+ }),
+ title: z.string({
+ required_error: "Required",
+ }),
+ detail: z.string({
+ required_error: "Required",
+ }),
+});
+export default function DetailMonthly() {
+ const id = useParams()?.id;
+ const MySwal = withReactContent(Swal);
+ const router = useRouter();
+ const form = useForm>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: {
+ detail: "",
+ },
+ });
+ const editor = useRef(null);
+
+ useEffect(() => {
+ async function getPlanning() {
+ if (id != undefined) {
+ const parseDate = (dateString: string): Date => {
+ const [month, year] = dateString.split("/").map(Number);
+ return new Date(year, month - 1);
+ };
+ loading();
+ const res = await getPlanningById(id);
+ close();
+ if (res?.data?.data != undefined) {
+ const data = res?.data?.data;
+ console.log("Data :", data);
+ form.setValue("title", data?.title);
+ form.setValue("detail", data.description);
+ const date = parseDate(data.date);
+ console.log("date", date);
+ form.setValue(
+ "month",
+ new Date(date.getFullYear(), date.getMonth(), 1)
+ );
+ }
+ }
+ }
+
+ getPlanning();
+ }, [id]);
+
+ const onSubmit = async (data: z.infer) => {
+ if (form.getValues("detail") == "") {
+ form.setError("detail", {
+ 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 save = async (data: z.infer) => {
+ const reqData = {
+ planningTypeId: 1,
+ title: data.title,
+ time: "3",
+ description: data.detail,
+ username: "",
+ date: `${new Date(data.month).getMonth() + 1}/${new Date(
+ data.month
+ ).getFullYear()}`,
+ status: "Open",
+ };
+ console.log("req", reqData, data.month);
+ const response = await savePlanning(reqData);
+ close();
+ if (response.error) {
+ error(response.message);
+ return false;
+ }
+
+ MySwal.fire({
+ title: "Sukses",
+ icon: "success",
+ confirmButtonColor: "#3085d6",
+ confirmButtonText: "OK",
+ }).then((result) => {
+ if (result.isConfirmed) {
+ router.push("/curator/task-plan/mediahub");
+ }
+ });
+ };
+
+ const handleMonthSelect = (selectedDate: Date | undefined) => {
+ if (!selectedDate) return;
+ const newDate = new Date(
+ selectedDate.getFullYear(),
+ selectedDate.getMonth(),
+ 1
+ );
+ console.log("newDate", newDate, selectedDate);
+ form.setValue("month", newDate);
+ };
+ return (
+
+
+
+
+
Perencanaan MediaHub Bulanan
+
+
+
+
+
+
+ );
+}
diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/edit/[id]/page.tsx
new file mode 100644
index 00000000..cee02ce1
--- /dev/null
+++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-monthly/edit/[id]/page.tsx
@@ -0,0 +1,250 @@
+"use client";
+import SiteBreadcrumb from "@/components/site-breadcrumb";
+import { Button } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Link, useRouter } from "@/i18n/routing";
+import { CalendarIcon } from "lucide-react";
+import React, { useEffect, useRef, useState } from "react";
+import { cn } from "@/lib/utils";
+import { format } from "date-fns";
+import JoditEditor from "jodit-react";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { z } from "zod";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { close, error, loading } from "@/config/swal";
+import { savePlanning } from "@/service/agenda-setting/agenda-setting";
+import { getPlanningById } from "@/service/planning/planning";
+import { useParams } from "next/navigation";
+
+const FormSchema = z.object({
+ month: z.date({
+ required_error: "Required",
+ }),
+ title: z.string({
+ required_error: "Required",
+ }),
+ detail: z.string({
+ required_error: "Required",
+ }),
+});
+export default function EditMonthly() {
+ const id = useParams()?.id;
+ const MySwal = withReactContent(Swal);
+ const router = useRouter();
+ const form = useForm>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: {
+ detail: "",
+ },
+ });
+ const editor = useRef(null);
+
+ useEffect(() => {
+ async function getPlanning() {
+ if (id != undefined) {
+ const parseDate = (dateString: string): Date => {
+ const [month, year] = dateString.split("/").map(Number);
+ return new Date(year, month - 1);
+ };
+ loading();
+ const res = await getPlanningById(id);
+ close();
+ if (res?.data?.data != undefined) {
+ const data = res?.data?.data;
+ console.log("Data :", data);
+ form.setValue("title", data?.title);
+ form.setValue("detail", data.description);
+ const date = parseDate(data.date);
+ console.log("date", date);
+ form.setValue(
+ "month",
+ new Date(date.getFullYear(), date.getMonth(), 1)
+ );
+ }
+ }
+ }
+
+ getPlanning();
+ }, [id]);
+
+ const onSubmit = async (data: z.infer) => {
+ if (form.getValues("detail") == "") {
+ form.setError("detail", {
+ 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 save = async (data: z.infer) => {
+ const reqData = {
+ id: id,
+ planningTypeId: 1,
+ title: data.title,
+ time: "3",
+ description: data.detail,
+ username: "",
+ date: `${new Date(data.month).getMonth() + 1}/${new Date(
+ data.month
+ ).getFullYear()}`,
+ status: "Open",
+ };
+ console.log("req", reqData, data.month);
+ const response = await savePlanning(reqData);
+ close();
+ if (response.error) {
+ error(response.message);
+ return false;
+ }
+
+ MySwal.fire({
+ title: "Sukses",
+ icon: "success",
+ confirmButtonColor: "#3085d6",
+ confirmButtonText: "OK",
+ }).then((result) => {
+ if (result.isConfirmed) {
+ router.push("/curator/task-plan/mediahub");
+ }
+ });
+ };
+
+ const handleMonthSelect = (selectedDate: Date | undefined) => {
+ if (!selectedDate) return;
+ const newDate = new Date(
+ selectedDate.getFullYear(),
+ selectedDate.getMonth(),
+ 1
+ );
+ console.log("newDate", newDate, selectedDate);
+ form.setValue("month", newDate);
+ };
+ return (
+
+
+
+
+
Perencanaan MediaHub Bulanan
+
+
+
+
+
+
+ );
+}
diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/detail/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/detail/[id]/page.tsx
new file mode 100644
index 00000000..1d3c4ff5
--- /dev/null
+++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/detail/[id]/page.tsx
@@ -0,0 +1,261 @@
+"use client";
+import SiteBreadcrumb from "@/components/site-breadcrumb";
+import { Button } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Link, useRouter } from "@/i18n/routing";
+import { CalendarIcon } from "lucide-react";
+import React, { useEffect, useRef, useState } from "react";
+import { cn } from "@/lib/utils";
+import { format } from "date-fns";
+import JoditEditor from "jodit-react";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { z } from "zod";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { close, error, loading } from "@/config/swal";
+import { getOnlyDate } from "@/utils/globals";
+import {
+ getMonthlyPlanList,
+ savePlanning,
+} from "@/service/agenda-setting/agenda-setting";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import dayjs from "dayjs";
+import { getPlanningById } from "@/service/planning/planning";
+import { useParams } from "next/navigation";
+
+const FormSchema = z.object({
+ week: z.object({
+ from: z.date({
+ required_error: "Start date (from) is required",
+ }),
+ to: z.date({
+ required_error: "End date (to) is required",
+ }),
+ }),
+ title: z.string({
+ required_error: "Required",
+ }),
+ detail: z.string({
+ required_error: "Required",
+ }),
+});
+export default function DetailMonthly() {
+ const id = useParams()?.id;
+ const MySwal = withReactContent(Swal);
+ const router = useRouter();
+ const [parentId, setParentId] = useState();
+ const form = useForm>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: {
+ detail: "",
+ },
+ });
+
+ const editor = useRef(null);
+
+ const onSubmit = async (data: z.infer) => {
+ if (form.getValues("detail") == "") {
+ form.setError("detail", {
+ 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 save = async (data: z.infer) => {
+ const reqData = {
+ id: id,
+ planningTypeId: 1,
+ title: data.title,
+ time: "2",
+ description: data.detail,
+ username: "",
+ date: `${getOnlyDate(data.week.from)} - ${getOnlyDate(data.week.to)}`,
+ status: "Open",
+ parentId: parentId,
+ };
+ console.log("req", reqData);
+ const response = await savePlanning(reqData);
+ close();
+ if (response.error) {
+ error(response.message);
+ return false;
+ }
+
+ MySwal.fire({
+ title: "Sukses",
+ icon: "success",
+ confirmButtonColor: "#3085d6",
+ confirmButtonText: "OK",
+ }).then((result) => {
+ if (result.isConfirmed) {
+ router.push("/curator/task-plan/mediahub");
+ }
+ });
+ };
+
+ useEffect(() => {
+ async function getPlanningData() {
+ if (id != undefined) {
+ loading();
+ const res = await getPlanningById(id);
+ close();
+ if (res?.data?.data != undefined) {
+ const data = res?.data?.data;
+ console.log("Data :", data);
+ form.setValue("title", data?.title);
+ form.setValue("week", {
+ from: new Date(data?.startDate),
+ to: new Date(data?.endDate),
+ });
+ form.setValue("detail", data.description);
+ setParentId(data?.parentId);
+ }
+ }
+ }
+
+ getPlanningData();
+ }, []);
+
+ return (
+
+
+
+
+
Perencanaan MediaHub Mingguan
+
+
+
+
+
+
+ );
+}
diff --git a/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/edit/[id]/page.tsx b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/edit/[id]/page.tsx
new file mode 100644
index 00000000..de245202
--- /dev/null
+++ b/app/[locale]/(protected)/curator/task-plan/medsos-mediahub/create-weekly/edit/[id]/page.tsx
@@ -0,0 +1,261 @@
+"use client";
+import SiteBreadcrumb from "@/components/site-breadcrumb";
+import { Button } from "@/components/ui/button";
+import { Calendar } from "@/components/ui/calendar";
+import { Input } from "@/components/ui/input";
+import {
+ Popover,
+ PopoverContent,
+ PopoverTrigger,
+} from "@/components/ui/popover";
+import { Link, useRouter } from "@/i18n/routing";
+import { CalendarIcon } from "lucide-react";
+import React, { useEffect, useRef, useState } from "react";
+import { cn } from "@/lib/utils";
+import { format } from "date-fns";
+import JoditEditor from "jodit-react";
+import {
+ Form,
+ FormControl,
+ FormDescription,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { z } from "zod";
+import { useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { close, error, loading } from "@/config/swal";
+import { getOnlyDate } from "@/utils/globals";
+import {
+ getMonthlyPlanList,
+ savePlanning,
+} from "@/service/agenda-setting/agenda-setting";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import dayjs from "dayjs";
+import { getPlanningById } from "@/service/planning/planning";
+import { useParams } from "next/navigation";
+
+const FormSchema = z.object({
+ week: z.object({
+ from: z.date({
+ required_error: "Start date (from) is required",
+ }),
+ to: z.date({
+ required_error: "End date (to) is required",
+ }),
+ }),
+ title: z.string({
+ required_error: "Required",
+ }),
+ detail: z.string({
+ required_error: "Required",
+ }),
+});
+export default function EditMonthly() {
+ const id = useParams()?.id;
+ const MySwal = withReactContent(Swal);
+ const router = useRouter();
+ const [parentId, setParentId] = useState();
+ const form = useForm>({
+ resolver: zodResolver(FormSchema),
+ defaultValues: {
+ detail: "",
+ },
+ });
+
+ const editor = useRef(null);
+
+ const onSubmit = async (data: z.infer) => {
+ if (form.getValues("detail") == "") {
+ form.setError("detail", {
+ 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 save = async (data: z.infer) => {
+ const reqData = {
+ id: id,
+ planningTypeId: 1,
+ title: data.title,
+ time: "2",
+ description: data.detail,
+ username: "",
+ date: `${getOnlyDate(data.week.from)} - ${getOnlyDate(data.week.to)}`,
+ status: "Open",
+ parentId: parentId,
+ };
+ console.log("req", reqData);
+ const response = await savePlanning(reqData);
+ close();
+ if (response.error) {
+ error(response.message);
+ return false;
+ }
+
+ MySwal.fire({
+ title: "Sukses",
+ icon: "success",
+ confirmButtonColor: "#3085d6",
+ confirmButtonText: "OK",
+ }).then((result) => {
+ if (result.isConfirmed) {
+ router.push("/curator/task-plan/mediahub");
+ }
+ });
+ };
+
+ useEffect(() => {
+ async function getPlanningData() {
+ if (id != undefined) {
+ loading();
+ const res = await getPlanningById(id);
+ close();
+ if (res?.data?.data != undefined) {
+ const data = res?.data?.data;
+ console.log("Data :", data);
+ form.setValue("title", data?.title);
+ form.setValue("week", {
+ from: new Date(data?.startDate),
+ to: new Date(data?.endDate),
+ });
+ form.setValue("detail", data.description);
+ setParentId(data?.parentId);
+ }
+ }
+ }
+
+ getPlanningData();
+ }, []);
+
+ return (
+
+
+
+
+
Perencanaan MediaHub Mingguan
+
+
+
+
+
+
+ );
+}
diff --git a/components/table/task-plan/list-view-column.tsx b/components/table/task-plan/list-view-column.tsx
index 0c8176fc..a8ff693a 100644
--- a/components/table/task-plan/list-view-column.tsx
+++ b/components/table/task-plan/list-view-column.tsx
@@ -86,7 +86,7 @@ const columns: ColumnDef[] = [
Edit
diff --git a/components/table/task-plan/list-view-social-media-column.tsx b/components/table/task-plan/list-view-social-media-column.tsx
index 6e99bb31..73bdc584 100644
--- a/components/table/task-plan/list-view-social-media-column.tsx
+++ b/components/table/task-plan/list-view-social-media-column.tsx
@@ -78,7 +78,21 @@ const columns: ColumnDef[] = [
- Detail
+
+ Detail
+
+
+
+
+ Edit
+
+
+
+ Hapus
@@ -121,7 +135,21 @@ const columns: ColumnDef[] = [
- Detail
+
+ Detail
+
+
+
+
+ Edit
+
+
+
+ Hapus
diff --git a/service/agenda-setting/agenda-setting.ts b/service/agenda-setting/agenda-setting.ts
index 63996f22..4057fe6e 100644
--- a/service/agenda-setting/agenda-setting.ts
+++ b/service/agenda-setting/agenda-setting.ts
@@ -28,7 +28,7 @@ export async function getPlanningDailyByTypeId(
return getAPIInterceptor(url);
}
-export async function getMonthlyPlanList(dates: number, typeId: number) {
+export async function getMonthlyPlanList(dates: any, typeId: number) {
const url = `planning/monthly/list?date=${dates}&typeId=${typeId}`;
return getAPIInterceptor(url);
}