260728_03_ENH: 시나리오에 치환 문자열 적용, 현황 bar chart에 bar max width 적용, 리스트 업로드 이력에서 만료된 파일은 안나오게 수정

This commit is contained in:
2026-07-28 12:17:54 +09:00
parent 17289bf0e8
commit 0285a3fe9d
8 changed files with 95 additions and 36 deletions

View File

@@ -9,13 +9,12 @@ import { KriSingleSelect } from '@/components/common/KriAutoComplete'
import { useDialog } from '@/hooks/useDialog'
import { useDownloadListItemFileByHeaderMutation, useUploadListItemFileMutation } from '@/query/list'
import { ListHeaderConst } from '@/const/listConst'
import { LIST_IS_USE_LABEL } from '@/components/table-column/ListTableColumn'
import type { listHeader, ListSearchWithFullResult } from '@/types/list'
import type { MessageSendChannel } from '@/types/message'
import { type ProjectSurvey, type ResultCode, ResultCodeType } from '@/types/project'
import { formatKst } from '@kri/common'
import { isAssignHeaderType, isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
import { substituteSurveyUrl } from '@/lib/surveyUrl'
import { isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
import { substituteVariables } from '@/lib/surveyUrl'
import { formatKoreanPhoneNumber } from '@/utils/phone'
import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
import SingleMessageSendDialog from '@/components/dialog/SingleMessageSendDialog'
@@ -24,6 +23,10 @@ import { useCtiConnectionStatus } from '@/hooks/useCtiConnectionStatus'
import { useCtiCallPhase } from '@/hooks/useCtiCallPhase'
import { cn } from '@/lib/utils'
import { downloadFile } from '@kri/common/browser'
import {
buildListContactVariableValues,
resolveListHeaderValue,
} from '@/components/list-contact/listContactVariables'
export type ListContactInfoPanelProps = {
prjctIdx: number
@@ -41,24 +44,13 @@ export type ListContactInfoPanelProps = {
onSaved?: () => void
}
const resolveHeaderValue = (header: listHeader, detail?: ListSearchWithFullResult): string => {
if (header.listHderTy === ListHeaderConst.MEMO) return detail?.memo ?? ''
if (header.listHderTy === ListHeaderConst.IS_USE) {
return detail?.use != null ? (LIST_IS_USE_LABEL[detail.use] ?? '') : ''
}
if (isAssignHeaderType(header.listHderTy)) {
return detail?.assignList?.[header.listHderTy] ?? ''
}
return detail?.itemList?.[header.listHderId] ?? ''
}
export const buildInitialValues = (listHeaders: listHeader[], detail?: ListSearchWithFullResult) => {
const values: Record<number, string> = {}
for (const header of listHeaders) {
if (header.listHderTy === ListHeaderConst.SID) continue
if (!isListFieldVisibleForContact(header)) continue
values[header.listHderId] = resolveHeaderValue(header, detail)
values[header.listHderId] = resolveListHeaderValue(header, detail)
}
return values
@@ -123,22 +115,16 @@ const ListContactInfoPanel = ({
const surveyResultByIdx = new Map((detail?.surveyResults ?? []).map((result) => [result.prjctSurveyIdx, result]))
// 설문 URL 치환은 화면 노출(면접원 노출) 여부와 무관하게 전체 헤더 값을 대상으로 한다.
const surveyUrlValues: Record<string, string> = {}
for (const header of listHeaders) {
if (header.listHderTy === ListHeaderConst.SID) continue
surveyUrlValues[header.listHderNm] = resolveHeaderValue(header, detail)
}
surveyUrlValues.SID = sid // 예약 토큰: 헤더명이 'SID'인 커스텀 헤더가 있어도 항상 실제 sid로 치환한다.
const surveyUrlValues = buildListContactVariableValues(listHeaders, detail, sid)
const handleStartSurvey = (survey: ProjectSurvey) => {
if (!survey.surveyUrl) return
window.open(substituteSurveyUrl(survey.surveyUrl, surveyUrlValues), '_blank', 'noopener,noreferrer')
window.open(substituteVariables(survey.surveyUrl, surveyUrlValues), '_blank', 'noopener,noreferrer')
}
const handleShowQr = (survey: ProjectSurvey) => {
if (!survey.surveyUrl) return
setQrTargetUrl(substituteSurveyUrl(survey.surveyUrl, surveyUrlValues))
setQrTargetUrl(substituteVariables(survey.surveyUrl, surveyUrlValues))
showDialog('surveyQrDialog')
}