summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/additional-info/join-form.tsx8
-rw-r--r--components/pq-input/pq-review-wrapper.tsx92
2 files changed, 86 insertions, 14 deletions
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 && (
<div className="flex items-center gap-2 p-3 bg-muted/30 rounded-lg">
<Badge variant="secondary">
- {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' && '등록실패'}
</Badge>
</div>
)}
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<Record<number, string>>({})
const [isUpdatingComment, setIsUpdatingComment] = React.useState<number | null>(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: "거부 실패",
@@ -746,6 +778,13 @@ export function PQReviewWrapper({
{isRejecting ? "거부 중..." : "거부"}
</Button>
<Button
+ variant="secondary"
+ onClick={() => setShowSupplementDialog(true)}
+ disabled={isSendingSupplement}
+ >
+ 보완요청
+ </Button>
+ <Button
variant="default"
onClick={() => setShowApproveDialog(true)}
disabled={isApproving}
@@ -756,7 +795,7 @@ export function PQReviewWrapper({
)}
{/* QM_REVIEWING 상태: QM 승인/거절 */}
- {pqSubmission.status === "QM_REVIEWING" && (
+ {pqSubmission.status === "APPROVED" && (
<>
<Button
variant="outline"
@@ -766,6 +805,13 @@ export function PQReviewWrapper({
{isQMRejecting ? "QM 거절 중..." : "QM 거절"}
</Button>
<Button
+ variant="secondary"
+ onClick={() => setShowSupplementDialog(true)}
+ disabled={isSendingSupplement}
+ >
+ 보완요청
+ </Button>
+ <Button
variant="default"
onClick={() => setShowQMApproveDialog(true)}
disabled={isQMApproving}
@@ -802,17 +848,17 @@ export function PQReviewWrapper({
</div>
- {/* 구매 승인 확인 다이얼로그 */}
+ {/* 승인 확인 다이얼로그 */}
<Dialog open={showApproveDialog} onOpenChange={setShowApproveDialog}>
<DialogContent>
<DialogHeader>
- <DialogTitle>PQ 구매 승인 확인</DialogTitle>
+ <DialogTitle>PQ 승인 확인</DialogTitle>
<DialogDescription>
{pqSubmission.vendorName || "알 수 없는 업체"}의 {
pqSubmission.type === "GENERAL" ? "일반" :
pqSubmission.type === "PROJECT" ? "프로젝트" :
pqSubmission.type === "NON_INSPECTION" ? "미실사" : "일반"
- } PQ를 구매 승인하여 QM 검토 단계로 전환하시겠습니까?
+ } PQ를 승인하시겠습니까?
{pqSubmission.projectId && (
<span> 프로젝트: {pqSubmission.projectName}</span>
)}
@@ -829,6 +875,32 @@ export function PQReviewWrapper({
</DialogContent>
</Dialog>
+ {/* 보완요청 다이얼로그 */}
+ <Dialog open={showSupplementDialog} onOpenChange={setShowSupplementDialog}>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>PQ 보완요청</DialogTitle>
+ <DialogDescription>
+ {pqSubmission.vendorName || "알 수 없는 업체"}에 보완요청을 전송합니다. 내용(사유)을 입력해주세요.
+ </DialogDescription>
+ </DialogHeader>
+ <Textarea
+ value={supplementComment}
+ onChange={(e) => setSupplementComment(e.target.value)}
+ placeholder="보완요청 사유를 입력하세요"
+ className="min-h-24"
+ />
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setShowSupplementDialog(false)}>
+ 취소
+ </Button>
+ <Button onClick={handleRequestSupplement} disabled={isSendingSupplement || !supplementComment.trim()}>
+ {isSendingSupplement ? "전송 중..." : "보완요청 전송"}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+
{/* QM 승인 확인 다이얼로그 */}
<Dialog open={showQMApproveDialog} onOpenChange={setShowQMApproveDialog}>
<DialogContent>