From d7585b3f2ea941ee807c1e87bbc833265a193c78 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Mon, 15 Sep 2025 10:14:09 +0000 Subject: (최겸) 구매 일반계약 및 상세, PO 전달 구현 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/create-general-contract-dialog.tsx | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'lib/general-contracts/main/create-general-contract-dialog.tsx') diff --git a/lib/general-contracts/main/create-general-contract-dialog.tsx b/lib/general-contracts/main/create-general-contract-dialog.tsx index b2f538c3..3eb8b11c 100644 --- a/lib/general-contracts/main/create-general-contract-dialog.tsx +++ b/lib/general-contracts/main/create-general-contract-dialog.tsx @@ -2,7 +2,6 @@ import * as React from "react" import { useRouter } from "next/navigation" -import { useSession } from "next-auth/react" import { Plus } from "lucide-react" import { toast } from "sonner" import { Button } from "@/components/ui/button" @@ -29,9 +28,9 @@ import { createContract, getVendors } from "@/lib/general-contracts/service" import { GENERAL_CONTRACT_CATEGORIES, GENERAL_CONTRACT_TYPES, - GENERAL_EXECUTION_METHODS, - GENERAL_CONTRACT_SCOPES + GENERAL_EXECUTION_METHODS } from "@/lib/general-contracts/types" +import { useSession } from "next-auth/react" interface CreateContractForm { contractNumber: string @@ -91,15 +90,6 @@ export function CreateGeneralContractDialog() { fetchVendors() }, []) - const generateContractNumber = () => { - const now = new Date() - const year = now.getFullYear() - const month = String(now.getMonth() + 1).padStart(2, '0') - const day = String(now.getDate()).padStart(2, '0') - const time = String(now.getHours()).padStart(2, '0') + String(now.getMinutes()).padStart(2, '0') - return `CT${year}${month}${day}${time}` - } - const handleSubmit = async () => { // 필수 필드 검증 if (!form.name || !form.category || !form.type || !form.executionMethod || @@ -116,7 +106,7 @@ export function CreateGeneralContractDialog() { setIsLoading(true) const contractData = { - contractNumber: generateContractNumber(), + contractNumber: '', name: form.name, category: form.category, type: form.type, @@ -129,8 +119,8 @@ export function CreateGeneralContractDialog() { // contractScope: form.contractScope, // specificationType: form.specificationType, status: 'Draft', - registeredById: session?.user?.id ? parseInt(session.user.id) : 3, - lastUpdatedById: session?.user?.id ? parseInt(session.user.id) : 3, + registeredById: session?.user?.id || 1, + lastUpdatedById: session?.user?.id || 1, notes: form.notes, linkedRfqOrItb: form.linkedRfqOrItb, linkedBidNumber: form.linkedBidNumber, -- cgit v1.2.3