import { useId, useMemo, useState } from "react" import { Card, CardHeader, CardTitle, CardContent, Button, Label, FilterBar, FilterBarSearch, FilterBarActions, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DataTable, useDataTable, type DataTableColumnDef, Badge, Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose, Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription, SheetBody, SheetFooter, SheetClose } from "@hm-design/ui" import { Heading } from "./Heading" type Row = { id: string; name: string; group: string; status: string } const records: Row[] = [{ id: "1", name: "김한맥", group: "설계", status: "진행" }, { id: "2", name: "이한맥", group: "시공", status: "대기" }, { id: "3", name: "박한맥", group: "설계", status: "완료" }] const columns: DataTableColumnDef[] = [{ accessorKey: "name", header: "이름" }, { accessorKey: "group", header: "부서" }, { accessorKey: "status", header: "상태" }] export function SearchList({ title, cards = false, detail = "none" }: { title: string; cards?: boolean; detail?: "none" | "dialog" | "sheet" }) { const [draft, setDraft] = useState("") const [group, setGroup] = useState("all") const [applied, setApplied] = useState({ query: "", group: "all" }) const [confirmed, setConfirmed] = useState(false) const rows = useMemo(() => records.filter(r => r.name.includes(applied.query) && (applied.group === "all" || r.group === applied.group)), [applied]) const table = useDataTable({ columns, data: rows, getRowId: row => row.id }) const id = useId() return <>
{ e.preventDefault(); setApplied({ query: draft, group }); table.setPageIndex(0) }}>

조회 결과 {rows.length}건{confirmed ? " · 처리 완료" : ""}

{cards ?
{rows.map(row => {row.name}{row.group} · {row.status})}{!rows.length &&

조건에 맞는 업무가 없습니다.

}
: } {detail === "dialog" && 결재 확인현재 조회한 결재를 승인합니다.} {detail === "sheet" && 채용 상세공고의 상세 내용과 확인 상태입니다.설계 부문 채용 · 서류 검토}
}