From 4c15b99d9586aa48693213c78c02fba4639ebb85 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 1 Jul 2025 11:47:47 +0000
Subject: (최겸) 인포메이션 기능 수정
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../table/update-information-dialog.tsx            | 124 +++++----------------
 1 file changed, 26 insertions(+), 98 deletions(-)

(limited to 'lib/information/table/update-information-dialog.tsx')

diff --git a/lib/information/table/update-information-dialog.tsx b/lib/information/table/update-information-dialog.tsx
index afa7559b..ed749fe7 100644
--- a/lib/information/table/update-information-dialog.tsx
+++ b/lib/information/table/update-information-dialog.tsx
@@ -24,7 +24,7 @@ import {
   FormLabel,
   FormMessage,
 } from "@/components/ui/form"
-import { Input } from "@/components/ui/input"
+
 import { Textarea } from "@/components/ui/textarea"
 import { Switch } from "@/components/ui/switch"
 import { updateInformationData } from "@/lib/information/service"
@@ -35,14 +35,14 @@ interface UpdateInformationDialogProps {
   open: boolean
   onOpenChange: (open: boolean) => void
   information?: PageInformation
-  onClose: () => void
+  onSuccess?: () => void
 }
 
 export function UpdateInformationDialog({
   open,
   onOpenChange,
   information,
-  onClose,
+  onSuccess,
 }: UpdateInformationDialogProps) {
   const router = useRouter()
   const [isLoading, setIsLoading] = React.useState(false)
@@ -52,12 +52,10 @@ export function UpdateInformationDialog({
     resolver: zodResolver(updateInformationSchema),
     defaultValues: {
       id: 0,
-      pageCode: "",
-      pageName: "",
-      title: "",
-      description: "",
-      noticeTitle: "",
-      noticeContent: "",
+      informationContent: "",
+      attachmentFileName: "",
+      attachmentFilePath: "",
+      attachmentFileSize: "",
       isActive: true,
     },
   })
@@ -67,12 +65,7 @@ export function UpdateInformationDialog({
     if (information && open) {
       form.reset({
         id: information.id,
-        pageCode: information.pageCode,
-        pageName: information.pageName,
-        title: information.title,
-        description: information.description,
-        noticeTitle: information.noticeTitle || "",
-        noticeContent: information.noticeContent || "",
+        informationContent: information.informationContent || "",
         attachmentFileName: information.attachmentFileName || "",
         attachmentFilePath: information.attachmentFilePath || "",
         attachmentFileSize: information.attachmentFileSize || "",
@@ -131,7 +124,8 @@ export function UpdateInformationDialog({
 
       if (result.success) {
         toast.success(result.message)
-        onClose()
+        if (onSuccess) onSuccess()
+        onOpenChange(false)
         router.refresh()
       } else {
         toast.error(result.message)
@@ -146,7 +140,7 @@ export function UpdateInformationDialog({
 
   const handleClose = () => {
     setUploadedFile(null)
-    onClose()
+    onOpenChange(false)
   }
 
   const currentFileName = form.watch("attachmentFileName")
@@ -163,92 +157,26 @@ export function UpdateInformationDialog({
 
         <Form {...form}>
           <form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
-            <div className="grid grid-cols-2 gap-4">
-              <FormField
-                control={form.control}
-                name="pageCode"
-                render={({ field }) => (
-                  <FormItem>
-                    <FormLabel>페이지 코드</FormLabel>
-                    <FormControl>
-                      <Input placeholder="예: vendor-list" {...field} />
-                    </FormControl>
-                    <FormMessage />
-                  </FormItem>
-                )}
-              />
-
-              <FormField
-                control={form.control}
-                name="pageName"
-                render={({ field }) => (
-                  <FormItem>
-                    <FormLabel>페이지명</FormLabel>
-                    <FormControl>
-                      <Input placeholder="예: 협력업체 목록" {...field} />
-                    </FormControl>
-                    <FormMessage />
-                  </FormItem>
-                )}
-              />
+            <div className="bg-blue-50 p-4 rounded-lg">
+              <div className="flex items-center gap-2 mb-2">
+                <span className="font-medium text-blue-900">페이지 정보</span>
+              </div>
+              <div className="text-sm text-blue-700">
+                <div><strong>페이지명:</strong> {information?.pageName}</div>
+                <div><strong>경로:</strong> {information?.pagePath}</div>
+              </div>
             </div>
 
             <FormField
               control={form.control}
-              name="title"
-              render={({ field }) => (
-                <FormItem>
-                  <FormLabel>제목</FormLabel>
-                  <FormControl>
-                    <Input placeholder="인포메이션 제목을 입력하세요" {...field} />
-                  </FormControl>
-                  <FormMessage />
-                </FormItem>
-              )}
-            />
-
-            <FormField
-              control={form.control}
-              name="description"
-              render={({ field }) => (
-                <FormItem>
-                  <FormLabel>설명</FormLabel>
-                  <FormControl>
-                    <Textarea 
-                      placeholder="페이지 설명을 입력하세요" 
-                      rows={4}
-                      {...field} 
-                    />
-                  </FormControl>
-                  <FormMessage />
-                </FormItem>
-              )}
-            />
-
-            <FormField
-              control={form.control}
-              name="noticeTitle"
-              render={({ field }) => (
-                <FormItem>
-                  <FormLabel>공지사항 제목 (선택사항)</FormLabel>
-                  <FormControl>
-                    <Input placeholder="공지사항 제목을 입력하세요" {...field} />
-                  </FormControl>
-                  <FormMessage />
-                </FormItem>
-              )}
-            />
-
-            <FormField
-              control={form.control}
-              name="noticeContent"
+              name="informationContent"
               render={({ field }) => (
                 <FormItem>
-                  <FormLabel>공지사항 내용 (선택사항)</FormLabel>
+                  <FormLabel>인포메이션 내용</FormLabel>
                   <FormControl>
                     <Textarea 
-                      placeholder="공지사항 내용을 입력하세요" 
-                      rows={3}
+                      placeholder="인포메이션 내용을 입력하세요" 
+                      rows={6}
                       {...field} 
                     />
                   </FormControl>
@@ -267,7 +195,7 @@ export function UpdateInformationDialog({
                       <span className="text-xs text-gray-500">
                         ({(uploadedFile.size / (1024 * 1024)).toFixed(2)} MB)
                       </span>
-                      <span className="text-xs text-blue-600">(새 파일)</span>
+                      <span className="text-xs">(새 파일)</span>
                     </div>
                     <Button
                       type="button"
@@ -291,7 +219,7 @@ export function UpdateInformationDialog({
                     <div className="flex gap-2">
                       <label
                         htmlFor="file-upload-update"
-                        className="cursor-pointer text-sm text-blue-600 hover:text-blue-500"
+                        className="cursor-pointer text-sm"
                       >
                         변경
                       </label>
@@ -312,7 +240,7 @@ export function UpdateInformationDialog({
                       <div className="mt-2">
                         <label
                           htmlFor="file-upload-update"
-                          className="cursor-pointer text-sm text-blue-600 hover:text-blue-500"
+                          className="cursor-pointer text-sm"
                         >
                           파일을 선택하세요
                         </label>
-- 
cgit v1.2.3

