260716_01_ENH: 본 서버에서 기동 후 중간 테스트를 위한 커밋
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { KriDialog } from '@/components/common/KriDialog'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Input } from '@/components/ui/input'
|
||||
@@ -15,6 +15,13 @@ import {apiError} from "@kri/common/http";
|
||||
import {CONTACT_INTERVIEWER_ROLE, FW_TEAM, USER_NAME_REGEX} from "@/const/userConst";
|
||||
import {NONE_HTTP_ERROR, UNKNOWN_HTTP_ERROR} from "@kri/common/http";
|
||||
import type { CmpnInfo } from "@/types/cmpn";
|
||||
import { isExternalManager, isFieldWorkUser } from "@/utils/userRole";
|
||||
|
||||
// 외주사(EXTERNAL_USER_ROLE_GROUP)와 콜센터/컨택원/면접원(FW_USER_ROLE_GROUP)은 배정 체계가 완전히 달라
|
||||
// 서로 넘나드는 권한 수정을 지원하지 않는다. 하나 새로 만들어서 넘기는 게 맞다.
|
||||
const isCrossExternalFwRoleChange = (fromRole: number, toRole: number) =>
|
||||
(isExternalManager(fromRole) && isFieldWorkUser(toRole)) ||
|
||||
(isFieldWorkUser(fromRole) && isExternalManager(toRole))
|
||||
|
||||
export type UserUpsertDialogProps = {
|
||||
/** Jotai로 관리할 다이얼로그 ID */
|
||||
@@ -94,6 +101,13 @@ const UserUpsertDialog = ({
|
||||
}
|
||||
}, [initialData, mode, resolvedOpen])
|
||||
|
||||
// 수정 모드에서는 최초 권한 기준으로 외주사 ↔ 콜센터/컨택원/면접원 간 이동이 되는 선택지를 아예 뺀다.
|
||||
const availableRoleArray = useMemo(() => {
|
||||
if (mode === 'create' || initialData?.userRole == null) return userRoleArray
|
||||
const initialRole = initialData.userRole
|
||||
return userRoleArray.filter((item) => !isCrossExternalFwRoleChange(initialRole, Number(item.value)))
|
||||
}, [mode, initialData?.userRole, userRoleArray])
|
||||
|
||||
const handleInputChange = <K extends keyof UserInfoSaveRequest>(field: K, value: UserInfoSaveRequest[K]) => {
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
@@ -250,7 +264,7 @@ const UserUpsertDialog = ({
|
||||
<div className="grid gap-2">
|
||||
<Label>계정 권한</Label>
|
||||
<KriSelect
|
||||
items={userRoleArray}
|
||||
items={availableRoleArray}
|
||||
value={String(formData.userRole)}
|
||||
getLabel={(item) => item.label}
|
||||
getValue={(item) => String(item.value)}
|
||||
|
||||
Reference in New Issue
Block a user