feat: ESLint 정리 및 전체 코드 품질 개선
- eslint.config.mjs 규칙 강화 및 정리 - 전역 unused import/변수 제거 (312개 파일) - next.config.ts, middleware, proxy route 개선 - CopyableCell molecule 추가 - 회계/결재/HR/생산/건설/품질/영업 등 전 도메인 lint 정리 - IntegratedListTemplateV2, DataTable, MobileCard 등 공통 컴포넌트 개선 - execute-server-action 에러 핸들링 보강
This commit is contained in:
@@ -90,7 +90,7 @@ export function AttendanceInfoDialog({
|
||||
};
|
||||
|
||||
// 선택된 사원 정보
|
||||
const selectedEmployee = employees.find(e => e.id === formData.employeeId);
|
||||
const _selectedEmployee = employees.find(e => e.id === formData.employeeId);
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
|
||||
@@ -22,7 +22,6 @@ import { format } from 'date-fns';
|
||||
import type {
|
||||
ReasonInfoDialogProps,
|
||||
ReasonFormData,
|
||||
ReasonType,
|
||||
} from './types';
|
||||
import { REASON_TYPE_LABELS } from './types';
|
||||
|
||||
|
||||
@@ -10,12 +10,10 @@ import {
|
||||
Calendar,
|
||||
Plus,
|
||||
FileText,
|
||||
Search,
|
||||
} from 'lucide-react';
|
||||
import type { ExcelColumn } from '@/lib/utils/excel-download';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { TableRow, TableCell } from '@/components/ui/table';
|
||||
import { format } from 'date-fns';
|
||||
@@ -27,7 +25,6 @@ import {
|
||||
type FilterFieldConfig,
|
||||
type FilterValues,
|
||||
} from '@/components/templates/UniversalListPage';
|
||||
import { DateRangeSelector } from '@/components/molecules/DateRangeSelector';
|
||||
import { ListMobileCard, InfoField } from '@/components/organisms/MobileCard';
|
||||
import { AttendanceInfoDialog } from './AttendanceInfoDialog';
|
||||
import { ReasonInfoDialog } from './ReasonInfoDialog';
|
||||
@@ -62,11 +59,11 @@ export function AttendanceManagement() {
|
||||
const [employees, setEmployees] = useState<EmployeeOption[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const isInitialLoadDone = useRef(false);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [, setTotal] = useState(0);
|
||||
|
||||
// 검색 및 필터 상태
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const [activeTab, setActiveTab] = useState<string>('all');
|
||||
const [activeTab, _setActiveTab] = useState<string>('all');
|
||||
const [filterOption, setFilterOption] = useState<FilterOption>('all');
|
||||
const [sortOption, setSortOption] = useState<SortOption>('dateDesc');
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
@@ -84,7 +81,7 @@ export function AttendanceManagement() {
|
||||
const [selectedAttendance, setSelectedAttendance] = useState<AttendanceRecord | null>(null);
|
||||
const [reasonDialogOpen, setReasonDialogOpen] = useState(false);
|
||||
const [selectedItems, setSelectedItems] = useState<Set<string>>(new Set());
|
||||
const [isSaving, setIsSaving] = useState(false);
|
||||
const [, setIsSaving] = useState(false);
|
||||
|
||||
// 데이터 로드
|
||||
useEffect(() => {
|
||||
@@ -253,20 +250,20 @@ export function AttendanceManagement() {
|
||||
// 테이블 컬럼 정의
|
||||
const tableColumns = useMemo(() => [
|
||||
{ key: 'no', label: '번호', className: 'w-[60px] text-center' },
|
||||
{ key: 'department', label: '부서', className: 'min-w-[80px]', sortable: true },
|
||||
{ key: 'position', label: '직책', className: 'min-w-[100px]', sortable: true },
|
||||
{ key: 'name', label: '이름', className: 'min-w-[60px]', sortable: true },
|
||||
{ key: 'rank', label: '직급', className: 'min-w-[60px]', sortable: true },
|
||||
{ key: 'baseDate', label: '기준일', className: 'min-w-[100px]', sortable: true },
|
||||
{ key: 'checkIn', label: '출근', className: 'min-w-[60px]', sortable: true },
|
||||
{ key: 'checkOut', label: '퇴근', className: 'min-w-[60px]', sortable: true },
|
||||
{ key: 'breakTime', label: '휴게', className: 'min-w-[60px]', sortable: true },
|
||||
{ key: 'overtime', label: '연장근무', className: 'min-w-[80px]', sortable: true },
|
||||
{ key: 'reason', label: '사유', className: 'min-w-[80px]', sortable: true },
|
||||
{ key: 'department', label: '부서', className: 'min-w-[80px]', sortable: true, copyable: true },
|
||||
{ key: 'position', label: '직책', className: 'min-w-[100px]', sortable: true, copyable: true },
|
||||
{ key: 'name', label: '이름', className: 'min-w-[60px]', sortable: true, copyable: true },
|
||||
{ key: 'rank', label: '직급', className: 'min-w-[60px]', sortable: true, copyable: true },
|
||||
{ key: 'baseDate', label: '기준일', className: 'min-w-[100px]', sortable: true, copyable: true },
|
||||
{ key: 'checkIn', label: '출근', className: 'min-w-[60px]', sortable: true, copyable: true },
|
||||
{ key: 'checkOut', label: '퇴근', className: 'min-w-[60px]', sortable: true, copyable: true },
|
||||
{ key: 'breakTime', label: '휴게', className: 'min-w-[60px]', sortable: true, copyable: true },
|
||||
{ key: 'overtime', label: '연장근무', className: 'min-w-[80px]', sortable: true, copyable: true },
|
||||
{ key: 'reason', label: '사유', className: 'min-w-[80px]', sortable: true, copyable: true },
|
||||
], []);
|
||||
|
||||
// 체크박스 토글
|
||||
const toggleSelection = useCallback((id: string) => {
|
||||
const _toggleSelection = useCallback((id: string) => {
|
||||
setSelectedItems(prev => {
|
||||
const newSet = new Set(prev);
|
||||
if (newSet.has(id)) {
|
||||
@@ -279,7 +276,7 @@ export function AttendanceManagement() {
|
||||
}, []);
|
||||
|
||||
// 전체 선택/해제
|
||||
const toggleSelectAll = useCallback(() => {
|
||||
const _toggleSelectAll = useCallback(() => {
|
||||
if (selectedItems.size === paginatedData.length && paginatedData.length > 0) {
|
||||
setSelectedItems(new Set());
|
||||
} else {
|
||||
@@ -393,7 +390,7 @@ export function AttendanceManagement() {
|
||||
sort: sortOption,
|
||||
}), [filterOption, sortOption]);
|
||||
|
||||
const handleFilterChange = useCallback((key: string, value: string | string[]) => {
|
||||
const _handleFilterChange = useCallback((key: string, value: string | string[]) => {
|
||||
switch (key) {
|
||||
case 'filter':
|
||||
setFilterOption(value as FilterOption);
|
||||
@@ -405,7 +402,7 @@ export function AttendanceManagement() {
|
||||
setCurrentPage(1);
|
||||
}, []);
|
||||
|
||||
const handleFilterReset = useCallback(() => {
|
||||
const _handleFilterReset = useCallback(() => {
|
||||
setFilterOption('all');
|
||||
setSortOption('dateDesc');
|
||||
setCurrentPage(1);
|
||||
|
||||
@@ -30,13 +30,13 @@ import type { TableColumn } from '@/components/templates/UniversalListPage/types
|
||||
|
||||
const LIST_COLUMNS: TableColumn[] = [
|
||||
{ key: 'no', label: 'No.', className: 'text-center w-[60px]' },
|
||||
{ key: 'type', label: '유형', className: 'w-[100px]' },
|
||||
{ key: 'name', label: '일정명' },
|
||||
{ key: 'startDate', label: '시작일', className: 'w-[120px]' },
|
||||
{ key: 'endDate', label: '종료일', className: 'w-[120px]' },
|
||||
{ key: 'days', label: '일수', className: 'text-center w-[70px]' },
|
||||
{ key: 'type', label: '유형', className: 'w-[100px]', copyable: true },
|
||||
{ key: 'name', label: '일정명', copyable: true },
|
||||
{ key: 'startDate', label: '시작일', className: 'w-[120px]', copyable: true },
|
||||
{ key: 'endDate', label: '종료일', className: 'w-[120px]', copyable: true },
|
||||
{ key: 'days', label: '일수', className: 'text-center w-[70px]', copyable: true },
|
||||
{ key: 'isRecurring', label: '반복', className: 'text-center w-[70px]' },
|
||||
{ key: 'memo', label: '메모' },
|
||||
{ key: 'memo', label: '메모', copyable: true },
|
||||
];
|
||||
|
||||
export function CalendarManagement() {
|
||||
@@ -46,7 +46,7 @@ export function CalendarManagement() {
|
||||
|
||||
const [schedules, setSchedules] = useState<CalendarSchedule[]>([]);
|
||||
const [stats, setStats] = useState<CalendarStats>({ totalCount: 0, totalHolidayDays: 0, publicHolidayCount: 0 });
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [, setIsLoading] = useState(true);
|
||||
|
||||
// Dialog states
|
||||
const [detailOpen, setDetailOpen] = useState(false);
|
||||
|
||||
@@ -148,12 +148,12 @@ export function CardManagement() {
|
||||
// 테이블 컬럼
|
||||
columns: [
|
||||
{ key: 'no', label: 'No.', className: 'text-center w-[60px]' },
|
||||
{ key: 'cardCompany', label: '카드사', className: 'min-w-[90px]' },
|
||||
{ key: 'cardNumber', label: '카드번호', className: 'min-w-[160px]' },
|
||||
{ key: 'cardName', label: '카드명', className: 'min-w-[150px]' },
|
||||
{ key: 'department', label: '부서', className: 'min-w-[80px]' },
|
||||
{ key: 'user', label: '사용자', className: 'min-w-[80px]' },
|
||||
{ key: 'usage', label: '사용현황', className: 'min-w-[180px]' },
|
||||
{ key: 'cardCompany', label: '카드사', className: 'min-w-[90px]', copyable: true },
|
||||
{ key: 'cardNumber', label: '카드번호', className: 'min-w-[160px]', copyable: true },
|
||||
{ key: 'cardName', label: '카드명', className: 'min-w-[150px]', copyable: true },
|
||||
{ key: 'department', label: '부서', className: 'min-w-[80px]', copyable: true },
|
||||
{ key: 'user', label: '사용자', className: 'min-w-[80px]', copyable: true },
|
||||
{ key: 'usage', label: '사용현황', className: 'min-w-[180px]', copyable: true },
|
||||
{ key: 'status', label: '상태', className: 'text-center min-w-[70px]' },
|
||||
],
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ export function DepartmentManagement() {
|
||||
const [departments, setDepartments] = useState<Department[]>([]);
|
||||
|
||||
// 로딩/처리 상태
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [, setIsLoading] = useState(false);
|
||||
const [isProcessing, setIsProcessing] = useState(false);
|
||||
|
||||
// 선택 상태
|
||||
|
||||
@@ -38,14 +38,12 @@ import type {
|
||||
} from './types';
|
||||
import {
|
||||
EMPLOYMENT_TYPE_LABELS,
|
||||
GENDER_LABELS,
|
||||
USER_ROLE_LABELS,
|
||||
USER_ACCOUNT_STATUS_LABELS,
|
||||
EMPLOYEE_STATUS_LABELS,
|
||||
DEFAULT_FIELD_SETTINGS,
|
||||
} from './types';
|
||||
import { getPositions, getDepartments, uploadProfileImage, type PositionItem, type DepartmentItem } from './actions';
|
||||
import { getProfileImageUrl } from './utils';
|
||||
import { extractDigits } from '@/lib/formatters';
|
||||
|
||||
// 부서 트리 구조 타입
|
||||
@@ -191,8 +189,8 @@ export function EmployeeForm({
|
||||
const [showFieldSettings, setShowFieldSettings] = useState(false);
|
||||
const [fieldSettings, setFieldSettings] = useState<FieldSettings>(initialFieldSettings);
|
||||
|
||||
const title = mode === 'create' ? '사원 등록' : mode === 'edit' ? '사원 수정' : '사원 상세';
|
||||
const description = mode === 'create'
|
||||
const _title = mode === 'create' ? '사원 등록' : mode === 'edit' ? '사원 수정' : '사원 상세';
|
||||
const _description = mode === 'create'
|
||||
? '새로운 사원 정보를 입력합니다'
|
||||
: mode === 'edit'
|
||||
? '사원 정보를 수정합니다'
|
||||
@@ -380,7 +378,7 @@ export function EmployeeForm({
|
||||
};
|
||||
|
||||
// 부서/직책 변경
|
||||
const handleDepartmentPositionChange = (id: string, field: keyof DepartmentPosition, value: string) => {
|
||||
const _handleDepartmentPositionChange = (id: string, field: keyof DepartmentPosition, value: string) => {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
departmentPositions: prev.departmentPositions.map(dp =>
|
||||
|
||||
@@ -15,7 +15,7 @@ interface EmployeeToolbarProps {
|
||||
|
||||
export function EmployeeToolbar({
|
||||
dateRange,
|
||||
onDateRangeChange,
|
||||
onDateRangeChange: _onDateRangeChange,
|
||||
onAddEmployee,
|
||||
onCSVUpload,
|
||||
onUserInvite,
|
||||
|
||||
@@ -28,7 +28,7 @@ import { transformApiToFrontend, transformFrontendToApi, type EmployeeApiData }
|
||||
// API 응답 타입 정의
|
||||
// ============================================
|
||||
|
||||
interface ApiResponse<T> {
|
||||
interface _ApiResponse<T> {
|
||||
success: boolean;
|
||||
data: T;
|
||||
message: string;
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
|
||||
import { useState, useMemo, useCallback, useEffect, useRef } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { Users, Edit, Trash2, UserCheck, UserX, Clock, Calendar, Mail, Plus, Upload, Loader2, Search } from 'lucide-react';
|
||||
import { getEmployees, deleteEmployee, deleteEmployees, getEmployeeStats } from './actions';
|
||||
import { Users, Edit, Trash2, UserCheck, UserX, Clock, Calendar, Mail, Plus, Upload } from 'lucide-react';
|
||||
import { getEmployees, deleteEmployee, deleteEmployees } from './actions';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { TableRow, TableCell } from '@/components/ui/table';
|
||||
import { DeleteConfirmDialog } from '@/components/ui/confirm-dialog';
|
||||
@@ -18,13 +17,11 @@ import {
|
||||
type FilterFieldConfig,
|
||||
type FilterValues,
|
||||
} from '@/components/templates/UniversalListPage';
|
||||
import { DateRangeSelector } from '@/components/molecules/DateRangeSelector';
|
||||
import { ListMobileCard, InfoField } from '@/components/organisms/MobileCard';
|
||||
import { FieldSettingsDialog } from './FieldSettingsDialog';
|
||||
import { UserInviteDialog } from './UserInviteDialog';
|
||||
import type {
|
||||
Employee,
|
||||
EmployeeStatus,
|
||||
FieldSettings,
|
||||
} from './types';
|
||||
import {
|
||||
@@ -69,11 +66,11 @@ export function EmployeeManagement() {
|
||||
const [employees, setEmployees] = useState<Employee[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const isInitialLoadDone = useRef(false);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [, setTotal] = useState(0);
|
||||
|
||||
// 검색 및 필터 상태
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const [activeTab, setActiveTab] = useState<string>('all');
|
||||
const [activeTab, _setActiveTab] = useState<string>('all');
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const itemsPerPage = 20;
|
||||
|
||||
@@ -162,22 +159,25 @@ export function EmployeeManagement() {
|
||||
// 정렬
|
||||
filtered = [...filtered].sort((a, b) => {
|
||||
switch (sortOption) {
|
||||
case 'rank':
|
||||
case 'rank': {
|
||||
// 직급 순서 정의 (높은 직급이 먼저)
|
||||
const rankOrder: Record<string, number> = { '회장': 1, '사장': 2, '부사장': 3, '전무': 4, '상무': 5, '이사': 6, '부장': 7, '차장': 8, '과장': 9, '대리': 10, '주임': 11, '사원': 12 };
|
||||
return (rankOrder[a.rank || ''] || 99) - (rankOrder[b.rank || ''] || 99);
|
||||
}
|
||||
case 'hireDateDesc':
|
||||
return new Date(b.hireDate || 0).getTime() - new Date(a.hireDate || 0).getTime();
|
||||
case 'hireDateAsc':
|
||||
return new Date(a.hireDate || 0).getTime() - new Date(b.hireDate || 0).getTime();
|
||||
case 'departmentAsc':
|
||||
case 'departmentAsc': {
|
||||
const deptA = a.departmentPositions?.[0]?.departmentName || '';
|
||||
const deptB = b.departmentPositions?.[0]?.departmentName || '';
|
||||
return deptA.localeCompare(deptB, 'ko');
|
||||
case 'departmentDesc':
|
||||
}
|
||||
case 'departmentDesc': {
|
||||
const deptA2 = a.departmentPositions?.[0]?.departmentName || '';
|
||||
const deptB2 = b.departmentPositions?.[0]?.departmentName || '';
|
||||
return deptB2.localeCompare(deptA2, 'ko');
|
||||
}
|
||||
case 'nameAsc':
|
||||
return a.name.localeCompare(b.name, 'ko');
|
||||
case 'nameDesc':
|
||||
@@ -255,22 +255,22 @@ export function EmployeeManagement() {
|
||||
// 테이블 컬럼 정의
|
||||
const tableColumns = useMemo(() => [
|
||||
{ key: 'rowNumber', label: '번호', className: 'w-[60px] text-center' },
|
||||
{ key: 'employeeCode', label: '사원코드', className: 'min-w-[100px]', sortable: true },
|
||||
{ key: 'employeeCode', label: '사원코드', className: 'min-w-[100px]', sortable: true, copyable: true },
|
||||
{ key: 'department', label: '부서', className: 'min-w-[100px]', sortable: true },
|
||||
{ key: 'position', label: '직책', className: 'min-w-[100px]', sortable: true },
|
||||
{ key: 'name', label: '이름', className: 'min-w-[80px]', sortable: true },
|
||||
{ key: 'rank', label: '직급', className: 'min-w-[80px]', sortable: true },
|
||||
{ key: 'phone', label: '휴대폰', className: 'min-w-[120px]', sortable: true },
|
||||
{ key: 'email', label: '이메일', className: 'min-w-[150px]', sortable: true },
|
||||
{ key: 'hireDate', label: '입사일', className: 'min-w-[100px]', sortable: true },
|
||||
{ key: 'name', label: '이름', className: 'min-w-[80px]', sortable: true, copyable: true },
|
||||
{ key: 'rank', label: '직급', className: 'min-w-[80px]', sortable: true, copyable: true },
|
||||
{ key: 'phone', label: '휴대폰', className: 'min-w-[120px]', sortable: true, copyable: true },
|
||||
{ key: 'email', label: '이메일', className: 'min-w-[150px]', sortable: true, copyable: true },
|
||||
{ key: 'hireDate', label: '입사일', className: 'min-w-[100px]', sortable: true, copyable: true },
|
||||
{ key: 'status', label: '상태', className: 'min-w-[80px]', sortable: true },
|
||||
{ key: 'userId', label: '사용자아이디', className: 'min-w-[100px]', sortable: true },
|
||||
{ key: 'userRole', label: '권한', className: 'min-w-[80px]', sortable: true },
|
||||
{ key: 'userRole', label: '권한', className: 'min-w-[80px]', sortable: true, copyable: true },
|
||||
{ key: 'actions', label: '작업', className: 'w-[100px] text-right' },
|
||||
], []);
|
||||
|
||||
// 체크박스 토글
|
||||
const toggleSelection = useCallback((id: string) => {
|
||||
const _toggleSelection = useCallback((id: string) => {
|
||||
setSelectedItems(prev => {
|
||||
const newSet = new Set(prev);
|
||||
if (newSet.has(id)) {
|
||||
@@ -283,7 +283,7 @@ export function EmployeeManagement() {
|
||||
}, []);
|
||||
|
||||
// 전체 선택/해제
|
||||
const toggleSelectAll = useCallback(() => {
|
||||
const _toggleSelectAll = useCallback(() => {
|
||||
if (selectedItems.size === paginatedData.length && paginatedData.length > 0) {
|
||||
setSelectedItems(new Set());
|
||||
} else {
|
||||
@@ -293,7 +293,7 @@ export function EmployeeManagement() {
|
||||
}, [selectedItems.size, paginatedData]);
|
||||
|
||||
// 일괄 삭제 핸들러
|
||||
const handleBulkDelete = useCallback(async () => {
|
||||
const _handleBulkDelete = useCallback(async () => {
|
||||
const ids = Array.from(selectedItems);
|
||||
if (ids.length === 0) return;
|
||||
|
||||
@@ -385,7 +385,7 @@ export function EmployeeManagement() {
|
||||
sort: sortOption,
|
||||
}), [filterOption, sortOption]);
|
||||
|
||||
const handleFilterChange = useCallback((key: string, value: string | string[]) => {
|
||||
const _handleFilterChange = useCallback((key: string, value: string | string[]) => {
|
||||
switch (key) {
|
||||
case 'filter':
|
||||
setFilterOption(value as FilterOption);
|
||||
@@ -397,7 +397,7 @@ export function EmployeeManagement() {
|
||||
setCurrentPage(1);
|
||||
}, []);
|
||||
|
||||
const handleFilterReset = useCallback(() => {
|
||||
const _handleFilterReset = useCallback(() => {
|
||||
setFilterOption('all');
|
||||
setSortOption('rank');
|
||||
setCurrentPage(1);
|
||||
@@ -539,14 +539,16 @@ export function EmployeeManagement() {
|
||||
return new Date(b.hireDate || 0).getTime() - new Date(a.hireDate || 0).getTime();
|
||||
case 'hireDateAsc':
|
||||
return new Date(a.hireDate || 0).getTime() - new Date(b.hireDate || 0).getTime();
|
||||
case 'departmentAsc':
|
||||
case 'departmentAsc': {
|
||||
const deptA = a.departmentPositions?.[0]?.departmentName || '';
|
||||
const deptB = b.departmentPositions?.[0]?.departmentName || '';
|
||||
return deptA.localeCompare(deptB, 'ko');
|
||||
case 'departmentDesc':
|
||||
}
|
||||
case 'departmentDesc': {
|
||||
const deptA2 = a.departmentPositions?.[0]?.departmentName || '';
|
||||
const deptB2 = b.departmentPositions?.[0]?.departmentName || '';
|
||||
return deptB2.localeCompare(deptA2, 'ko');
|
||||
}
|
||||
case 'nameAsc':
|
||||
return a.name.localeCompare(b.name, 'ko');
|
||||
case 'nameDesc':
|
||||
@@ -558,7 +560,7 @@ export function EmployeeManagement() {
|
||||
},
|
||||
|
||||
renderTableRow: (item, index, globalIndex, handlers) => {
|
||||
const { isSelected, onToggle, onRowClick } = handlers;
|
||||
const { isSelected, onToggle, onRowClick: _onRowClick } = handlers;
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
@@ -724,7 +726,7 @@ export function EmployeeManagement() {
|
||||
<UserInviteDialog
|
||||
open={userInviteOpen}
|
||||
onOpenChange={setUserInviteOpen}
|
||||
onInvite={(data) => {
|
||||
onInvite={(_data) => {
|
||||
setUserInviteOpen(false);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -15,7 +15,6 @@ import type {
|
||||
Address,
|
||||
UserInfo,
|
||||
UserRole,
|
||||
UserAccountStatus,
|
||||
} from './types';
|
||||
|
||||
// ============================================
|
||||
|
||||
@@ -70,7 +70,7 @@ function EditableRow({
|
||||
label,
|
||||
value,
|
||||
onChange,
|
||||
prefix,
|
||||
prefix: _prefix,
|
||||
}: {
|
||||
label: string;
|
||||
value: number;
|
||||
|
||||
@@ -12,12 +12,10 @@ import {
|
||||
Gift,
|
||||
MinusCircle,
|
||||
Loader2,
|
||||
Search,
|
||||
Plus,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Checkbox } from '@/components/ui/checkbox';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { TableRow, TableCell } from '@/components/ui/table';
|
||||
@@ -43,7 +41,6 @@ import {
|
||||
import type {
|
||||
SalaryRecord,
|
||||
SalaryDetail,
|
||||
PaymentStatus,
|
||||
SortOption,
|
||||
} from './types';
|
||||
import {
|
||||
@@ -164,7 +161,7 @@ const MOCK_SALARY_DETAILS: Record<string, SalaryDetail> = {
|
||||
};
|
||||
|
||||
export function SalaryManagement() {
|
||||
const { canExport } = usePermission();
|
||||
const { canExport: _canExport } = usePermission();
|
||||
// ===== 상태 관리 =====
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [sortOption, setSortOption] = useState<SortOption>('rank');
|
||||
@@ -522,17 +519,17 @@ export function SalaryManagement() {
|
||||
|
||||
// ===== 테이블 컬럼 (부서, 직책, 이름, 직급, 기본급, 수당, 초과근무, 상여, 공제, 실지급액, 일자, 상태, 작업) =====
|
||||
const tableColumns = useMemo(() => [
|
||||
{ key: 'department', label: '부서', sortable: true },
|
||||
{ key: 'position', label: '직책', sortable: true },
|
||||
{ key: 'name', label: '이름', sortable: true },
|
||||
{ key: 'rank', label: '직급', sortable: true },
|
||||
{ key: 'baseSalary', label: '기본급', className: 'text-right', sortable: true },
|
||||
{ key: 'allowance', label: '수당', className: 'text-right', sortable: true },
|
||||
{ key: 'overtime', label: '초과근무', className: 'text-right', sortable: true },
|
||||
{ key: 'bonus', label: '상여', className: 'text-right', sortable: true },
|
||||
{ key: 'deduction', label: '공제', className: 'text-right', sortable: true },
|
||||
{ key: 'netPayment', label: '실지급액', className: 'text-right', sortable: true },
|
||||
{ key: 'paymentDate', label: '일자', className: 'text-center', sortable: true },
|
||||
{ key: 'department', label: '부서', sortable: true, copyable: true },
|
||||
{ key: 'position', label: '직책', sortable: true, copyable: true },
|
||||
{ key: 'name', label: '이름', sortable: true, copyable: true },
|
||||
{ key: 'rank', label: '직급', sortable: true, copyable: true },
|
||||
{ key: 'baseSalary', label: '기본급', className: 'text-right', sortable: true, copyable: true },
|
||||
{ key: 'allowance', label: '수당', className: 'text-right', sortable: true, copyable: true },
|
||||
{ key: 'overtime', label: '초과근무', className: 'text-right', sortable: true, copyable: true },
|
||||
{ key: 'bonus', label: '상여', className: 'text-right', sortable: true, copyable: true },
|
||||
{ key: 'deduction', label: '공제', className: 'text-right', sortable: true, copyable: true },
|
||||
{ key: 'netPayment', label: '실지급액', className: 'text-right', sortable: true, copyable: true },
|
||||
{ key: 'paymentDate', label: '일자', className: 'text-center', sortable: true, copyable: true },
|
||||
{ key: 'status', label: '상태', className: 'text-center', sortable: true },
|
||||
], []);
|
||||
|
||||
@@ -553,7 +550,7 @@ export function SalaryManagement() {
|
||||
sort: sortOption,
|
||||
}), [sortOption]);
|
||||
|
||||
const handleFilterChange = useCallback((key: string, value: string | string[]) => {
|
||||
const _handleFilterChange = useCallback((key: string, value: string | string[]) => {
|
||||
switch (key) {
|
||||
case 'sort':
|
||||
setSortOption(value as SortOption);
|
||||
@@ -562,7 +559,7 @@ export function SalaryManagement() {
|
||||
setCurrentPage(1);
|
||||
}, []);
|
||||
|
||||
const handleFilterReset = useCallback(() => {
|
||||
const _handleFilterReset = useCallback(() => {
|
||||
setSortOption('rank');
|
||||
setCurrentPage(1);
|
||||
}, []);
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
DialogFooter,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { DatePicker } from '@/components/ui/date-picker';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
DialogFooter,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
import { NumberInput } from '@/components/ui/number-input';
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
DialogFooter,
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { DatePicker } from '@/components/ui/date-picker';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import {
|
||||
|
||||
@@ -160,7 +160,7 @@ export interface LeaveBalanceRecord {
|
||||
remainingDays: number;
|
||||
}
|
||||
|
||||
interface ApiResponse<T> {
|
||||
interface _ApiResponse<T> {
|
||||
success: boolean;
|
||||
data: T;
|
||||
message: string;
|
||||
|
||||
@@ -67,7 +67,7 @@ import { formatDate } from '@/lib/utils/date';
|
||||
|
||||
// ===== Mock 데이터 생성 (request 탭용 - 신청 현황은 leaves API 사용 예정) =====
|
||||
|
||||
const generateRequestData = (): VacationRequestRecord[] => {
|
||||
const _generateRequestData = (): VacationRequestRecord[] => {
|
||||
const departments = ['개발팀', '디자인팀', '기획팀', '영업팀', '인사팀'];
|
||||
const positions = ['팀장', '파트장', '선임', '주임', '사원'];
|
||||
const ranks = ['부장', '차장', '과장', '대리', '사원'];
|
||||
@@ -123,7 +123,7 @@ export function VacationManagement() {
|
||||
const [usageData, setUsageData] = useState<VacationUsageRecord[]>([]);
|
||||
const [grantData, setGrantData] = useState<VacationGrantRecord[]>([]);
|
||||
const [requestData, setRequestData] = useState<VacationRequestRecord[]>([]);
|
||||
const [apiLeaveRecords, setApiLeaveRecords] = useState<LeaveRecord[]>([]);
|
||||
const [, setApiLeaveRecords] = useState<LeaveRecord[]>([]);
|
||||
|
||||
// ===== API 데이터 로드 =====
|
||||
/**
|
||||
@@ -394,41 +394,41 @@ export function VacationManagement() {
|
||||
// 휴가 사용현황: 번호|부서|직책|이름|직급|입사일|기본|부여|사용|잔액
|
||||
return [
|
||||
{ key: 'no', label: '번호', className: 'w-[60px] text-center' },
|
||||
{ key: 'department', label: '부서', sortable: true },
|
||||
{ key: 'position', label: '직책', sortable: true },
|
||||
{ key: 'name', label: '이름', sortable: true },
|
||||
{ key: 'rank', label: '직급', sortable: true },
|
||||
{ key: 'hireDate', label: '입사일', sortable: true },
|
||||
{ key: 'base', label: '기본', className: 'text-center', sortable: true },
|
||||
{ key: 'granted', label: '부여', className: 'text-center', sortable: true },
|
||||
{ key: 'used', label: '사용', className: 'text-center', sortable: true },
|
||||
{ key: 'remaining', label: '잔여', className: 'text-center', sortable: true },
|
||||
{ key: 'department', label: '부서', sortable: true, copyable: true },
|
||||
{ key: 'position', label: '직책', sortable: true, copyable: true },
|
||||
{ key: 'name', label: '이름', sortable: true, copyable: true },
|
||||
{ key: 'rank', label: '직급', sortable: true, copyable: true },
|
||||
{ key: 'hireDate', label: '입사일', sortable: true, copyable: true },
|
||||
{ key: 'base', label: '기본', className: 'text-center', sortable: true, copyable: true },
|
||||
{ key: 'granted', label: '부여', className: 'text-center', sortable: true, copyable: true },
|
||||
{ key: 'used', label: '사용', className: 'text-center', sortable: true, copyable: true },
|
||||
{ key: 'remaining', label: '잔여', className: 'text-center', sortable: true, copyable: true },
|
||||
];
|
||||
} else if (mainTab === 'grant') {
|
||||
// 휴가 부여현황: 번호|부서|직책|이름|직급|유형|부여일|부여휴가일수|사유
|
||||
return [
|
||||
{ key: 'no', label: '번호', className: 'w-[60px] text-center' },
|
||||
{ key: 'department', label: '부서', sortable: true },
|
||||
{ key: 'position', label: '직책', sortable: true },
|
||||
{ key: 'name', label: '이름', sortable: true },
|
||||
{ key: 'rank', label: '직급', sortable: true },
|
||||
{ key: 'type', label: '유형', sortable: true },
|
||||
{ key: 'grantDate', label: '부여일', sortable: true },
|
||||
{ key: 'grantDays', label: '부여휴가일수', className: 'text-center', sortable: true },
|
||||
{ key: 'reason', label: '사유', sortable: true },
|
||||
{ key: 'department', label: '부서', sortable: true, copyable: true },
|
||||
{ key: 'position', label: '직책', sortable: true, copyable: true },
|
||||
{ key: 'name', label: '이름', sortable: true, copyable: true },
|
||||
{ key: 'rank', label: '직급', sortable: true, copyable: true },
|
||||
{ key: 'type', label: '유형', sortable: true, copyable: true },
|
||||
{ key: 'grantDate', label: '부여일', sortable: true, copyable: true },
|
||||
{ key: 'grantDays', label: '부여휴가일수', className: 'text-center', sortable: true, copyable: true },
|
||||
{ key: 'reason', label: '사유', sortable: true, copyable: true },
|
||||
];
|
||||
} else {
|
||||
// 휴가 신청현황: 번호|부서|직책|이름|직급|휴가기간|휴가일수|상태|신청일
|
||||
return [
|
||||
{ key: 'no', label: '번호', className: 'w-[60px] text-center' },
|
||||
{ key: 'department', label: '부서', sortable: true },
|
||||
{ key: 'position', label: '직책', sortable: true },
|
||||
{ key: 'name', label: '이름', sortable: true },
|
||||
{ key: 'rank', label: '직급', sortable: true },
|
||||
{ key: 'period', label: '휴가기간', sortable: true },
|
||||
{ key: 'days', label: '휴가일수', className: 'text-center', sortable: true },
|
||||
{ key: 'department', label: '부서', sortable: true, copyable: true },
|
||||
{ key: 'position', label: '직책', sortable: true, copyable: true },
|
||||
{ key: 'name', label: '이름', sortable: true, copyable: true },
|
||||
{ key: 'rank', label: '직급', sortable: true, copyable: true },
|
||||
{ key: 'period', label: '휴가기간', sortable: true, copyable: true },
|
||||
{ key: 'days', label: '휴가일수', className: 'text-center', sortable: true, copyable: true },
|
||||
{ key: 'status', label: '상태', className: 'text-center', sortable: true },
|
||||
{ key: 'requestDate', label: '신청일', sortable: true },
|
||||
{ key: 'requestDate', label: '신청일', sortable: true, copyable: true },
|
||||
];
|
||||
}
|
||||
}, [mainTab]);
|
||||
@@ -642,7 +642,7 @@ export function VacationManagement() {
|
||||
},
|
||||
], []);
|
||||
|
||||
const filterValues: FilterValues = useMemo(() => ({
|
||||
const _filterValues: FilterValues = useMemo(() => ({
|
||||
filter: filterOption,
|
||||
sort: sortOption,
|
||||
}), [filterOption, sortOption]);
|
||||
@@ -660,7 +660,7 @@ export function VacationManagement() {
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleFilterReset = useCallback(() => {
|
||||
const _handleFilterReset = useCallback(() => {
|
||||
setFilterOption('all');
|
||||
setSortOption('rank');
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user