260812_01_ENH: 배정·진행 현황 개선 및 예약/이벤트 이력 기능 추가
- 프로젝트별 외주사·필드워커 배정 현황 및 미배정 건수 UI 추가 - 현장 면접 진행 여부와 사용자 권한에 따른 배정 탭·필터·컬럼 노출 제어 - 컨택 마지막 이벤트 일자 필터·정렬 및 결과/일자 컬럼 분리 - 컨택·면접·발송 현황의 날짜 범위 선택 optional 처리 - 진행 현황의 미배정 표시 및 일자별 미사용 결과 제외 - 전역 예약 기간 조회·이동 및 5분 단위 예약 알림 추가 - 내부 관리자용 이벤트 이력 단건 삭제 기능 추가 - 리스트 필터 UI 및 일반 헤더 정렬 기준 개선 - 프로젝트 저장 시 선택 프로젝트 정보 동기화
This commit is contained in:
@@ -8,6 +8,7 @@ import { Input } from '@/components/ui/input'
|
||||
import { DataTable } from '@/components/data-table/DataTable'
|
||||
import type { DataTableColumn, SelectMode } from '@/components/data-table/DataTable.type'
|
||||
import { KriMultiSelect } from '@/components/common/KriAutoComplete'
|
||||
import KriDateRangePicker, { type KriDateRange } from '@/components/common/KriDateRangePicker'
|
||||
import ListBatchEditDialog, { type BatchEditPayload, type BatchEditResultCodes, type BatchEditRow, type BatchEditSurveyResultCodes } from '@/components/dialog/ListBatchEditDialog'
|
||||
import ListFilterDialog, { operatorLabel } from '@/components/dialog/ListFilterDialog'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
@@ -50,6 +51,7 @@ export type ListSearchTableProps = {
|
||||
resultCodes: ResultCode[]
|
||||
surveys: ProjectSurvey[]
|
||||
listHeaders: listHeader[]
|
||||
fieldInterviewEnabled?: boolean
|
||||
enableBatchEdit?: boolean
|
||||
refreshKey?: number
|
||||
selectMode?: SelectMode
|
||||
@@ -133,7 +135,7 @@ const toFilterCondition = (row: FilterRow, usesListValue: boolean): Omit<ListOth
|
||||
const TEXT_LIKE_OPERATORS: FilterOperator[] = ['eq', 'neq', 'contains', 'notContains', 'empty', 'notEmpty']
|
||||
const ASSIGN_LIKE_OPERATORS: FilterOperator[] = ['eq', 'neq', 'empty', 'notEmpty']
|
||||
const IS_USE_OPERATORS: FilterOperator[] = ['eq', 'neq']
|
||||
const FILE_OPERATORS: FilterOperator[] = ['empty', 'notEmpty']
|
||||
const FILE_OPERATORS: FilterOperator[] = ['none', 'empty', 'notEmpty']
|
||||
|
||||
const getAllowedOperators = (listHderTy: number): FilterOperator[] => {
|
||||
if (listHderTy === ListHeaderConst.IS_USE) return IS_USE_OPERATORS
|
||||
@@ -142,6 +144,13 @@ const getAllowedOperators = (listHderTy: number): FilterOperator[] => {
|
||||
return TEXT_LIKE_OPERATORS
|
||||
}
|
||||
|
||||
const getDefaultOperator = (listHderTy: number): FilterOperator => {
|
||||
if (listHderTy === ListHeaderConst.FILE) return 'none'
|
||||
if (listHderTy === ListHeaderConst.IS_USE) return 'eq'
|
||||
if (isAssignHeaderType(listHderTy) || listHderTy === ListHeaderConst.CONTENT_ITEM) return 'eq'
|
||||
return 'contains'
|
||||
}
|
||||
|
||||
const IS_USE_VALUE_OPTIONS: FilterValueOption[] = Object.entries(LIST_IS_USE_LABEL).map(([value, label]) => ({
|
||||
value,
|
||||
label,
|
||||
@@ -156,6 +165,7 @@ export function ListSearchTable({
|
||||
resultCodes,
|
||||
surveys,
|
||||
listHeaders,
|
||||
fieldInterviewEnabled = true,
|
||||
enableBatchEdit = false,
|
||||
refreshKey = 0,
|
||||
selectMode = 'multi',
|
||||
@@ -178,6 +188,9 @@ export function ListSearchTable({
|
||||
const { showDialog } = useDialog()
|
||||
const [searchText, setSearchText] = useState(initialSearchState?.searchText ?? '')
|
||||
const [searchContactResult, setSearchContactResult] = useState<string[]>(initialSearchState?.searchContactResult ?? [])
|
||||
const [searchContactDateRange, setSearchContactDateRange] = useState<KriDateRange>(
|
||||
initialSearchState?.searchContactDateRange ?? { from: '', to: '' },
|
||||
)
|
||||
const [searchInterviewResult, setSearchInterviewResult] = useState<string[]>(initialSearchState?.searchInterviewResult ?? [])
|
||||
const [surveyResultSelections, setSurveyResultSelections] = useState<SurveyResultSelections>(initialSearchState?.surveyResultSelections ?? {})
|
||||
const [pagination, setPagination] = useState<PaginationState>(initialPagination ?? { pageIndex: 0, pageSize: 25 })
|
||||
@@ -200,7 +213,11 @@ export function ListSearchTable({
|
||||
enabled,
|
||||
assignType: ListHeaderAssignConst.CONTACT_INTERVIEWER,
|
||||
})
|
||||
const fieldTargetRows = useAssignTargetRows({ prjctIdx, enabled, assignType: ListHeaderAssignConst.FIELD_INTERVIEWER })
|
||||
const fieldTargetRows = useAssignTargetRows({
|
||||
prjctIdx,
|
||||
enabled: enabled && fieldInterviewEnabled,
|
||||
assignType: ListHeaderAssignConst.FIELD_INTERVIEWER,
|
||||
})
|
||||
|
||||
const getValueOptionsForHeader = useCallback(
|
||||
(header: listHeader): FilterValueOption[] | undefined => {
|
||||
@@ -222,20 +239,28 @@ export function ListSearchTable({
|
||||
[contactTargetRows, fieldTargetRows, outsourceTargetRows],
|
||||
)
|
||||
|
||||
const availableListHeaders = useMemo(
|
||||
() =>
|
||||
fieldInterviewEnabled
|
||||
? listHeaders
|
||||
: listHeaders.filter((header) => header.listHderTy !== ListHeaderConst.FIELD_INTERVIEWER),
|
||||
[fieldInterviewEnabled, listHeaders],
|
||||
)
|
||||
|
||||
const accessibleListHeaders = useMemo(
|
||||
() => listHeaders.filter((header) => isListHeaderVisibleByAccess(header, userRole)),
|
||||
[listHeaders, userRole],
|
||||
() => availableListHeaders.filter((header) => isListHeaderVisibleByAccess(header, userRole)),
|
||||
[availableListHeaders, userRole],
|
||||
)
|
||||
|
||||
const accessibleFilterHeaders = useMemo(
|
||||
() =>
|
||||
listHeaders.filter(
|
||||
availableListHeaders.filter(
|
||||
(header) =>
|
||||
header.listHderTy !== ListHeaderConst.SID &&
|
||||
isListFilterVisibleByAccess(header, userRole) &&
|
||||
!excludeFilterHeaderTypes?.includes(header.listHderTy),
|
||||
),
|
||||
[listHeaders, userRole, excludeFilterHeaderTypes],
|
||||
[availableListHeaders, userRole, excludeFilterHeaderTypes],
|
||||
)
|
||||
|
||||
const accessibleFilterHeaderById = useMemo(
|
||||
@@ -252,7 +277,7 @@ export function ListSearchTable({
|
||||
listFilter.memoConditions = []
|
||||
listFilter.resultCodeMap = {
|
||||
[ResultCodeType.CONTACT]: searchContactResult.map(Number),
|
||||
[ResultCodeType.INTERVIEW]: searchInterviewResult.map(Number),
|
||||
[ResultCodeType.INTERVIEW]: fieldInterviewEnabled ? searchInterviewResult.map(Number) : [],
|
||||
}
|
||||
listFilter.surveyResultConditions = Object.entries(surveyResultSelections)
|
||||
.filter(([, codes]) => codes.length > 0)
|
||||
@@ -261,9 +286,20 @@ export function ListSearchTable({
|
||||
resultCodes: codes.map(Number),
|
||||
}))
|
||||
|
||||
if (searchContactDateRange.from || searchContactDateRange.to) {
|
||||
listFilter.lastEventDateRange = [
|
||||
{
|
||||
resultCodeType: ResultCodeType.CONTACT,
|
||||
startDate: searchContactDateRange.from ? `${searchContactDateRange.from}T00:00:00` : undefined,
|
||||
endDate: searchContactDateRange.to ? `${searchContactDateRange.to}T23:59:59` : undefined,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
filterRows.forEach((row) => {
|
||||
const header = accessibleFilterHeaderById.get(row.headerId)
|
||||
if (!header || lockedListFilterHeaderTypes.has(header.listHderTy)) return
|
||||
if (row.operator === 'none') return
|
||||
|
||||
const isEmptyOperator = row.operator === 'empty' || row.operator === 'notEmpty'
|
||||
const usesListValue = getValueOptionsForHeader(header) !== undefined
|
||||
@@ -324,12 +360,14 @@ export function ListSearchTable({
|
||||
}, [
|
||||
accessibleFilterHeaderById,
|
||||
externalAssignFilter,
|
||||
fieldInterviewEnabled,
|
||||
filterRows,
|
||||
getValueOptionsForHeader,
|
||||
lockedListFilterHeaderTypes,
|
||||
pagination.pageIndex,
|
||||
pagination.pageSize,
|
||||
searchContactResult,
|
||||
searchContactDateRange,
|
||||
searchInterviewResult,
|
||||
surveyResultSelections,
|
||||
searchText,
|
||||
@@ -363,13 +401,19 @@ export function ListSearchTable({
|
||||
|
||||
const resultSummaryGroups: { label: string; type: ResultCodeType; values: string[] }[] = [
|
||||
{ label: '컨택 결과', type: ResultCodeType.CONTACT, values: searchContactResult },
|
||||
{ label: '면접 결과', type: ResultCodeType.INTERVIEW, values: searchInterviewResult },
|
||||
...(fieldInterviewEnabled
|
||||
? [{ label: '면접 결과', type: ResultCodeType.INTERVIEW, values: searchInterviewResult }]
|
||||
: []),
|
||||
]
|
||||
resultSummaryGroups.forEach(({ label, type, values }) => {
|
||||
if (values.length === 0) return
|
||||
lines.push(`${label}: ${values.map((value) => resultCodeLabel(type, value)).join(', ')}`)
|
||||
})
|
||||
|
||||
if (searchContactDateRange.from || searchContactDateRange.to) {
|
||||
lines.push(`컨택 일자: ${searchContactDateRange.from || ''} ~ ${searchContactDateRange.to || ''}`)
|
||||
}
|
||||
|
||||
surveys.forEach((survey) => {
|
||||
if (survey.prjctSurveyIdx == null) return
|
||||
const codes = surveyResultSelections[survey.prjctSurveyIdx] ?? []
|
||||
@@ -404,9 +448,11 @@ export function ListSearchTable({
|
||||
}, [
|
||||
accessibleFilterHeaderById,
|
||||
filterRows,
|
||||
fieldInterviewEnabled,
|
||||
getValueOptionsForHeader,
|
||||
lockedListFilterHeaderTypes,
|
||||
resultCodeLabel,
|
||||
searchContactDateRange,
|
||||
searchContactResult,
|
||||
searchInterviewResult,
|
||||
surveys,
|
||||
@@ -446,9 +492,12 @@ export function ListSearchTable({
|
||||
)
|
||||
|
||||
const columns = useMemo<DataTableColumn<ListTableRow, unknown>[]>(() => {
|
||||
if (!listHeaders.length) return []
|
||||
return getListColumns(listHeaders, resultCodes, userRole, surveys)
|
||||
}, [listHeaders, resultCodes, userRole, surveys])
|
||||
if (!availableListHeaders.length) return []
|
||||
const listColumns = getListColumns(availableListHeaders, resultCodes, userRole, surveys)
|
||||
return fieldInterviewEnabled
|
||||
? listColumns
|
||||
: listColumns.filter((column) => column.id !== 'result-interview')
|
||||
}, [availableListHeaders, fieldInterviewEnabled, resultCodes, surveys, userRole])
|
||||
|
||||
const viewList = useMemo<ListTableRow[]>(
|
||||
() => (listSearchQuery.data?.content ?? []).map((row) => ({ ...row, ...row.itemList })),
|
||||
@@ -477,6 +526,7 @@ export function ListSearchTable({
|
||||
id: header.listHderId,
|
||||
label: header.listHderNm,
|
||||
allowedOperators: getAllowedOperators(header.listHderTy),
|
||||
defaultOperator: getDefaultOperator(header.listHderTy),
|
||||
valueOptions: getValueOptionsForHeader(header),
|
||||
disabled: lockedListFilterHeaderTypes.has(header.listHderTy),
|
||||
})),
|
||||
@@ -535,6 +585,7 @@ export function ListSearchTable({
|
||||
onSearchStateChange?.({
|
||||
searchText,
|
||||
searchContactResult,
|
||||
searchContactDateRange,
|
||||
searchInterviewResult,
|
||||
surveyResultSelections,
|
||||
filterRows,
|
||||
@@ -543,6 +594,7 @@ export function ListSearchTable({
|
||||
}, [
|
||||
searchText,
|
||||
searchContactResult,
|
||||
searchContactDateRange,
|
||||
searchInterviewResult,
|
||||
surveyResultSelections,
|
||||
filterRows,
|
||||
@@ -572,7 +624,7 @@ export function ListSearchTable({
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<Input
|
||||
placeholder="SID 검색"
|
||||
className="h-9 bg-white flex-1 min-w-0 max-w-xs"
|
||||
@@ -592,18 +644,29 @@ export function ListSearchTable({
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1 min-w-0 max-w-xs">
|
||||
<KriMultiSelect
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.INTERVIEW)}
|
||||
value={searchInterviewResult}
|
||||
onChange={setSearchInterviewResult}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder="면접 결과"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
<KriDateRangePicker
|
||||
value={searchContactDateRange}
|
||||
onChange={(range) => {
|
||||
setSearchContactDateRange(range)
|
||||
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
|
||||
}}
|
||||
placeholder="컨택 일자"
|
||||
className="flex-1 min-w-[240px] max-w-xs"
|
||||
/>
|
||||
{fieldInterviewEnabled ? (
|
||||
<div className="flex-1 min-w-0 max-w-xs">
|
||||
<KriMultiSelect
|
||||
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.INTERVIEW)}
|
||||
value={searchInterviewResult}
|
||||
onChange={setSearchInterviewResult}
|
||||
getValue={(item) => String(item.resultCd)}
|
||||
getLabel={(item) => item.resultCdLbl}
|
||||
placeholder="면접 결과"
|
||||
widthClassName="w-full"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{surveys.length > 0 ? (
|
||||
|
||||
Reference in New Issue
Block a user