summaryrefslogtreecommitdiff
path: root/components/bidding/create/bidding-create-dialog.tsx
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-11-18 10:30:31 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-11-18 10:30:31 +0000
commitc4f5472b961afb237dc819f9dd3f42a7b8f71075 (patch)
treea1c0d00e46a005ff472bf1125e739bae73b0a53e /components/bidding/create/bidding-create-dialog.tsx
parent1d1f6010704a1d655b3007887db0fe3ac866177a (diff)
(최겸) 구매 입찰 수정, 입찰초대 결재 등록, 재입찰, 차수증가, 폐찰, 유찰취소 로직 수정, readonly 추가 등
Diffstat (limited to 'components/bidding/create/bidding-create-dialog.tsx')
-rw-r--r--components/bidding/create/bidding-create-dialog.tsx121
1 files changed, 78 insertions, 43 deletions
diff --git a/components/bidding/create/bidding-create-dialog.tsx b/components/bidding/create/bidding-create-dialog.tsx
index bdb00a01..c7d79435 100644
--- a/components/bidding/create/bidding-create-dialog.tsx
+++ b/components/bidding/create/bidding-create-dialog.tsx
@@ -38,12 +38,23 @@ import {
import { TAX_CONDITIONS } from '@/lib/tax-conditions/types'
import { getBiddingNoticeTemplate } from '@/lib/bidding/service'
import TiptapEditor from '@/components/qna/tiptap-editor'
+
+// Dropzone components
+import {
+ Dropzone,
+ DropzoneDescription,
+ DropzoneInput,
+ DropzoneTitle,
+ DropzoneUploadIcon,
+ DropzoneZone,
+} from "@/components/ui/dropzone"
import { PurchaseGroupCodeSelector } from '@/components/common/selectors/purchase-group-code'
import { ProcurementManagerSelector } from '@/components/common/selectors/procurement-manager'
import type { PurchaseGroupCodeWithUser } from '@/components/common/selectors/purchase-group-code/purchase-group-code-service'
import type { ProcurementManagerWithUser } from '@/components/common/selectors/procurement-manager/procurement-manager-service'
import { createBidding } from '@/lib/bidding/service'
import { useSession } from 'next-auth/react'
+import { useRouter } from 'next/navigation'
interface BiddingCreateDialogProps {
form: UseFormReturn<CreateBiddingSchema>
@@ -52,6 +63,7 @@ interface BiddingCreateDialogProps {
export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProps) {
const { data: session } = useSession()
+ const router = useRouter()
const userId = session?.user?.id ? Number(session.user.id) : null;
const [isOpen, setIsOpen] = React.useState(false)
@@ -145,6 +157,13 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp
React.useEffect(() => {
if (isOpen) {
+ if (userId && session?.user?.name) {
+ // 현재 사용자의 정보를 임시로 입찰담당자로 설정
+ form.setValue('bidPicName', session.user.name)
+ form.setValue('bidPicId', userId)
+ // userCode는 현재 세션에 없으므로 이름으로 설정 (실제로는 API에서 가져와야 함)
+ // form.setValue('bidPicCode', session.user.name)
+ }
loadPaymentTerms()
loadIncoterms()
loadShippingPlaces()
@@ -280,7 +299,7 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp
}))
// sparePartOptions가 undefined인 경우 빈 문자열로 설정
- const biddingData: CreateBiddingInput = {
+ const biddingData = {
...data,
attachments,
vendorAttachments,
@@ -298,6 +317,12 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp
if (result.success) {
toast.success("입찰이 성공적으로 생성되었습니다.")
+
+ // 생성된 입찰의 상세 페이지로 이동
+ if ('data' in result && result.data?.id) {
+ router.push(`/evcp/bid/${result.data.id}`)
+ }
+
setIsOpen(false)
form.reset()
setShiAttachmentFiles([])
@@ -1130,30 +1155,35 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp
SHI용 첨부파일
</CardTitle>
<p className="text-sm text-muted-foreground">
- SHI에서 제공하는 문서나 파일을 업로드하세요
+ 내부 보관를 위해 필요한 문서나 파일을 업로드 하세요.
</p>
</CardHeader>
<CardContent className="space-y-4">
- <div className="border-2 border-dashed border-gray-300 rounded-lg p-6">
- <div className="text-center">
- <Upload className="h-12 w-12 text-gray-400 mx-auto mb-4" />
- <div className="space-y-2">
- <p className="text-sm text-gray-600">
- 파일을 드래그 앤 드롭하거나{' '}
- <label className="text-blue-600 hover:text-blue-500 cursor-pointer">
- <input
- type="file"
- multiple
- className="hidden"
- onChange={handleShiFileUpload}
- accept=".pdf,.doc,.docx,.xls,.xlsx,.png,.jpg,.jpeg"
- />
- 찾아보세요
- </label>
- </p>
- </div>
- </div>
- </div>
+ <Dropzone
+ maxSize={6e8} // 600MB
+ onDropAccepted={(files) => {
+ const newFiles = Array.from(files)
+ setShiAttachmentFiles(prev => [...prev, ...newFiles])
+ }}
+ onDropRejected={() => {
+ toast({
+ title: "File upload rejected",
+ description: "Please check file size and type.",
+ variant: "destructive",
+ })
+ }}
+ >
+ {() => (
+ <DropzoneZone className="flex justify-center h-32">
+ <div className="flex items-center gap-6">
+ <DropzoneUploadIcon />
+ <div className="grid gap-0.5">
+ <DropzoneTitle>파일을 드래그하여 업로드</DropzoneTitle>
+ </div>
+ </div>
+ </DropzoneZone>
+ )}
+ </Dropzone>
{shiAttachmentFiles.length > 0 && (
<div className="space-y-2">
@@ -1197,30 +1227,35 @@ export function BiddingCreateDialog({ form, onSuccess }: BiddingCreateDialogProp
협력업체용 첨부파일
</CardTitle>
<p className="text-sm text-muted-foreground">
- 협력업체에서 제공하는 문서나 파일을 업로드하세요
+ 협력사로 제공하는 문서나 파일을 업로드 하세요.
</p>
</CardHeader>
<CardContent className="space-y-4">
- <div className="border-2 border-dashed border-gray-300 rounded-lg p-6">
- <div className="text-center">
- <Upload className="h-12 w-12 text-gray-400 mx-auto mb-4" />
- <div className="space-y-2">
- <p className="text-sm text-gray-600">
- 파일을 드래그 앤 드롭하거나{' '}
- <label className="text-blue-600 hover:text-blue-500 cursor-pointer">
- <input
- type="file"
- multiple
- className="hidden"
- onChange={handleVendorFileUpload}
- accept=".pdf,.doc,.docx,.xls,.xlsx,.png,.jpg,.jpeg"
- />
- 찾아보세요
- </label>
- </p>
- </div>
- </div>
- </div>
+ <Dropzone
+ maxSize={6e8} // 600MB
+ onDropAccepted={(files) => {
+ const newFiles = Array.from(files)
+ setVendorAttachmentFiles(prev => [...prev, ...newFiles])
+ }}
+ onDropRejected={() => {
+ toast({
+ title: "File upload rejected",
+ description: "Please check file size and type.",
+ variant: "destructive",
+ })
+ }}
+ >
+ {() => (
+ <DropzoneZone className="flex justify-center h-32">
+ <div className="flex items-center gap-6">
+ <DropzoneUploadIcon />
+ <div className="grid gap-0.5">
+ <DropzoneTitle>파일을 드래그하여 업로드</DropzoneTitle>
+ </div>
+ </div>
+ </DropzoneZone>
+ )}
+ </Dropzone>
{vendorAttachmentFiles.length > 0 && (
<div className="space-y-2">