diff options
Diffstat (limited to 'lib/vendor-investigation')
| -rw-r--r-- | lib/vendor-investigation/service.ts | 9 | ||||
| -rw-r--r-- | lib/vendor-investigation/table/investigation-table-columns.tsx | 17 |
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/vendor-investigation/service.ts b/lib/vendor-investigation/service.ts index 81eabc37..f0eb411e 100644 --- a/lib/vendor-investigation/service.ts +++ b/lib/vendor-investigation/service.ts @@ -3,7 +3,7 @@ import { items, vendorInvestigationAttachments, vendorInvestigations, vendorInvestigationsView, vendorPossibleItems, vendors } from "@/db/schema/" import { GetVendorsInvestigationSchema, updateVendorInvestigationSchema } from "./validations" import { asc, desc, ilike, inArray, and, or, gte, lte, eq, isNull, count } from "drizzle-orm"; -import { revalidateTag, unstable_noStore } from "next/cache"; +import { revalidateTag, unstable_noStore, revalidatePath } from "next/cache"; import { filterColumns } from "@/lib/filter-columns"; import { unstable_cache } from "@/lib/unstable-cache"; import { getErrorMessage } from "@/lib/handle-error"; @@ -293,6 +293,10 @@ export async function updateVendorInvestigationAction(formData: FormData) { if (parsed.investigationNotes !== undefined) { updateData.investigationNotes = parsed.investigationNotes } + // evaluationType이 null이 아니고, status가 계획중(PLANNED) 이라면, 진행중(IN_PROGRESS)으로 바꿔주는 로직 추가 + if (parsed.evaluationResult !== null && parsed.investigationStatus === "PLANNED") { + updateData.investigationStatus = "IN_PROGRESS"; + } // 5) vendor_investigations 테이블 업데이트 await db @@ -302,6 +306,9 @@ export async function updateVendorInvestigationAction(formData: FormData) { // 6) 캐시 무효화 revalidateTag("vendors-in-investigation") + revalidateTag("pq-submissions") + revalidateTag("vendor-pq-submissions") + revalidatePath("/evcp/pq_new") return { data: "OK", error: null } } catch (err: unknown) { diff --git a/lib/vendor-investigation/table/investigation-table-columns.tsx b/lib/vendor-investigation/table/investigation-table-columns.tsx index 3d765179..521befa9 100644 --- a/lib/vendor-investigation/table/investigation-table-columns.tsx +++ b/lib/vendor-investigation/table/investigation-table-columns.tsx @@ -179,6 +179,23 @@ export function getColumns({ ) } + // Handle pqItems + if (column.id === "pqItems") { + if (!value) return <span className="text-muted-foreground">-</span> + const items = typeof value === 'string' ? JSON.parse(value as string) : value; + if (Array.isArray(items) && items.length > 0) { + const firstItem = items[0]; + return ( + <div className="flex items-center gap-2"> + <span className="text-sm">{firstItem.itemCode} - {firstItem.itemName}</span> + {items.length > 1 && ( + <span className="text-xs text-muted-foreground">외 {items.length - 1}건</span> + )} + </div> + ); + } + } + // Handle IDs for pqSubmissionId (keeping for reference) if (column.id === "pqSubmissionId") { return value ? `#${value}` : "" |
