From 1a2241c40e10193c5ff7008a7b7b36cc1d855d96 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Tue, 25 Mar 2025 15:55:45 +0900
Subject: initial commit

---
 components/documents/RevisionForm.tsx | 115 ++++++++++++++++++++++++++++++++++
 1 file changed, 115 insertions(+)
 create mode 100644 components/documents/RevisionForm.tsx

(limited to 'components/documents/RevisionForm.tsx')

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
-- 
cgit v1.2.3

