summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-09-01 09:09:15 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-09-01 09:09:15 +0000
commit089c70ffbe2303ab5e2611a152ddd3aed0e6e718 (patch)
tree1ce91012dba99495dde5eb8b414b2732197bfec4 /components
parent69648a25c2ac62bbc3354b3a0e41abc932273b7c (diff)
(최겸) 구매 pq, 기본정보 수정
Diffstat (limited to 'components')
-rw-r--r--components/additional-info/join-form.tsx1
-rw-r--r--components/pq-input/pq-input-tabs.tsx34
-rw-r--r--components/pq-input/pq-review-wrapper.tsx23
-rw-r--r--components/vendor-regular-registrations/document-status-dialog.tsx7
4 files changed, 59 insertions, 6 deletions
diff --git a/components/additional-info/join-form.tsx b/components/additional-info/join-form.tsx
index 4f3998e3..220547df 100644
--- a/components/additional-info/join-form.tsx
+++ b/components/additional-info/join-form.tsx
@@ -1879,6 +1879,7 @@ export function InfoForm() {
},
} as VendorRegularRegistration}
onRefresh={handleAdditionalInfoSave}
+ isVendorUser={true}
/>
{/* 추가정보 입력 Dialog */}
diff --git a/components/pq-input/pq-input-tabs.tsx b/components/pq-input/pq-input-tabs.tsx
index 0c3b2276..7ae6d16a 100644
--- a/components/pq-input/pq-input-tabs.tsx
+++ b/components/pq-input/pq-input-tabs.tsx
@@ -159,6 +159,27 @@ export function PQInputTabs({
const shouldDisableInput = isReadOnly;
+ // 코드 순서로 정렬하는 함수 (1-1-1, 1-1-2, 1-2-1 순서)
+ const sortByCode = (items: any[]) => {
+ return [...items].sort((a, b) => {
+ const parseCode = (code: string) => {
+ return code.split('-').map(part => parseInt(part, 10))
+ }
+
+ const aCode = parseCode(a.code)
+ const bCode = parseCode(b.code)
+
+ for (let i = 0; i < Math.max(aCode.length, bCode.length); i++) {
+ const aPart = aCode[i] || 0
+ const bPart = bCode[i] || 0
+ if (aPart !== bPart) {
+ return aPart - bPart
+ }
+ }
+ return 0
+ })
+ }
+
// ----------------------------------------------------------------------
// A) Create initial form values
// Mark items as "saved" if they have existing answer or attachments
@@ -167,7 +188,10 @@ export function PQInputTabs({
const answers: PQFormValues["answers"] = []
data.forEach((group) => {
- group.items.forEach((item) => {
+ // 그룹 내 아이템들을 코드 순서로 정렬
+ const sortedItems = sortByCode(group.items)
+
+ sortedItems.forEach((item) => {
// Check if the server item is already "complete"
const hasExistingAnswer = item.answer && item.answer.trim().length > 0
const hasExistingAttachments = item.attachments && item.attachments.length > 0
@@ -634,7 +658,7 @@ export function PQInputTabs({
disabled={isSaving || !isAnyItemDirty || shouldDisableInput}
onClick={handleSaveAll}
>
- {isSaving ? "Saving..." : "Save All"}
+ {isSaving ? "Saving..." : "임시 저장"}
<Save className="ml-2 h-4 w-4" />
</Button>
@@ -644,7 +668,7 @@ export function PQInputTabs({
disabled={!allSaved || isSubmitting || shouldDisableInput}
onClick={handleSubmitPQ}
>
- {isSubmitting ? "Submitting..." : "Submit PQ"}
+ {isSubmitting ? "Submitting..." : "최종 제출"}
<CheckCircle2 className="ml-2 h-4 w-4" />
</Button>
</div>
@@ -655,7 +679,7 @@ export function PQInputTabs({
<TabsContent key={group.groupName} value={group.groupName}>
{/* 2-column grid */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 pb-4">
- {group.items.map((item) => {
+ {sortByCode(group.items).map((item) => {
const { criteriaId, code, checkPoint, description, contractInfo, additionalRequirement } = item
const answerIndex = getAnswerIndex(criteriaId)
if (answerIndex === -1) return null
@@ -670,7 +694,7 @@ export function PQInputTabs({
return (
- <Collapsible key={criteriaId} defaultOpen={!isSaved} className="w-full">
+ <Collapsible key={criteriaId} defaultOpen={isReadOnly || !isSaved} className="w-full">
<Card className={isSaved ? "border-green-200" : ""}>
<CardHeader className="pb-1">
<div className="flex justify-between">
diff --git a/components/pq-input/pq-review-wrapper.tsx b/components/pq-input/pq-review-wrapper.tsx
index 1056189e..cc0f1b40 100644
--- a/components/pq-input/pq-review-wrapper.tsx
+++ b/components/pq-input/pq-review-wrapper.tsx
@@ -67,6 +67,27 @@ export function PQReviewWrapper({
const [shiComments, setShiComments] = React.useState<Record<number, string>>({})
const [isUpdatingComment, setIsUpdatingComment] = React.useState<number | null>(null)
+ // 코드 순서로 정렬하는 함수 (1-1-1, 1-1-2, 1-2-1 순서)
+ const sortByCode = (items: any[]) => {
+ return [...items].sort((a, b) => {
+ const parseCode = (code: string) => {
+ return code.split('-').map(part => parseInt(part, 10))
+ }
+
+ const aCode = parseCode(a.code)
+ const bCode = parseCode(b.code)
+
+ for (let i = 0; i < Math.max(aCode.length, bCode.length); i++) {
+ const aPart = aCode[i] || 0
+ const bPart = bCode[i] || 0
+ if (aPart !== bPart) {
+ return aPart - bPart
+ }
+ }
+ return 0
+ })
+ }
+
// 기존 SHI 코멘트를 로컬 상태에 초기화
React.useEffect(() => {
const initialComments: Record<number, string> = {}
@@ -344,7 +365,7 @@ export function PQReviewWrapper({
<h3 className="text-lg font-medium">{group.groupName}</h3>
<div className="grid grid-cols-1 gap-4">
- {group.items.map((item) => (
+ {sortByCode(group.items).map((item) => (
<Card key={item.criteriaId}>
<CardHeader>
<div className="flex justify-between items-start">
diff --git a/components/vendor-regular-registrations/document-status-dialog.tsx b/components/vendor-regular-registrations/document-status-dialog.tsx
index 848e4977..cfdd03fd 100644
--- a/components/vendor-regular-registrations/document-status-dialog.tsx
+++ b/components/vendor-regular-registrations/document-status-dialog.tsx
@@ -21,6 +21,7 @@ interface DocumentStatusDialogProps {
onOpenChange: (open: boolean) => void;
registration: VendorRegularRegistration | null;
onRefresh?: () => void;
+ isVendorUser?: boolean;
}
const StatusIcon = ({ status }: { status: string | boolean }) => {
@@ -68,6 +69,7 @@ export function DocumentStatusDialog({
onOpenChange,
registration,
onRefresh,
+ isVendorUser = false,
}: DocumentStatusDialogProps) {
if (!registration) return null;
@@ -82,6 +84,11 @@ export function DocumentStatusDialog({
registrationKeys: Object.keys(registration),
fullRegistration: registration
});
+ //isvendoruser인 경우는 실사 결과 파일 다운로드 불가능
+ if (isVendorUser && docKey === "auditResult") {
+ toast.error("실사 결과 파일은 다운로드할 수 없습니다.");
+ return;
+ }
// documentFiles가 없는 경우 처리
if (!registration.documentFiles) {