summaryrefslogtreecommitdiff
path: root/lib/bidding/selection/bidding-selection-detail-content.tsx
blob: 887498dcfea7579c38dfc0ba5367b6e4b5ef4456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
'use client'

import * as React from 'react'
import { Bidding } from '@/db/schema'
import { BiddingInfoCard } from './bidding-info-card'
import { SelectionResultForm } from './selection-result-form'
import { VendorSelectionTable } from './vendor-selection-table'
import { BiddingItemTable } from './bidding-item-table'

interface BiddingSelectionDetailContentProps {
  biddingId: number
  bidding: Bidding
}

export function BiddingSelectionDetailContent({
  biddingId,
  bidding
}: BiddingSelectionDetailContentProps) {
  const [refreshKey, setRefreshKey] = React.useState(0)

  // 입찰평가중 상태가 아니면 읽기 전용
  const isReadOnly = bidding.status !== 'evaluation_of_bidding'

  const handleRefresh = React.useCallback(() => {
    setRefreshKey(prev => prev + 1)
  }, [])

  return (
    <div className="space-y-6">
      {/* 입찰정보 카드 */}
      <BiddingInfoCard bidding={bidding} />

      {/* 선정결과 폼 */}
      <SelectionResultForm biddingId={biddingId} onSuccess={handleRefresh} readOnly={isReadOnly} />

      {/* 업체선정 테이블 */}
      <VendorSelectionTable
        key={refreshKey}
        biddingId={biddingId}
        bidding={bidding}
        onRefresh={handleRefresh}
        readOnly={isReadOnly}
      />

      {/* 응찰품목 테이블 */}
      <BiddingItemTable biddingId={biddingId} />
      
    </div>
  )
}