develop #50

Merged
gitadmin merged 2 commits from develop into master 2026-10-15 07:44:58 +09:00
8 changed files with 264 additions and 214 deletions

View File

@@ -174,12 +174,13 @@ const ListContactPageContent = () => {
return (
<div className="space-y-6 text-sm">
<div className="flex items-center gap-3 w-1/2 pr-5">
{/* lg 미만은 아래 패널이 1열이므로 전체 폭을 쓰고, 한 줄에 들어가도록 글자/간격을 줄인다. */}
<div className="flex w-full items-center gap-2 lg:w-1/2 lg:gap-3 lg:pr-5">
<Button type="button" variant="outline" size="icon" onClick={handleGoToListManage} aria-label="목록으로">
<ArrowLeft className="h-4 w-4" />
</Button>
<h1 className="text-2xl font-bold tracking-tight">컨택 진행</h1>
<span className="text-2xl font-bold tracking-tight">SID: {sid}</span>
<h1 className="text-xl font-bold tracking-tight max-lg:whitespace-nowrap lg:text-2xl">컨택 진행</h1>
<span className="text-xl font-bold tracking-tight max-lg:min-w-0 max-lg:truncate lg:text-2xl">SID: {sid}</span>
<Button
type="button"
variant="ghost"

View File

@@ -336,6 +336,7 @@ const ListManagePage = () => {
initialSearchState={restoredForThisProject}
onSearchStateChange={setSearchUiState}
focusRowId={restoredForThisProject?.sid}
collapsibleFiltersOnMobile
/>
{isInternal && (

View File

@@ -48,69 +48,79 @@ export function AppHeader({
const ctiConnectionStatus = useCtiConnectionStatus();
const isCtiConnected = ctiConnectionStatus === "open";
const showProjectTitle = isViewProjectTitle && !!projectName;
return (
<KriHeader
logo={
<div className="flex h-10 w-20 items-center justify-center">
<Image
src="/kri_logo.png"
alt="KRI 로고"
width={120}
height={40}
className="object-contain"
priority
/>
</div>
}
homePath="/"
menus={isContactPage? []:topMenus}
activeMenuId={activeTopId}
menuOpen={menuOpen}
showMenuButton={!isMain && !isContactPage}
onToggleMenu={onToggleMenu}
onNavigate={(path) => {if(!isContactPage) onNavigate(path)}}
className="border-gray-200 bg-white"
innerClassName="h-16 px-4"
center={
isViewProjectTitle && projectName ? (
<h1 className="ml-3 text-2xl font-bold">{projectName}</h1>
) : null
}
right={
<>
<div className="flex items-center gap-1 border-r pr-4">
<Button variant="ghost" size="icon" onClick={decreaseFontSize} title="폰트 작게">
<ZoomOut className="h-4 w-4" />
</Button>
<span className="min-w-[3rem] text-center text-xs text-gray-500">{fontSize}px</span>
<Button variant="ghost" size="icon" onClick={increaseFontSize} title="폰트 크게">
<ZoomIn className="h-4 w-4" />
</Button>
<>
<KriHeader
logo={
<div className="flex h-10 w-20 items-center justify-center">
<Image
src="/kri_logo.png"
alt="KRI 로고"
width={120}
height={40}
className="object-contain"
priority
/>
</div>
<Button variant="ghost" size="icon-lg" onClick={onOpenReserveSearch} title="예약 내역 조회">
<CalendarClock className="size-6" />
</Button>
<span className="hidden items-center gap-1.5 text-sm text-gray-600 sm:inline-flex">
{userInfo?.userName || ""}
{seatNo ? (
<span className="inline-flex items-center gap-1">
{`(${seatNo})`}
<span
className={cn(
"inline-block h-2 w-2 rounded-full",
isCtiConnected ? "bg-green-500" : "bg-red-500",
)}
title={isCtiConnected ? "CTI 연결됨" : "CTI 연결 안됨"}
/>
</span>
) : null}
</span>
<Button variant="ghost" size="sm" className="gap-2" onClick={() => onNavigate("/logout")}>
<LogOut className="h-4 w-4" />
<span className="hidden sm:inline">로그아웃</span>
</Button>
</>
}
/>
}
homePath="/"
menus={isContactPage? []:topMenus}
activeMenuId={activeTopId}
menuOpen={menuOpen}
showMenuButton={!isMain && !isContactPage}
onToggleMenu={onToggleMenu}
onNavigate={(path) => {if(!isContactPage) onNavigate(path)}}
className="border-gray-200 bg-white"
innerClassName="h-16 px-4"
center={
showProjectTitle ? (
<h1 className="ml-3 hidden truncate text-2xl font-bold lg:block" title={projectName}>{projectName}</h1>
) : null
}
right={
<>
<div className="flex items-center gap-1 border-r pr-4">
<Button variant="ghost" size="icon" onClick={decreaseFontSize} title="폰트 작게">
<ZoomOut className="h-4 w-4" />
</Button>
<span className="min-w-[3rem] text-center text-xs text-gray-500">{fontSize}px</span>
<Button variant="ghost" size="icon" onClick={increaseFontSize} title="폰트 크게">
<ZoomIn className="h-4 w-4" />
</Button>
</div>
<Button variant="ghost" size="icon-lg" onClick={onOpenReserveSearch} title="예약 내역 조회">
<CalendarClock className="size-6" />
</Button>
<span className="hidden items-center gap-1.5 text-sm text-gray-600 sm:inline-flex">
{userInfo?.userName || ""}
{seatNo ? (
<span className="inline-flex items-center gap-1">
{`(${seatNo})`}
<span
className={cn(
"inline-block h-2 w-2 rounded-full",
isCtiConnected ? "bg-green-500" : "bg-red-500",
)}
title={isCtiConnected ? "CTI 연결됨" : "CTI 연결 안됨"}
/>
</span>
) : null}
</span>
<Button variant="ghost" size="sm" className="gap-2" onClick={() => onNavigate("/logout")}>
<LogOut className="h-4 w-4" />
<span className="hidden sm:inline">로그아웃</span>
</Button>
</>
}
/>
{/* 모바일(lg 미만)은 헤더 공간이 좁아 프로젝트명을 헤더 아래 한 줄로 내려 표시한다. */}
{showProjectTitle ? (
<div className="border-b border-gray-200 bg-white px-4 py-2 lg:hidden">
<h1 className="truncate text-center text-lg font-bold" title={projectName}>{projectName}</h1>
</div>
) : null}
</>
);
}

View File

@@ -154,6 +154,11 @@ export default function AppMainLayout({ children, initialFontSize }: AppMainLayo
setFontSize(Math.min(FONT_SIZE.MAX, fontSize + 2));
};
// 모바일(lg 미만)에서는 사이드바가 본문을 덮는 오버레이라 메뉴를 접힌 상태로 시작한다.
useEffect(() => {
if (!window.matchMedia("(min-width: 64rem)").matches) setMenuOpen(false);
}, []);
useEffect(() => {
if (!mounted) return;

View File

@@ -79,7 +79,7 @@ const FieldRow = ({ label, editable, children }: { label: string; editable?: boo
<Label
className={cn(
'w-24 shrink-0 rounded-md px-2 py-2.5 text-sm font-bold text-foreground',
editable && 'bg-blue-100 text-black',
editable && 'bg-blue-100',
)}
>
{label}
@@ -215,44 +215,47 @@ const ListContactInfoPanel = ({
if (header.listHderTy === ListHeaderConst.TEL_NUM) {
return (
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
<div className="flex gap-2">
{/* 모바일(md 미만)은 버튼을 입력란 아래 줄로 내린다. */}
<div className="flex flex-col gap-2 md:flex-row">
<Input
value={formatKoreanPhoneNumber(value)}
readOnly={!editable}
onChange={(e) => onChange(e.target.value.replace(/\D/g, ''))}
className={readOnlyContrastClass}
/>
<Button
type="button"
variant="outline"
className={cn('shrink-0 gap-2', isOnCall && 'bg-accent text-accent-foreground')}
disabled={isEditing || !isCtiReady || isDialing}
title={getCallButtonTitle(isCtiReady, isDialing)}
onClick={() => handleCall(value, header.listHderId)}
>
<Phone className="h-4 w-4" />
{getCallButtonLabel(isDialing, isOnCall)}
</Button>
<Button
type="button"
variant="outline"
className="shrink-0 gap-2"
disabled={isEditing}
onClick={() => handleSend('sms', header.listHderId)}
>
<MessageSquare className="h-4 w-4" />
발송
</Button>
<Button
type="button"
variant="outline"
className="shrink-0 gap-2"
disabled={isEditing}
onClick={() => handleSend('kko', header.listHderId)}
>
<MessageCircle className="h-4 w-4" />
알림톡
</Button>
<div className="flex shrink-0 flex-wrap gap-2">
<Button
type="button"
variant="outline"
className={cn('shrink-0 gap-2', isOnCall && 'bg-accent text-accent-foreground')}
disabled={isEditing || !isCtiReady || isDialing}
title={getCallButtonTitle(isCtiReady, isDialing)}
onClick={() => handleCall(value, header.listHderId)}
>
<Phone className="h-4 w-4" />
{getCallButtonLabel(isDialing, isOnCall)}
</Button>
<Button
type="button"
variant="outline"
className="shrink-0 gap-2"
disabled={isEditing}
onClick={() => handleSend('sms', header.listHderId)}
>
<MessageSquare className="h-4 w-4" />
발송
</Button>
<Button
type="button"
variant="outline"
className="shrink-0 gap-2"
disabled={isEditing}
onClick={() => handleSend('kko', header.listHderId)}
>
<MessageCircle className="h-4 w-4" />
알림톡
</Button>
</div>
</div>
{(isDialing || isOnCall) &&
<p className="text-sm text-red-600 font-medium mt-1">
@@ -266,23 +269,25 @@ const ListContactInfoPanel = ({
if (header.listHderTy === ListHeaderConst.EMAIL) {
return (
<FieldRow key={header.listHderId} label={header.listHderNm} editable={canEditField}>
<div className="flex gap-2">
<div className="flex flex-col gap-2 md:flex-row">
<Input
value={value}
readOnly={!editable}
onChange={(e) => onChange(e.target.value)}
className={readOnlyContrastClass}
/>
<Button
type="button"
variant="outline"
className="shrink-0 gap-2"
disabled={isEditing}
onClick={() => handleSend('email', header.listHderId)}
>
<Mail className="h-4 w-4" />
발송
</Button>
<div className="flex shrink-0 gap-2">
<Button
type="button"
variant="outline"
className="shrink-0 gap-2"
disabled={isEditing}
onClick={() => handleSend('email', header.listHderId)}
>
<Mail className="h-4 w-4" />
발송
</Button>
</div>
</div>
</FieldRow>
)
@@ -367,14 +372,17 @@ const ListContactInfoPanel = ({
return (
<FieldRow key={survey.prjctSurveyIdx ?? survey.surveyOrder} label={survey.surveyName || 'Web'}>
<div className="flex items-center gap-2">
<Button type="button" className="gap-2" disabled={isEditing} onClick={() => handleStartSurvey(survey)}>
조사 시작
</Button>
<Button type="button" variant="outline" className="gap-2" disabled={isEditing} onClick={() => handleShowQr(survey)}>
<QrCode className="h-4 w-4" />
QR
</Button>
{/* 모바일(md 미만)은 응답 상태를 버튼 아래 줄로 내린다. */}
<div className="flex flex-col items-start gap-2 md:flex-row md:items-center">
<div className="flex items-center gap-2">
<Button type="button" className="gap-2" disabled={isEditing} onClick={() => handleStartSurvey(survey)}>
조사 시작
</Button>
<Button type="button" variant="outline" className="gap-2" disabled={isEditing} onClick={() => handleShowQr(survey)}>
<QrCode className="h-4 w-4" />
QR
</Button>
</div>
{hasSurveyResponse ? (
<span className="text-sm">
[{resultCodes.find((rc) => rc.resultCdTy === ResultCodeType.SURVEY && rc.resultCd === result.lastResultCd)

View File

@@ -2,7 +2,8 @@
import { useCallback, useEffect, useMemo, useRef, useState, type ClipboardEvent, type ReactNode } from 'react'
import type { PaginationState, SortingState } from '@tanstack/react-table'
import { Funnel, PencilLine } from 'lucide-react'
import { ChevronDown, Funnel, PencilLine } from 'lucide-react'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Popover, PopoverAnchor, PopoverContent } from '@/components/ui/popover'
@@ -13,6 +14,7 @@ import KriDateRangePicker, { type KriDateRange } from '@/components/common/KriDa
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'
import { cn } from '@/lib/utils'
import { useListSearchQuery, useUpdateListMutation } from '@/query/list'
import { getListColumns, LIST_IS_USE_LABEL, type ListTableRow } from '@/components/table-column/ListTableColumn'
import { useAssignTargetRows } from '@/components/assign/AssignTargetList'
@@ -72,6 +74,8 @@ export type ListSearchTableProps = {
initialSearchState?: ListSearchUiState
onSearchStateChange?: (state: ListSearchUiState) => void
focusRowId?: string
/** 모바일(md 미만)에서 기본 검색 필터를 1열로 쌓고 접기/펼치기 토글을 노출한다. */
collapsibleFiltersOnMobile?: boolean
}
const toSidSet = (value: string) =>
@@ -197,8 +201,10 @@ export function ListSearchTable({
initialSearchState,
onSearchStateChange,
focusRowId,
collapsibleFiltersOnMobile = false,
}: ListSearchTableProps) {
const { showDialog } = useDialog()
const [filtersOpen, setFiltersOpen] = useState(true)
const [searchText, setSearchText] = useState(initialSearchState?.searchText ?? '')
const [showSidHangulHint, setShowSidHangulHint] = useState(false)
const [searchContactResult, setSearchContactResult] = useState<string[]>(initialSearchState?.searchContactResult ?? [])
@@ -696,88 +702,132 @@ export function ListSearchTable({
resetToFirstPage()
}, [externalAssignFilter])
// md 이상에서는 기존 클래스와 동일하게 렌더링되도록 모바일 전용 값만 분기한다.
const filterRowClassName = collapsibleFiltersOnMobile
? 'flex flex-col gap-2 md:flex-row md:flex-wrap md:items-center'
: 'flex items-center gap-2 flex-wrap'
const filterItemClassName = collapsibleFiltersOnMobile
? 'w-full md:w-auto md:flex-1 md:min-w-0 md:max-w-xs'
: 'flex-1 min-w-0 max-w-xs'
const dateFilterClassName = collapsibleFiltersOnMobile
? 'w-full md:w-auto md:flex-1 md:min-w-[240px] md:max-w-xs'
: 'flex-1 min-w-[240px] max-w-xs'
const surveyFilterClassName = collapsibleFiltersOnMobile
? 'w-full md:w-auto md:flex-1 md:min-w-[180px] md:max-w-xs'
: 'flex-1 min-w-[180px] max-w-xs'
// 접힌 상태에서도 기본 검색 조건 적용 여부를 알 수 있도록 토글 버튼에 표시한다.
const hasActiveFilters =
searchText.trim().length > 0 ||
searchContactResult.length > 0 ||
Boolean(searchContactDateRange.from || searchContactDateRange.to) ||
(fieldInterviewEnabled && searchInterviewResult.length > 0) ||
Object.values(surveyResultSelections).some((values) => values.length > 0)
return (
<div className="space-y-2">
<div className="space-y-2">
<div className="flex items-center gap-2 flex-wrap">
<div className="flex-1 min-w-0 max-w-xs">
<Popover open={showSidHangulHint}>
<PopoverAnchor asChild>
<Input
placeholder="SID 검색"
className="h-9 bg-white w-full"
value={searchText}
onChange={(e) => handleSearchTextChange(e.target.value)}
onPaste={handleSidPaste}
/>
</PopoverAnchor>
<PopoverContent
align="start"
className="w-auto p-2 text-xs text-destructive"
onOpenAutoFocus={(e) => e.preventDefault()}
>
한글은 입력할 수 없습니다. 한/영 전환 후 영문·숫자로 입력해 주세요.
</PopoverContent>
</Popover>
</div>
<div className="flex-1 min-w-0 max-w-xs">
<KriMultiSelect
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.CONTACT)}
value={searchContactResult}
onChange={handleContactResultChange}
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">
{collapsibleFiltersOnMobile ? (
<Button
type="button"
variant="outline"
className="w-full justify-between md:hidden"
aria-expanded={filtersOpen}
aria-controls="list-search-filters"
onClick={() => setFiltersOpen((prev) => !prev)}
>
<span className="flex items-center gap-2">
검색 조건
{hasActiveFilters ? <Badge>적용 중</Badge> : null}
</span>
<ChevronDown className={cn('h-4 w-4 transition-transform', filtersOpen && 'rotate-180')} />
</Button>
) : null}
<div
id="list-search-filters"
className={cn('space-y-2', collapsibleFiltersOnMobile && !filtersOpen && 'hidden md:block')}
>
<div className={filterRowClassName}>
<div className={filterItemClassName}>
<Popover open={showSidHangulHint}>
<PopoverAnchor asChild>
<Input
placeholder="SID 검색"
className="h-9 bg-white w-full"
value={searchText}
onChange={(e) => handleSearchTextChange(e.target.value)}
onPaste={handleSidPaste}
/>
</PopoverAnchor>
<PopoverContent
align="start"
className="w-auto p-2 text-xs text-destructive"
onOpenAutoFocus={(e) => e.preventDefault()}
>
한글은 입력할 수 없습니다. 한/영 전환 후 영문·숫자로 입력해 주세요.
</PopoverContent>
</Popover>
</div>
<div className={filterItemClassName}>
<KriMultiSelect
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.INTERVIEW)}
value={searchInterviewResult}
onChange={handleInterviewResultChange}
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.CONTACT)}
value={searchContactResult}
onChange={handleContactResultChange}
getValue={(item) => String(item.resultCd)}
getLabel={(item) => item.resultCdLbl}
placeholder="면접 결과"
placeholder="컨택 결과"
widthClassName="w-full"
heightClassName="h-9"
/>
</div>
<KriDateRangePicker
value={searchContactDateRange}
onChange={(range) => {
setSearchContactDateRange(range)
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
}}
placeholder="컨택 일자"
className={dateFilterClassName}
/>
{fieldInterviewEnabled ? (
<div className={filterItemClassName}>
<KriMultiSelect
items={resultCodes.filter((item) => item.resultCdTy === ResultCodeType.INTERVIEW)}
value={searchInterviewResult}
onChange={handleInterviewResultChange}
getValue={(item) => String(item.resultCd)}
getLabel={(item) => item.resultCdLbl}
placeholder="면접 결과"
widthClassName="w-full"
heightClassName="h-9"
/>
</div>
) : null}
</div>
{surveys.length > 0 ? (
<div className={filterRowClassName}>
{surveys
.filter((survey) => survey.prjctSurveyIdx != null)
.map((survey) => (
<div key={survey.prjctSurveyIdx} className={surveyFilterClassName}>
<KriMultiSelect
items={surveyResultCodeOptions}
value={surveyResultSelections[survey.prjctSurveyIdx as number] ?? []}
onChange={(value) => handleChangeSurveyResult(survey.prjctSurveyIdx as number, value)}
getValue={(item) => String(item.resultCd)}
getLabel={(item) => item.resultCdLbl}
placeholder={`${survey.surveyName} 결과`}
widthClassName="w-full"
heightClassName="h-9"
/>
</div>
))}
</div>
) : null}
</div>
{surveys.length > 0 ? (
<div className="flex items-center gap-2 flex-wrap">
{surveys
.filter((survey) => survey.prjctSurveyIdx != null)
.map((survey) => (
<div key={survey.prjctSurveyIdx} className="flex-1 min-w-[180px] max-w-xs">
<KriMultiSelect
items={surveyResultCodeOptions}
value={surveyResultSelections[survey.prjctSurveyIdx as number] ?? []}
onChange={(value) => handleChangeSurveyResult(survey.prjctSurveyIdx as number, value)}
getValue={(item) => String(item.resultCd)}
getLabel={(item) => item.resultCdLbl}
placeholder={`${survey.surveyName} 결과`}
widthClassName="w-full"
heightClassName="h-9"
/>
</div>
))}
</div>
) : null}
<div className="flex items-center gap-2 flex-wrap justify-between">
<div className="flex items-center gap-2 flex-wrap">
<Button type="button" variant="outline" className="gap-2" onClick={() => showDialog('listFilterDialog')}>

View File

@@ -43,30 +43,10 @@ export function useCtiConnection() {
// 뒤로/앞으로 가기로 bfcache에 들어갔다가 돌아오면 React 상태가 그대로 복원되어 위 effect가 다시 실행되지 않는다.
// 떠날 때 CTI 서버에 Logout, 돌아올 때 다시 Login 하여 새로고침 없이 전화걸기를 쓸 수 있게 한다.
useEffect(() => {
// TEMP_CTI_LOG: pagehide 시점 로그가 콘솔에 남지 않아, 떠날 때 정보를 sessionStorage에 남기고 돌아오거나 다시 로드될 때 출력한다.
const PAGEHIDE_DEBUG_KEY = "__cti_pagehide_debug"; // TEMP_CTI_LOG
const printLastPageHide = (from: string) => {
const saved = sessionStorage.getItem(PAGEHIDE_DEBUG_KEY);
if (!saved) return;
console.log(`[CTI][TEMP_LOG] last pagehide (${from}) ->`, JSON.parse(saved)); // TEMP_CTI_LOG
sessionStorage.removeItem(PAGEHIDE_DEBUG_KEY);
};
printLastPageHide("mount");
console.log("[CTI][TEMP_LOG] page lifecycle listeners registered"); // TEMP_CTI_LOG
const handlePageHide = (event: PageTransitionEvent) => {
console.log("[CTI][TEMP_LOG] pagehide, persisted =", event.persisted); // TEMP_CTI_LOG
sessionStorage.setItem(PAGEHIDE_DEBUG_KEY, JSON.stringify({
persisted: event.persisted,
at: new Date().toISOString(),
path: window.location.pathname,
connectionState: ctiClient.getConnectionState(),
})); // TEMP_CTI_LOG
if (event.persisted) ctiClient.suspendForPageHide();
};
const handlePageShow = (event: PageTransitionEvent) => {
console.log("[CTI][TEMP_LOG] pageshow, persisted =", event.persisted); // TEMP_CTI_LOG
printLastPageHide("pageshow");
if (event.persisted) ctiClient.resumeFromPageShow();
};

View File

@@ -769,12 +769,8 @@ const connectAndLogin = (params: CtiLoginParams) => {
const suspendForPageHide = () => {
if (!currentLoginParams) return;
stopReconnectLoop();
if (currentAgentLoginId && connectionState === "open") {
if (isCallInProgress()) {
console.log("[CTI][TEMP_LOG] pagehide logout skipped, call is in progress"); // TEMP_CTI_LOG
} else {
send({ ZCommand: "Logout", AgentLoginID: currentAgentLoginId });
}
if (currentAgentLoginId && connectionState === "open" && !isCallInProgress()) {
send({ ZCommand: "Logout", AgentLoginID: currentAgentLoginId });
}
teardownSocket();
};
@@ -784,7 +780,6 @@ const resumeFromPageShow = () => {
const params = currentLoginParams;
if (!params) return;
if (connectionState === "open" || connectionState === "connecting") return;
console.log("[CTI][TEMP_LOG] pageshow resume, reconnecting"); // TEMP_CTI_LOG
connectAndLogin(params);
};