260115_02_ENH : 로그인 오류 수정 및 템플릿 생성 연동 완료
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import {useEffect, useMemo, useState} from 'react'
|
||||
import {useEffect, useState} from 'react'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -10,10 +10,10 @@ import {
|
||||
} from '@/components/ui/dialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
import {Trash2, Plus, Download, Search, XIcon} from 'lucide-react'
|
||||
import {ProjectInfo, ResultCode} from "@/types/project";
|
||||
import {Trash2, Plus, Download} from 'lucide-react'
|
||||
import {ProjectInfo, ResultCode, ResultCodeType} from "@/types/project";
|
||||
import {nextApi} from "@/lib/http-client";
|
||||
import {PROJECT_SEARCH_COUNT, RESULT_CODE_TYPE_OPTIONS, ResultCodeType} from "@/const/projectConst";
|
||||
import {PROJECT_SEARCH_COUNT, RESULT_CODE_TYPE_OPTIONS} from "@/const/projectConst";
|
||||
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
|
||||
import {SelectedProject} from "@/store/jotai/project";
|
||||
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
|
||||
@@ -221,7 +221,7 @@ const ResultCodeDialog = ({
|
||||
|
||||
useEffect(() => {
|
||||
if(importProject){
|
||||
nextApi.get<ResultCode[]>(`/project/result-code/${importProject.prjctIdx}`)
|
||||
nextApi.get<ResultCode[]>(`/result-code/${importProject.prjctIdx}`)
|
||||
.then((res) => setImportCodeArray(res));
|
||||
}
|
||||
}, [importProject]);
|
||||
|
||||
@@ -39,7 +39,7 @@ export const Header = ({
|
||||
else{
|
||||
window.location.replace("/logout");
|
||||
}
|
||||
}, [auth])
|
||||
}, [auth.user])
|
||||
|
||||
return (
|
||||
<header className="bg-white border-b border-gray-200 sticky top-0 z-40">
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ChevronDown } from "lucide-react";
|
||||
import { SideMenuItem } from "@/config/menu.types";
|
||||
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
|
||||
import {useDebouncedValue} from "@/hooks/useDebouncedValue";
|
||||
import {SidebarProjectSearch} from "@/components/layout/SidebarProjectSearch ";
|
||||
|
||||
interface SidebarProps {
|
||||
|
||||
424
src/components/message-template/MessageTemplate.tsx
Normal file
424
src/components/message-template/MessageTemplate.tsx
Normal file
@@ -0,0 +1,424 @@
|
||||
'use client'
|
||||
|
||||
import {useSelectedProject} from "@/hooks/useSelectedProject";
|
||||
import {useCallback, useEffect, useRef, useState} from "react";
|
||||
import {listHder, ListHeaderGrade, ListHeaderType} from "@/types/list";
|
||||
import {
|
||||
ChannelType,
|
||||
MessageType,
|
||||
SMS_TYPE_ARRAY,
|
||||
Template,
|
||||
TemplateSms,
|
||||
TemplateSummary
|
||||
} from "@/types/messageTemplate";
|
||||
import {isTextAreaElement, isTipTapEditor} from "@/components/kri-editor/utils/editorTypeGuards";
|
||||
import {nextApi} from "@/lib/http-client";
|
||||
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card";
|
||||
import {Label} from "@/components/ui/label";
|
||||
import {KriSingleSelect} from "@/components/common/KriAutoComplete";
|
||||
import {SMS_TYPE_OPTIONS} from "@/const/messageTemplateConst";
|
||||
import {Input} from "@/components/ui/input";
|
||||
import {Checkbox} from "@/components/ui/checkbox";
|
||||
import {KriEditor, KriEditorCommand} from "@/components/kri-editor";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {cn} from "@/lib/utils";
|
||||
import _ from "lodash";
|
||||
import {ProjectMainTemplateUpdateRequest} from "@/types/project";
|
||||
import {toast} from "sonner";
|
||||
|
||||
interface MessageTemplateProps {
|
||||
pageTitle: string;
|
||||
defaultTemplate: Template;
|
||||
}
|
||||
|
||||
const MessageTemplate = ({
|
||||
pageTitle,
|
||||
defaultTemplate,
|
||||
}: MessageTemplateProps) => {
|
||||
const { selectedProject } = useSelectedProject();
|
||||
|
||||
const editorCmdRef = useRef<KriEditorCommand | null>(null);
|
||||
const sessionTempUrlsRef = useRef<Set<string>>(new Set());
|
||||
|
||||
const [mainTemplateIdx, setMainTemplateIdx] = useState<number|null>(null);
|
||||
const [listHderList, setListHderList] = useState<listHder[]>([])
|
||||
const [templateList, setTemplateList] = useState<TemplateSummary[]>([]);
|
||||
const [selectedTemplate, setSelectedTemplate] = useState<Template>(defaultTemplate);
|
||||
const [isMainTemplate, setIsMainTemplate] = useState(false);
|
||||
|
||||
|
||||
const isSmsTemplate = (t: Template): t is TemplateSms =>
|
||||
(SMS_TYPE_ARRAY as readonly MessageType[]).includes(t.tmplatTy);
|
||||
|
||||
const isSms = isSmsTemplate(defaultTemplate);
|
||||
const chnnlTy:ChannelType = isSms? ChannelType.SMS : ChannelType.EMAIL;
|
||||
|
||||
// 유니온의 키를 합집합으로 뽑기
|
||||
type KeysOfUnion<T> = T extends unknown ? keyof T : never;
|
||||
|
||||
// 특정 키의 값 타입을 유니온에서 안전하게 뽑기
|
||||
type ValueOfUnionKey<T, K extends KeysOfUnion<T>> =
|
||||
T extends unknown ? (K extends keyof T ? T[K] : never) : never;
|
||||
|
||||
const handleSelectTemplate = (templateIdxString: string) => {
|
||||
if(!selectedProject) return
|
||||
|
||||
if(!templateIdxString){
|
||||
const projectDefaultTemplate = _.cloneDeep(defaultTemplate);
|
||||
projectDefaultTemplate.itrntPrjctCd = selectedProject.itrntPrjctCd;
|
||||
setSelectedTemplate(projectDefaultTemplate);
|
||||
}
|
||||
else{
|
||||
nextApi.get<Template>(`/message-template/${templateIdxString}`).then(setSelectedTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
const handleChange = <K extends KeysOfUnion<Template>>(
|
||||
field: K,
|
||||
value: ValueOfUnionKey<Template, K>
|
||||
) => {
|
||||
setSelectedTemplate(prev => {
|
||||
const next = { ...prev } as any;
|
||||
next[field] = value;
|
||||
return next as Template;
|
||||
});
|
||||
};
|
||||
|
||||
const setTemplateBody = (newString: string) => {
|
||||
setSelectedTemplate(prev => ({ ...prev, tmplatBody: newString }));
|
||||
};
|
||||
|
||||
const setSmsType = (smsTypeString: "SMS" | "LMS") => {
|
||||
const smsType =
|
||||
smsTypeString === "SMS" ? MessageType.SMS : MessageType.LMS_MMS;
|
||||
|
||||
setSelectedTemplate((prev) => {
|
||||
if (!isSmsTemplate(prev)) return prev;
|
||||
|
||||
return {
|
||||
...prev,
|
||||
tmplatTy: smsType,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const handleCreate = async () => {
|
||||
//Todo 데이터 검증 필요
|
||||
|
||||
nextApi.put<Template>(`/message-template`, selectedTemplate)
|
||||
.then((res) => {
|
||||
settingTemplateList();
|
||||
|
||||
setSelectedTemplate(res);
|
||||
updateMainTemplate(res.tmplatIdx!);
|
||||
|
||||
alert("저장되었습니다.");
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
alert("저장에 실패했습니다.");
|
||||
});
|
||||
};
|
||||
|
||||
const handleUpdate = async () => {
|
||||
if(!selectedTemplate.tmplatIdx) return;
|
||||
|
||||
//Todo 데이터 검증 필요
|
||||
|
||||
nextApi.patch<Template>(`/message-template`, selectedTemplate)
|
||||
.then((res) => {
|
||||
settingTemplateList();
|
||||
|
||||
setSelectedTemplate(res);
|
||||
updateMainTemplate(res.tmplatIdx!);
|
||||
|
||||
alert("수정되었습니다.");
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
alert("저장에 실패했습니다.");
|
||||
});
|
||||
};
|
||||
|
||||
const updateMainTemplate = (templatIdx:number):void => {
|
||||
if(!selectedProject || !selectedProject.prjctIdx) return;
|
||||
|
||||
let updateFlag = false;
|
||||
let updateTemplateIdx: number | null = null;
|
||||
|
||||
if(isMainTemplate && mainTemplateIdx !== templatIdx){
|
||||
updateFlag = true;
|
||||
updateTemplateIdx = templatIdx;
|
||||
}
|
||||
|
||||
if(!isMainTemplate && mainTemplateIdx === templatIdx){
|
||||
updateFlag = true;
|
||||
}
|
||||
|
||||
if(updateFlag){
|
||||
const req:ProjectMainTemplateUpdateRequest = {
|
||||
prjctIdx: selectedProject.prjctIdx,
|
||||
chnnlTy:chnnlTy,
|
||||
tmplatIdx:updateTemplateIdx,
|
||||
}
|
||||
|
||||
nextApi.patch(`/project/main-template`, req);
|
||||
setMainTemplateIdx(updateTemplateIdx);
|
||||
}
|
||||
}
|
||||
|
||||
const handleVariableClick = (placeholder: string) => {
|
||||
editorCmdRef.current?.insertText(placeholder);
|
||||
};
|
||||
|
||||
const toggleIsMainTemplate = () => {
|
||||
setIsMainTemplate(!isMainTemplate);
|
||||
}
|
||||
|
||||
const handleImageUpload = useCallback(async (file: File): Promise<{ url: string }> => {
|
||||
if(selectedProject) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", file);
|
||||
|
||||
const url = await nextApi.putForm<string>(`/message-template/body-image/${selectedProject?.itrntPrjctCd}`, formData);
|
||||
// 이 세션에서 업로드한 temp 파일 목록에 기록
|
||||
sessionTempUrlsRef.current.add(url);
|
||||
|
||||
return { url }
|
||||
}
|
||||
|
||||
return { url: '' }
|
||||
}, [selectedProject]);
|
||||
|
||||
const settingTemplateList = useCallback(() => {
|
||||
if(!selectedProject) return;
|
||||
|
||||
nextApi.get<TemplateSummary[]>(`/message-template/list/${chnnlTy}/${selectedProject.itrntPrjctCd}`).then(setTemplateList);
|
||||
}, [selectedProject, chnnlTy]);
|
||||
|
||||
useEffect(() => {
|
||||
if(!selectedProject) return;
|
||||
|
||||
settingTemplateList();
|
||||
nextApi.get<number | null>(`/project/main-template/${selectedProject.prjctIdx}/${chnnlTy}`).then(setMainTemplateIdx);
|
||||
|
||||
const projectDefaultTemplate = _.cloneDeep(defaultTemplate);
|
||||
projectDefaultTemplate.itrntPrjctCd = selectedProject.itrntPrjctCd;
|
||||
setSelectedTemplate(projectDefaultTemplate);
|
||||
|
||||
//Todo: 프로젝트 별 리스트 헤더 조회해서 세팅하기
|
||||
setListHderList([]);
|
||||
}, [selectedProject]);
|
||||
|
||||
useEffect(() => {
|
||||
setIsMainTemplate(selectedTemplate.tmplatIdx === mainTemplateIdx);
|
||||
}, [selectedTemplate.tmplatIdx]);
|
||||
|
||||
return (
|
||||
<div className={cn(
|
||||
"w-full mx-auto p-6",
|
||||
isSms ? "max-w-7xl" : "max-w-4xl"
|
||||
)}>
|
||||
<Card>
|
||||
<CardHeader className="border-b">
|
||||
<CardTitle className="text-center content-text-lg font-bold">{pageTitle}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="pt-6 relative">
|
||||
<div
|
||||
className={cn(
|
||||
isSms
|
||||
? "grid grid-cols-1 lg:grid-cols-[1fr_340px] gap-6 items-start"
|
||||
: ""
|
||||
)}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<Label htmlFor="tmplatNm" className="content-text-base">
|
||||
템플릿
|
||||
</Label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
id="mainTemplate"
|
||||
checked={isMainTemplate}
|
||||
onClick={toggleIsMainTemplate}
|
||||
/>
|
||||
<label htmlFor="mainTemplate" className="content-text-base cursor-pointer">
|
||||
대표 템플릿
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<KriSingleSelect
|
||||
items={templateList}
|
||||
value={String(selectedTemplate.tmplatIdx || "")}
|
||||
onChange={(value) => handleSelectTemplate(value)}
|
||||
placeholder="템플릿을 선택해 주세요"
|
||||
heightClassName="h-9"
|
||||
widthClassName="w-full"
|
||||
getLabel={(item) => item.tmplatNm}
|
||||
getValue={(item) => String(item.tmplatIdx)}
|
||||
preventDeselect={true}
|
||||
useClear={true}
|
||||
clearLabel="새 테플릿 생성"
|
||||
/>
|
||||
</div>
|
||||
|
||||
{isSms && (
|
||||
<div className="space-y-2">
|
||||
<Label className="content-text-base">타입</Label>
|
||||
<KriSingleSelect
|
||||
items={[...SMS_TYPE_OPTIONS]}
|
||||
value={String(selectedTemplate.tmplatTy || MessageType.SMS)}
|
||||
onChange={(value) => handleChange('tmplatTy', Number(value))}
|
||||
placeholder="템플릿 타입을 선택해 주세요"
|
||||
heightClassName="h-9"
|
||||
widthClassName="w-full"
|
||||
getLabel={(item) => item.label}
|
||||
getValue={(item) => String(item.value)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="tmplatNm" className="content-text-base">
|
||||
템플릿 명
|
||||
</Label>
|
||||
<Input
|
||||
id="tmplatNm"
|
||||
placeholder="템플릿 명을 입력하세요"
|
||||
value={selectedTemplate.tmplatNm}
|
||||
onChange={(e) => handleChange('tmplatNm', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="tmplatTitle" className="content-text-base">
|
||||
제목
|
||||
</Label>
|
||||
<Input
|
||||
id="tmplatTitle"
|
||||
placeholder="제목을 입력하세요"
|
||||
value={selectedTemplate.tmplatTitle || ''}
|
||||
onChange={(e) => handleChange('tmplatTitle', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
<div className="flex items-center">
|
||||
<Label className="content-text-base">변수 리스트</Label>
|
||||
</div>
|
||||
<div className="border rounded-md overflow-hidden">
|
||||
<div className="bg-blue-100 grid grid-cols-2 border-b">
|
||||
<div className="py-2 px-3 text-center font-medium border-r content-text-base">리스트 헤더명</div>
|
||||
<div className="py-2 px-3 text-center font-medium content-text-base">치환 문자</div>
|
||||
</div>
|
||||
<div className="max-h-32 overflow-y-auto">
|
||||
{listHderList.map((listHder) =>
|
||||
{
|
||||
const placeholder = `[\$${listHder.listHderNm}]`
|
||||
return (
|
||||
<div
|
||||
key={listHder.listHderId}
|
||||
className="grid grid-cols-2 border-b last:border-b-0 hover:bg-blue-50 cursor-pointer transition-colors"
|
||||
onPointerDown={(e) => {
|
||||
e.preventDefault();
|
||||
handleVariableClick(placeholder);
|
||||
}}
|
||||
>
|
||||
<div className="py-2 px-3 text-center border-r content-text-base">{listHder.listHderNm}</div>
|
||||
<div className="py-2 px-3 text-center content-text-base">{placeholder}</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{selectedTemplate && (
|
||||
isSmsTemplate(selectedTemplate)?
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="sendTel" className="content-text-base">발신 번호</Label>
|
||||
<Input
|
||||
id="sendTel"
|
||||
value={selectedTemplate.sendTel}
|
||||
onChange={(e) => handleChange('sendTel', e.target.value)}
|
||||
placeholder="발신 번호를 입력하세요"
|
||||
className="w-full"
|
||||
/>
|
||||
<p className="content-text-sm text-red-600 font-medium">
|
||||
⚠️ 비즈 뿌리오에 등록된 발신 번호가 아니면 전송되지 않습니다.
|
||||
</p>
|
||||
</div>
|
||||
:
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="sendEmail" className="content-text-base">발신 이메일</Label>
|
||||
<Input
|
||||
id="sendEmail"
|
||||
value={selectedTemplate.sendEml}
|
||||
onChange={(e) => handleChange('sendEml', e.target.value)}
|
||||
placeholder="발신 이메일을 입력하세요"
|
||||
className="w-full"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="sendNm" className="content-text-base">
|
||||
발신자 명
|
||||
</Label>
|
||||
<Input
|
||||
id="sendNm"
|
||||
placeholder="발신자 명을 입력하세요"
|
||||
value={selectedTemplate.sendNm}
|
||||
onChange={(e) => handleChange('sendNm', e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{!isSms && (
|
||||
<KriEditor
|
||||
editorMode={'both'}
|
||||
value={selectedTemplate.tmplatBody ?? "<p></p>"}
|
||||
onChange={(html: string) => setTemplateBody(html)}
|
||||
placeholder="이메일 내용을 입력해 주세요"
|
||||
className="w-full"
|
||||
debounceMs={600}
|
||||
onCommandReady={(cmd) => { editorCmdRef.current = cmd; }}
|
||||
onImageUpload={async (file) => await handleImageUpload(file)} // 사용 시만
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{isSms && (
|
||||
<div className="mt-6 lg:mt-0 lg:border-l lg:pl-6">
|
||||
<KriEditor
|
||||
editorMode={"sms"}
|
||||
value={(selectedTemplate as TemplateSms).tmplatBody ?? ""}
|
||||
onChange={(html: string) => setTemplateBody(html)}
|
||||
placeholder="문자 내용을 입력해 주세요"
|
||||
className="max-w-none mx-0"
|
||||
debounceMs={600}
|
||||
onCommandReady={(cmd) => { editorCmdRef.current = cmd; }}
|
||||
smsTitle={(selectedTemplate as TemplateSms).tmplatTitle}
|
||||
changeSmsType={(smsTypeString) => setSmsType(smsTypeString)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex justify-center gap-3 pt-4">
|
||||
<Button onClick={handleCreate} className="w-32 h-10">
|
||||
{selectedTemplate.tmplatIdx ? "복사 후 저장" : "저장"}
|
||||
</Button>
|
||||
|
||||
{selectedTemplate.tmplatIdx && (
|
||||
<Button
|
||||
onClick={handleUpdate}
|
||||
className="w-32 h-10 bg-blue-500 text-white hover:bg-blue-600"
|
||||
>
|
||||
수정
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default MessageTemplate
|
||||
53
src/components/table-column/ProjectTableColumn.tsx
Normal file
53
src/components/table-column/ProjectTableColumn.tsx
Normal file
@@ -0,0 +1,53 @@
|
||||
import {ProjectInfo} from "@/types/project";
|
||||
import {ColumnDef} from "@tanstack/react-table";
|
||||
import {Badge} from "@/components/ui/badge";
|
||||
import {cn, formatKst} from "@/lib/utils";
|
||||
import {PROJECT_STATUS_CLASS, PROJECT_STATUS_LABEL} from "@/const/projectConst";
|
||||
import {ItrntUserInfo} from "@/types/user";
|
||||
|
||||
export const getProjectColumns = (users:ItrntUserInfo[]): ColumnDef<ProjectInfo>[] => [
|
||||
{
|
||||
accessorKey: "prjctIdx",
|
||||
header: "No",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctCd",
|
||||
header: "프로젝트 코드",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctName",
|
||||
header: "프로젝트 명",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "prjctStatus",
|
||||
header: "진행 상태",
|
||||
cell: ({row}) => (
|
||||
<Badge className={cn("w-15 h-7 my-1.5", PROJECT_STATUS_CLASS[row.original.prjctStatus])}>
|
||||
{PROJECT_STATUS_LABEL[row.original.prjctStatus]}
|
||||
</Badge>
|
||||
) ,
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "ownerDept",
|
||||
header: "담당 그룹",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "ownerFw",
|
||||
header: "담당 실사",
|
||||
enableSorting: true,
|
||||
cell: ({row}) => (
|
||||
users.find(u => u.userId === row.original.ownerFw)?.userNm ?? ""
|
||||
) ,
|
||||
},
|
||||
{
|
||||
accessorKey: "regDt",
|
||||
header: "등록일",
|
||||
cell: ({row}) => (formatKst(row.original.regDt ?? "", "date")),
|
||||
enableSorting: true,
|
||||
}
|
||||
];
|
||||
80
src/components/table-column/UserTableColumn.tsx
Normal file
80
src/components/table-column/UserTableColumn.tsx
Normal file
@@ -0,0 +1,80 @@
|
||||
import {ColumnDef} from "@tanstack/react-table";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Pencil, Trash2} from "lucide-react";
|
||||
import {UserInfo} from "@/types/user";
|
||||
import {formatKst} from "@/lib/utils";
|
||||
import {MultiSelectOption} from "@/components/ui/multi-select";
|
||||
|
||||
|
||||
|
||||
export type UserColumnsActions = {
|
||||
onEdit: (userId: string) => void
|
||||
onDelete: (userId: string) => void
|
||||
}
|
||||
|
||||
export const getUserColumns = (actions: UserColumnsActions, userRoleArray:MultiSelectOption[]): ColumnDef<UserInfo>[] => [
|
||||
{
|
||||
accessorKey: "userId",
|
||||
header: "아이디",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userCmpn",
|
||||
header: "소속",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userName",
|
||||
header: "이름",
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "userRole",
|
||||
header: "권한",
|
||||
cell: ({row}) => {
|
||||
const role = userRoleArray.filter((r) => r.value === String(row.original.userRole));
|
||||
return role.length > 0 ? role[0].label : String(row.original.userRole);
|
||||
},
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "regDt",
|
||||
header: "등록일",
|
||||
cell: ({row}) => (formatKst(row.original.regDt ?? "", "date")),
|
||||
enableSorting: true,
|
||||
},
|
||||
{
|
||||
accessorKey: "memo",
|
||||
header: "메모",
|
||||
enableSorting: false,
|
||||
},
|
||||
{
|
||||
id: "actions",
|
||||
header: "관리",
|
||||
cell: ({ row }) => (
|
||||
<div
|
||||
className="flex items-center justify-center gap-2"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => actions.onEdit(row.original.userId)}
|
||||
aria-label="수정"
|
||||
>
|
||||
<Pencil className="w-4 h-4" />
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => actions.onDelete(row.original.userId)}
|
||||
aria-label="삭제"
|
||||
>
|
||||
<Trash2 className="w-4 h-4 text-destructive" />
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
enableSorting: false,
|
||||
},
|
||||
];
|
||||
@@ -1381,6 +1381,7 @@ function MultiSelectInner(
|
||||
<CommandGroup>
|
||||
<CommandItem
|
||||
key="all"
|
||||
value={"all"}
|
||||
onSelect={toggleAll}
|
||||
role="option"
|
||||
aria-selected={isAllSelected}
|
||||
@@ -1424,6 +1425,7 @@ function MultiSelectInner(
|
||||
return (
|
||||
<CommandItem
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
onSelect={() => toggleOption(option.value)}
|
||||
role="option"
|
||||
aria-selected={isSelected}
|
||||
@@ -1470,6 +1472,7 @@ function MultiSelectInner(
|
||||
return (
|
||||
<CommandItem
|
||||
key={option.value}
|
||||
value={option.value}
|
||||
onSelect={() => toggleOption(option.value)}
|
||||
role="option"
|
||||
aria-selected={isSelected}
|
||||
|
||||
Reference in New Issue
Block a user