|
@@ -12,7 +12,7 @@ import Xss from '~/services/xss';
|
|
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
|
userGroup?: IUserGroupHasId,
|
|
userGroup?: IUserGroupHasId,
|
|
|
- parentUserGroups?: IUserGroupHasId[],
|
|
|
|
|
|
|
+ selectableParentUserGroups?: IUserGroupHasId[],
|
|
|
submitButtonLabel: TFunctionResult;
|
|
submitButtonLabel: TFunctionResult;
|
|
|
onSubmit?: (userGroupData: Partial<IUserGroup>) => Promise<IUserGroupHasId | void>
|
|
onSubmit?: (userGroupData: Partial<IUserGroup>) => Promise<IUserGroupHasId | void>
|
|
|
};
|
|
};
|
|
@@ -23,7 +23,7 @@ const UserGroupForm: FC<Props> = (props: Props) => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
const {
|
|
const {
|
|
|
- userGroup, parentUserGroups, submitButtonLabel, onSubmit,
|
|
|
|
|
|
|
+ userGroup, selectableParentUserGroups, submitButtonLabel, onSubmit,
|
|
|
} = props;
|
|
} = props;
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -115,15 +115,22 @@ const UserGroupForm: FC<Props> = (props: Props) => {
|
|
|
{t('admin:user_group_management.parent_group')}
|
|
{t('admin:user_group_management.parent_group')}
|
|
|
</label>
|
|
</label>
|
|
|
<div className="dropdown col-md-4">
|
|
<div className="dropdown col-md-4">
|
|
|
- <button className="btn btn-outline-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown">
|
|
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ id="dropdownMenuButton"
|
|
|
|
|
+ data-toggle="dropdown"
|
|
|
|
|
+ className={`
|
|
|
|
|
+ btn btn-outline-secondary dropdown-toggle ${selectableParentUserGroups != null && selectableParentUserGroups.length > 0 ? '' : 'disabled'}
|
|
|
|
|
+ `}
|
|
|
|
|
+ >
|
|
|
{selectedParent?.name ?? t('admin:user_group_management.select_parent_group')}
|
|
{selectedParent?.name ?? t('admin:user_group_management.select_parent_group')}
|
|
|
</button>
|
|
</button>
|
|
|
<div className="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
|
<div className="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
|
|
{
|
|
{
|
|
|
- (parentUserGroups != null && parentUserGroups.length > 0) && (
|
|
|
|
|
|
|
+ (selectableParentUserGroups != null && selectableParentUserGroups.length > 0) && (
|
|
|
<>
|
|
<>
|
|
|
{
|
|
{
|
|
|
- parentUserGroups.map(userGroup => (
|
|
|
|
|
|
|
+ selectableParentUserGroups.map(userGroup => (
|
|
|
<button
|
|
<button
|
|
|
key={userGroup._id}
|
|
key={userGroup._id}
|
|
|
type="button"
|
|
type="button"
|