"use client"; import { useEffect, useState } from "react"; import { Upload, Plus, Settings, CheckCheck } from "lucide-react"; import Image from "next/image"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Button } from "@/components/ui/button"; import { Card, CardHeader, CardContent, CardTitle } from "@/components/ui/card"; import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { loading } from "@/config/swal"; import { Controller, useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import { useDropzone } from "react-dropzone"; import z from "zod"; import dynamic from "next/dynamic"; import { useParams } from "next/navigation"; import Cookies from "js-cookie"; import { getProductDataById } from "@/service/product"; import { getAgentById } from "@/service/agent"; import { Checkbox } from "@/components/ui/checkbox"; const ViewEditor = dynamic( () => { return import("@/components/editor/view-editor"); }, { ssr: false }, ); const CustomEditor = dynamic( () => { return import("@/components/editor/custom-editor"); }, { ssr: false }, ); interface FileWithPreview extends File { preview: string; } interface CategoryType { id: number; label: string; value: number; } const categorySchema = z.object({ id: z.number(), label: z.string(), value: z.number(), }); const AGENT_TYPES = [ { key: "after-sales", label: "After Sales" }, { key: "sales", label: "Sales" }, { key: "spv", label: "SPV" }, { key: "branch_manager", label: "Branch Manager" }, ]; const createArticleSchema = z.object({ title: z.string().min(2, { message: "Judul harus diisi", }), variant: z.string().min(2, { message: "variant diisi", }), price: z.string().min(2, { message: "Price harus diisi", }), category: z.array(categorySchema).nonempty({ message: "Kategori harus memiliki setidaknya satu item", }), tags: z.array(z.string()).nonempty({ message: "Minimal 1 tag", }), // Array berisi string }); export default function DetailAgentForm(props: { isDetail: boolean }) { const { isDetail } = props; const params = useParams(); const id = params?.id; const [data, setData] = useState(null); const [openApproverHistory, setOpenApproverHistory] = useState(false); useEffect(() => { fetchData(); }, []); async function fetchData() { const res = await getAgentById(id); setData(res?.data?.data); } if (!data) return null; const handleOpenApproverHistory = () => { setOpenApproverHistory(true); }; return ( <> Detail Agen {/* FORM */}
{/* JENIS AGEN */}
{AGENT_TYPES.map((item) => (
{item.label}
))}
{/* FOTO PROFILE */}
Profile

Comment :

Jaecoo - Approver | 10/11/2026

{/* */}
{openApproverHistory && (
setOpenApproverHistory(false)} >
e.stopPropagation()} > {/* HEADER */}

Approver History

Menunggu Banner 1
{/* BODY */}
{/* LEFT TIMELINE */}
{/* Upload */}
Upload
{/* Diterima */}

Diterima

Direview oleh: approver-jaecoo1
{/* Pending */}

Pending

Direview oleh: approver-jaecoo1
{/* ARROW */}
> >
{/* RIGHT NOTES */}
Catatan:
Catatan:
{/* FOOTER */}
)} ); }