From 2c3dc9d082aeda5ebfaad225a241af98aecbb301 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Thu, 1 Oct 2026 16:33:47 +0900 Subject: [PATCH] =?UTF-8?q?261001=5F03=5FENH:=20sub=20=EA=B3=B5=EC=97=B0?= =?UTF-8?q?=20=EC=8B=A0=EC=B2=AD=EC=9E=90=20=EC=88=98=20=EB=B6=80=EB=AA=A8?= =?UTF-8?q?=20=EA=B3=B5=EC=97=B0=20=EA=B8=B0=EC=A4=80=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=20=EB=B0=8F=20sub=EA=B0=80=20=EC=9E=88=EB=8A=94=20=EB=A7=88?= =?UTF-8?q?=EC=8A=A4=ED=84=B0=20=EA=B3=B5=EC=97=B0=20=EB=AA=A9=EB=A1=9D=20?= =?UTF-8?q?=EC=A0=9C=EC=99=B8,=20=EC=97=B0=EB=B2=88=20=EB=AC=B8=EC=9E=90?= =?UTF-8?q?=20=EC=A0=95=EB=A0=AC=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/(pages)/(main)/assign/page.tsx | 19 +++++++++++++------ src/app/(pages)/(main)/performance/page.tsx | 16 +++++++++++++--- .../dialog/AssignCalendarDialog.tsx | 12 +++++++----- src/lib/kmusical/assignment-calendar.ts | 3 ++- src/lib/kmusical/view.ts | 17 +++++++++++++++++ 5 files changed, 52 insertions(+), 15 deletions(-) diff --git a/src/app/(pages)/(main)/assign/page.tsx b/src/app/(pages)/(main)/assign/page.tsx index baa19e8..d2ec2e6 100644 --- a/src/app/(pages)/(main)/assign/page.tsx +++ b/src/app/(pages)/(main)/assign/page.tsx @@ -19,7 +19,13 @@ import { useMonitoringApplyUsersQuery, } from "@/query/assign"; import {useReviewSlotsQuery} from "@/query/review"; -import {filterPerformance, getCodeLabel, type PerformanceFilterState} from "@/lib/kmusical/view"; +import { + excludeMastersWithSub, + filterPerformance, + getApplyPerformanceId, + getCodeLabel, + type PerformanceFilterState, +} from "@/lib/kmusical/view"; import {buildPerformanceSmsParams} from "@/lib/kmusical/notification"; import {PERFORMANCE_FIELD_LABELS} from "@/lib/kmusical/field-labels"; import {REVIEW_TYPE, type PerformanceFull, type ReviewType} from "@/types/kmusical"; @@ -54,7 +60,7 @@ const AssignPage = () => { const smsOpen = isDialogOpen("assignSmsSendDialog"); const calendarOpen = isDialogOpen("assignCalendarDialog"); const {data: detail, refetch: refetchDetail} = usePerformanceQuery(assignOpen ? selectedId : ""); - const {data: applyUsers = []} = useMonitoringApplyUsersQuery(selectedId); + const {data: applyUsers = []} = useMonitoringApplyUsersQuery(getApplyPerformanceId(selectedId)); const {data: users = []} = useUserListQuery(MONITORING_USER_ROLE); const suppressAssignCloseRef = useRef(false); const confirmMutation = useConfirmAssignMutation(); @@ -64,7 +70,8 @@ const AssignPage = () => { const reviewSlotTypeMap = new Map(reviewSlots.map((slot) => [slot.reviewSlot, slot.reviewType])); const countConfirmedAssigns = (row: PerformanceFull, reviewType: ReviewType) => row.performanceAssignList.filter((assign) => reviewSlotTypeMap.get(assign.reviewSlot) === reviewType).length; - const filteredData = data + const assignableData = excludeMastersWithSub(data); + const filteredData = assignableData .filter((item) => filterPerformance(item, filters)) .sort((a, b) => (b.performanceMonitoringSchedule?.monitoringDate ?? "").localeCompare(a.performanceMonitoringSchedule?.monitoringDate ?? "")); const selected = detail ?? data.find((item) => item.performanceId === selectedId) ?? null; @@ -75,7 +82,7 @@ const AssignPage = () => { const smsTargetUsers = availableUsers.filter((user) => smsTargetIds.includes(user.userId)); const columns: DataTableColumn[] = [ - {accessorKey: "performanceId", header: PERFORMANCE_FIELD_LABELS.performanceId, size: 90}, + {accessorKey: "performanceId", header: PERFORMANCE_FIELD_LABELS.performanceId, size: 90, sortingFn: "text"}, { accessorKey: "performanceName", header: PERFORMANCE_FIELD_LABELS.performanceName, @@ -109,7 +116,7 @@ const AssignPage = () => { ), enableSorting: false }, - {id: "applyCount", header: "신청자 수", size: 100, accessorFn: (row) => applyCountMap.get(row.performanceId) ?? 0}, + {id: "applyCount", header: "신청자 수", size: 100, accessorFn: (row) => applyCountMap.get(getApplyPerformanceId(row.performanceId)) ?? 0}, {id: "monitoringAssignCount", header: "모니터링 확정자 수", size: 140, accessorFn: (row) => countConfirmedAssigns(row, REVIEW_TYPE.MONITORING)}, {id: "consultingAssignCount", header: "컨설팅 확정자 수", size: 140, accessorFn: (row) => countConfirmedAssigns(row, REVIEW_TYPE.CONSULTING)}, ]; @@ -269,7 +276,7 @@ const AssignPage = () => { open ? showDialog("assignCalendarDialog") : hideDialog("assignCalendarDialog")} - performances={data} + performances={assignableData} applyCountMap={applyCountMap} reviewSlots={reviewSlots} reviewers={users} diff --git a/src/app/(pages)/(main)/performance/page.tsx b/src/app/(pages)/(main)/performance/page.tsx index d8fad9e..b7264fc 100644 --- a/src/app/(pages)/(main)/performance/page.tsx +++ b/src/app/(pages)/(main)/performance/page.tsx @@ -21,7 +21,15 @@ import { useUploadPerformanceExcelMutation, } from "@/query/performance"; import {useDownloadReviewOriginalMutation, useReviewSlotsQuery} from "@/query/review"; -import {filterPerformance, getCodeLabel, isInternalRole, isResearcherRole, type PerformanceFilterState} from "@/lib/kmusical/view"; +import { + excludeMastersWithSub, + filterPerformance, + getCodeLabel, + isFoundationRole, + isInternalRole, + isResearcherRole, + type PerformanceFilterState, +} from "@/lib/kmusical/view"; import {getMonitoringStatusDisplay, isReviewComplete} from "@/lib/kmusical/performance-status"; import {downloadBlob, downloadExcelBuffer} from "@/lib/kmusical/file"; import {PERFORMANCE_FIELD_LABELS} from "@/lib/kmusical/field-labels"; @@ -59,7 +67,9 @@ const PerformancePage = () => { const visibleData = isMonitoring ? data.filter((item) => Boolean(auth.user?.userId && item.performanceAssignList.some((assign) => assign.assignUser === auth.user?.userId))) - : data; + : isFoundationRole(auth.user?.userRole) + ? excludeMastersWithSub(data) + : data; const filteredData = visibleData.filter((item) => filterPerformance(item, filters)); const downloadReview = async (performance: PerformanceFull, reviewSlot: number) => { @@ -71,7 +81,7 @@ const PerformancePage = () => { const columns: DataTableColumn[] = [ {accessorKey: "performanceNo", header: PERFORMANCE_FIELD_LABELS.performanceNo, size: 60}, - {accessorKey: "performanceId", header: PERFORMANCE_FIELD_LABELS.performanceId, size: 90}, + {accessorKey: "performanceId", header: PERFORMANCE_FIELD_LABELS.performanceId, size: 90, sortingFn: "text"}, {id: "businessType", header: PERFORMANCE_FIELD_LABELS.businessType, size: 100, cell: ({row}) => getCodeLabel(codes, "business_type", row.original.businessType)}, {id: "area", header: PERFORMANCE_FIELD_LABELS.performanceArea, size: 80, cell: ({row}) => getCodeLabel(codes, "area", row.original.performanceArea)}, {accessorKey: "artistName", header: PERFORMANCE_FIELD_LABELS.artistName, size: 160}, diff --git a/src/components/dialog/AssignCalendarDialog.tsx b/src/components/dialog/AssignCalendarDialog.tsx index c27e85f..ab21485 100644 --- a/src/components/dialog/AssignCalendarDialog.tsx +++ b/src/components/dialog/AssignCalendarDialog.tsx @@ -11,7 +11,7 @@ import {Tooltip, TooltipContent, TooltipProvider, TooltipTrigger} from "@/compon import {KriMultiSelect} from "@/components/common/KriAutoComplete"; import {StatusPill} from "@/components/kmusical/StatusPill"; import {useAllMonitoringApplyUsersQuery} from "@/query/assign"; -import {getDetailValue, includesText} from "@/lib/kmusical/view"; +import {getApplyPerformanceId, getDetailValue, includesText} from "@/lib/kmusical/view"; import { buildMonthGrid, chunkIntoWeeks, @@ -151,10 +151,12 @@ export function AssignCalendarDialog({ list.push(applyUser); applyUsersByPerformanceId.set(applyUser.performanceId, list); } - const detailApplyUsers = detailPerformance ? applyUsersByPerformanceId.get(detailPerformance.performanceId) ?? [] : []; + const detailApplyUsers = detailPerformance ? applyUsersByPerformanceId.get(getApplyPerformanceId(detailPerformance.performanceId)) ?? [] : []; const orderedPerformanceIds = performances.map((performance) => performance.performanceId); - const searchedPerformances = performances.filter((performance) => includesText(performance.performanceName, performanceSearch)); + const searchedPerformances = performances + .filter((performance) => includesText(performance.performanceName, performanceSearch)) + .sort((a, b) => a.performanceId.localeCompare(b.performanceId, "ko")); const allSelected = performances.length > 0 && selectedPerformanceIds.size === performances.length; const togglePerformance = (performanceId: string) => { @@ -278,7 +280,7 @@ export function AssignCalendarDialog({ colorClassName={PERFORMANCE_BADGE_COLOR_CLASSES[getPerformanceColorSlot(performance.performanceId, orderedPerformanceIds)]} reviewSlots={reviewSlots} userById={userById} - applyUsers={applyUsersByPerformanceId.get(performance.performanceId) ?? []} + applyUsers={applyUsersByPerformanceId.get(getApplyPerformanceId(performance.performanceId)) ?? []} onClick={() => setSelectedDetailPerformanceId(performance.performanceId)} /> ))} @@ -301,7 +303,7 @@ export function AssignCalendarDialog({ colorClassName={PERFORMANCE_BADGE_COLOR_CLASSES[getPerformanceColorSlot(performance.performanceId, orderedPerformanceIds)]} reviewSlots={reviewSlots} userById={userById} - applyUsers={applyUsersByPerformanceId.get(performance.performanceId) ?? []} + applyUsers={applyUsersByPerformanceId.get(getApplyPerformanceId(performance.performanceId)) ?? []} onClick={() => { setExpandedDayKey(null); setSelectedDetailPerformanceId(performance.performanceId); diff --git a/src/lib/kmusical/assignment-calendar.ts b/src/lib/kmusical/assignment-calendar.ts index a4c1906..1ca1ca7 100644 --- a/src/lib/kmusical/assignment-calendar.ts +++ b/src/lib/kmusical/assignment-calendar.ts @@ -1,4 +1,5 @@ import {parseLocalDateString, toLocalDateString} from "@/lib/kmusical/date"; +import {getApplyPerformanceId} from "@/lib/kmusical/view"; import type {PerformanceFull, PerformanceReviewSlot} from "@/types/kmusical"; export const WEEKDAY_LABELS = ["일", "월", "화", "수", "목", "금", "토"] as const; @@ -99,7 +100,7 @@ export const getPerformanceBadgeInfo = ( applyCountMap: Map, reviewSlots: PerformanceReviewSlot[] ): PerformanceBadgeInfo => { - const applyCount = applyCountMap.get(performance.performanceId) ?? 0; + const applyCount = applyCountMap.get(getApplyPerformanceId(performance.performanceId)) ?? 0; const assignCount = performance.performanceAssignList.length; const requiredAssignCount = reviewSlots.length; const isMatchingComplete = requiredAssignCount > 0 && assignCount >= requiredAssignCount; diff --git a/src/lib/kmusical/view.ts b/src/lib/kmusical/view.ts index b05943f..9542c1e 100644 --- a/src/lib/kmusical/view.ts +++ b/src/lib/kmusical/view.ts @@ -49,6 +49,23 @@ export const includesText = (value: unknown, keyword: string) => { return String(value ?? "").toLowerCase().includes(keyword.toLowerCase()); }; +// 4자리 연번은 sub 공연이며 앞 3자리가 부모 공연 연번이다. 신청은 부모 공연 기준으로 받는다. +export const isSubPerformanceId = (performanceId: string) => /^\d{4}$/.test(performanceId); + +export const getApplyPerformanceId = (performanceId: string) => + isSubPerformanceId(performanceId) ? performanceId.slice(0, 3) : performanceId; + +// sub 공연이 있는 마스터 공연을 목록에서 제외한다. +export const excludeMastersWithSub = (performances: T[]): T[] => { + const masterIdsWithSub = new Set( + performances + .map((performance) => performance.performanceId) + .filter(isSubPerformanceId) + .map(getApplyPerformanceId) + ); + return performances.filter((performance) => !masterIdsWithSub.has(performance.performanceId)); +}; + export type PerformanceFilterState = { businessType: string[]; area: string[]; -- 2.49.0.windows.1