260727_01_ENH: 전화 걸기 ws 틀어막기, 선택 항목만인경우 선택된 것이 없으면 오류

This commit is contained in:
2026-07-27 16:37:26 +09:00
parent 58e9d0702e
commit 157ba6155d
9 changed files with 393 additions and 158 deletions

View File

@@ -12,8 +12,13 @@ export type ApplyFilterOptionValue = ListFilterTarget
* alert 후 진행을 막아야 하는 호출부에서 공통으로 사용한다.
*/
export const validateApplyFilterTarget = (value: ApplyFilterOptionValue, filterSummary?: string[]): boolean => {
if (value === 'filtered' && (filterSummary?.length ?? 0) === 0) {
alert('적용된 필터가 없습니다. 필터를 적용해 주세요.')
if (["selected", "filtered"].includes(value) && (filterSummary?.length ?? 0) === 0) {
const alertText: string =
value === "selected" ?
"선택된 항목이 없습니다. 항목을 선택해 주세요"
: "적용된 필터가 없습니다. 필터를 적용해 주세요."
alert(alertText)
return false
}
return true

View File

@@ -21,8 +21,7 @@ import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
import SingleMessageSendDialog from '@/components/dialog/SingleMessageSendDialog'
import { ctiClient } from '@/lib/cti/ctiClient'
import { useCtiConnectionStatus } from '@/hooks/useCtiConnectionStatus'
import { useCtiAgentStatus } from '@/hooks/useCtiAgentStatus'
import { CTI_ON_CALL_STATUSES } from '@/const/ctiConst'
import { useCtiCallPhase } from '@/hooks/useCtiCallPhase'
import { cn } from '@/lib/utils'
import { downloadFile } from '@kri/common/browser'
@@ -67,6 +66,18 @@ export const buildInitialValues = (listHeaders: listHeader[], detail?: ListSearc
const disabledContrastClass = 'disabled:opacity-100 disabled:text-foreground disabled:bg-muted/60'
const getCallButtonLabel = (isDialing: boolean, isOnCall: boolean) => {
if (isDialing) return '거는 중'
if (isOnCall) return '전화 끊기'
return '전화'
}
const getCallButtonTitle = (isCtiReady: boolean, isDialing: boolean) => {
if (!isCtiReady) return '전화 시스템에 연결되어 있지 않습니다.'
if (isDialing) return '전화를 거는 중입니다.'
return undefined
}
const FieldRow = ({ label, children }: { label: string; children: ReactNode }) => (
<div className="flex items-center gap-3">
<Label className="w-24 shrink-0 text-sm font-bold text-foreground">{label}</Label>
@@ -98,8 +109,9 @@ const ListContactInfoPanel = ({
const [qrTargetUrl, setQrTargetUrl] = useState('')
const ctiConnectionStatus = useCtiConnectionStatus()
const isCtiReady = ctiConnectionStatus === 'open'
const ctiAgentStatus = useCtiAgentStatus()
const isOnCall = ctiAgentStatus !== null && (CTI_ON_CALL_STATUSES as readonly string[]).includes(ctiAgentStatus)
const ctiCallPhase = useCtiCallPhase()
const isDialing = ctiCallPhase === 'dialing'
const isOnCall = ctiCallPhase === 'active'
useEffect(() => {
if (!isOnCall) return
@@ -148,12 +160,13 @@ const ListContactInfoPanel = ({
}
const handleCall = (telNum: string, listHderId: number) => {
if (!isCtiReady) return
if (!isCtiReady || isDialing) return
// CTI_HANGUP_PENDING_VENDOR: 외주사 Hangup 명령 동작 확인 후 통화 중 버튼을 활성화하면 즉시 사용할 수 있다.
if (isOnCall) {
ctiClient.hangup()
return
}
if (!telNum) return
ctiClient.makeCall({ dialNumber: telNum, prjctIdx, sid: Number(sid), listHderId, aniNumber: callerTelNum ?? '' })
}
@@ -218,12 +231,12 @@ const ListContactInfoPanel = ({
type="button"
variant="outline"
className={cn('shrink-0 gap-2', isOnCall && 'bg-accent text-accent-foreground')}
disabled={!isCtiReady || isOnCall}
title={!isCtiReady ? '전화 시스템에 연결되어 있지 않습니다.' : undefined}
disabled={!isCtiReady || isDialing}
title={getCallButtonTitle(isCtiReady, isDialing)}
onClick={() => handleCall(value, header.listHderId)}
>
<Phone className="h-4 w-4" />
{isOnCall ? '통화중' : '전화'}
{getCallButtonLabel(isDialing, isOnCall)}
</Button>
<Button
type="button"
@@ -235,6 +248,11 @@ const ListContactInfoPanel = ({
발송
</Button>
</div>
{(isDialing || isOnCall) &&
<p className="text-sm text-red-600 font-medium mt-1">
⚠️ 전화를 끊어야만 통화 종료가 기록됩니다.
</p>
}
</FieldRow>
)
}