From 871a6d46a769cbe9e87146434f4bcb2d6792ab81 Mon Sep 17 00:00:00 2001 From: dujinkim Date: Thu, 30 Oct 2025 10:44:47 +0000 Subject: (최겸) 구매 PQ/실사 재개발(테스트 필요), 정규업체등록 결재 개발, 실사 의뢰 결재 후처리 등 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/additional-info/join-form.tsx | 8 +- components/pq-input/pq-review-wrapper.tsx | 92 +++- config/vendorInvestigationsColumnsConfig.ts | 2 +- config/vendorRegularRegistrationsColumnsConfig.ts | 23 +- db/schema/pq.ts | 19 +- db/schema/vendorRegistrations.ts | 2 +- lib/approval/handlers-registry.ts | 7 +- lib/mail/templates/pq-approved-vendor.hbs | 7 +- .../pq-investigation-supplement-request.hbs | 54 ++ lib/mail/templates/pq-rejected-vendor.hbs | 7 +- lib/mail/templates/pq-submitted-vendor.hbs | 9 +- lib/mail/templates/pq-supplement-request.hbs | 56 ++ .../edit-investigation-dialog.tsx | 6 +- lib/pq/pq-review-table-new/site-visit-dialog.tsx | 135 +++-- .../pq-review-table-new/vendors-table-columns.tsx | 43 +- .../vendors-table-toolbar-actions.tsx | 91 +++- lib/pq/pq-review-table-new/vendors-table.tsx | 5 +- lib/pq/service.ts | 266 +++++++--- lib/site-visit/service.ts | 131 +++++ lib/site-visit/vendor-info-view-dialog.tsx | 110 +++- lib/vendor-investigation/approval-actions.ts | 1 + lib/vendor-investigation/handlers.ts | 3 + lib/vendor-investigation/service.ts | 139 ++++- .../table/investigation-cancel-plan-button.tsx | 91 ++++ .../table/investigation-progress-sheet.tsx | 14 +- .../table/investigation-result-sheet.tsx | 580 ++++++++++----------- .../table/investigation-table-columns.tsx | 60 ++- .../table/investigation-table-toolbar-actions.tsx | 4 +- lib/vendor-investigation/validations.ts | 71 ++- .../approval-actions.ts | 14 + lib/vendor-regular-registrations/handlers.ts | 56 +- lib/vendor-regular-registrations/repository.ts | 5 +- lib/vendor-regular-registrations/service.ts | 487 ++++------------- .../vendor-regular-registrations-table-columns.tsx | 19 +- ...regular-registrations-table-toolbar-actions.tsx | 5 +- .../table/vendor-regular-registrations-table.tsx | 1 - 36 files changed, 1629 insertions(+), 994 deletions(-) create mode 100644 lib/mail/templates/pq-investigation-supplement-request.hbs create mode 100644 lib/mail/templates/pq-supplement-request.hbs create mode 100644 lib/vendor-investigation/table/investigation-cancel-plan-button.tsx diff --git a/components/additional-info/join-form.tsx b/components/additional-info/join-form.tsx index 8dca4b61..afe38841 100644 --- a/components/additional-info/join-form.tsx +++ b/components/additional-info/join-form.tsx @@ -1129,11 +1129,11 @@ export function InfoForm() { {registrationData.registration && (
- {registrationData.registration.status === 'under_review' && '검토중'} + {registrationData.registration.status === 'audit_pass' && '검토중'} {registrationData.registration.status === 'approval_ready' && '조건충족'} - {registrationData.registration.status === 'in_review' && '정규등록검토'} - {registrationData.registration.status === 'completed' && '등록완료'} - {registrationData.registration.status === 'pending_approval' && '장기미등록'} + {registrationData.registration.status === 'pending_approval' && '결재진행중'} + {registrationData.registration.status === 'registration_completed' && '등록완료'} + {registrationData.registration.status === 'registration_failed' && '등록실패'}
)} diff --git a/components/pq-input/pq-review-wrapper.tsx b/components/pq-input/pq-review-wrapper.tsx index 9b719644..bcb384d9 100644 --- a/components/pq-input/pq-review-wrapper.tsx +++ b/components/pq-input/pq-review-wrapper.tsx @@ -23,7 +23,7 @@ import { import { useToast } from "@/hooks/use-toast" import { CheckCircle, AlertCircle, Paperclip, Square } from "lucide-react" import { PQGroupData } from "@/lib/pq/service" -import { approvePQAction, rejectPQAction, updateSHICommentAction, approveQMReviewAction, rejectQMReviewAction } from "@/lib/pq/service" +import { approvePQAction, rejectPQAction, updateSHICommentAction, approveQMReviewAction, rejectQMReviewAction, requestPqSupplementAction } from "@/lib/pq/service" // import * as ExcelJS from 'exceljs'; // import { saveAs } from "file-saver"; @@ -67,10 +67,13 @@ export function PQReviewWrapper({ const [showRejectDialog, setShowRejectDialog] = React.useState(false) const [showQMApproveDialog, setShowQMApproveDialog] = React.useState(false) const [showQMRejectDialog, setShowQMRejectDialog] = React.useState(false) + const [showSupplementDialog, setShowSupplementDialog] = React.useState(false) const [rejectReason, setRejectReason] = React.useState("") const [qmRejectReason, setQmRejectReason] = React.useState("") + const [supplementComment, setSupplementComment] = React.useState("") const [shiComments, setShiComments] = React.useState>({}) const [isUpdatingComment, setIsUpdatingComment] = React.useState(null) + const [isSendingSupplement, setIsSendingSupplement] = React.useState(false) // 코드 순서로 정렬하는 함수 (1-1-1, 1-1-2, 1-2-1 순서) @@ -108,7 +111,7 @@ export function PQReviewWrapper({ setShiComments(initialComments) }, [pqData]) - // PQ 승인 처리 (구매 담당자) + // PQ 승인 처리 const handleApprove = async () => { try { setIsApproving(true) @@ -121,10 +124,10 @@ export function PQReviewWrapper({ if (result.ok) { toast({ title: "PQ 승인 완료", - description: "PQ가 QM 검토 단계로 전환되었습니다.", + description: "PQ가 성공적으로 승인되었습니다.", }) // 페이지 새로고침 - router.refresh() + router.push(`/evcp/pq_new/`) } else { toast({ title: "승인 실패", @@ -182,6 +185,35 @@ export function PQReviewWrapper({ } } + // 보완요청 처리 + const handleRequestSupplement = async () => { + if (!supplementComment.trim()) { + toast({ title: "보완요청 내용 필요", description: "보완요청 사유를 입력해주세요.", variant: "destructive" }) + return + } + try { + setIsSendingSupplement(true) + const result = await requestPqSupplementAction({ + pqSubmissionId: pqSubmission.id, + vendorId, + comment: supplementComment, + }) + if (result.ok) { + toast({ title: "보완요청 전송", description: "보완요청 메일을 발송했습니다." }) + setShowSupplementDialog(false) + setSupplementComment("") + router.refresh() + } else { + toast({ title: "전송 실패", description: result.error || "보완요청 전송 중 오류가 발생했습니다.", variant: "destructive" }) + } + } catch (e) { + console.error(e) + toast({ title: "전송 실패", description: "보완요청 전송 중 오류가 발생했습니다.", variant: "destructive" }) + } finally { + setIsSendingSupplement(false) + } + } + // QM 거절 처리 const handleQMReject = async () => { if (!qmRejectReason.trim()) { @@ -426,8 +458,8 @@ export function PQReviewWrapper({ title: "PQ 거부 완료", description: "PQ가 거부되었습니다.", }) - // 페이지 새로고침 - router.refresh() + // 페이지 리다이렉트 + router.push(`/evcp/pq_new/`) } else { toast({ title: "거부 실패", @@ -745,6 +777,13 @@ export function PQReviewWrapper({ > {isRejecting ? "거부 중..." : "거부"} + +