summaryrefslogtreecommitdiff
path: root/lib/pq/pq-review-table-new/vendors-table-toolbar-actions.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pq/pq-review-table-new/vendors-table-toolbar-actions.tsx')
-rw-r--r--lib/pq/pq-review-table-new/vendors-table-toolbar-actions.tsx23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/pq/pq-review-table-new/vendors-table-toolbar-actions.tsx b/lib/pq/pq-review-table-new/vendors-table-toolbar-actions.tsx
index 4584e772..b7e54f3d 100644
--- a/lib/pq/pq-review-table-new/vendors-table-toolbar-actions.tsx
+++ b/lib/pq/pq-review-table-new/vendors-table-toolbar-actions.tsx
@@ -38,6 +38,7 @@ interface InvestigationInitialData {
createdAt?: Date;
investigationAddress?: string;
investigationNotes?: string;
+ vendorCountry?: string | null;
}
export function VendorsTableToolbarActions({ table }: VendorsTableToolbarActionsProps) {
@@ -87,6 +88,7 @@ const handleOpenRequestDialog = async () => {
// 선택된 행이 정확히 1개인 경우에만 초기값 설정
if (selectedRows.length === 1) {
const row = selectedRows[0].original;
+ initialData.vendorCountry = row.vendorCountry ?? null;
// 승인된 PQ이고 아직 실사가 없는 경우
if (row.status === "APPROVED" && !row.investigation) {
@@ -570,6 +572,11 @@ const handleOpenRequestDialog = async () => {
row.original.type === "NON_INSPECTION"
)
+ // 승인되지 않은 PQ가 포함되었는지 확인
+ const hasNonApprovedStatus = selectedRows.some(row =>
+ row.original.status !== "APPROVED"
+ )
+
// 실사 방법 라벨 변환 함수
const getInvestigationMethodLabel = (method: string): string => {
switch (method) {
@@ -674,9 +681,20 @@ const handleOpenRequestDialog = async () => {
variant="outline"
size="sm"
onClick={handleOpenRequestDialog} // 여기를 수정: 새로운 핸들러 함수 사용
- disabled={isLoading || selectedRows.length === 0 || hasNonInspectionPQ}
+ disabled={
+ isLoading ||
+ selectedRows.length === 0 ||
+ hasNonInspectionPQ ||
+ hasNonApprovedStatus
+ }
className="gap-2"
- title={hasNonInspectionPQ ? "미실사 PQ는 실사 의뢰할 수 없습니다." : undefined}
+ title={
+ hasNonInspectionPQ
+ ? "미실사 PQ는 실사 의뢰할 수 없습니다."
+ : hasNonApprovedStatus
+ ? "승인된 PQ만 실사 의뢰할 수 있습니다."
+ : undefined
+ }
>
<ClipboardCheck className="size-4" aria-hidden="true" />
<span className="hidden sm:inline">실사 의뢰</span>
@@ -784,6 +802,7 @@ const handleOpenRequestDialog = async () => {
onSubmit={handleRequestInvestigation}
selectedCount={approvedPQsCount}
initialData={dialogInitialData} // 초기 데이터 전달
+ vendorCountry={dialogInitialData?.vendorCountry}
/>