260716_01_ENH: 본 서버에서 기동 후 중간 테스트를 위한 커밋
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { ReactNode, useEffect, useMemo, useState } from "react";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import { getCurrentPositionMeta } from "@kri/common/browser";
|
||||
import { KriMainLayout } from "@/components/layout/KriMainLayout";
|
||||
import { AppHeader } from "@/components/app-shell/AppHeader";
|
||||
import { AppSidebar } from "@/components/app-shell/AppSidebar";
|
||||
@@ -155,6 +156,13 @@ export default function AppMainLayout({ children, initialFontSize }: AppMainLayo
|
||||
}
|
||||
}, [auth.user, mounted, router]);
|
||||
|
||||
// 컨택결과 저장 시점에 GPS 권한 프롬프트가 뜨면 저장이 지연/누락될 수 있어,
|
||||
// 로그인 후 메인 진입 시점에 미리 권한을 받아 위치를 캐시해둔다(결과는 사용하지 않음).
|
||||
useEffect(() => {
|
||||
if (!mounted || !auth.user) return;
|
||||
void getCurrentPositionMeta();
|
||||
}, [mounted, auth.user]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!mounted || !auth.user || hasRouteAccess) return;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import type { ReactNode } from 'react'
|
||||
import { useAtomValue } from 'jotai'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import {
|
||||
Dialog,
|
||||
@@ -12,6 +13,7 @@ import {
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { loadingAtom } from '@/store/jotai/loading'
|
||||
|
||||
export interface KriDialogProps {
|
||||
open: boolean
|
||||
@@ -42,6 +44,8 @@ export function KriDialog({
|
||||
bodyClassName,
|
||||
footerClassName,
|
||||
}: KriDialogProps) {
|
||||
const isLoading = useAtomValue(loadingAtom)
|
||||
|
||||
const renderFooter = () => {
|
||||
if (footer !== undefined) {
|
||||
if (footer === null) return null
|
||||
@@ -63,7 +67,16 @@ export function KriDialog({
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className={contentClassName} showCloseButton={showCloseButton}>
|
||||
<DialogContent
|
||||
className={contentClassName}
|
||||
showCloseButton={showCloseButton}
|
||||
onInteractOutside={(e) => {
|
||||
if (isLoading) e.preventDefault()
|
||||
}}
|
||||
onEscapeKeyDown={(e) => {
|
||||
if (isLoading) e.preventDefault()
|
||||
}}
|
||||
>
|
||||
<DialogHeader>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
{description ? <DialogDescription>{description}</DialogDescription> : null}
|
||||
|
||||
@@ -18,6 +18,9 @@ export function KriLoadingOverlay({ open, label = '로딩 중', className, spinn
|
||||
aria-live="polite"
|
||||
aria-label={label}
|
||||
className={cn('fixed inset-0 z-[9999] flex items-center justify-center bg-black/70', className)}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onMouseDown={(e) => e.stopPropagation()}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className={cn('size-12 animate-spin rounded-full border-4 border-gray-400 border-t-white', spinnerClassName)} />
|
||||
<span className="sr-only">{label}</span>
|
||||
|
||||
@@ -74,6 +74,10 @@ export function DataTable<TData, TValue = unknown>({
|
||||
|
||||
const pagination = isClient ? internalPagination : (externalPagination ?? internalPagination)
|
||||
|
||||
useEffect(() => {
|
||||
setRowSelection({})
|
||||
}, [pagination.pageIndex, pagination.pageSize, sorting])
|
||||
|
||||
const handlePaginationChange = useCallback<OnChangeFn<PaginationState>>(
|
||||
(updater) => {
|
||||
if (isClient) {
|
||||
@@ -193,7 +197,7 @@ export function DataTable<TData, TValue = unknown>({
|
||||
onClick={drag.wrapClick(() => handleRowClick(row))}
|
||||
onDoubleClick={onRowDoubleClick ? () => handleRowDoubleClick(row) : undefined}
|
||||
className={cn(
|
||||
'text-base [&>td]:px-2 [&>td]:py-0',
|
||||
'text-base [&>td]:px-2 [&>td]:py-1',
|
||||
(selectMode !== 'none' || onRowDoubleClick) && 'cursor-pointer',
|
||||
'data-[state=selected]:bg-muted data-[state=selected]:font-semibold',
|
||||
highlightRowIds?.includes(row.id) && 'bg-emerald-50',
|
||||
|
||||
@@ -16,12 +16,12 @@ interface DataTablePaginationProps<TData> {
|
||||
}
|
||||
|
||||
export function DataTablePagination<TData>({
|
||||
table,
|
||||
isClient,
|
||||
totalCount,
|
||||
pageSizeOptions,
|
||||
paginationItemsToDisplay,
|
||||
}: DataTablePaginationProps<TData>) {
|
||||
table,
|
||||
isClient,
|
||||
totalCount,
|
||||
pageSizeOptions,
|
||||
paginationItemsToDisplay,
|
||||
}: DataTablePaginationProps<TData>) {
|
||||
'use no memo'
|
||||
|
||||
const currentPage = table.getState().pagination.pageIndex + 1
|
||||
@@ -33,66 +33,66 @@ export function DataTablePagination<TData>({
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-3 p-2 pt-0 max-sm:flex-col">
|
||||
<p className="text-muted-foreground flex-1 whitespace-nowrap text-sm" aria-live="polite">
|
||||
Page <span className="text-foreground">{currentPage}</span> of{' '}
|
||||
<span className="text-foreground">{pageCount}</span>
|
||||
{!isClient && totalCount > 0 ? (
|
||||
<span className="ml-2">(총 <span className="text-foreground">{totalCount}</span>건)</span>
|
||||
) : null}
|
||||
</p>
|
||||
<div className="flex items-center justify-between gap-3 p-2 pt-0 max-sm:flex-col">
|
||||
<p className="text-muted-foreground flex-1 whitespace-nowrap text-sm" aria-live="polite">
|
||||
Page <span className="text-foreground">{currentPage}</span> of{' '}
|
||||
<span className="text-foreground">{pageCount}</span>
|
||||
{!isClient && totalCount > 0 ? (
|
||||
<span className="ml-2">(총 <span className="text-foreground">{totalCount}</span>건)</span>
|
||||
) : null}
|
||||
</p>
|
||||
|
||||
<div className="grow">
|
||||
<Pagination>
|
||||
<PaginationContent>
|
||||
<PaginationItem>
|
||||
<Button size="icon" variant="outline" onClick={() => table.firstPage()} disabled={!table.getCanPreviousPage()} aria-label="첫 페이지">
|
||||
<ChevronsLeftIcon aria-hidden="true" />
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
<PaginationItem>
|
||||
<Button size="icon" variant="outline" onClick={() => table.previousPage()} disabled={!table.getCanPreviousPage()} aria-label="이전 페이지">
|
||||
<ChevronLeftIcon aria-hidden="true" />
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
{showLeftEllipsis ? <PaginationItem><PaginationEllipsis /></PaginationItem> : null}
|
||||
{pages.map((page) => (
|
||||
<PaginationItem key={page}>
|
||||
<Button
|
||||
size="icon"
|
||||
variant={page === currentPage ? 'default' : 'ghost'}
|
||||
onClick={() => table.setPageIndex(page - 1)}
|
||||
aria-current={page === currentPage ? 'page' : undefined}
|
||||
>
|
||||
{page}
|
||||
<div className="grow">
|
||||
<Pagination>
|
||||
<PaginationContent>
|
||||
<PaginationItem>
|
||||
<Button size="icon" variant="outline" onClick={() => table.firstPage()} disabled={!table.getCanPreviousPage()} aria-label="첫 페이지">
|
||||
<ChevronsLeftIcon aria-hidden="true" />
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
))}
|
||||
{showRightEllipsis ? <PaginationItem><PaginationEllipsis /></PaginationItem> : null}
|
||||
<PaginationItem>
|
||||
<Button size="icon" variant="outline" onClick={() => table.nextPage()} disabled={!table.getCanNextPage()} aria-label="다음 페이지">
|
||||
<ChevronRightIcon aria-hidden="true" />
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
<PaginationItem>
|
||||
<Button size="icon" variant="outline" onClick={() => table.lastPage()} disabled={!table.getCanNextPage()} aria-label="마지막 페이지">
|
||||
<ChevronsRightIcon aria-hidden="true" />
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
</PaginationContent>
|
||||
</Pagination>
|
||||
</div>
|
||||
<PaginationItem>
|
||||
<Button size="icon" variant="outline" onClick={() => table.previousPage()} disabled={!table.getCanPreviousPage()} aria-label="이전 페이지">
|
||||
<ChevronLeftIcon aria-hidden="true" />
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
{showLeftEllipsis ? <PaginationItem><PaginationEllipsis /></PaginationItem> : null}
|
||||
{pages.map((page) => (
|
||||
<PaginationItem key={page}>
|
||||
<Button
|
||||
size="icon"
|
||||
variant={page === currentPage ? 'default' : 'ghost'}
|
||||
onClick={() => table.setPageIndex(page - 1)}
|
||||
aria-current={page === currentPage ? 'page' : undefined}
|
||||
>
|
||||
{page}
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
))}
|
||||
{showRightEllipsis ? <PaginationItem><PaginationEllipsis /></PaginationItem> : null}
|
||||
<PaginationItem>
|
||||
<Button size="icon" variant="outline" onClick={() => table.nextPage()} disabled={!table.getCanNextPage()} aria-label="다음 페이지">
|
||||
<ChevronRightIcon aria-hidden="true" />
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
<PaginationItem>
|
||||
<Button size="icon" variant="outline" onClick={() => table.lastPage()} disabled={!table.getCanNextPage()} aria-label="마지막 페이지">
|
||||
<ChevronsRightIcon aria-hidden="true" />
|
||||
</Button>
|
||||
</PaginationItem>
|
||||
</PaginationContent>
|
||||
</Pagination>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-1 justify-end">
|
||||
<Select value={String(table.getState().pagination.pageSize)} onValueChange={(value) => table.setPageSize(Number(value))}>
|
||||
<SelectTrigger className="w-fit whitespace-nowrap" aria-label="페이지당 개수">
|
||||
<SelectValue placeholder="페이지당 개수" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{pageSizeOptions.map((size) => <SelectItem key={size} value={String(size)}>{size} / page</SelectItem>)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex flex-1 justify-end">
|
||||
<Select value={String(table.getState().pagination.pageSize)} onValueChange={(value) => table.setPageSize(Number(value))}>
|
||||
<SelectTrigger className="w-fit whitespace-nowrap" aria-label="페이지당 개수">
|
||||
<SelectValue placeholder="페이지당 개수" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{pageSizeOptions.map((size) => <SelectItem key={size} value={String(size)}>{size} / page</SelectItem>)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Plus, X } from 'lucide-react'
|
||||
import { KriDialog } from '@/components/common/KriDialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
@@ -12,12 +12,19 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from '@/components/ui/select'
|
||||
import { KriSingleSelect } from '@/components/common/KriAutoComplete'
|
||||
import ApplyFilterOption from './ListDialogOption/ApplyFilterOption'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import type { DialogId } from '@/store/jotai/dialog'
|
||||
import type { FilterValueOption, ListFilterTarget } from '@/types/list'
|
||||
import { type ResultCode, ResultCodeType } from '@/types/project'
|
||||
import { ListHeaderConst, LIST_BATCH_EDIT_FILE_DELETE_VALUE } from '@/const/listConst'
|
||||
|
||||
export type BatchEditOption = {
|
||||
id: number
|
||||
label: string
|
||||
listHderTy: number
|
||||
valueOptions?: FilterValueOption[]
|
||||
}
|
||||
|
||||
export type BatchEditRow = {
|
||||
@@ -26,57 +33,74 @@ export type BatchEditRow = {
|
||||
value: string
|
||||
}
|
||||
|
||||
export type BatchEditResultCodes = Partial<Record<ResultCodeType, number>>
|
||||
|
||||
export type BatchEditPayload = {
|
||||
rows: BatchEditRow[]
|
||||
resultCodes: BatchEditResultCodes
|
||||
target: ListFilterTarget
|
||||
}
|
||||
|
||||
export type ListBatchEditDialogProps = {
|
||||
dialogId?: DialogId
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
appliedFilters?: Record<number, string[]>
|
||||
headerOptions: BatchEditOption[]
|
||||
resultCodes: ResultCode[]
|
||||
filterSummary?: string[]
|
||||
initialRows?: BatchEditRow[]
|
||||
onConfirm: (rows: BatchEditRow[]) => void | Promise<void>
|
||||
initialResultCodes?: BatchEditResultCodes
|
||||
onConfirm: (payload: BatchEditPayload) => void | Promise<void>
|
||||
}
|
||||
|
||||
const createRow = (headerId: number): BatchEditRow => ({
|
||||
const createRow = (headerId: number, value = ''): BatchEditRow => ({
|
||||
id: crypto.randomUUID(),
|
||||
headerId,
|
||||
value: '',
|
||||
value,
|
||||
})
|
||||
|
||||
const NO_CHANGE = '__no_change__'
|
||||
|
||||
const resultCodeGroups: { type: ResultCodeType; label: string }[] = [
|
||||
{ type: ResultCodeType.CONTACT, label: '컨택 결과' },
|
||||
{ type: ResultCodeType.INTERVIEW, label: '면접 결과' },
|
||||
{ type: ResultCodeType.SURVEY, label: '설문 결과' },
|
||||
]
|
||||
|
||||
const ListBatchEditDialog = ({
|
||||
dialogId = 'listBatchEditDialog',
|
||||
open,
|
||||
onOpenChange,
|
||||
appliedFilters = {},
|
||||
headerOptions,
|
||||
resultCodes,
|
||||
filterSummary,
|
||||
initialRows = [],
|
||||
initialResultCodes = {},
|
||||
onConfirm,
|
||||
}: ListBatchEditDialogProps) => {
|
||||
const { isDialogOpen, showDialog, hideDialog } = useDialog()
|
||||
const [rows, setRows] = useState<BatchEditRow[]>([])
|
||||
const [resultCodeSelections, setResultCodeSelections] = useState<BatchEditResultCodes>({})
|
||||
const [target, setTarget] = useState<ListFilterTarget>('filtered')
|
||||
const [submitting, setSubmitting] = useState(false)
|
||||
|
||||
const resolvedOpen = open ?? isDialogOpen(dialogId)
|
||||
const defaultHeaderId = headerOptions[0]?.id ?? 0
|
||||
|
||||
const isFileHeader = (headerId: number) => headerOptions.find((option) => option.id === headerId)?.listHderTy === ListHeaderConst.FILE
|
||||
|
||||
useEffect(() => {
|
||||
if (!resolvedOpen) return
|
||||
if (initialRows.length > 0) {
|
||||
setRows(initialRows.map((row) => ({ ...row })))
|
||||
return
|
||||
} else if (defaultHeaderId > 0) {
|
||||
setRows([createRow(defaultHeaderId, isFileHeader(defaultHeaderId) ? LIST_BATCH_EDIT_FILE_DELETE_VALUE : '')])
|
||||
} else {
|
||||
setRows([])
|
||||
}
|
||||
if (defaultHeaderId > 0) {
|
||||
setRows([createRow(defaultHeaderId)])
|
||||
}
|
||||
}, [resolvedOpen, initialRows, defaultHeaderId])
|
||||
|
||||
const filterSummary = useMemo(() => {
|
||||
return Object.entries(appliedFilters)
|
||||
.map(([headerId, values]) => {
|
||||
const headerLabel = headerOptions.find((opt) => opt.id === Number(headerId))?.label ?? headerId
|
||||
return `${headerLabel}: ${values.join(', ')}`
|
||||
})
|
||||
.join(' / ')
|
||||
}, [appliedFilters, headerOptions])
|
||||
setResultCodeSelections({ ...initialResultCodes })
|
||||
setTarget('filtered')
|
||||
}, [resolvedOpen, initialRows, initialResultCodes, defaultHeaderId])
|
||||
|
||||
const handleOpenChange = (nextOpen: boolean) => {
|
||||
onOpenChange?.(nextOpen)
|
||||
@@ -89,7 +113,7 @@ const ListBatchEditDialog = ({
|
||||
|
||||
const handleAddRow = () => {
|
||||
if (defaultHeaderId <= 0) return
|
||||
setRows((prev) => [...prev, createRow(defaultHeaderId)])
|
||||
setRows((prev) => [...prev, createRow(defaultHeaderId, isFileHeader(defaultHeaderId) ? LIST_BATCH_EDIT_FILE_DELETE_VALUE : '')])
|
||||
}
|
||||
|
||||
const handleRemoveRow = (id: string) => {
|
||||
@@ -97,23 +121,38 @@ const ListBatchEditDialog = ({
|
||||
}
|
||||
|
||||
const handleChangeHeader = (id: string, headerId: number) => {
|
||||
setRows((prev) => prev.map((row) => (row.id === id ? { ...row, headerId } : row)))
|
||||
const value = isFileHeader(headerId) ? LIST_BATCH_EDIT_FILE_DELETE_VALUE : ''
|
||||
setRows((prev) => prev.map((row) => (row.id === id ? { ...row, headerId, value } : row)))
|
||||
}
|
||||
|
||||
const getValueOptions = (headerId: number) => headerOptions.find((option) => option.id === headerId)?.valueOptions
|
||||
|
||||
const handleChangeValue = (id: string, value: string) => {
|
||||
setRows((prev) => prev.map((row) => (row.id === id ? { ...row, value } : row)))
|
||||
}
|
||||
|
||||
const handleChangeResultCode = (type: ResultCodeType, value: string) => {
|
||||
setResultCodeSelections((prev) => {
|
||||
if (value === NO_CHANGE) {
|
||||
const next = { ...prev }
|
||||
delete next[type]
|
||||
return next
|
||||
}
|
||||
return { ...prev, [type]: Number(value) }
|
||||
})
|
||||
}
|
||||
|
||||
const handleConfirm = async () => {
|
||||
const normalized = rows.filter((row) => row.headerId > 0 && row.value.trim().length > 0)
|
||||
if (normalized.length === 0) {
|
||||
const hasResultCodeChange = Object.keys(resultCodeSelections).length > 0
|
||||
if (normalized.length === 0 && !hasResultCodeChange) {
|
||||
alert('일괄 수정할 항목을 입력해주세요.')
|
||||
return
|
||||
}
|
||||
|
||||
setSubmitting(true)
|
||||
try {
|
||||
await onConfirm(normalized)
|
||||
await onConfirm({ rows: normalized, resultCodes: resultCodeSelections, target })
|
||||
handleOpenChange(false)
|
||||
} finally {
|
||||
setSubmitting(false)
|
||||
@@ -138,13 +177,45 @@ const ListBatchEditDialog = ({
|
||||
</>
|
||||
}
|
||||
>
|
||||
<div className="rounded-md border px-4 py-3 text-sm">
|
||||
<p className="font-semibold mb-1">적용된 필터</p>
|
||||
<p className="text-muted-foreground">
|
||||
{filterSummary.length > 0 ? filterSummary : '적용된 필터가 없습니다.'}
|
||||
</p>
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="text-lg font-semibold">적용 대상</p>
|
||||
<ApplyFilterOption value={target} onValueChange={setTarget} idPrefix="batch-edit-target" filterSummary={filterSummary} />
|
||||
</div>
|
||||
|
||||
<div className="rounded-md border p-4 space-y-3">
|
||||
<p className="font-semibold text-sm">결과값 수정</p>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-3 gap-2">
|
||||
{resultCodeGroups.map((group) => (
|
||||
<div key={group.type} className="space-y-1">
|
||||
<p className="text-sm text-muted-foreground">{group.label}</p>
|
||||
<Select
|
||||
value={
|
||||
resultCodeSelections[group.type] !== undefined
|
||||
? String(resultCodeSelections[group.type])
|
||||
: NO_CHANGE
|
||||
}
|
||||
onValueChange={(v) => handleChangeResultCode(group.type, v)}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="변경 안함" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value={NO_CHANGE}>변경 안함</SelectItem>
|
||||
{resultCodes
|
||||
.filter((code) => code.resultCdTy === group.type && code.resultCd !== 0)
|
||||
.map((code) => (
|
||||
<SelectItem key={code.resultCdUUID} value={String(code.resultCd)}>
|
||||
{code.resultCdLbl}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p className="font-semibold text-sm">항목값 수정</p>
|
||||
<div className="rounded-md border overflow-hidden">
|
||||
<div className="h-11 px-4 border-b bg-muted grid grid-cols-[1fr_2fr_64px] items-center text-sm font-semibold">
|
||||
<span>헤더</span>
|
||||
@@ -153,7 +224,11 @@ const ListBatchEditDialog = ({
|
||||
</div>
|
||||
|
||||
<div className="max-h-72 overflow-auto">
|
||||
{rows.map((row) => (
|
||||
{rows.map((row) => {
|
||||
const valueOptions = getValueOptions(row.headerId)
|
||||
const isFile = isFileHeader(row.headerId)
|
||||
|
||||
return (
|
||||
<div
|
||||
key={row.id}
|
||||
className="h-12 px-4 border-b last:border-b-0 grid grid-cols-[1fr_2fr_64px] items-center gap-2"
|
||||
@@ -174,11 +249,27 @@ const ListBatchEditDialog = ({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
|
||||
<Input
|
||||
value={row.value}
|
||||
onChange={(e) => handleChangeValue(row.id, e.target.value)}
|
||||
placeholder="수정할 값을 입력해주세요"
|
||||
/>
|
||||
{isFile ? (
|
||||
<p className="text-sm font-bold text-red-600">파일 삭제</p>
|
||||
) : valueOptions !== undefined ? (
|
||||
<KriSingleSelect
|
||||
items={valueOptions}
|
||||
value={row.value}
|
||||
onChange={(value) => handleChangeValue(row.id, value)}
|
||||
getValue={(item) => item.value}
|
||||
getLabel={(item) => item.label}
|
||||
placeholder="값 선택"
|
||||
heightClassName="h-9"
|
||||
widthClassName="w-full"
|
||||
className="w-full"
|
||||
/>
|
||||
) : (
|
||||
<Input
|
||||
value={row.value}
|
||||
onChange={(e) => handleChangeValue(row.id, e.target.value)}
|
||||
placeholder="수정할 값을 입력해주세요"
|
||||
/>
|
||||
)}
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
@@ -192,7 +283,8 @@ const ListBatchEditDialog = ({
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -11,28 +11,47 @@ type ApplyFilterGroupProps = {
|
||||
value: ApplyFilterOptionValue
|
||||
onValueChange: (value: ApplyFilterOptionValue) => void
|
||||
idPrefix: string
|
||||
/** '필터 적용 대상만' 선택 시 보여줄, 사람이 읽을 수 있는 현재 필터 조건 목록 */
|
||||
filterSummary?: string[]
|
||||
}
|
||||
|
||||
const ApplyFilterOption = ({ value, onValueChange, idPrefix }: ApplyFilterGroupProps) => {
|
||||
const ApplyFilterOption = ({ value, onValueChange, idPrefix, filterSummary }: ApplyFilterGroupProps) => {
|
||||
return (
|
||||
<RadioGroup
|
||||
value={value}
|
||||
onValueChange={(next) => onValueChange(next as ApplyFilterOptionValue)}
|
||||
className="flex items-center gap-6 flex-wrap"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="selected" id={`${idPrefix}-selected`} />
|
||||
<Label className="text-base" htmlFor={`${idPrefix}-selected`}>선택 항목만</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="filtered" id={`${idPrefix}-filtered`} />
|
||||
<Label className="text-base" htmlFor={`${idPrefix}-filtered`}>필터 적용 대상만</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<RadioGroupItem value="all" id={`${idPrefix}-all`} />
|
||||
<Label className="text-base" htmlFor={`${idPrefix}-all`}>전체 대상</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
<div className="space-y-3">
|
||||
<RadioGroup
|
||||
value={value}
|
||||
onValueChange={(next) => onValueChange(next as ApplyFilterOptionValue)}
|
||||
className="flex items-center gap-6 flex-wrap"
|
||||
>
|
||||
<div className="flex items-center gap-2 cursor-pointer">
|
||||
<RadioGroupItem value="selected" id={`${idPrefix}-selected`} />
|
||||
<Label className="text-base" htmlFor={`${idPrefix}-selected`}>선택 항목만</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 cursor-pointer">
|
||||
<RadioGroupItem value="filtered" id={`${idPrefix}-filtered`} />
|
||||
<Label className="text-base" htmlFor={`${idPrefix}-filtered`}>필터 적용 대상만</Label>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 cursor-pointer">
|
||||
<RadioGroupItem value="all" id={`${idPrefix}-all`} />
|
||||
<Label className="text-base" htmlFor={`${idPrefix}-all`}>전체 대상</Label>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
|
||||
{value === 'filtered' && filterSummary !== undefined && (
|
||||
<div className="rounded-md border px-4 py-3 text-sm">
|
||||
<p className="font-semibold mb-1">적용된 필터</p>
|
||||
{filterSummary.length > 0 ? (
|
||||
<ul className="text-muted-foreground list-disc pl-4 space-y-0.5">
|
||||
{filterSummary.map((line, index) => (
|
||||
<li key={index}>{line}</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p className="text-muted-foreground">적용된 필터가 없습니다.</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ export type ListDownloadDialogProps = {
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
mode: ListDownloadMode
|
||||
filterSummary?: string[]
|
||||
onDownload: (payload: ListDownloadPayload) => void | Promise<void>
|
||||
}
|
||||
|
||||
@@ -32,6 +33,7 @@ const ListDownloadDialog = ({
|
||||
open,
|
||||
onOpenChange,
|
||||
mode,
|
||||
filterSummary,
|
||||
onDownload,
|
||||
}: ListDownloadDialogProps) => {
|
||||
const { isDialogOpen, showDialog, hideDialog } = useDialog()
|
||||
@@ -116,7 +118,7 @@ const ListDownloadDialog = ({
|
||||
) : null}
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
<p className="text-lg font-semibold">다운로드 범위</p>
|
||||
<ApplyFilterOption value={target} onValueChange={setTarget} idPrefix="download-scope-target" />
|
||||
<ApplyFilterOption value={target} onValueChange={setTarget} idPrefix="download-scope-target" filterSummary={filterSummary} />
|
||||
</div>
|
||||
{mode === 'contact-history' ? (
|
||||
<div className="rounded-md border p-4 space-y-4">
|
||||
|
||||
@@ -26,7 +26,7 @@ export type ListFilterDialogProps = {
|
||||
onConfirm: (rows: FilterRow[]) => void | Promise<void>
|
||||
}
|
||||
|
||||
const operatorLabel: Record<FilterOperator, string> = {
|
||||
export const operatorLabel: Record<FilterOperator, string> = {
|
||||
eq: '같음',
|
||||
neq: '다름',
|
||||
contains: '포함',
|
||||
@@ -117,7 +117,9 @@ const ListFilterDialog = ({
|
||||
)
|
||||
|
||||
const handleConfirm = async () => {
|
||||
if (serializedRows.length === 0) {
|
||||
// rows가 아예 없으면 "필터를 전부 지우겠다"는 의도이므로 그대로 통과시킨다.
|
||||
// rows는 있는데 값을 안 채워 serializedRows가 비면, 실수로 방치된 조건일 가능성이 높아 알려준다.
|
||||
if (rows.length > 0 && serializedRows.length === 0) {
|
||||
alert('필터 조건을 입력해주세요.')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export type ListResetDialogProps = {
|
||||
dialogId?: DialogId
|
||||
open?: boolean
|
||||
onOpenChange?: (open: boolean) => void
|
||||
filterSummary?: string[]
|
||||
onConfirm: (payload: { target: ListFilterTarget; scope: ListResetScope }) => void | Promise<void>
|
||||
}
|
||||
|
||||
@@ -21,6 +22,7 @@ const ListResetDialog = ({
|
||||
dialogId = 'listResetDialog',
|
||||
open,
|
||||
onOpenChange,
|
||||
filterSummary,
|
||||
onConfirm,
|
||||
}: ListResetDialogProps) => {
|
||||
const { isDialogOpen, showDialog, hideDialog } = useDialog()
|
||||
@@ -73,6 +75,7 @@ const ListResetDialog = ({
|
||||
value={target}
|
||||
onValueChange={(v) => setTarget(v)}
|
||||
idPrefix="list-reset-target"
|
||||
filterSummary={filterSummary}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -213,7 +213,10 @@ const ListUploadDialog = ({
|
||||
}),
|
||||
[baseHeaderRows.length, compareRows, excelHeaders, hasCommonHeader],
|
||||
)
|
||||
const hasHeaderMismatch = headerCompareList.some(({ serverHeader, isMatched }) => !!serverHeader && !isMatched)
|
||||
const hasHeaderCountMismatch =
|
||||
excelHeaders.length < compareRows.length || (hasCommonHeader && excelHeaders.length > compareRows.length)
|
||||
const hasHeaderMismatch =
|
||||
hasHeaderCountMismatch || headerCompareList.some(({ serverHeader, isMatched }) => !!serverHeader && !isMatched)
|
||||
|
||||
const renderHeaderTypeCell = (
|
||||
serverHeader: listHeader | undefined,
|
||||
@@ -316,6 +319,11 @@ const ListUploadDialog = ({
|
||||
{selectedFile && excelHeaders.length > 0 && compareRows.length > 0 && (
|
||||
<div className="min-w-0 space-y-3">
|
||||
<Label className="text-lg font-semibold">헤더 비교</Label>
|
||||
{hasHeaderCountMismatch && (
|
||||
<p className="text-sm text-red-600">
|
||||
업로드 파일의 헤더 개수({excelHeaders.length}개)가 리스트 헤더 개수({compareRows.length}개)와 일치하지 않습니다.
|
||||
</p>
|
||||
)}
|
||||
<div className="block w-full max-w-full overflow-x-scroll rounded-md border pb-1">
|
||||
<div className="w-max whitespace-nowrap">
|
||||
{headerCompareList.map(({ header, index, isMatched, isSettingRequired, serverHeader }) => {
|
||||
|
||||
@@ -72,9 +72,14 @@ const MessageHistoryDialog = ({
|
||||
|
||||
const visibleRows = useMemo(() => {
|
||||
if (tab === 'email') return emailListQuery.data ?? []
|
||||
return [...(smsListQuery.data ?? []), ...(lmsListQuery.data ?? [])].sort((a, b) =>
|
||||
(b.regDt ?? '').localeCompare(a.regDt ?? ''),
|
||||
)
|
||||
|
||||
// 문자 길이에 따라 SMS로 발송된 건도 자동으로 LMS/MMS로 전환될 수 있는데, 이 경우 두 목록 API가
|
||||
// 같은 bulkSendKey를 각각 반환해 합치면 행이 중복된다. bulkSendKey 기준으로 한 번만 남긴다.
|
||||
const merged = new Map<string, BulkSendInfo>()
|
||||
for (const row of [...(smsListQuery.data ?? []), ...(lmsListQuery.data ?? [])]) {
|
||||
merged.set(row.bulkSendKey, row)
|
||||
}
|
||||
return Array.from(merged.values()).sort((a, b) => (b.regDt ?? '').localeCompare(a.regDt ?? ''))
|
||||
}, [tab, emailListQuery.data, smsListQuery.data, lmsListQuery.data])
|
||||
|
||||
const detailQuery = useBulkSendDetailQuery(
|
||||
|
||||
@@ -3,23 +3,19 @@
|
||||
import { useEffect, useMemo, useRef, useState } from 'react'
|
||||
import { KriDialog } from '@/components/common/KriDialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
import { RadioGroup, RadioGroupItem } from '@/components/ui/radio-group'
|
||||
import { KriDateTimePicker } from '@/components/common/KriDateTimePicker'
|
||||
import { KriSingleSelect } from '@/components/common/KriAutoComplete'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
import { useSelectedProject } from '@/hooks/useSelectedProject'
|
||||
import { useListSearchQuery } from '@/query/list'
|
||||
import {
|
||||
useCreateBulkSendKeyMutation,
|
||||
useMainTemplateIdxQuery,
|
||||
useSendBulkMutation,
|
||||
useSendBulkMessageMutation,
|
||||
useTemplateListQuery,
|
||||
useTemplateQuery,
|
||||
} from '@/query/message'
|
||||
import {ChannelType, type DestInfo, TemplateSms, type TemplateSummary} from '@kri/common/noti-hub'
|
||||
import { ChannelType, TemplateSms, type TemplateSummary } from '@kri/common/noti-hub'
|
||||
import { sanitizeHtmlForPreview } from '@/components/kri-editor/utils/sanitizeHtml'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { getNearestFutureDateTime } from '@/lib/datetime'
|
||||
@@ -28,18 +24,10 @@ import { createEmptyListFilter, type ListFilter, type ListFilterTarget, type lis
|
||||
import { ListHeaderConst } from '@/const/listConst'
|
||||
import type { ListTableRow } from '@/components/table-column/ListTableColumn'
|
||||
import ApplyFilterOption from './ListDialogOption/ApplyFilterOption'
|
||||
import {KriEditor} from "@/components/kri-editor";
|
||||
import {clientEnv} from "@/lib/env.client";
|
||||
import { KriEditor } from '@/components/kri-editor'
|
||||
|
||||
export type MessageSendMode = 'email' | 'sms'
|
||||
|
||||
const MAX_TARGET_COUNT = 5000
|
||||
|
||||
const toTargetRow = (row: ListTableRow): { sid: string; itemList: Record<number, string> } => ({
|
||||
sid: String(row.sid ?? ''),
|
||||
itemList: (row.itemList as Record<number, string> | undefined) ?? {},
|
||||
})
|
||||
|
||||
export type MessageSendDialogProps = {
|
||||
dialogId?: DialogId
|
||||
open?: boolean
|
||||
@@ -48,6 +36,7 @@ export type MessageSendDialogProps = {
|
||||
listHeaders: listHeader[]
|
||||
currentFilter: ListFilter
|
||||
selectedRows: ListTableRow[]
|
||||
filterSummary?: string[]
|
||||
onSent?: () => void
|
||||
}
|
||||
|
||||
@@ -64,18 +53,15 @@ const MessageSendDialog = ({
|
||||
listHeaders,
|
||||
currentFilter,
|
||||
selectedRows,
|
||||
filterSummary,
|
||||
onSent,
|
||||
}: MessageSendDialogProps) => {
|
||||
const { isDialogOpen, showDialog, hideDialog } = useDialog()
|
||||
const { auth } = useAuth()
|
||||
const { selectedProject } = useSelectedProject()
|
||||
|
||||
const chnnlTy = mode === 'email' ? ChannelType.EMAIL : ChannelType.SMS
|
||||
|
||||
const [templateIdx, setTemplateIdx] = useState<number | null>(null)
|
||||
const [senderEmail, setSenderEmail] = useState('')
|
||||
const [senderName, setSenderName] = useState('')
|
||||
const [senderNumber, setSenderNumber] = useState('')
|
||||
const [scheduleType, setScheduleType] = useState<'instant' | 'reserve'>('instant')
|
||||
const [reserveAt, setReserveAt] = useState('')
|
||||
const [targetHeaderId, setTargetHeaderId] = useState<number | null>(null)
|
||||
@@ -85,7 +71,6 @@ const MessageSendDialog = ({
|
||||
const resolvedOpen = open ?? isDialogOpen(dialogId)
|
||||
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0
|
||||
const prjctCd = selectedProject?.prjctCd ?? ''
|
||||
const itrntPrjctCd = selectedProject?.itrntPrjctCd ?? ''
|
||||
const enabled = resolvedOpen && !!selectedProject && prjctIdx > 0
|
||||
|
||||
@@ -96,43 +81,23 @@ const MessageSendDialog = ({
|
||||
const mainTemplateQuery = useMainTemplateIdxQuery(prjctIdx, chnnlTy, enabled)
|
||||
const mainTemplateIdx = mainTemplateQuery.data ?? null
|
||||
|
||||
const templateSenderName = selectedTemplate?.sendNm
|
||||
const templateSenderEmail = selectedTemplate && 'sendEml' in selectedTemplate ? selectedTemplate.sendEml : undefined
|
||||
const templateSenderTel = selectedTemplate && 'sendTel' in selectedTemplate ? selectedTemplate.sendTel : undefined
|
||||
|
||||
const headerType = mode === 'email' ? ListHeaderConst.EMAIL : ListHeaderConst.TEL_NUM
|
||||
const targetHeaderOptions = useMemo(
|
||||
() => listHeaders.filter((header) => header.listHderTy === headerType),
|
||||
[listHeaders, headerType],
|
||||
)
|
||||
|
||||
// '전체'/'필터 적용 대상'은 현재 페이지에 보이는 행을 넘어설 수 있어 별도로 넓게 조회한다
|
||||
const bulkTargetFilter = target === 'all' ? createEmptyListFilter() : currentFilter
|
||||
const bulkTargetEnabled = enabled && target !== 'selected'
|
||||
const bulkTargetQuery = useListSearchQuery(
|
||||
prjctIdx,
|
||||
{
|
||||
listFilter: bulkTargetFilter,
|
||||
pageRequest: { pageIndex: 0, pageSize: MAX_TARGET_COUNT, sortBy: 'sid', sortDir: 'asc' },
|
||||
},
|
||||
bulkTargetEnabled,
|
||||
)
|
||||
|
||||
const targetRows = useMemo(() => {
|
||||
const rows = target === 'selected' ? selectedRows : (bulkTargetQuery.data?.content ?? [])
|
||||
return rows.map(toTargetRow)
|
||||
}, [target, selectedRows, bulkTargetQuery.data])
|
||||
|
||||
const targetTotalCount = target === 'selected' ? selectedRows.length : (bulkTargetQuery.data?.totalElements ?? 0)
|
||||
const isTargetTruncated = target !== 'selected' && targetTotalCount > MAX_TARGET_COUNT
|
||||
|
||||
const createBulkKeyMutation = useCreateBulkSendKeyMutation(mode)
|
||||
const sendBulkMutation = useSendBulkMutation(mode)
|
||||
const sendBulkMessageMutation = useSendBulkMessageMutation(mode, prjctIdx)
|
||||
|
||||
const mainTemplateAppliedRef = useRef(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (!resolvedOpen) return
|
||||
setTemplateIdx(null)
|
||||
setSenderEmail('')
|
||||
setSenderName('')
|
||||
setSenderNumber('')
|
||||
setScheduleType('instant')
|
||||
setReserveAt('')
|
||||
setTarget('selected')
|
||||
@@ -147,14 +112,6 @@ const MessageSendDialog = ({
|
||||
if (mainTemplateIdx) setTemplateIdx(mainTemplateIdx)
|
||||
}, [enabled, mainTemplateQuery.isSuccess, mainTemplateIdx])
|
||||
|
||||
// 템플릿 상세가 도착하면 발신 정보를 세팅한다 (발송 전 수정 가능)
|
||||
useEffect(() => {
|
||||
if (!selectedTemplate) return
|
||||
setSenderName(selectedTemplate.sendNm)
|
||||
if ('sendEml' in selectedTemplate) setSenderEmail(selectedTemplate.sendEml)
|
||||
if ('sendTel' in selectedTemplate) setSenderNumber(selectedTemplate.sendTel)
|
||||
}, [selectedTemplate])
|
||||
|
||||
useEffect(() => {
|
||||
if (targetHeaderId !== null) return
|
||||
const first = targetHeaderOptions[0]
|
||||
@@ -182,26 +139,15 @@ const MessageSendDialog = ({
|
||||
setTemplateIdx(Number.isFinite(idx) && idx > 0 ? idx : null)
|
||||
}
|
||||
|
||||
const buildMsgParam = (itemList: Record<number, string>): Record<string, string> => {
|
||||
const param: Record<string, string> = {}
|
||||
listHeaders.forEach((header) => {
|
||||
const value = itemList[header.listHderId]
|
||||
if (value !== undefined) param[header.listHderNm] = value
|
||||
})
|
||||
return param
|
||||
}
|
||||
|
||||
const buildDestInfoList = (): DestInfo[] => {
|
||||
if (!targetHeaderId) return []
|
||||
return targetRows.map(({ sid, itemList }) => {
|
||||
const destValue = itemList[targetHeaderId] ?? ''
|
||||
const buildListFilter = (): ListFilter => {
|
||||
if (target === 'all') return createEmptyListFilter()
|
||||
if (target === 'selected') {
|
||||
return {
|
||||
sid,
|
||||
destEml: mode === 'email' ? destValue : undefined,
|
||||
destTel: mode === 'sms' ? destValue : undefined,
|
||||
msgParam: buildMsgParam(itemList),
|
||||
...createEmptyListFilter(),
|
||||
sidSet: selectedRows.map((row) => String(row.sid ?? '')).filter((sid) => sid.length > 0),
|
||||
}
|
||||
})
|
||||
}
|
||||
return currentFilter
|
||||
}
|
||||
|
||||
const handleConfirm = async () => {
|
||||
@@ -213,50 +159,39 @@ const MessageSendDialog = ({
|
||||
alert(`수신 ${mode === 'email' ? '이메일' : '번호'} 헤더를 선택해 주세요.`)
|
||||
return
|
||||
}
|
||||
if (mode === 'email' && !senderEmail.trim()) {
|
||||
alert('발송자 메일을 입력해 주세요.')
|
||||
if (mode === 'email' && !templateSenderEmail) {
|
||||
alert('선택한 템플릿에 발송자 메일이 등록되어 있지 않습니다. 템플릿 설정을 확인해 주세요.')
|
||||
return
|
||||
}
|
||||
if (mode === 'sms' && !senderNumber.trim()) {
|
||||
alert('발송 번호를 입력해 주세요.')
|
||||
if (mode === 'sms' && !templateSenderTel) {
|
||||
alert('선택한 템플릿에 발송 번호가 등록되어 있지 않습니다. 템플릿 설정을 확인해 주세요.')
|
||||
return
|
||||
}
|
||||
if (scheduleType === 'reserve' && !reserveAt) {
|
||||
alert('예약 발송 일시를 선택해 주세요.')
|
||||
return
|
||||
}
|
||||
if (isTargetTruncated) {
|
||||
alert(`수신 대상이 ${MAX_TARGET_COUNT}건을 초과합니다. 대상 범위를 좁혀 주세요.`)
|
||||
return
|
||||
}
|
||||
const destInfoList = buildDestInfoList()
|
||||
if (destInfoList.length === 0) {
|
||||
const listFilter = buildListFilter()
|
||||
if (target === 'selected' && listFilter.sidSet.length === 0) {
|
||||
alert('수신 대상이 없습니다.')
|
||||
return
|
||||
}
|
||||
|
||||
setSubmitting(true)
|
||||
try {
|
||||
const bulkSendKey = await createBulkKeyMutation.mutateAsync({
|
||||
reqstCmpn: auth.user?.userCmpn ?? '',
|
||||
reqstUser: auth.user?.userId ?? '',
|
||||
reqstSvc: clientEnv.REQUEST_SVC,
|
||||
prjctCd,
|
||||
const res = await sendBulkMessageMutation.mutateAsync({
|
||||
tmplatIdx: templateIdx,
|
||||
resve: scheduleType === 'reserve',
|
||||
sendDt: scheduleType === 'reserve' ? new Date(reserveAt).toISOString() : undefined,
|
||||
trgtCnt: destInfoList.length,
|
||||
listFilter,
|
||||
destHeaderIds: [targetHeaderId],
|
||||
})
|
||||
|
||||
await sendBulkMutation.mutateAsync({
|
||||
sendEml: mode === 'email' ? senderEmail : undefined,
|
||||
sendTel: mode === 'sms' ? senderNumber : undefined,
|
||||
sendNm: senderName || undefined,
|
||||
bulkSendKey,
|
||||
destInfoList,
|
||||
})
|
||||
|
||||
alert('발송 요청이 완료되었습니다.')
|
||||
if (res.failCount > 0) {
|
||||
alert(`대상 ${res.targetCount}건 중 ${res.acceptCount}건 접수, ${res.failCount}건 실패했습니다.`)
|
||||
} else {
|
||||
alert(`대상 ${res.targetCount}건 발송 요청이 완료되었습니다.`)
|
||||
}
|
||||
onSent?.()
|
||||
handleOpenChange(false)
|
||||
} catch (e) {
|
||||
@@ -304,17 +239,23 @@ const MessageSendDialog = ({
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||
<div className="space-y-2">
|
||||
<Label className="text-base">발송자 메일</Label>
|
||||
<Input value={senderEmail} onChange={(e) => setSenderEmail(e.target.value)} />
|
||||
<p className="text-sm rounded-md border px-3 py-2 h-9 flex items-center bg-muted/30">
|
||||
{templateSenderEmail || '-'}
|
||||
</p>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label className="text-base">발송자 이름</Label>
|
||||
<Input value={senderName} onChange={(e) => setSenderName(e.target.value)} />
|
||||
<p className="text-sm rounded-md border px-3 py-2 h-9 flex items-center bg-muted/30">
|
||||
{templateSenderName || '-'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2">
|
||||
<Label className="text-base">발송 번호</Label>
|
||||
<Input value={senderNumber} onChange={(e) => setSenderNumber(e.target.value)} />
|
||||
<p className="text-sm rounded-md border px-3 py-2 h-9 flex items-center bg-muted/30">
|
||||
{templateSenderTel || '-'}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -360,11 +301,7 @@ const MessageSendDialog = ({
|
||||
|
||||
<div className="space-y-2 rounded-md border p-4">
|
||||
<Label className="text-base">수신 대상</Label>
|
||||
<ApplyFilterOption value={target} onValueChange={setTarget} idPrefix="message-send-target" />
|
||||
<p className="text-sm text-muted-foreground">
|
||||
대상 {targetTotalCount.toLocaleString()}건
|
||||
{isTargetTruncated ? ` (최대 ${MAX_TARGET_COUNT.toLocaleString()}건까지만 발송 가능합니다)` : ''}
|
||||
</p>
|
||||
<ApplyFilterOption value={target} onValueChange={setTarget} idPrefix="message-send-target" filterSummary={filterSummary} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { KriDialog } from '@/components/common/KriDialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
@@ -15,6 +15,13 @@ import {apiError} from "@kri/common/http";
|
||||
import {CONTACT_INTERVIEWER_ROLE, FW_TEAM, USER_NAME_REGEX} from "@/const/userConst";
|
||||
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@kri/common/http";
|
||||
import type { CmpnInfo } from "@/types/cmpn";
|
||||
import { isExternalManager, isFieldWorkUser } from "@/utils/userRole";
|
||||
|
||||
// 외주사(EXTERNAL_USER_ROLE_GROUP)와 콜센터/컨택원/면접원(FW_USER_ROLE_GROUP)은 배정 체계가 완전히 달라
|
||||
// 서로 넘나드는 권한 수정을 지원하지 않는다. 하나 새로 만들어서 넘기는 게 맞다.
|
||||
const isCrossExternalFwRoleChange = (fromRole: number, toRole: number) =>
|
||||
(isExternalManager(fromRole) && isFieldWorkUser(toRole)) ||
|
||||
(isFieldWorkUser(fromRole) && isExternalManager(toRole))
|
||||
|
||||
export type UserUpsertDialogProps = {
|
||||
/** Jotai로 관리할 다이얼로그 ID */
|
||||
@@ -94,6 +101,13 @@ const UserUpsertDialog = ({
|
||||
}
|
||||
}, [initialData, mode, resolvedOpen])
|
||||
|
||||
// 수정 모드에서는 최초 권한 기준으로 외주사 ↔ 콜센터/컨택원/면접원 간 이동이 되는 선택지를 아예 뺀다.
|
||||
const availableRoleArray = useMemo(() => {
|
||||
if (mode === 'create' || initialData?.userRole == null) return userRoleArray
|
||||
const initialRole = initialData.userRole
|
||||
return userRoleArray.filter((item) => !isCrossExternalFwRoleChange(initialRole, Number(item.value)))
|
||||
}, [mode, initialData?.userRole, userRoleArray])
|
||||
|
||||
const handleInputChange = <K extends keyof UserInfoSaveRequest>(field: K, value: UserInfoSaveRequest[K]) => {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
@@ -250,7 +264,7 @@ const UserUpsertDialog = ({
|
||||
<div className="grid gap-2">
|
||||
<Label>계정 권한</Label>
|
||||
<KriSelect
|
||||
items={userRoleArray}
|
||||
items={availableRoleArray}
|
||||
value={String(formData.userRole)}
|
||||
getLabel={(item) => item.label}
|
||||
getValue={(item) => String(item.value)}
|
||||
|
||||
@@ -71,7 +71,7 @@ export function KriSidebar({
|
||||
<Button
|
||||
key={item.id}
|
||||
type="button"
|
||||
variant={active ? 'secondary' : 'ghost'}
|
||||
variant={active ? 'default' : 'ghost'}
|
||||
className="w-full justify-start"
|
||||
disabled={item.disabled || !item.path}
|
||||
onClick={() => item.path && onNavigate?.(item.path, item)}
|
||||
@@ -86,7 +86,7 @@ export function KriSidebar({
|
||||
<div key={item.id} className="space-y-1">
|
||||
<Button
|
||||
type="button"
|
||||
variant={active ? 'secondary' : 'ghost'}
|
||||
variant={active ? 'default' : 'ghost'}
|
||||
className="w-full justify-between"
|
||||
disabled={item.disabled}
|
||||
onClick={() => toggleItem(item.id)}
|
||||
@@ -107,7 +107,7 @@ export function KriSidebar({
|
||||
<Button
|
||||
key={child.id}
|
||||
type="button"
|
||||
variant={childActive ? 'secondary' : 'ghost'}
|
||||
variant={childActive ? 'default' : 'ghost'}
|
||||
className="w-full justify-start"
|
||||
disabled={child.disabled || !child.path}
|
||||
onClick={() => child.path && onNavigate?.(child.path, child)}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,8 +8,8 @@ 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 ListBatchEditDialog, { type BatchEditRow } from '@/components/dialog/ListBatchEditDialog'
|
||||
import ListFilterDialog from '@/components/dialog/ListFilterDialog'
|
||||
import ListBatchEditDialog, { type BatchEditPayload, type BatchEditResultCodes, type BatchEditRow } from '@/components/dialog/ListBatchEditDialog'
|
||||
import ListFilterDialog, { operatorLabel } from '@/components/dialog/ListFilterDialog'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import { useListSearchQuery, useUpdateListMutation } from '@/query/list'
|
||||
import { getListColumns, LIST_IS_USE_LABEL, type ListTableRow } from '@/components/table-column/ListTableColumn'
|
||||
@@ -25,9 +25,11 @@ import {
|
||||
type ListFilter,
|
||||
ListFilterMatchType,
|
||||
ListFilterOperator,
|
||||
type ListFilterTarget,
|
||||
type ListHeaderAssignType,
|
||||
type ListOtherItemFilterCondition,
|
||||
type ListSearchRequest,
|
||||
type ListSearchUiState,
|
||||
} from '@/types/list'
|
||||
import { type ResultCode, ResultCodeType } from '@/types/project'
|
||||
import {
|
||||
@@ -53,12 +55,16 @@ export type ListSearchTableProps = {
|
||||
excludeFilterHeaderTypes?: number[]
|
||||
externalAssignFilter?: { type: ListHeaderAssignType; values: string[]; condition?: 'assigned' | 'unassigned' }
|
||||
onCurrentFilterChange?: (filter: ListFilter) => void
|
||||
onFilterSummaryChange?: (summary: string[]) => void
|
||||
onSelectedRowsChange?: (rows: ListTableRow[]) => void
|
||||
onRowClick?: (row: ListTableRow) => void
|
||||
onRowDoubleClick?: (row: ListTableRow) => void
|
||||
maxTableHeight?: string
|
||||
initialPagination?: PaginationState
|
||||
onPaginationChange?: (pagination: PaginationState) => void
|
||||
/** 뒤로 돌아왔을 때 검색창/필터/정렬을 그대로 복원하기 위한 초기값. 최초 마운트 시 한 번만 사용된다. */
|
||||
initialSearchState?: ListSearchUiState
|
||||
onSearchStateChange?: (state: ListSearchUiState) => void
|
||||
focusRowId?: string
|
||||
}
|
||||
|
||||
@@ -157,23 +163,28 @@ export function ListSearchTable({
|
||||
excludeFilterHeaderTypes,
|
||||
externalAssignFilter,
|
||||
onCurrentFilterChange,
|
||||
onFilterSummaryChange,
|
||||
onSelectedRowsChange,
|
||||
onRowClick,
|
||||
onRowDoubleClick,
|
||||
maxTableHeight = '66vh',
|
||||
initialPagination,
|
||||
onPaginationChange,
|
||||
initialSearchState,
|
||||
onSearchStateChange,
|
||||
focusRowId,
|
||||
}: ListSearchTableProps) {
|
||||
const { showDialog } = useDialog()
|
||||
const [searchText, setSearchText] = useState('')
|
||||
const [searchContactResult, setSearchContactResult] = useState<string[]>([])
|
||||
const [searchInterviewResult, setSearchInterviewResult] = useState<string[]>([])
|
||||
const [searchSurveyResult, setSearchSurveyResult] = useState<string[]>([])
|
||||
const [searchText, setSearchText] = useState(initialSearchState?.searchText ?? '')
|
||||
const [searchContactResult, setSearchContactResult] = useState<string[]>(initialSearchState?.searchContactResult ?? [])
|
||||
const [searchInterviewResult, setSearchInterviewResult] = useState<string[]>(initialSearchState?.searchInterviewResult ?? [])
|
||||
const [searchSurveyResult, setSearchSurveyResult] = useState<string[]>(initialSearchState?.searchSurveyResult ?? [])
|
||||
const [pagination, setPagination] = useState<PaginationState>(initialPagination ?? { pageIndex: 0, pageSize: 25 })
|
||||
const [sorting, setSorting] = useState<SortingState>([])
|
||||
const [filterRows, setFilterRows] = useState<FilterRow[]>([])
|
||||
const [sorting, setSorting] = useState<SortingState>(initialSearchState?.sorting ?? [])
|
||||
const [filterRows, setFilterRows] = useState<FilterRow[]>(initialSearchState?.filterRows ?? [])
|
||||
const [batchRows, setBatchRows] = useState<BatchEditRow[]>([])
|
||||
const [batchResultCodes, setBatchResultCodes] = useState<BatchEditResultCodes>({})
|
||||
const [selectedRows, setSelectedRows] = useState<ListTableRow[]>([])
|
||||
|
||||
const updateListMutation = useUpdateListMutation(prjctIdx)
|
||||
|
||||
@@ -317,9 +328,98 @@ export function ListSearchTable({
|
||||
userRole,
|
||||
])
|
||||
|
||||
const resultCodeLabel = useCallback(
|
||||
(type: ResultCodeType, code: string) =>
|
||||
resultCodes.find((item) => item.resultCdTy === type && String(item.resultCd) === code)?.resultCdLbl ?? code,
|
||||
[resultCodes],
|
||||
)
|
||||
|
||||
// ApplyFilterOption의 "필터 적용 대상만"을 고를 때 보여줄, 사람이 읽을 수 있는 현재 필터 조건 요약.
|
||||
// 실제 서버로 보내는 listSearchRequest와 같은 유효성 조건(잠긴 헤더 제외, 빈 값 제외 등)을 따라간다.
|
||||
const filterSummaryLines = useMemo<string[]>(() => {
|
||||
const lines: string[] = []
|
||||
|
||||
const sidValues = toSidSet(searchText)
|
||||
if (sidValues.length > 0) {
|
||||
lines.push(`SID: ${sidValues.join(', ')}`)
|
||||
}
|
||||
|
||||
const resultSummaryGroups: { label: string; type: ResultCodeType; values: string[] }[] = [
|
||||
{ label: '컨택 결과', type: ResultCodeType.CONTACT, values: searchContactResult },
|
||||
{ label: '면접 결과', type: ResultCodeType.INTERVIEW, values: searchInterviewResult },
|
||||
{ label: '설문 결과', type: ResultCodeType.SURVEY, values: searchSurveyResult },
|
||||
]
|
||||
resultSummaryGroups.forEach(({ label, type, values }) => {
|
||||
if (values.length === 0) return
|
||||
lines.push(`${label}: ${values.map((value) => resultCodeLabel(type, value)).join(', ')}`)
|
||||
})
|
||||
|
||||
filterRows.forEach((row) => {
|
||||
const header = accessibleFilterHeaderById.get(row.headerId)
|
||||
if (!header || lockedListFilterHeaderTypes.has(header.listHderTy)) return
|
||||
|
||||
if (row.operator === 'empty' || row.operator === 'notEmpty') {
|
||||
lines.push(`${header.listHderNm} ${operatorLabel[row.operator]}`)
|
||||
return
|
||||
}
|
||||
|
||||
const valueOptions = getValueOptionsForHeader(header)
|
||||
if (valueOptions !== undefined) {
|
||||
if (row.multiValues.length === 0) return
|
||||
const labels = row.multiValues.map(
|
||||
(value) => valueOptions.find((option) => option.value === value)?.label ?? value,
|
||||
)
|
||||
lines.push(`${header.listHderNm} ${operatorLabel[row.operator]} ${labels.join(', ')}`)
|
||||
return
|
||||
}
|
||||
|
||||
if (row.textValue.trim().length === 0) return
|
||||
lines.push(`${header.listHderNm} ${operatorLabel[row.operator]} ${row.textValue.trim()}`)
|
||||
})
|
||||
|
||||
return lines
|
||||
}, [
|
||||
accessibleFilterHeaderById,
|
||||
filterRows,
|
||||
getValueOptionsForHeader,
|
||||
lockedListFilterHeaderTypes,
|
||||
resultCodeLabel,
|
||||
searchContactResult,
|
||||
searchInterviewResult,
|
||||
searchSurveyResult,
|
||||
searchText,
|
||||
])
|
||||
|
||||
const listSearchQuery = useListSearchQuery(prjctIdx, listSearchRequest, enabled)
|
||||
const { refetch } = listSearchQuery
|
||||
|
||||
const buildTargetFilter = useCallback(
|
||||
(target: ListFilterTarget): ListFilter => {
|
||||
if (target === 'all') {
|
||||
return applyListAccessFilter(createEmptyListFilter(), { userRole, userId, userCmpn })
|
||||
}
|
||||
if (target === 'selected') {
|
||||
return applyListAccessFilter(
|
||||
{
|
||||
...createEmptyListFilter(),
|
||||
sidSet: selectedRows.map((row) => String(row.sid ?? '')).filter((sid) => sid.length > 0),
|
||||
},
|
||||
{ userRole, userId, userCmpn },
|
||||
)
|
||||
}
|
||||
return listSearchRequest.listFilter
|
||||
},
|
||||
[listSearchRequest.listFilter, selectedRows, userCmpn, userId, userRole],
|
||||
)
|
||||
|
||||
const handleRowSelectionChange = useCallback(
|
||||
(rows: ListTableRow[]) => {
|
||||
setSelectedRows(rows)
|
||||
onSelectedRowsChange?.(rows)
|
||||
},
|
||||
[onSelectedRowsChange],
|
||||
)
|
||||
|
||||
const columns = useMemo<DataTableColumn<ListTableRow, unknown>[]>(() => {
|
||||
if (!listHeaders.length) return []
|
||||
return getListColumns(listHeaders, resultCodes, userRole)
|
||||
@@ -335,11 +435,15 @@ export function ListSearchTable({
|
||||
|
||||
const headerOptions = useMemo(
|
||||
() =>
|
||||
accessibleListHeaders.map((header) => ({
|
||||
id: header.listHderId,
|
||||
label: header.listHderNm,
|
||||
})),
|
||||
[accessibleListHeaders],
|
||||
accessibleListHeaders
|
||||
.filter((header) => header.listHderTy !== ListHeaderConst.SID && !isAssignHeaderType(header.listHderTy))
|
||||
.map((header) => ({
|
||||
id: header.listHderId,
|
||||
label: header.listHderNm,
|
||||
listHderTy: header.listHderTy,
|
||||
valueOptions: getValueOptionsForHeader(header),
|
||||
})),
|
||||
[accessibleListHeaders, getValueOptionsForHeader],
|
||||
)
|
||||
|
||||
const filterHeaderOptions = useMemo<FilterHeaderOption[]>(
|
||||
@@ -363,12 +467,14 @@ export function ListSearchTable({
|
||||
setPagination((prev) => ({ ...prev, pageIndex: 0 }))
|
||||
}
|
||||
|
||||
const handleBatchConfirm = async (rows: BatchEditRow[]) => {
|
||||
const handleBatchConfirm = async ({ rows, resultCodes: resultCodeSelections, target }: BatchEditPayload) => {
|
||||
setBatchRows(rows)
|
||||
setBatchResultCodes(resultCodeSelections)
|
||||
const updateContents = Object.fromEntries(rows.map((row) => [String(row.headerId), row.value]))
|
||||
await updateListMutation.mutateAsync({
|
||||
updateContents,
|
||||
listFilter: listSearchRequest.listFilter,
|
||||
updateResultCodes: resultCodeSelections,
|
||||
listFilter: buildTargetFilter(target),
|
||||
})
|
||||
await listSearchQuery.refetch()
|
||||
}
|
||||
@@ -377,6 +483,29 @@ export function ListSearchTable({
|
||||
onCurrentFilterChange?.(listSearchRequest.listFilter)
|
||||
}, [listSearchRequest.listFilter, onCurrentFilterChange])
|
||||
|
||||
useEffect(() => {
|
||||
onFilterSummaryChange?.(filterSummaryLines)
|
||||
}, [filterSummaryLines, onFilterSummaryChange])
|
||||
|
||||
useEffect(() => {
|
||||
onSearchStateChange?.({
|
||||
searchText,
|
||||
searchContactResult,
|
||||
searchInterviewResult,
|
||||
searchSurveyResult,
|
||||
filterRows,
|
||||
sorting,
|
||||
})
|
||||
}, [
|
||||
searchText,
|
||||
searchContactResult,
|
||||
searchInterviewResult,
|
||||
searchSurveyResult,
|
||||
filterRows,
|
||||
sorting,
|
||||
onSearchStateChange,
|
||||
])
|
||||
|
||||
useEffect(() => {
|
||||
onPaginationChange?.(pagination)
|
||||
}, [pagination, onPaginationChange])
|
||||
@@ -478,7 +607,7 @@ export function ListSearchTable({
|
||||
onPaginationChange={setPagination}
|
||||
onSortingChange={setSorting}
|
||||
selectMode={selectMode}
|
||||
onRowSelectionChange={onSelectedRowsChange}
|
||||
onRowSelectionChange={handleRowSelectionChange}
|
||||
onRowClick={onRowClick}
|
||||
onRowDoubleClick={onRowDoubleClick}
|
||||
pageSizeOptions={[25, 50, 100]}
|
||||
@@ -490,8 +619,10 @@ export function ListSearchTable({
|
||||
{enableBatchEdit ? (
|
||||
<ListBatchEditDialog
|
||||
headerOptions={headerOptions}
|
||||
appliedFilters={Object.fromEntries(filterRows.map((row) => [row.headerId, row.multiValues]))}
|
||||
resultCodes={resultCodes}
|
||||
filterSummary={filterSummaryLines}
|
||||
initialRows={batchRows}
|
||||
initialResultCodes={batchResultCodes}
|
||||
onConfirm={handleBatchConfirm}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
@@ -57,7 +57,7 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
|
||||
<tr
|
||||
data-slot="table-row"
|
||||
className={cn(
|
||||
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
||||
"hover:bg-primary/20 data-[state=selected]:bg-muted border-b transition-colors",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
Reference in New Issue
Block a user