diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-03-26 00:37:41 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-03-26 00:37:41 +0000 |
| commit | e0dfb55c5457aec489fc084c4567e791b4c65eb1 (patch) | |
| tree | 68543a65d88f5afb3a0202925804103daa91bc6f /components/documents/RevisionForm.tsx | |
3/25 까지의 대표님 작업사항
Diffstat (limited to 'components/documents/RevisionForm.tsx')
| -rw-r--r-- | components/documents/RevisionForm.tsx | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/components/documents/RevisionForm.tsx b/components/documents/RevisionForm.tsx new file mode 100644 index 00000000..9eea04c5 --- /dev/null +++ b/components/documents/RevisionForm.tsx @@ -0,0 +1,115 @@ +"use client" + +import React, { useState } from "react" + +// shadcn/ui Components +import { Label } from "@/components/ui/label" +import { Input } from "@/components/ui/input" +import { Button } from "@/components/ui/button" +import { Separator } from "@/components/ui/separator" + +type RevisionFormProps = { + document: any +} + +export default function RevisionForm({ document }: RevisionFormProps) { + const [stage, setStage] = useState("") + const [revision, setRevision] = useState("") + const [planDate, setPlanDate] = useState("") + const [actualDate, setActualDate] = useState("") + const [file, setFile] = useState<File | null>(null) + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault() + if (!document?.id) return + // server action 호출 예시 + // await createDocumentVersion({ + // documentId: document.id, + // stage, + // revision, + // planDate, + // actualDate, + // file, + // }); + alert("리비전이 등록되었습니다.") + // 이후 상태 초기화나 revalidation 등 필요에 따라 처리 + } + + return ( + <div className="p-3"> + <h2 className="text-lg font-semibold">리비전 등록</h2> + <Separator className="my-2" /> + + <form onSubmit={handleSubmit} className="space-y-4"> + {/* Stage */} + <div> + <Label htmlFor="stage" className="mb-1"> + Stage + </Label> + <Input + id="stage" + type="text" + value={stage} + onChange={(e) => setStage(e.target.value)} + /> + </div> + + {/* Revision */} + <div> + <Label htmlFor="revision" className="mb-1"> + Revision + </Label> + <Input + id="revision" + type="text" + value={revision} + onChange={(e) => setRevision(e.target.value)} + /> + </div> + + {/* 계획일 */} + <div> + <Label htmlFor="planDate" className="mb-1"> + 계획일 + </Label> + <Input + id="planDate" + type="date" + value={planDate} + onChange={(e) => setPlanDate(e.target.value)} + /> + </div> + + {/* 실제일 */} + <div> + <Label htmlFor="actualDate" className="mb-1"> + 실제일 + </Label> + <Input + id="actualDate" + type="date" + value={actualDate} + onChange={(e) => setActualDate(e.target.value)} + /> + </div> + + {/* 파일 업로드 */} + <div> + <Label htmlFor="file" className="mb-1"> + 파일 업로드 + </Label> + <Input + id="file" + type="file" + onChange={(e) => setFile(e.target.files?.[0] ?? null)} + /> + </div> + + {/* 제출 버튼 */} + <Button type="submit" variant="default"> + 등록하기 + </Button> + </form> + </div> + ) +}
\ No newline at end of file |
