260702_01_ENH: 리스트 작업 도중 공용 ui를 적용하기 위한 중간 커밋
This commit is contained in:
@@ -8,24 +8,22 @@ import { ChevronLeft, ChevronRight } from 'lucide-react'
|
||||
import { KriSingleSelect } from '@/components/common/KriAutoComplete'
|
||||
import { ProjectInfo } from "@/types/project";
|
||||
import { PROJECT_SEARCH_COUNT } from "@/const/projectConst";
|
||||
import { useDebouncedValue } from "@/hooks/useDebouncedValue";
|
||||
import { useMounted } from "@/hooks/useMounted";
|
||||
import { useDebouncedValue, useMounted } from "@kri/common/hooks";
|
||||
import { UserInfo } from "@/types/user";
|
||||
import { useSelectedProject } from "@/hooks/useSelectedProject";
|
||||
import { KriSelect, KriSelectItem } from "@/components/common/KriSelect";
|
||||
import { useAuth } from "@/hooks/useAuth";
|
||||
import { CONTACT_USER_ROLE, FW_USER_ROLE } from "@/const/userConst";
|
||||
import {CONTACT_USER_ROLE, DEFAULT_COMPANY_NAME, FW_USER_ROLE} from "@/const/userConst";
|
||||
|
||||
import {
|
||||
useFieldworkUsersQuery,
|
||||
useFieldworkUsersQuery, useOutsourceUsersQuery,
|
||||
useRoleListQuery,
|
||||
useUserCompaniesQuery,
|
||||
} from "@/query/user";
|
||||
|
||||
import {
|
||||
useAssignedFieldworkIdsQuery,
|
||||
useSaveAssignedFieldworkMutation,
|
||||
useProjectTopQuery,
|
||||
useProjectTopQuery, useAssignedOutsourceIdsQuery,
|
||||
} from "@/query/project";
|
||||
|
||||
const ProjectAssignPage = () => {
|
||||
@@ -36,18 +34,27 @@ const ProjectAssignPage = () => {
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0;
|
||||
const enabled = mounted && prjctIdx > 0;
|
||||
|
||||
const companyQuery = useOutsourceUsersQuery(enabled);
|
||||
const fwUsersQuery = useFieldworkUsersQuery(enabled);
|
||||
const assignedCompanyQuery = useAssignedOutsourceIdsQuery(prjctIdx, enabled);
|
||||
const assignedIdsQuery = useAssignedFieldworkIdsQuery(prjctIdx, enabled);
|
||||
const saveAssignMutation = useSaveAssignedFieldworkMutation(prjctIdx);
|
||||
|
||||
const companyQuery = useUserCompaniesQuery();
|
||||
const roleQuery = useRoleListQuery();
|
||||
|
||||
const [searchKeyword, setSearchKeyword] = useState("");
|
||||
const debouncedKeyword = useDebouncedValue(searchKeyword, 500);
|
||||
const projectTopQuery = useProjectTopQuery(PROJECT_SEARCH_COUNT, debouncedKeyword, mounted);
|
||||
const projectArray = projectTopQuery.data ?? [];
|
||||
const companyArray = companyQuery.data ?? [];
|
||||
const companyArray = useMemo(() => {
|
||||
const companies = companyQuery.data ?? [];
|
||||
const assigned = assignedCompanyQuery.data ?? [];
|
||||
const assignedCompanies = companies
|
||||
.filter(c => !assigned.includes(c.userCmpn))
|
||||
.map(c => c.userCmpn);
|
||||
|
||||
return [DEFAULT_COMPANY_NAME, ...assignedCompanies];
|
||||
}, [companyQuery.data, assignedCompanyQuery.data]);
|
||||
|
||||
const roleArray: KriSelectItem[] = useMemo(() => {
|
||||
const roles = roleQuery.data ?? [];
|
||||
@@ -252,12 +259,12 @@ const ProjectAssignPage = () => {
|
||||
if (!mounted || !selectedProject) return null;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 p-1">
|
||||
<div className="bg-gray-50 p-1">
|
||||
<div className="max-w-7xl mx-auto">
|
||||
<div className="mb-6 rounded-lg border border-gray-200 bg-white p-4 shadow-sm">
|
||||
<div className="mb-6 rounded-lg border border-gray-200 bg-white p-2 shadow-sm">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-end">
|
||||
<div className="w-full sm:w-auto flex items-center gap-3">
|
||||
<div className="w-14 content-text-lg font-medium text-gray-700 whitespace-nowrap text-right">회사</div>
|
||||
<div className="w-14 text-lg font-medium text-gray-700 whitespace-nowrap text-right">회사</div>
|
||||
<KriSelect
|
||||
items={companyArray}
|
||||
value={companyFilter}
|
||||
@@ -269,7 +276,7 @@ const ProjectAssignPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="w-full sm:w-auto flex items-center gap-3">
|
||||
<div className="w-14 content-text-lg font-medium text-gray-700 whitespace-nowrap text-right">대상</div>
|
||||
<div className="w-14 text-lg font-medium text-gray-700 whitespace-nowrap text-right">대상</div>
|
||||
<KriSelect
|
||||
items={roleArray}
|
||||
value={roleFilter?.value || ""}
|
||||
@@ -286,11 +293,11 @@ const ProjectAssignPage = () => {
|
||||
|
||||
<div className="grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] gap-6 mb-6">
|
||||
<div className="min-w-0">
|
||||
<div className="p-3 bg-black text-white rounded-lg content-text-lg mb-2 h-15 flex items-center">
|
||||
<div className="p-2 bg-black text-white rounded-lg text-lg mb-2 h-13 flex items-center">
|
||||
<span className="truncate w-full">{assignInfoString}</span>
|
||||
</div>
|
||||
<div className="border border-gray-200 rounded-lg overflow-hidden bg-white shadow-sm">
|
||||
<div className="bg-gray-50 p-3 border-b border-gray-200">
|
||||
<div className="bg-gray-50 p-2 border-b border-gray-200">
|
||||
<Input
|
||||
placeholder="면접원 ID Or 면접원 이름"
|
||||
value={searchAssign}
|
||||
@@ -299,18 +306,18 @@ const ProjectAssignPage = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="h-[600px] overflow-y-auto">
|
||||
<div className="h-[550px] overflow-y-auto">
|
||||
<table className="w-full">
|
||||
<thead className="bg-black text-white sticky top-0">
|
||||
<tr>
|
||||
<th className="p-3 text-left w-12">
|
||||
<th className="p-2 text-left w-12">
|
||||
<Checkbox
|
||||
checked={selectedAssignUser.length === assignView.length && assignView.length > 0}
|
||||
onCheckedChange={handleSelectAllLeft}
|
||||
className="border-white"
|
||||
/>
|
||||
</th>
|
||||
<th className="p-3 text-left content-text-base font-medium">
|
||||
<th className="p-2 text-left text-base font-medium">
|
||||
배정된 {roleFilter?.label} ( {assignBase.length}명 )
|
||||
</th>
|
||||
</tr>
|
||||
@@ -324,14 +331,14 @@ const ProjectAssignPage = () => {
|
||||
}`}
|
||||
onClick={() => handleToggleUnassign(userInfo.userId)}
|
||||
>
|
||||
<td className="p-3">
|
||||
<td className="p-2">
|
||||
<Checkbox
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
checked={selectedAssignUser.includes(userInfo.userId)}
|
||||
onCheckedChange={() => handleToggleUnassign(userInfo.userId)}
|
||||
/>
|
||||
</td>
|
||||
<td className="p-3 content-text-base">
|
||||
<td className="p-2 text-base">
|
||||
{userInfo.userName} ({userInfo.userId})
|
||||
</td>
|
||||
</tr>
|
||||
@@ -346,7 +353,7 @@ const ProjectAssignPage = () => {
|
||||
<Button
|
||||
onClick={handleAssign}
|
||||
disabled={selectedAbleUser.length === 0}
|
||||
className="bg-black hover:bg-gray-800 w-36 h-12 flex items-center justify-center content-text-base disabled:bg-gray-300"
|
||||
className="bg-black hover:bg-gray-800 w-36 h-12 flex items-center justify-center text-base disabled:bg-gray-300"
|
||||
>
|
||||
<ChevronLeft className="w-5 h-5" />
|
||||
<span className="ml-2">배정 {selectedAbleUser.length}명</span>
|
||||
@@ -354,7 +361,7 @@ const ProjectAssignPage = () => {
|
||||
<Button
|
||||
onClick={handleRemove}
|
||||
disabled={selectedAssignUser.length === 0}
|
||||
className="bg-red-600 hover:bg-red-700 w-36 h-12 flex items-center justify-center content-text-base disabled:bg-gray-300"
|
||||
className="bg-red-600 hover:bg-red-700 w-36 h-12 flex items-center justify-center text-base disabled:bg-gray-300"
|
||||
>
|
||||
<ChevronRight className="w-5 h-5" />
|
||||
<span className="ml-2">제외 {selectedAssignUser.length}명</span>
|
||||
@@ -362,7 +369,7 @@ const ProjectAssignPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="min-w-0">
|
||||
<div className="p-3 bg-black text-white rounded-lg content-text-lg mb-2 h-15">
|
||||
<div className="p-2 bg-black text-white rounded-lg text-lg mb-2 h-13">
|
||||
<KriSingleSelect<ProjectInfo>
|
||||
items={projectArray}
|
||||
value={String(sourceProject?.prjctIdx ?? "")}
|
||||
@@ -383,7 +390,7 @@ const ProjectAssignPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="border border-gray-200 rounded-lg overflow-hidden bg-white shadow-sm">
|
||||
<div className="bg-gray-50 p-3 border-b border-gray-200">
|
||||
<div className="bg-gray-50 p-2 border-b border-gray-200">
|
||||
<Input
|
||||
placeholder="면접원 ID Or 면접원 이름"
|
||||
value={searchAble}
|
||||
@@ -392,18 +399,18 @@ const ProjectAssignPage = () => {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="h-[600px] overflow-y-auto">
|
||||
<div className="h-[550px] overflow-y-auto">
|
||||
<table className="w-full">
|
||||
<thead className="bg-black text-white sticky top-0">
|
||||
<tr>
|
||||
<th className="p-3 text-left w-12">
|
||||
<th className="p-2 text-left w-12">
|
||||
<Checkbox
|
||||
checked={selectedAbleUser.length === ableView.length && ableView.length > 0}
|
||||
onCheckedChange={handleSelectAllRight}
|
||||
className="border-white"
|
||||
/>
|
||||
</th>
|
||||
<th className="p-3 text-left content-text-base font-medium">
|
||||
<th className="p-2 text-left text-base font-medium">
|
||||
배정 가능 {roleFilter?.label} ({ableBase.length}명 )
|
||||
</th>
|
||||
</tr>
|
||||
@@ -417,14 +424,14 @@ const ProjectAssignPage = () => {
|
||||
}`}
|
||||
onClick={() => handleToggleAssign(user.userId)}
|
||||
>
|
||||
<td className="p-3">
|
||||
<td className="p-2">
|
||||
<Checkbox
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
checked={selectedAbleUser.includes(user.userId)}
|
||||
onCheckedChange={() => handleToggleAssign(user.userId)}
|
||||
/>
|
||||
</td>
|
||||
<td className="p-3 content-text-base">
|
||||
<td className="p-2 text-base">
|
||||
{user.userName} ({user.userId})
|
||||
</td>
|
||||
</tr>
|
||||
@@ -439,7 +446,7 @@ const ProjectAssignPage = () => {
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
className="bg-black hover:bg-gray-800 px-12 h-11 content-text-base font-medium"
|
||||
className="bg-black hover:bg-gray-800 px-12 h-9 text-base font-medium"
|
||||
>
|
||||
저장
|
||||
</Button>
|
||||
@@ -449,4 +456,4 @@ const ProjectAssignPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export default ProjectAssignPage;
|
||||
export default ProjectAssignPage;
|
||||
|
||||
@@ -5,10 +5,10 @@ import {CookieKeys} from "@/store/cookie/cookie-keys";
|
||||
import {FONT_SIZE} from "@/const/commonConst";
|
||||
|
||||
function parseFontSize(raw: string | undefined | null) {
|
||||
if (!raw) return FONT_SIZE.MIN;
|
||||
if (!raw) return FONT_SIZE.DEFAULT;
|
||||
|
||||
const parsed = parseInt(raw, 10);
|
||||
if (Number.isNaN(parsed)) return FONT_SIZE.MIN;
|
||||
if (Number.isNaN(parsed)) return FONT_SIZE.DEFAULT;
|
||||
|
||||
return Math.min(
|
||||
FONT_SIZE.MAX,
|
||||
@@ -23,7 +23,7 @@ export default async function MainLayoutWrapper({
|
||||
}) {
|
||||
const cookieStore = await cookies();
|
||||
const fontSize = cookieStore.get(CookieKeys.FontSize);
|
||||
const accessToken = cookieStore.get("access_token")?.value;
|
||||
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value;
|
||||
const initialFontSize = parseFontSize(fontSize?.value);
|
||||
|
||||
if (!accessToken) {
|
||||
@@ -35,4 +35,4 @@ export default async function MainLayoutWrapper({
|
||||
{children}
|
||||
</MainLayout>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'use client'
|
||||
'use client'
|
||||
|
||||
import { useMemo, useState } from 'react'
|
||||
import { PaginationState, SortingState } from '@tanstack/react-table'
|
||||
@@ -18,34 +18,57 @@ import { DataTable } from '@/components/data-table/DataTable'
|
||||
import type { DataTableColumn } from '@/components/data-table/DataTable.type'
|
||||
import { KriMultiSelect } from '@/components/common/KriAutoComplete'
|
||||
import { LoadingOverlay } from '@/components/common/LoadingOverlay'
|
||||
import { useMounted } from '@/hooks/useMounted'
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import { useAuth } from '@/hooks/useAuth'
|
||||
import { useDialog } from '@/hooks/useDialog'
|
||||
import { useSelectedProject } from '@/hooks/useSelectedProject'
|
||||
import { useListHeaderQuery, useListSearchQuery } from '@/query/list'
|
||||
import {
|
||||
useDownloadListEventHistoryMutation,
|
||||
useDownloadListExcelTemplateMutation,
|
||||
useDownloadListItemFileMutation,
|
||||
useDownloadListMutation,
|
||||
useDownloadListUpdateHistoryMutation,
|
||||
useDownloadUploadHistoryFileMutation,
|
||||
useListHeaderQuery,
|
||||
useListSearchQuery,
|
||||
useListUploadHistoryQuery,
|
||||
useResetListMutation,
|
||||
useUpdateListHeaderMutation,
|
||||
useUpdateListMutation,
|
||||
useUploadListExcelMutation,
|
||||
} from '@/query/list'
|
||||
import { useResultCodesQuery } from '@/query/project'
|
||||
import { getListColumns, ListTableRow } from '@/components/table-column/ListTableColumn'
|
||||
import { ListSearchRequest } from '@/types/list'
|
||||
import {
|
||||
createEmptyListFilter,
|
||||
FilterRow,
|
||||
ListEventHistoryBase,
|
||||
ListDownloadMode,
|
||||
ListDownloadPayload,
|
||||
listHeader,
|
||||
ListFilterMatchType,
|
||||
ListFilterOperator,
|
||||
ListFilterTarget,
|
||||
ListOtherItemFilterCondition,
|
||||
ListResetMode,
|
||||
ListResetScope,
|
||||
ListSearchRequest,
|
||||
ListUploadRequest,
|
||||
} from '@/types/list'
|
||||
import { ResultCode, ResultCodeType } from '@/types/project'
|
||||
import { ListHeaderAssignConst } from '@/const/listConst'
|
||||
import ListResetDialog, { ListResetScope, ListResetTarget } from '@/components/dialog/ListResetDialog'
|
||||
import ListUploadDialog, { ListUploadHistory, ValidationOption } from '@/components/dialog/ListUploadDialog'
|
||||
import ListHeaderManageDialog, { ListHeaderManageRow } from '@/components/dialog/ListHeaderManageDialog'
|
||||
import ListResetDialog from '@/components/dialog/ListResetDialog'
|
||||
import ListUploadDialog from '@/components/dialog/ListUploadDialog'
|
||||
import ListHeaderManageDialog from '@/components/dialog/ListHeaderManageDialog'
|
||||
import ListBatchEditDialog, { BatchEditRow } from '@/components/dialog/ListBatchEditDialog'
|
||||
import ListFilterDialog, { FilterRow } from '@/components/dialog/ListFilterDialog'
|
||||
import ListDownloadDialog, { ListDownloadMode } from '@/components/dialog/ListDownloadDialog'
|
||||
import ListFilterDialog from '@/components/dialog/ListFilterDialog'
|
||||
import ListDownloadDialog from '@/components/dialog/ListDownloadDialog'
|
||||
import MessageSendDialog, {
|
||||
MessageSendMode,
|
||||
MessageSendPayload,
|
||||
MessageTemplateOption,
|
||||
} from '@/components/dialog/MessageSendDialog'
|
||||
import MessageHistoryDialog, { MessageHistoryRow } from '@/components/dialog/MessageHistoryDialog'
|
||||
|
||||
const uploadHistoryMock: ListUploadHistory[] = [
|
||||
{ round: 1, fileName: 'a.xlsx', userId: 'admin', uploadCount: 3500, uploadAt: '2025-10-30T11:00:00Z' },
|
||||
{ round: 2, fileName: '1.xlsx', userId: 'admin', uploadCount: 100, uploadAt: '2025-10-30T12:00:00Z' },
|
||||
{ round: 3, fileName: '2.xlsx', userId: 'admin', uploadCount: 2000, uploadAt: '2025-10-30T13:00:00Z' },
|
||||
]
|
||||
import { downloadBase64File, downloadFile, XLSX_MIME_TYPE } from '@kri/common/browser'
|
||||
|
||||
const messageTemplateMock: MessageTemplateOption[] = [
|
||||
{
|
||||
@@ -84,7 +107,7 @@ const messageHistoryMock: MessageHistoryRow[] = [
|
||||
{
|
||||
id: 2,
|
||||
type: 'email',
|
||||
title: 'Please answer this survey',
|
||||
title: 'Survey Answer Request',
|
||||
templateName: 'EMAIL Template A',
|
||||
sendInfo: 'info@kric.com',
|
||||
targetHeader: 'Email',
|
||||
@@ -101,6 +124,39 @@ const messageHistoryMock: MessageHistoryRow[] = [
|
||||
},
|
||||
]
|
||||
|
||||
const toSidSet = (value: string) =>
|
||||
value
|
||||
.split(',')
|
||||
.map((item) => item.trim())
|
||||
.filter((item) => item.length > 0)
|
||||
|
||||
const toFilterCondition = (row: FilterRow, usesListValue: boolean): Omit<ListOtherItemFilterCondition, 'listHderId'> => {
|
||||
const values = usesListValue ? row.multiValues : [row.textValue.trim()]
|
||||
|
||||
if (row.operator === 'eq') {
|
||||
return { operator: ListFilterOperator.POSITIVE, matchType: ListFilterMatchType.EXACT, values }
|
||||
}
|
||||
if (row.operator === 'neq') {
|
||||
return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.EXACT, values }
|
||||
}
|
||||
if (row.operator === 'contains') {
|
||||
return { operator: ListFilterOperator.POSITIVE, matchType: ListFilterMatchType.CONTAINS, values }
|
||||
}
|
||||
return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.CONTAINS, values }
|
||||
}
|
||||
|
||||
const toDateTimeRange = (from?: string, to?: string) => {
|
||||
if (!from || !to) return undefined
|
||||
return {
|
||||
startDate: `${from}T00:00:00`,
|
||||
endDate: `${to}T23:59:59`,
|
||||
}
|
||||
}
|
||||
|
||||
const downloadArrayBuffer = (buffer: ArrayBuffer, filename: string, type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') => {
|
||||
downloadFile(new Blob([buffer], { type }), filename)
|
||||
}
|
||||
|
||||
const ListManagePage = () => {
|
||||
const mounted = useMounted()
|
||||
const { auth } = useAuth()
|
||||
@@ -118,30 +174,49 @@ const ListManagePage = () => {
|
||||
const [messageSendMode, setMessageSendMode] = useState<MessageSendMode>('email')
|
||||
const [filterRows, setFilterRows] = useState<FilterRow[]>([])
|
||||
const [batchRows, setBatchRows] = useState<BatchEditRow[]>([])
|
||||
const [selectedRows, setSelectedRows] = useState<ListTableRow[]>([])
|
||||
|
||||
const userRole = auth?.user?.userRole ?? 9000
|
||||
const prjctName = selectedProject?.prjctName ?? '';
|
||||
const prjctIdx = selectedProject?.prjctIdx ?? 0
|
||||
const enabled = mounted && prjctIdx > 0
|
||||
|
||||
const resultCodesQuery = useResultCodesQuery(prjctIdx, enabled)
|
||||
const listHeaderQuery = useListHeaderQuery(prjctIdx, enabled)
|
||||
const uploadHistoryQuery = useListUploadHistoryQuery(prjctIdx, enabled)
|
||||
const downloadListExcelTemplateMutation = useDownloadListExcelTemplateMutation()
|
||||
const uploadListExcelMutation = useUploadListExcelMutation(prjctIdx)
|
||||
const updateListHeaderMutation = useUpdateListHeaderMutation(prjctIdx)
|
||||
const resetListMutation = useResetListMutation(prjctIdx)
|
||||
const updateListMutation = useUpdateListMutation(prjctIdx)
|
||||
const downloadListMutation = useDownloadListMutation(prjctIdx)
|
||||
const downloadListUpdateHistoryMutation = useDownloadListUpdateHistoryMutation(prjctIdx)
|
||||
const downloadListEventHistoryMutation = useDownloadListEventHistoryMutation(prjctIdx)
|
||||
const downloadListItemFileMutation = useDownloadListItemFileMutation(prjctIdx)
|
||||
const downloadUploadHistoryFileMutation = useDownloadUploadHistoryFileMutation(prjctIdx)
|
||||
|
||||
const resultCodeArray = useMemo<ResultCode[]>(() => resultCodesQuery.data ?? [], [resultCodesQuery.data])
|
||||
|
||||
const listSearchRequest = useMemo<ListSearchRequest>(() => {
|
||||
const sort = sorting?.[0] ?? { id: 'sid', desc: true as const }
|
||||
const sort = sorting?.[0] ?? { id: 'sid', desc: false as const }
|
||||
const listFilter = createEmptyListFilter()
|
||||
listFilter.sidSet = toSidSet(searchText)
|
||||
listFilter.memoConditions = []
|
||||
listFilter.otherItemConditions = filterRows
|
||||
.map((row) => {
|
||||
const usesListValue = (listHeaderQuery.data ?? []).some(
|
||||
(header) => header.listHderId === row.headerId && (header.filterContents?.length ?? 0) > 0,
|
||||
)
|
||||
|
||||
return {
|
||||
listHderId: row.headerId,
|
||||
...toFilterCondition(row, usesListValue),
|
||||
}
|
||||
})
|
||||
.filter((item) => item.values.some((value) => value.trim().length > 0))
|
||||
|
||||
return {
|
||||
listFilter: {
|
||||
sidSet: [],
|
||||
listUseSet: [],
|
||||
assignUserMap: {
|
||||
[ListHeaderAssignConst.OUTSOURCE]: [],
|
||||
[ListHeaderAssignConst.CONTACT_INTERVIEWER]: [],
|
||||
[ListHeaderAssignConst.FIELD_INTERVIEWER]: [],
|
||||
},
|
||||
memo: '',
|
||||
otherItems: {},
|
||||
},
|
||||
listFilter,
|
||||
pageRequest: {
|
||||
pageIndex: pagination.pageIndex,
|
||||
pageSize: pagination.pageSize,
|
||||
@@ -149,7 +224,7 @@ const ListManagePage = () => {
|
||||
sortDir: sort.desc ? 'desc' : 'asc',
|
||||
},
|
||||
}
|
||||
}, [pagination, sorting])
|
||||
}, [filterRows, listHeaderQuery.data, pagination.pageIndex, pagination.pageSize, searchText, sorting])
|
||||
|
||||
const listSearchQuery = useListSearchQuery(prjctIdx, listSearchRequest, enabled)
|
||||
|
||||
@@ -163,6 +238,26 @@ const ListManagePage = () => {
|
||||
[listSearchQuery.data],
|
||||
)
|
||||
|
||||
const selectedSidSet = useMemo(
|
||||
() =>
|
||||
selectedRows
|
||||
.map((row) => row.sid)
|
||||
.filter((sid): sid is string | number => typeof sid === 'string' || typeof sid === 'number')
|
||||
.map(String),
|
||||
[selectedRows],
|
||||
)
|
||||
|
||||
const buildTargetFilter = (target: ListFilterTarget) => {
|
||||
if (target === 'all') return createEmptyListFilter()
|
||||
if (target === 'selected') {
|
||||
return {
|
||||
...createEmptyListFilter(),
|
||||
sidSet: selectedSidSet,
|
||||
}
|
||||
}
|
||||
return listSearchRequest.listFilter
|
||||
}
|
||||
|
||||
const totalCount = listSearchQuery.data?.totalElements ?? 0
|
||||
const pageCount = listSearchQuery.data?.totalPages ?? 0
|
||||
|
||||
@@ -175,20 +270,18 @@ const ListManagePage = () => {
|
||||
[listHeaderQuery.data],
|
||||
)
|
||||
|
||||
const headerManageRows = useMemo<ListHeaderManageRow[]>(
|
||||
() =>
|
||||
(listHeaderQuery.data ?? []).map((header) => ({
|
||||
id: header.listHderId,
|
||||
name: header.listHderNm,
|
||||
visible: header.useColView,
|
||||
locked: header.listHderGrad === 0,
|
||||
})),
|
||||
[listHeaderQuery.data],
|
||||
)
|
||||
const headerManageRows = useMemo<listHeader[]>(() => listHeaderQuery.data ?? [], [listHeaderQuery.data])
|
||||
|
||||
const filterHeaderOptions = useMemo(
|
||||
() => headerOptions.map((item) => ({ ...item, values: ['A', 'B', 'C'] })),
|
||||
[headerOptions],
|
||||
() =>
|
||||
(listHeaderQuery.data ?? [])
|
||||
.filter((header) => header.useFilter)
|
||||
.map((header) => ({
|
||||
id: header.listHderId,
|
||||
label: header.listHderNm,
|
||||
values: header.filterContents ?? [],
|
||||
})),
|
||||
[listHeaderQuery.data],
|
||||
)
|
||||
|
||||
const messageTargetHeaders = useMemo(() => {
|
||||
@@ -210,39 +303,85 @@ const ListManagePage = () => {
|
||||
showDialog('messageSendDialog')
|
||||
}
|
||||
|
||||
const handleResetConfirm = async (payload: { target: ListResetTarget; scope: ListResetScope }) => {
|
||||
void payload
|
||||
alert('List reset action callback placeholder.')
|
||||
const handleResetConfirm = async (payload: { target: ListFilterTarget; scope: ListResetScope }) => {
|
||||
const listFilter = buildTargetFilter(payload.target)
|
||||
await resetListMutation.mutateAsync({
|
||||
resetMode: payload.scope === 'result-and-history' ? ListResetMode.HIST : ListResetMode.ALL,
|
||||
listFilter,
|
||||
})
|
||||
await listSearchQuery.refetch()
|
||||
}
|
||||
|
||||
const handleUploadConfirm = async (file: File, validation: ValidationOption) => {
|
||||
void file
|
||||
void validation
|
||||
alert('List upload action callback placeholder.')
|
||||
const handleUploadConfirm = async (file: File, request: ListUploadRequest) => {
|
||||
const res = await uploadListExcelMutation.mutateAsync({ file, request })
|
||||
|
||||
if (res.hasErrorFile && res.errorFileBase64) {
|
||||
alert("업로드 중 오류가 발생하여 오류 파일을 다운로드합니다.");
|
||||
downloadBase64File(res.errorFileBase64, res.errorFileName ?? "error.xlsx", XLSX_MIME_TYPE);
|
||||
}
|
||||
else{
|
||||
alert(`${res.successCount}개의 리스트를 업로드했습니다.`);
|
||||
}
|
||||
|
||||
await listSearchQuery.refetch()
|
||||
}
|
||||
|
||||
const handleDownloadTemplate = async () => {
|
||||
alert('Template download callback placeholder.')
|
||||
if (!prjctIdx) {
|
||||
alert("프로젝트를 선택해주세요.")
|
||||
return
|
||||
}
|
||||
|
||||
const buffer = await downloadListExcelTemplateMutation.mutateAsync(prjctIdx)
|
||||
downloadArrayBuffer(buffer, `${prjctName} list-upload-template.xlsx`)
|
||||
}
|
||||
|
||||
const handleHeaderManageConfirm = async (rows: ListHeaderManageRow[]) => {
|
||||
void rows
|
||||
alert('Header manage action callback placeholder.')
|
||||
const handleHeaderManageConfirm = async (rows: listHeader[]) => {
|
||||
await updateListHeaderMutation.mutateAsync(rows)
|
||||
}
|
||||
|
||||
const handleFilterConfirm = async (rows: FilterRow[]) => {
|
||||
setFilterRows(rows)
|
||||
alert('Filter action callback placeholder.')
|
||||
}
|
||||
|
||||
const handleBatchConfirm = async (rows: BatchEditRow[]) => {
|
||||
setBatchRows(rows)
|
||||
alert('Batch edit action callback placeholder.')
|
||||
const updateContents = Object.fromEntries(rows.map((row) => [String(row.headerId), row.value]))
|
||||
await updateListMutation.mutateAsync({
|
||||
updateContents,
|
||||
listFilter: buildTargetFilter('filtered'),
|
||||
})
|
||||
await listSearchQuery.refetch()
|
||||
}
|
||||
|
||||
const handleDownloadConfirm = async (payload: { mode: ListDownloadMode; onlyFiltered: boolean }) => {
|
||||
void payload
|
||||
alert('Download action callback placeholder.')
|
||||
const handleDownloadConfirm = async (payload: ListDownloadPayload) => {
|
||||
const listFilter = buildTargetFilter(payload.target)
|
||||
|
||||
if (payload.mode === 'list') {
|
||||
const buffer = await downloadListMutation.mutateAsync(listFilter)
|
||||
downloadArrayBuffer(buffer, `${prjctName} list.xlsx`)
|
||||
return
|
||||
}
|
||||
|
||||
if (payload.mode === 'list-change-history') {
|
||||
const buffer = await downloadListUpdateHistoryMutation.mutateAsync(listFilter)
|
||||
downloadArrayBuffer(buffer, `${prjctName} update-history.xlsx`)
|
||||
return
|
||||
}
|
||||
|
||||
if (payload.mode === 'upload-file') {
|
||||
const buffer = await downloadListItemFileMutation.mutateAsync(listFilter)
|
||||
downloadArrayBuffer(buffer, `${prjctName} upload-files.zip`, 'application/zip')
|
||||
return
|
||||
}
|
||||
|
||||
const buffer = await downloadListEventHistoryMutation.mutateAsync({
|
||||
listFilter,
|
||||
resultCodeTypes: [ResultCodeType.CONTACT, ResultCodeType.INTERVIEW, ResultCodeType.SURVEY],
|
||||
searchBase: payload.contactHistoryType === 'latest' ? ListEventHistoryBase.LATEST : ListEventHistoryBase.ALL,
|
||||
dateRange: toDateTimeRange(payload.contactHistoryDateFrom, payload.contactHistoryDateTo),
|
||||
})
|
||||
downloadArrayBuffer(buffer, `${prjctName} contact-history.xlsx`)
|
||||
}
|
||||
|
||||
const handleMessageSendConfirm = async (payload: MessageSendPayload) => {
|
||||
@@ -253,55 +392,55 @@ const ListManagePage = () => {
|
||||
if (!mounted) return <LoadingOverlay force />
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<div className="space-y-6 text-sm">
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2 flex-wrap">
|
||||
<Button variant="destructive" className="content-text-base gap-2" onClick={() => showDialog('listResetDialog')}>
|
||||
<Button variant="destructive" className="text-base gap-2" onClick={() => showDialog('listResetDialog')}>
|
||||
<RotateCcw className="w-4 h-4" />
|
||||
리스트 초기화
|
||||
</Button>
|
||||
<Button className="content-text-base" onClick={() => showDialog('listHeaderManageDialog')}>
|
||||
<Button className="text-base" onClick={() => showDialog('listHeaderManageDialog')}>
|
||||
헤더 관리
|
||||
</Button>
|
||||
<Button className="content-text-base gap-2" onClick={() => showDialog('listUploadDialog')}>
|
||||
<Button className="text-base gap-2" onClick={() => showDialog('listUploadDialog')}>
|
||||
<Upload className="w-4 h-4" />
|
||||
리스트 업로드
|
||||
</Button>
|
||||
<Button className="content-text-base bg-excel gap-2" onClick={() => openDownloadDialog('list')}>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => openDownloadDialog('list')}>
|
||||
<Download className="w-4 h-4" />
|
||||
리스트
|
||||
</Button>
|
||||
<Button className="content-text-base bg-excel gap-2" onClick={() => openDownloadDialog('contact-history')}>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => openDownloadDialog('contact-history')}>
|
||||
<Download className="w-4 h-4" />
|
||||
컨택 이력
|
||||
</Button>
|
||||
<Button className="content-text-base bg-excel gap-2" onClick={() => openDownloadDialog('list-change-history')}>
|
||||
<Button className="text-base bg-excel gap-2" onClick={() => openDownloadDialog('list-change-history')}>
|
||||
<Download className="w-4 h-4" />
|
||||
리스트 변경 이력
|
||||
</Button>
|
||||
<Button className="content-text-base gap-2" onClick={() => openDownloadDialog('upload-file')}>
|
||||
<Button className="text-base gap-2" onClick={() => openDownloadDialog('upload-file')}>
|
||||
<Download className="w-4 h-4" />
|
||||
업로드 파일(.zip)
|
||||
</Button>
|
||||
</div>
|
||||
<Button className="content-text-base bg-blue gap-2" onClick={() => openMessageDialog('email')}>
|
||||
<Button className="text-base bg-blue gap-2" onClick={() => openMessageDialog('email')}>
|
||||
<Mail className="w-4 h-4" />
|
||||
이메일 발송
|
||||
</Button>
|
||||
<Button className="content-text-base bg-blue gap-2" onClick={() => openMessageDialog('sms')}>
|
||||
<Button className="text-base bg-blue gap-2" onClick={() => openMessageDialog('sms')}>
|
||||
<MessageSquareMore className="w-4 h-4" />
|
||||
문자 발송
|
||||
</Button>
|
||||
<Button className="content-text-base gap-2" onClick={() => showDialog('messageHistoryDialog')}>
|
||||
<Button className="text-base gap-2" onClick={() => showDialog('messageHistoryDialog')}>
|
||||
<FileClock className="w-4 h-4" />
|
||||
발송 이력
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2 flex-wrap">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<Input
|
||||
placeholder="SID ',' '~' 사용 가능"
|
||||
placeholder="Search SID"
|
||||
className="w-100 h-9 bg-white"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
@@ -336,9 +475,12 @@ const ListManagePage = () => {
|
||||
widthClassName="w-70"
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
<Button className="content-text-lg" onClick={handleSearchClick}>
|
||||
<Button className="text-lg" onClick={handleSearchClick}>
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center gap-2 flex-wrap">
|
||||
<Button type="button" variant="outline" className="gap-2" onClick={() => showDialog('listFilterDialog')}>
|
||||
<Funnel className="w-4 h-4" />
|
||||
필터
|
||||
@@ -354,18 +496,29 @@ const ListManagePage = () => {
|
||||
<DataTable<ListTableRow>
|
||||
columns={columns}
|
||||
data={viewList}
|
||||
getRowId={(row) => String(row.sid)}
|
||||
isClient={false}
|
||||
pageCount={pageCount}
|
||||
totalCount={totalCount}
|
||||
onPaginationChange={setPagination}
|
||||
onSortingChange={setSorting}
|
||||
selectMode="click-event"
|
||||
selectMode="multi"
|
||||
onRowSelectionChange={setSelectedRows}
|
||||
pageSizeOptions={[10, 20, 30, 50]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ListResetDialog onConfirm={handleResetConfirm} />
|
||||
<ListUploadDialog onUpload={handleUploadConfirm} onDownloadTemplate={handleDownloadTemplate} uploadHistory={uploadHistoryMock} />
|
||||
<ListUploadDialog
|
||||
onUpload={handleUploadConfirm}
|
||||
onDownloadTemplate={handleDownloadTemplate}
|
||||
uploadHistory={uploadHistoryQuery.data ?? []}
|
||||
onDownloadHistory={async (item) => {
|
||||
const buffer = await downloadUploadHistoryFileMutation.mutateAsync(item.listUploadLogId)
|
||||
downloadArrayBuffer(buffer, item.fileName)
|
||||
}}
|
||||
headerRows={headerManageRows}
|
||||
/>
|
||||
<ListHeaderManageDialog rows={headerManageRows} onConfirm={handleHeaderManageConfirm} />
|
||||
<ListFilterDialog headerOptions={filterHeaderOptions} initialRows={filterRows} onConfirm={handleFilterConfirm} />
|
||||
<ListBatchEditDialog
|
||||
@@ -380,7 +533,7 @@ const ListManagePage = () => {
|
||||
templateOptions={messageTemplateMock}
|
||||
targetHeaderOptions={messageTargetHeaders}
|
||||
defaultSenderEmail="info@kric.com"
|
||||
defaultSenderName="Korea Research"
|
||||
defaultSenderName="코리아리서치"
|
||||
defaultSenderNumber="02-0000-0000"
|
||||
onConfirm={handleMessageSendConfirm}
|
||||
/>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
'use client'
|
||||
'use client'
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import {Button} from "@/components/ui/button";
|
||||
@@ -10,11 +10,11 @@ import UserUpsertDialog from "@/components/dialog/UserUpsertDialog";
|
||||
import {UserInfoSaveRequest} from "@/types/user";
|
||||
import UserUploadDialog from "@/components/dialog/UserUploadDialog";
|
||||
import {useDialog} from "@/hooks/useDialog";
|
||||
import {downloadBase64File, downloadFile} from "@/lib/utils";
|
||||
import { downloadBase64File, downloadFile, XLSX_MIME_TYPE } from "@kri/common/browser";
|
||||
import {KriMultiSelect} from "@/components/common/KriAutoComplete";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {MultiSelectOption} from "@/components/ui/multi-select";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {DEFAULT_COMPANY_NAME, EXTERNAL_USER_ROLE} from "@/const/userConst";
|
||||
import {Upload} from "lucide-react";
|
||||
@@ -101,9 +101,9 @@ const UserManagePage = () => {
|
||||
await upsertMutation.mutateAsync({ mode: dialogMode, data });
|
||||
|
||||
if (dialogMode === "create") {
|
||||
alert("등록 됐습니다.");
|
||||
alert("등록되었습니다.");
|
||||
} else {
|
||||
alert("수정 됐습니다.");
|
||||
alert("수정되었습니다.");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -117,17 +117,18 @@ const UserManagePage = () => {
|
||||
if (!confirm("정말 삭제하시겠습니까?")) return;
|
||||
|
||||
await deleteMutation.mutateAsync(userId);
|
||||
alert("삭제 됐습니다.");
|
||||
alert("삭제되었습니다.");
|
||||
};
|
||||
|
||||
const uploadFile = async (file: File) => {
|
||||
const res = await uploadMutation.mutateAsync(file);
|
||||
|
||||
if (res.hasErrorFile && res.errorFileBase64) {
|
||||
downloadBase64File(res.errorFileBase64, res.errorFileName ?? "error.xlsx");
|
||||
alert("업로드 중 오류가 발생하여 오류 파일을 다운로드합니다.");
|
||||
downloadBase64File(res.errorFileBase64, res.errorFileName ?? "error.xlsx", XLSX_MIME_TYPE);
|
||||
}
|
||||
else{
|
||||
alert(`${res.successCount}개의 계정을 생성했습니다.`);
|
||||
alert(`${res.successCount}개의 계정이 생성되었습니다.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -138,8 +139,8 @@ const UserManagePage = () => {
|
||||
const blob = new Blob([buffer], {
|
||||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
});
|
||||
downloadFile(blob, "사용자 업로드 양식.xlsx");
|
||||
alert("다운로드 됐습니다.");
|
||||
downloadFile(blob, "사용자_업로드_양식.xlsx");
|
||||
alert("다운로드되었습니다.");
|
||||
} else {
|
||||
console.log("빈 파일입니다.");
|
||||
}
|
||||
@@ -163,13 +164,13 @@ const UserManagePage = () => {
|
||||
if (!mounted) return <LoadingOverlay force />;
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<BodyTitle titleText={"계정 관리"}/>
|
||||
<div className="space-y-6 text-sm">
|
||||
<BodyTitle titleText={"User management"}/>
|
||||
|
||||
<div className="flex gap-2 items-center">
|
||||
<div className="flex flex-1 items-center gap-2">
|
||||
<Input
|
||||
placeholder="면접원 ID Or 면접원 이름"
|
||||
placeholder="면접원 ID 또는 면접원 이름"
|
||||
className="w-70 h-9 bg-white"
|
||||
value={searchText}
|
||||
onChange={(e) => setSearchText(e.target.value)}
|
||||
@@ -197,14 +198,14 @@ const UserManagePage = () => {
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
className="content-text-lg"
|
||||
className="text-lg"
|
||||
onClick={handleCreateClick}
|
||||
>
|
||||
면접원 등록
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => showDialog('userUploadDialog')}
|
||||
className="gap-2 bg-excel content-text-lg"
|
||||
className="gap-2 bg-excel text-lg"
|
||||
>
|
||||
<Upload className="w-4 h-4" />
|
||||
면접원 일괄 등록
|
||||
|
||||
@@ -15,7 +15,7 @@ const EmailTemplatePage = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<div className="space-y-6 text-sm">
|
||||
<MessageTemplate pageTitle={"이메일 템플릿 관리"} defaultTemplate={defaultEmailTemplate}/>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ const SmsTemplatePage = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<div className="space-y-6 text-sm">
|
||||
<MessageTemplate pageTitle="문자 템플릿 관리" defaultTemplate={defaultSmsTemplate}/>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ import {useDialog} from "@/hooks/useDialog";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
import {SelectedProject} from "@/store/jotai/project";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import { useMounted } from "@kri/common/hooks";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {FW_USER_ROLE} from "@/const/userConst";
|
||||
import {useItrntUserList} from "@/hooks/useItrntUserList";
|
||||
@@ -144,7 +144,7 @@ const MainPage = () => {
|
||||
if (!mounted || isLoading) return <LoadingOverlay force />;
|
||||
|
||||
return (
|
||||
<div className="space-y-6 content-text-sm">
|
||||
<div className="space-y-6 text-sm">
|
||||
<BodyTitle titleText={"프로젝트"}/>
|
||||
|
||||
<div className="flex gap-2 items-center">
|
||||
@@ -192,14 +192,14 @@ const MainPage = () => {
|
||||
heightClassName="h-9"
|
||||
/>
|
||||
<Button
|
||||
className="content-text-lg"
|
||||
className="text-lg"
|
||||
onClick={handleSearchClick}
|
||||
>
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
<Button
|
||||
className="content-text-lg"
|
||||
className="text-lg"
|
||||
onClick={handleCreateClick}
|
||||
>
|
||||
프로젝트 등록
|
||||
@@ -231,4 +231,4 @@ const MainPage = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export default MainPage;
|
||||
export default MainPage;
|
||||
|
||||
@@ -11,7 +11,7 @@ import {Tabs, TabsContent, TabsList, TabsTrigger} from '@/components/ui/tabs'
|
||||
import {KriMultiSelect, KriSingleSelect} from '@/components/common/KriAutoComplete'
|
||||
import {useDialog} from '@/hooks/useDialog'
|
||||
import ResultCodeDialog from '@/components/dialog/ResultCodeDialog'
|
||||
import {useMounted} from '@/hooks/useMounted'
|
||||
import { useDebouncedValue, useMounted } from "@kri/common/hooks";
|
||||
import {LoadingOverlay} from '@/components/common/LoadingOverlay'
|
||||
import {
|
||||
ProjectInfo, ProjectUpdateRequest, ResultCode,
|
||||
@@ -27,7 +27,6 @@ import {MultiSelectOption} from "@/components/ui/multi-select";
|
||||
import {FW_TEAM} from "@/const/userConst";
|
||||
import {useItrntUserList} from "@/hooks/useItrntUserList";
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
|
||||
import {useAuth} from "@/hooks/useAuth";
|
||||
import {KriEditor} from "@/components/kri-editor";
|
||||
import {useRouter} from "next/navigation";
|
||||
@@ -257,16 +256,16 @@ const ProjectInfoPage = () => {
|
||||
|
||||
{/* 1. 기본 정보 */}
|
||||
<div className="border rounded-lg p-6 space-y-5 bg-white mt-6">
|
||||
<h3 className="content-text-xl font-semibold">프로젝트 기본 정보</h3>
|
||||
<h3 className="text-xl font-semibold">프로젝트 기본 정보</h3>
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">프로젝트 코드</Label>
|
||||
<Label className="text-base">프로젝트 코드</Label>
|
||||
<Input value={projectInfo.prjctCd || ''} disabled className="bg-gray-100 h-9" />
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-[1fr_auto] gap-3 items-end">
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">진행 상태</Label>
|
||||
<Label className="text-base">진행 상태</Label>
|
||||
<RadioGroup
|
||||
value={String(projectInfo.prjctStatus ?? ProjectStatus.WAITING)}
|
||||
onValueChange={(v) => handleChange('prjctStatus', Number(v) as ProjectStatus)}
|
||||
@@ -277,7 +276,7 @@ const ProjectInfoPage = () => {
|
||||
return (
|
||||
<div key={s} className="flex items-center space-x-2">
|
||||
<RadioGroupItem value={String(s)} id={id} />
|
||||
<Label htmlFor={id} className="font-normal cursor-pointer content-text-base">
|
||||
<Label htmlFor={id} className="font-normal cursor-pointer text-base">
|
||||
{PROJECT_STATUS_LABEL[s]}
|
||||
</Label>
|
||||
</div>
|
||||
@@ -286,13 +285,13 @@ const ProjectInfoPage = () => {
|
||||
</RadioGroup>
|
||||
</div>
|
||||
|
||||
<Button onClick={handleResultCodeClick} className="h-9 content-text-base whitespace-nowrap">
|
||||
<Button onClick={handleResultCodeClick} className="h-9 text-base whitespace-nowrap">
|
||||
결과 코드 설정
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">
|
||||
<Label className="text-base">
|
||||
프로젝트 명<span className="text-red-500 ml-1">*</span>
|
||||
</Label>
|
||||
<Input
|
||||
@@ -305,7 +304,7 @@ const ProjectInfoPage = () => {
|
||||
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">담당 그룹</Label>
|
||||
<Label className="text-base">담당 그룹</Label>
|
||||
<KriSingleSelect
|
||||
items={deptArray}
|
||||
value={projectInfo.ownerDept || ''}
|
||||
@@ -317,7 +316,7 @@ const ProjectInfoPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">담당 실사</Label>
|
||||
<Label className="text-base">담당 실사</Label>
|
||||
<KriSingleSelect
|
||||
items={fwArray}
|
||||
value={projectInfo.ownerFw || ''}
|
||||
@@ -334,7 +333,7 @@ const ProjectInfoPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="border rounded-lg p-6 space-y-4 bg-white mt-3">
|
||||
<h3 className="content-text-xl font-semibold">외주사</h3>
|
||||
<h3 className="text-xl font-semibold">외주사</h3>
|
||||
<KriMultiSelect
|
||||
items={outsourceOptionArray}
|
||||
value={outsourceUserArray}
|
||||
@@ -349,7 +348,7 @@ const ProjectInfoPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="border rounded-lg p-6 space-y-4 bg-white mt-3">
|
||||
<h3 className="content-text-xl font-semibold">설문 연동</h3>
|
||||
<h3 className="text-xl font-semibold">설문 연동</h3>
|
||||
|
||||
<RadioGroup
|
||||
value={String(projectInfo.surveyTy ?? SurveyType.NONE)}
|
||||
@@ -361,7 +360,7 @@ const ProjectInfoPage = () => {
|
||||
return (
|
||||
<div key={t} className="flex items-center space-x-2">
|
||||
<RadioGroupItem value={String(t)} id={id} />
|
||||
<Label htmlFor={id} className="font-normal cursor-pointer content-text-base">
|
||||
<Label htmlFor={id} className="font-normal cursor-pointer text-base">
|
||||
{SURVEY_TYPE_LABEL[t]}
|
||||
</Label>
|
||||
</div>
|
||||
@@ -371,7 +370,7 @@ const ProjectInfoPage = () => {
|
||||
|
||||
{(projectInfo.surveyTy === SurveyType.KON || projectInfo.surveyTy === SurveyType.KIWI) && (
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">{SURVEY_TYPE_LABEL[projectInfo.surveyTy]} 프로젝트</Label>
|
||||
<Label className="text-base">{SURVEY_TYPE_LABEL[projectInfo.surveyTy]} 프로젝트</Label>
|
||||
<KriSingleSelect
|
||||
items={surveyProjectArray}
|
||||
value={projectInfo.surveyPrjctCd || ''}
|
||||
@@ -388,7 +387,7 @@ const ProjectInfoPage = () => {
|
||||
)}
|
||||
{projectInfo.surveyTy !== SurveyType.NONE && (
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">설문 URL</Label>
|
||||
<Label className="text-base">설문 URL</Label>
|
||||
<Input
|
||||
value={projectInfo.surveyUrl || ''}
|
||||
onChange={(e) => handleChange('surveyUrl', e.target.value)}
|
||||
@@ -412,19 +411,19 @@ const ProjectInfoPage = () => {
|
||||
|
||||
<div className="grid gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">시작:</Label>
|
||||
<Label className="w-24 text-base">시작:</Label>
|
||||
<Input value={externalUrls.redirect.start} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">완료:</Label>
|
||||
<Label className="w-24 text-base">완료:</Label>
|
||||
<Input value={externalUrls.redirect.complete} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">스크린 아웃:</Label>
|
||||
<Label className="w-24 text-base">스크린 아웃:</Label>
|
||||
<Input value={externalUrls.redirect.screen} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">쿼터 풀:</Label>
|
||||
<Label className="w-24 text-base">쿼터 풀:</Label>
|
||||
<Input value={externalUrls.redirect.quota} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -437,19 +436,19 @@ const ProjectInfoPage = () => {
|
||||
|
||||
<div className="grid gap-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">시작 API:</Label>
|
||||
<Label className="w-24 text-base">시작 API:</Label>
|
||||
<Input value={externalUrls.api.start} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">완료 API:</Label>
|
||||
<Label className="w-24 text-base">완료 API:</Label>
|
||||
<Input value={externalUrls.api.complete} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">스크린 API:</Label>
|
||||
<Label className="w-24 text-base">스크린 API:</Label>
|
||||
<Input value={externalUrls.api.screen} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="w-24 content-text-base">쿼터 API:</Label>
|
||||
<Label className="w-24 text-base">쿼터 API:</Label>
|
||||
<Input value={externalUrls.api.quota} disabled className="bg-white h-9" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -463,7 +462,7 @@ const ProjectInfoPage = () => {
|
||||
</div>
|
||||
|
||||
<div className="border rounded-lg p-6 space-y-4 bg-white mt-3">
|
||||
<h3 className="content-text-xl font-semibold">기타 옵션</h3>
|
||||
<h3 className="text-xl font-semibold">기타 옵션</h3>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
@@ -472,7 +471,7 @@ const ProjectInfoPage = () => {
|
||||
checked={projectInfo.ff || false}
|
||||
onCheckedChange={(checked) => handleChange('ff', checked === true)}
|
||||
/>
|
||||
<Label htmlFor="ff" className="font-normal cursor-pointer content-text-base">
|
||||
<Label htmlFor="ff" className="font-normal cursor-pointer text-base">
|
||||
현장 면접 진행
|
||||
</Label>
|
||||
</div>
|
||||
@@ -483,7 +482,7 @@ const ProjectInfoPage = () => {
|
||||
checked={projectInfo.useContactSenario || false}
|
||||
onCheckedChange={(checked) => handleChange('useContactSenario', checked === true)}
|
||||
/>
|
||||
<Label htmlFor="useContactSenario" className="font-normal cursor-pointer content-text-base">
|
||||
<Label htmlFor="useContactSenario" className="font-normal cursor-pointer text-base">
|
||||
컨택 시나리오
|
||||
</Label>
|
||||
</div>
|
||||
@@ -512,12 +511,12 @@ const ProjectInfoPage = () => {
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
variant="destructive"
|
||||
className="w-32 h-10 content-text-base"
|
||||
className="w-32 h-10 text-base"
|
||||
onClick={handleDeleteClick}
|
||||
>
|
||||
삭제
|
||||
</Button>
|
||||
<Button onClick={handleSubmit} className="w-32 h-10 content-text-base">
|
||||
<Button onClick={handleSubmit} className="w-32 h-10 text-base">
|
||||
저장
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
"use client";
|
||||
"use client";
|
||||
|
||||
import Image from "next/image";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Card, CardContent, CardHeader} from "@/components/ui/card";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import React, {useEffect, useRef, useState} from "react";
|
||||
import React, { Suspense, useEffect, useRef, useState } from "react";
|
||||
import {useRouter, useSearchParams} from "next/navigation";
|
||||
import { useStorage } from "@/hooks/useStorage"
|
||||
import { StorageKeys } from "@/store/storage/storage-keys";
|
||||
import {apiError} from "@/lib/http-util";
|
||||
import {NONE_HTTP_ERROR} from "@/const/commonConst";
|
||||
import {apiError} from "@kri/common/http";
|
||||
import {NONE_HTTP_ERROR} from "@kri/common/http";
|
||||
import {useLoginMutation} from "@/query/auth";
|
||||
import {useInternalInfoQuery} from "@/query/internal";
|
||||
|
||||
const LoginPage = () => {
|
||||
const LoginPageContent = () => {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const typeParam = searchParams.get("type") ?? "";
|
||||
|
||||
const loginMutation = useLoginMutation();
|
||||
const internalInfoQuery = useInternalInfoQuery();
|
||||
// TODO: 받은 데이터 확인
|
||||
console.log(internalInfoQuery.data);
|
||||
|
||||
const { get: getSeatNumberStorage } = useStorage(StorageKeys.SeatNumber);
|
||||
|
||||
@@ -32,15 +36,17 @@ const LoginPage = () => {
|
||||
const seatNumberInputRef = useRef<HTMLInputElement | null>(null);
|
||||
|
||||
const tryLogin = async () => {
|
||||
if (!userId) return alert("아이디를 입력해 주세요");
|
||||
if (!userPw) return alert("PW를 입력해 주세요");
|
||||
if (loginType === "call" && !seatNum) return alert("자리번호를 입력해 주세요");
|
||||
if (!userId) return alert("Please enter ID.");
|
||||
if (!userPw) return alert("Please enter password.");
|
||||
if (loginType === "call" && !seatNum) return alert("Please enter seat number.");
|
||||
|
||||
setError(null);
|
||||
try {
|
||||
await loginMutation.mutateAsync({ userId, userPw, seatNum, loginType });
|
||||
} catch (e) {
|
||||
const err = apiError(e);
|
||||
const err = apiError(e, {
|
||||
fallbackMessage: "Login failed.",
|
||||
});
|
||||
if (err.status === 401 || err.status === 403) setError("아이디 또는 비밀번호를 다시 확인해주세요.");
|
||||
else if (err.code === NONE_HTTP_ERROR) setError("알 수 없는 오류가 발생했습니다. 잠시 후 다시 시도해주세요.");
|
||||
else setError(`로그인에 실패했습니다. (${err.message})`);
|
||||
@@ -101,7 +107,7 @@ const LoginPage = () => {
|
||||
<Image
|
||||
src="/kri_logo.png" // public/kri_logo.png
|
||||
alt="KRI 로고"
|
||||
width={500} // 원하는 크기로 줄이기
|
||||
width={500}
|
||||
height={500}
|
||||
className="object-contain ml-10"
|
||||
priority
|
||||
@@ -118,7 +124,7 @@ const LoginPage = () => {
|
||||
name="id"
|
||||
type="text"
|
||||
required
|
||||
placeholder="아이디를 입력하세요"
|
||||
placeholder="Enter ID"
|
||||
value={userId}
|
||||
onChange={(e) => setUserId(e.currentTarget.value)}
|
||||
onKeyDown={handleIdKeyDown}
|
||||
@@ -133,7 +139,7 @@ const LoginPage = () => {
|
||||
type="password"
|
||||
autoComplete="current-password"
|
||||
required
|
||||
placeholder="PW를 입력하세요"
|
||||
placeholder="Enter password"
|
||||
value={userPw}
|
||||
onChange={(e) => setUserPw(e.currentTarget.value)}
|
||||
onKeyDown={handlePwKeyDown}
|
||||
@@ -148,7 +154,7 @@ const LoginPage = () => {
|
||||
id="seatNum"
|
||||
name="seatNum"
|
||||
type="text"
|
||||
placeholder="자리번호를 입력하세요"
|
||||
placeholder="Enter seat number"
|
||||
value={seatNum}
|
||||
onChange={(e) => setSeatNum(e.currentTarget.value)}
|
||||
onKeyDown={handleSeatNumberKeyDown}
|
||||
@@ -183,4 +189,10 @@ const LoginPage = () => {
|
||||
);
|
||||
}
|
||||
|
||||
const LoginPage = () => (
|
||||
<Suspense fallback={null}>
|
||||
<LoginPageContent />
|
||||
</Suspense>
|
||||
);
|
||||
|
||||
export default LoginPage;
|
||||
|
||||
Reference in New Issue
Block a user