"use client"; import React, { useEffect, useRef, useState } from "react"; import { useForm, Controller } from "react-hook-form"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; import { Label } from "@/components/ui/label"; import { Card } from "@/components/ui/card"; import { zodResolver } from "@hookform/resolvers/zod"; import * as z from "zod"; import Swal from "sweetalert2"; import withReactContent from "sweetalert2-react-content"; import { useRouter } from "next/navigation"; import JoditEditor from "jodit-react"; import { getCuratorUser, getTicketingPriority, saveTicketing, saveTicketingInternal, } from "@/service/communication/communication"; import makeAnimated from "react-select/animated"; import Select from "react-select"; import { SelectTrigger, SelectValue, SelectContent, SelectItem, } from "@radix-ui/react-select"; import { SelectGroup } from "@/components/ui/select"; const taskSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), naration: z.string().min(2, { message: "Narasi Penugasan harus lebih dari 2 karakter.", }), }); interface Option { id: string; label: string; value: string; fullname: string; userLevel: string; userLevelId: string; } export default function FormCollaboration() { const MySwal = withReactContent(Swal); const router = useRouter(); const editor = useRef(null); type TaskSchema = z.infer; // State for various form fields const [taskOutput, setTaskOutput] = useState({ all: false, video: false, audio: false, image: false, text: false, }); const [assignmentType, setAssignmentType] = useState("mediahub"); const [assignmentCategory, setAssignmentCategory] = useState("publication"); const [mainType, setMainType] = useState(1); // untuk Tipe Penugasan const [type, setType] = useState("1"); const [options, setOptions] = useState([]); const [ticketPriority, setTicketPriority] = useState([]); const [selectedOption, setSelectedOption] = useState