260716_01_ENH: 본 서버에서 기동 후 중간 테스트를 위한 커밋
This commit is contained in:
@@ -8,6 +8,7 @@ import { KriDateTimePicker } from '@/components/common/KriDateTimePicker'
|
||||
import CollapsibleHistorySection from '@/components/list-contact/CollapsibleHistorySection'
|
||||
import { useAddListEventMutation, useListEventHistoryQuery, useReserveMutation } from '@/query/list'
|
||||
import { useSendResultBySidQuery } from '@/query/message'
|
||||
import { useInternalInfoQuery } from '@/query/internal'
|
||||
import { clientEnv } from '@/lib/env.client'
|
||||
import { ChannelType } from '@kri/common/noti-hub'
|
||||
import type { SendResultInfo } from '@/types/message'
|
||||
@@ -17,6 +18,8 @@ import { CONTACT_INTERVIEWER_ROLE, FIELD_INTERVIEWER_ROLE } from '@/const/userCo
|
||||
import { RESULT_CODE_RESERVATION, RESULT_CODE_UNUSED } from '@/const/projectConst'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getNearestFutureDateTime } from '@/lib/datetime'
|
||||
import { useCtiLastCallHistId } from '@/hooks/useCtiLastCallHistId'
|
||||
import { getCurrentPositionMeta } from '@kri/common/browser'
|
||||
|
||||
const RefreshIconButton = ({ onRefresh, isFetching }: { onRefresh: () => void; isFetching: boolean }) => (
|
||||
<Button
|
||||
@@ -43,7 +46,7 @@ type ContactEventSectionProps = {
|
||||
showReservation?: boolean
|
||||
showInput?: boolean
|
||||
submitting: boolean
|
||||
onSubmit: (resultCd: number, memo: string, resveDt: string) => Promise<void>
|
||||
onSubmit: (resultCd: number, memo: string, resveDt: string, listCallHistIdx: number | null) => Promise<void>
|
||||
}
|
||||
|
||||
const EventHistoryList = ({
|
||||
@@ -118,8 +121,11 @@ const ContactEventSection = ({
|
||||
|
||||
const codes = resultCodes.filter((code) => code.resultCdTy === resultCodeType && code.resultCd !== RESULT_CODE_UNUSED)
|
||||
const isReservationSelected = resultCd === String(RESULT_CODE_RESERVATION)
|
||||
const isContactType = resultCodeType === ResultCodeType.CONTACT
|
||||
|
||||
const historyQuery = useListEventHistoryQuery(prjctIdx, sid, true)
|
||||
const ctiLastCallHistId = useCtiLastCallHistId()
|
||||
const listCallHistIdx = isContactType ? ctiLastCallHistId : null
|
||||
|
||||
const handleResultCdChange = (next: string) => {
|
||||
setResultCd(next)
|
||||
@@ -137,8 +143,11 @@ const ContactEventSection = ({
|
||||
alert('예약 날짜/시간을 선택해주세요.')
|
||||
return
|
||||
}
|
||||
if (isContactType && !listCallHistIdx) {
|
||||
if (!confirm('통화 기록이 없습니다. 계속 진행하시겠습니까?')) return
|
||||
}
|
||||
|
||||
await onSubmit(Number(resultCd), memo, isReservationSelected ? resveDt : '')
|
||||
await onSubmit(Number(resultCd), memo, isReservationSelected ? resveDt : '', listCallHistIdx)
|
||||
setMemo('')
|
||||
setResveDt('')
|
||||
}
|
||||
@@ -287,25 +296,35 @@ const ListContactEventPanel = ({
|
||||
}: ListContactEventPanelProps) => {
|
||||
const addListEventMutation = useAddListEventMutation(prjctIdx, sid)
|
||||
const reserveMutation = useReserveMutation(prjctIdx, sid)
|
||||
const internalInfoQuery = useInternalInfoQuery()
|
||||
const showContactInput = userRole !== FIELD_INTERVIEWER_ROLE
|
||||
const showInterviewInput = userRole !== CONTACT_INTERVIEWER_ROLE
|
||||
|
||||
const handleAddEvent = (resultCodeType: ResultCodeType) => async (resultCd: number, memo: string, resveDt: string) => {
|
||||
await addListEventMutation.mutateAsync({
|
||||
prjctIdx,
|
||||
sid: Number(sid),
|
||||
resultCodeType,
|
||||
resultCd,
|
||||
memo,
|
||||
})
|
||||
const handleAddEvent =
|
||||
(resultCodeType: ResultCodeType) =>
|
||||
async (resultCd: number, memo: string, resveDt: string, listCallHistIdx: number | null) => {
|
||||
const geoMeta = await getCurrentPositionMeta()
|
||||
|
||||
if (resveDt) {
|
||||
await reserveMutation.mutateAsync({ prjctIdx, sid: Number(sid), userId, resveDt })
|
||||
await addListEventMutation.mutateAsync({
|
||||
prjctIdx,
|
||||
sid: Number(sid),
|
||||
resultCodeType,
|
||||
resultCd,
|
||||
listCallHistIdx,
|
||||
meta: {
|
||||
...geoMeta,
|
||||
remoteAddr: internalInfoQuery.data?.clientIp,
|
||||
},
|
||||
memo,
|
||||
})
|
||||
|
||||
if (resveDt) {
|
||||
await reserveMutation.mutateAsync({ prjctIdx, sid: Number(sid), userId, resveDt })
|
||||
}
|
||||
|
||||
alert('등록되었습니다.')
|
||||
}
|
||||
|
||||
alert('등록되었습니다.')
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="h-[80vh] space-y-4 overflow-y-auto pr-1">
|
||||
<ContactEventSection
|
||||
|
||||
Reference in New Issue
Block a user