diff options
Diffstat (limited to 'lib/bidding')
4 files changed, 43 insertions, 10 deletions
diff --git a/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx b/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx index c1471a69..d0f85b14 100644 --- a/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx +++ b/lib/bidding/detail/table/bidding-detail-vendor-create-dialog.tsx @@ -79,7 +79,7 @@ export function BiddingDetailVendorCreateDialog({ // 벤더 로드 const loadVendors = React.useCallback(async () => { try { - const result = await searchVendorsForBidding('', biddingId, 50) // 빈 검색어로 모든 벤더 로드 + const result = await searchVendorsForBidding('', biddingId) // 빈 검색어로 모든 벤더 로드 setVendorList(result || []) } catch (error) { console.error('Failed to load vendors:', error) diff --git a/lib/bidding/list/create-bidding-dialog.tsx b/lib/bidding/list/create-bidding-dialog.tsx index cb91a984..e99ac06f 100644 --- a/lib/bidding/list/create-bidding-dialog.tsx +++ b/lib/bidding/list/create-bidding-dialog.tsx @@ -137,6 +137,7 @@ export function CreateBiddingDialog() { const [activeTab, setActiveTab] = React.useState<TabType>("basic") const [showSuccessDialog, setShowSuccessDialog] = React.useState(false) // 추가 const [createdBiddingId, setCreatedBiddingId] = React.useState<number | null>(null) // 추가 + const [showCloseConfirmDialog, setShowCloseConfirmDialog] = React.useState(false) // 닫기 확인 다이얼로그 상태 // Procurement 데이터 상태들 const [paymentTermsOptions, setPaymentTermsOptions] = React.useState<Array<{code: string, description: string}>>([]) @@ -686,9 +687,23 @@ export function CreateBiddingDialog() { // 다이얼로그 핸들러 function handleDialogOpenChange(nextOpen: boolean) { if (!nextOpen) { + // 닫으려 할 때 확인 창을 먼저 띄움 + setShowCloseConfirmDialog(true) + } else { + // 열 때는 바로 적용 + setOpen(nextOpen) + } + } + + // 닫기 확인 핸들러 + const handleCloseConfirm = (confirmed: boolean) => { + setShowCloseConfirmDialog(false) + if (confirmed) { + // 사용자가 "예"를 선택한 경우 실제로 닫기 resetAllStates() + setOpen(false) } - setOpen(nextOpen) + // "아니오"를 선택한 경우는 아무것도 하지 않음 (다이얼로그 유지) } // 입찰 생성 버튼 클릭 핸들러 추가 @@ -2172,10 +2187,7 @@ export function CreateBiddingDialog() { <Button type="button" variant="outline" - onClick={() => { - resetAllStates() - setOpen(false) - }} + onClick={() => setShowCloseConfirmDialog(true)} disabled={isSubmitting} > 취소 @@ -2227,6 +2239,27 @@ export function CreateBiddingDialog() { </DialogContent> </Dialog> + {/* 닫기 확인 다이얼로그 */} + <AlertDialog open={showCloseConfirmDialog} onOpenChange={setShowCloseConfirmDialog}> + <AlertDialogContent> + <AlertDialogHeader> + <AlertDialogTitle>입찰 생성을 취소하시겠습니까?</AlertDialogTitle> + <AlertDialogDescription> + 현재 입력 중인 내용이 모두 삭제되며, 생성되지 않습니다. + 정말로 취소하시겠습니까? + </AlertDialogDescription> + </AlertDialogHeader> + <AlertDialogFooter> + <AlertDialogCancel onClick={() => handleCloseConfirm(false)}> + 아니오 (계속 입력) + </AlertDialogCancel> + <AlertDialogAction onClick={() => handleCloseConfirm(true)}> + 예 (취소) + </AlertDialogAction> + </AlertDialogFooter> + </AlertDialogContent> + </AlertDialog> + <AlertDialog open={showSuccessDialog} onOpenChange={setShowSuccessDialog}> <AlertDialogContent> <AlertDialogHeader> diff --git a/lib/bidding/pre-quote/table/bidding-pre-quote-vendor-create-dialog.tsx b/lib/bidding/pre-quote/table/bidding-pre-quote-vendor-create-dialog.tsx index 9ca7deb6..bd078192 100644 --- a/lib/bidding/pre-quote/table/bidding-pre-quote-vendor-create-dialog.tsx +++ b/lib/bidding/pre-quote/table/bidding-pre-quote-vendor-create-dialog.tsx @@ -68,7 +68,7 @@ export function BiddingPreQuoteVendorCreateDialog({ // 벤더 로드 const loadVendors = React.useCallback(async () => { try { - const result = await searchVendorsForBidding('', biddingId, 50) // 빈 검색어로 모든 벤더 로드 + const result = await searchVendorsForBidding('', biddingId) // 빈 검색어로 모든 벤더 로드 setVendorList(result || []) } catch (error) { console.error('Failed to load vendors:', error) diff --git a/lib/bidding/service.ts b/lib/bidding/service.ts index 68efe165..8cbe2a2b 100644 --- a/lib/bidding/service.ts +++ b/lib/bidding/service.ts @@ -1381,7 +1381,7 @@ export async function getActiveContractTemplates() { } // 입찰에 참여하지 않은 벤더만 검색 (중복 방지) -export async function searchVendorsForBidding(searchTerm: string = "", biddingId: number, limit: number = 100) { +export async function searchVendorsForBidding(searchTerm: string = "", biddingId: number) { try { let whereCondition; @@ -1419,8 +1419,8 @@ export async function searchVendorsForBidding(searchTerm: string = "", biddingId // eq(vendorsWithTypesView.status, "ACTIVE"), ) ) - .orderBy(asc(vendorsWithTypesView.vendorName)) - .limit(limit); + .orderBy(asc(vendorsWithTypesView.vendorName)); + return result; } catch (error) { |
