"use client"; import { z } from "zod"; import { useForm, Controller } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "../ui/dialog"; import { Checkbox } from "../ui/checkbox"; import { Button } from "../ui/button"; import { Textarea } from "../ui/textarea"; import { useState } from "react"; import { createTaskTa } from "@/service/task"; import { createSurveyData } from "@/service/survey/survey"; export default function FormSurvey() { // const [showSurvey, setShowSurvey] = useState(true); // const [isLoading, setIsLoading] = useState(false); // const { // control, // handleSubmit, // formState: { errors }, // } = useForm({ // resolver: zodResolver(surveySchema), // mode: "all", // defaultValues: { // accessFrequency: "", // uiExperienceDesign: "", // uiExperienceNavigation: "", // uiExperienceSpeed: "", // infoAccuracy: "", // infoCompleteness: "", // usefulness: "", // suggestion: "", // }, // }); // const options = { // accessFrequency: [ // "Setiap hari", // "Beberapa kali seminggu", // "Beberapa kali dalam sebulan", // "Baru pertama kali", // ], // uiExperienceDesign: ["Sangat baik", "Baik", "Cukup", "Kurang", "Buruk"], // uiExperienceNavigation: [ // "Sangat mudah", // "Mudah", // "Cukup", // "Sulit", // "Sangat sulit", // ], // uiExperienceSpeed: [ // "Sangat cepat", // "Cepat", // "Cukup", // "Lambat", // "Sangat lambat", // ], // infoAccuracy: ["Sangat puas", "Puas", "Cukup", "Kurang puas", "Tidak puas"], // infoCompleteness: [ // "Sangat lengkap", // "Lengkap", // "Cukup", // "Kurang lengkap", // "Tidak lengkap", // ], // usefulness: [ // "Sangat membantu", // "Membantu", // "Cukup membantu", // "Kurang membantu", // "Tidak membantu", // ], // }; // const renderControllerGroup = ( // name: keyof SurveySchema, // question: string, // choices: string[] // ) => ( //
//

{question}

//
// {choices.map((choice, i) => ( // ( // // )} // /> // ))} //
// {errors[name] && ( //

// {errors[name]?.message as string} //

// )} //
// ); // const onSubmit = async (data: SurveySchema) => { // setIsLoading(true); // try { // const response = await createSurveyData(data); // console.log("API Response:", response); // setShowSurvey(false); // } catch (error) { // console.error("Error submitting survey:", error); // } finally { // setIsLoading(false); // } // }; // return ( // // // // // ); }