develop #24

Merged
gitadmin merged 7 commits from develop into master 2026-08-12 08:43:25 +09:00
8 changed files with 181 additions and 119 deletions
Showing only changes of commit d9398c5675 - Show all commits

View File

@@ -1,6 +1,6 @@
'use client' 'use client'
import { useEffect, useMemo, useState } from 'react' import { useMemo, useState } from 'react'
import { useMounted } from '@kri/common/hooks' import { useMounted } from '@kri/common/hooks'
import { LoadingOverlayAdapter } from '@/components/app-shell/LoadingOverlayAdapter' import { LoadingOverlayAdapter } from '@/components/app-shell/LoadingOverlayAdapter'
import { useAuth } from '@/hooks/useAuth' import { useAuth } from '@/hooks/useAuth'
@@ -19,9 +19,9 @@ import { createEmptyListFilter, type ListFilter, type ListHeaderAssignType, type
import type { ResultCode } from '@/types/project' import type { ResultCode } from '@/types/project'
const ASSIGN_TAB_TYPES: ListHeaderAssignType[] = [ const ASSIGN_TAB_TYPES: ListHeaderAssignType[] = [
ListHeaderAssignConst.OUTSOURCE,
ListHeaderAssignConst.CONTACT_INTERVIEWER, ListHeaderAssignConst.CONTACT_INTERVIEWER,
ListHeaderAssignConst.FIELD_INTERVIEWER, ListHeaderAssignConst.FIELD_INTERVIEWER,
ListHeaderAssignConst.OUTSOURCE,
] ]
const ASSIGNED_SENTINEL = '__ASSIGNED__' const ASSIGNED_SENTINEL = '__ASSIGNED__'
@@ -37,7 +37,7 @@ const ListAssignPage = () => {
const enabled = mounted && prjctIdx > 0 const enabled = mounted && prjctIdx > 0
const userRole = auth?.user?.userRole ?? 0 const userRole = auth?.user?.userRole ?? 0
const [assignType, setAssignType] = useState<ListHeaderAssignType>(ListHeaderAssignConst.OUTSOURCE) const [assignType, setAssignType] = useState<ListHeaderAssignType>(ListHeaderAssignConst.CONTACT_INTERVIEWER)
const [selectedAssignId, setSelectedAssignId] = useState<string | undefined>(undefined) const [selectedAssignId, setSelectedAssignId] = useState<string | undefined>(undefined)
const [assignFilterIds, setAssignFilterIds] = useState<string[]>([]) const [assignFilterIds, setAssignFilterIds] = useState<string[]>([])
const [transferResve, setTransferResve] = useState(false) const [transferResve, setTransferResve] = useState(false)
@@ -60,11 +60,6 @@ const ListAssignPage = () => {
setSelectedAssignId(undefined) setSelectedAssignId(undefined)
} }
// 좌측 테이블 선택값이 바뀌면 결과 필터 multiselect도 그 값으로 맞춘다.
useEffect(() => {
setAssignFilterIds(selectedAssignId ? [selectedAssignId] : [])
}, [selectedAssignId])
// "배정됨"/"배정되지 않음"은 실제 대상 선택과 동시에 선택될 수 없다: 새로 클릭된 쪽만 남긴다. // "배정됨"/"배정되지 않음"은 실제 대상 선택과 동시에 선택될 수 없다: 새로 클릭된 쪽만 남긴다.
const handleAssignFilterChange = (next: string[]) => { const handleAssignFilterChange = (next: string[]) => {
const addedSentinel = next.find((value) => isAssignFilterSentinel(value) && !assignFilterIds.includes(value)) const addedSentinel = next.find((value) => isAssignFilterSentinel(value) && !assignFilterIds.includes(value))

View File

@@ -61,7 +61,13 @@ export function useAssignTargetRows({ prjctIdx, enabled, assignType }: UseAssign
]) ])
} }
export function AssignTargetList({ prjctIdx, enabled, assignType, selectedId, onSelect }: AssignTargetListProps) { export function AssignTargetList({
prjctIdx,
enabled,
assignType,
selectedId,
onSelect
}: AssignTargetListProps) {
const rows = useAssignTargetRows({ prjctIdx, enabled, assignType }) const rows = useAssignTargetRows({ prjctIdx, enabled, assignType })
return ( return (

View File

@@ -17,6 +17,11 @@ export type KriDateTimePickerProps = {
contentClassName?: string contentClassName?: string
disabled?: boolean disabled?: boolean
modalPopover?: boolean modalPopover?: boolean
startHour?: number
endHour?: number
minuteStep?: number
hourLabel?: string
minuteLabel?: string
} }
const parseDateTime = (value: string): { date: Date | undefined; time: string } => { const parseDateTime = (value: string): { date: Date | undefined; time: string } => {
@@ -67,6 +72,11 @@ export function KriDateTimePicker({
contentClassName, contentClassName,
disabled = false, disabled = false,
modalPopover = true, modalPopover = true,
startHour,
endHour,
minuteStep,
hourLabel,
minuteLabel,
}: KriDateTimePickerProps) { }: KriDateTimePickerProps) {
const [open, setOpen] = React.useState(false) const [open, setOpen] = React.useState(false)
const { date, time } = parseDateTime(value) const { date, time } = parseDateTime(value)
@@ -106,11 +116,17 @@ export function KriDateTimePicker({
mode="single" mode="single"
selected={date} selected={date}
onSelect={handleDateSelect} onSelect={handleDateSelect}
initialFocus
/> />
<KriTimePicker <KriTimePicker
value={time || '00:00'} value={time || '00:00'}
onChange={handleTimeChange} onChange={handleTimeChange}
disabled={!date} disabled={!date}
startHour={startHour}
endHour={endHour}
minuteStep={minuteStep}
hourLabel={hourLabel}
minuteLabel={minuteLabel}
/> />
</div> </div>
</PopoverContent> </PopoverContent>

View File

@@ -9,10 +9,10 @@ import { cn } from '@/lib/utils'
import { KRI_PW_REGEX, ONLY_ALLOWED_PW_REGEX } from '@/const/validationConst' import { KRI_PW_REGEX, ONLY_ALLOWED_PW_REGEX } from '@/const/validationConst'
const requirements = [ const requirements = [
{ test: (value: string) => /[A-Za-z]/.test(value), text: '영문 1개 이상' }, //{ test: (value: string) => /[A-Za-z]/.test(value), text: '영문 1개 이상' },
{ test: (value: string) => /\d/.test(value), text: '숫자 1개 이상' }, //{ test: (value: string) => /\d/.test(value), text: '숫자 1개 이상' },
{ test: (value: string) => value.length >= 8 && value.length <= 20, text: '8~20자' }, //{ test: (value: string) => value.length >= 1 && value.length <= 20, text: '1~20자' },
{ test: (value: string) => !value || ONLY_ALLOWED_PW_REGEX.test(value), text: '허용 문자만 사용' }, { test: (value: string) => !value || KRI_PW_REGEX.test(value), text: '영문, 숫자, 허용된 특수문자를 사용하여 1~20자로 입력해야 합니다.' },
] ]
export type KriPasswordRef = { export type KriPasswordRef = {
@@ -55,12 +55,13 @@ export const KriPassword = forwardRef<KriPasswordRef, KriPasswordProps>(function
const score = checks.filter((item) => item.met).length const score = checks.filter((item) => item.met).length
const statusText = useMemo(() => { const statusText = useMemo(() => {
if (!value) return '비밀번호를 입력하세요' if (!value) return '비밀번호를 입력하세요.'
if (!hasOnlyAllowedChars) return '허용되지 않는 문자가 포함되어 있어요' if (!hasOnlyAllowedChars) return '허용되지 않는 문자가 포함되어 있습니다.'
return isValid ? '사용 가능한 비밀번호입니다' : '영문과 숫자를 포함한 8~20자로 입력하세요' return isValid ? '사용 가능한 비밀번호입니다' : '영문, 숫자, 허용된 특수문자를 사용하여 1~20자로 입력해야 합니다.'
}, [hasOnlyAllowedChars, isValid, value]) }, [hasOnlyAllowedChars, isValid, value])
const barClass = score <= 1 ? 'bg-destructive' : score === 2 ? 'bg-orange-500' : score === 3 ? 'bg-yellow-400' : 'bg-green-500' //const barClass = score <= 1 ? 'bg-destructive' : score === 2 ? 'bg-orange-500' : score === 3 ? 'bg-yellow-400' : 'bg-green-500'
const barClass = 'bg-green-500'
return ( return (
<div className={cn('w-full space-y-2', className)}> <div className={cn('w-full space-y-2', className)}>

View File

@@ -9,6 +9,10 @@ export type KriTimePickerProps = {
onChange: (value: string) => void onChange: (value: string) => void
disabled?: boolean disabled?: boolean
minuteStep?: number minuteStep?: number
startHour?: number
endHour?: number
hourLabel?: string
minuteLabel?: string
className?: string className?: string
} }
@@ -27,18 +31,37 @@ const formatTime = (hour: number, minute: number) => {
return `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}` return `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}`
} }
const normalizeHour = (hour: number, fallback: number) => {
return Number.isFinite(hour) ? Math.min(23, Math.max(0, Math.trunc(hour))) : fallback
}
export function KriTimePicker({ export function KriTimePicker({
value, value,
onChange, onChange,
disabled = false, disabled = false,
minuteStep = 5, minuteStep = 5,
startHour = 0,
endHour = 23,
hourLabel = '시',
minuteLabel = '분',
className, className,
}: KriTimePickerProps) { }: KriTimePickerProps) {
const { hour: selectedHour, minute: selectedMinute } = parseTime(value) const { hour: selectedHour, minute: selectedMinute } = parseTime(value)
const normalizedMinuteStep = Number.isFinite(minuteStep) && minuteStep > 0 const normalizedMinuteStep = Number.isFinite(minuteStep) && minuteStep > 0
? Math.min(Math.floor(minuteStep), 60) ? Math.min(Math.floor(minuteStep), 60)
: 5 : 5
const hours = Array.from({ length: 24 }, (_, index) => index)
const clampedStartHour = normalizeHour(startHour, 0)
const clampedEndHour = normalizeHour(endHour, 23)
// startHour > endHour로 잘못 지정된 경우, 두 값을 뒤바꿔 유효한 범위로 되돌린다.
const [normalizedStartHour, normalizedEndHour] = clampedStartHour > clampedEndHour
? [clampedEndHour, clampedStartHour]
: [clampedStartHour, clampedEndHour]
const hours = Array.from(
{ length: normalizedEndHour - normalizedStartHour + 1 },
(_, index) => normalizedStartHour + index,
)
const minutes = Array.from( const minutes = Array.from(
{ length: Math.ceil(60 / normalizedMinuteStep) }, { length: Math.ceil(60 / normalizedMinuteStep) },
(_, index) => index * normalizedMinuteStep, (_, index) => index * normalizedMinuteStep,
@@ -47,7 +70,7 @@ export function KriTimePicker({
const handleTimeChange = (type: 'hour' | 'minute', nextValue: number) => { const handleTimeChange = (type: 'hour' | 'minute', nextValue: number) => {
if (disabled) return if (disabled) return
const nextHour = type === 'hour' ? nextValue : selectedHour ?? 0 const nextHour = type === 'hour' ? nextValue : selectedHour ?? normalizedStartHour
const nextMinute = type === 'minute' ? nextValue : selectedMinute ?? 0 const nextMinute = type === 'minute' ? nextValue : selectedMinute ?? 0
onChange(formatTime(nextHour, nextMinute)) onChange(formatTime(nextHour, nextMinute))
@@ -55,7 +78,9 @@ export function KriTimePicker({
return ( return (
<div className={cn('flex flex-col divide-y sm:h-[300px] sm:flex-row sm:divide-x sm:divide-y-0', className)}> <div className={cn('flex flex-col divide-y sm:h-[300px] sm:flex-row sm:divide-x sm:divide-y-0', className)}>
<ScrollArea className="w-64 sm:w-auto"> <div className="flex flex-col">
<div className="mt-1 p-1 align-middle text-center text-base border-b">{hourLabel}</div>
<ScrollArea className="w-64 sm:w-auto sm:min-h-0 sm:flex-1">
<div className="flex p-2 sm:flex-col"> <div className="flex p-2 sm:flex-col">
{hours.map((hour) => ( {hours.map((hour) => (
<Button <Button
@@ -73,8 +98,11 @@ export function KriTimePicker({
</div> </div>
<ScrollBar orientation="horizontal" className="sm:hidden" /> <ScrollBar orientation="horizontal" className="sm:hidden" />
</ScrollArea> </ScrollArea>
</div>
<ScrollArea className="w-64 sm:w-auto"> <div className="flex flex-col">
<div className="mt-1 p-1 align-middle text-center text-base border-b">{minuteLabel}</div>
<ScrollArea className="w-64 sm:w-auto sm:min-h-0 sm:flex-1">
<div className="flex p-2 sm:flex-col"> <div className="flex p-2 sm:flex-col">
{minutes.map((minute) => ( {minutes.map((minute) => (
<Button <Button
@@ -93,6 +121,7 @@ export function KriTimePicker({
<ScrollBar orientation="horizontal" className="sm:hidden" /> <ScrollBar orientation="horizontal" className="sm:hidden" />
</ScrollArea> </ScrollArea>
</div> </div>
</div>
) )
} }

View File

@@ -375,7 +375,7 @@ const ListContactEventPanel = ({
{useFF && {useFF &&
<ContactEventSection <ContactEventSection
title="인터뷰 요원 확인사항" title="면접 확인사항"
prjctIdx={prjctIdx} prjctIdx={prjctIdx}
sid={sid} sid={sid}
resultCodeType={ResultCodeType.INTERVIEW} resultCodeType={ResultCodeType.INTERVIEW}

View File

@@ -1,6 +1,6 @@
'use client' 'use client'
import { useCallback, useEffect, useMemo, useState, type ReactNode } from 'react' import { useCallback, useEffect, useMemo, useState, type ClipboardEvent, type ReactNode } from 'react'
import type { PaginationState, SortingState } from '@tanstack/react-table' import type { PaginationState, SortingState } from '@tanstack/react-table'
import { Funnel, PencilLine } from 'lucide-react' import { Funnel, PencilLine } from 'lucide-react'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
@@ -77,6 +77,8 @@ const toSidSet = (value: string) =>
.map((item) => item.trim()) .map((item) => item.trim())
.filter((item) => item.length > 0) .filter((item) => item.length > 0)
const deduplicateSidInput = (value: string) => [...new Set(toSidSet(value))].join(',')
const sanitizeSidInput = (value: string) => { const sanitizeSidInput = (value: string) => {
let result = '' let result = ''
let lastChar: 'digit' | 'comma' | 'tilde' | null = null let lastChar: 'digit' | 'comma' | 'tilde' | null = null
@@ -485,6 +487,17 @@ export function ListSearchTable({
setPagination((prev) => ({ ...prev, pageIndex: 0 })) setPagination((prev) => ({ ...prev, pageIndex: 0 }))
} }
const handleSidPaste = (e: ClipboardEvent<HTMLInputElement>) => {
const pastedText = e.clipboardData.getData('text')
const normalizedText = pastedText.replace(/\t|\r\n|\r|\n/g, ',')
e.preventDefault()
const selectionStart = e.currentTarget.selectionStart ?? searchText.length
const selectionEnd = e.currentTarget.selectionEnd ?? selectionStart
const nextValue = `${searchText.slice(0, selectionStart)}${normalizedText}${searchText.slice(selectionEnd)}`
setSearchText(deduplicateSidInput(sanitizeSidInput(nextValue)))
}
const handleFilterConfirm = async (rows: FilterRow[]) => { const handleFilterConfirm = async (rows: FilterRow[]) => {
setFilterRows(rows) setFilterRows(rows)
setPagination((prev) => ({ ...prev, pageIndex: 0 })) setPagination((prev) => ({ ...prev, pageIndex: 0 }))
@@ -565,6 +578,7 @@ export function ListSearchTable({
className="h-9 bg-white flex-1 min-w-0 max-w-xs" className="h-9 bg-white flex-1 min-w-0 max-w-xs"
value={searchText} value={searchText}
onChange={(e) => setSearchText(sanitizeSidInput(e.target.value))} onChange={(e) => setSearchText(sanitizeSidInput(e.target.value))}
onPaste={handleSidPaste}
/> />
<div className="flex-1 min-w-0 max-w-xs"> <div className="flex-1 min-w-0 max-w-xs">
<KriMultiSelect <KriMultiSelect

View File

@@ -14,4 +14,5 @@ export const ALLOWED_PW_SPECIALS_TEXT = `~ ! @ # $ % ^ & * ( ) _ + - = { } [ ] :
// 비밀번호에 허용된 문자만 사용했는지 // 비밀번호에 허용된 문자만 사용했는지
export const ONLY_ALLOWED_PW_REGEX = /^[A-Za-z\d~!@#$%^&*()_+\-={}\[\]:;"'<>,.?/]+$/ export const ONLY_ALLOWED_PW_REGEX = /^[A-Za-z\d~!@#$%^&*()_+\-={}\[\]:;"'<>,.?/]+$/
// 영문 1개 이상 + 숫자 1개 이상 포함, 8~20자, 허용된 문자만 사용 // 영문 1개 이상 + 숫자 1개 이상 포함, 8~20자, 허용된 문자만 사용
export const KRI_PW_REGEX = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!@#$%^&*()_+\-={}\[\]:;"'<>,.?/]{8,20}$/ //export const KRI_PW_REGEX = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d!@#$%^&*()_+\-={}\[\]:;"'<>,.?/]{1,20}$/
export const KRI_PW_REGEX = /^[A-Za-z\d!@#$%^&*()_+\-={}\[\]:;"'<>,.?/]{1,20}$/