From eaaf0b025de1f4e6e16d3f0d11e7daa0cbb954c8 Mon Sep 17 00:00:00 2001 From: Ariunzaya <91462097+ariunzayarin@users.noreply.github.com> Date: Wed, 27 Sep 2023 21:41:01 +0800 Subject: [PATCH] fix(settings): structure (#4647) --- .../settings/main/components/Settings.tsx | 2 +- .../settings/team/components/branch/Form.tsx | 26 ++-- .../team/components/branch/MainList.tsx | 128 ++++++++++-------- .../components/common/SettingsSideBar.tsx | 45 ++++-- .../team/components/department/Form.tsx | 26 ++-- .../team/components/department/MainList.tsx | 125 +++++++++-------- .../team/components/structure/Form.tsx | 12 +- .../team/components/structure/Settings.tsx | 3 +- .../team/components/structure/View.tsx | 27 ++-- .../settings/team/components/unit/Form.tsx | 10 +- .../team/components/unit/MainList.tsx | 98 ++++++++------ .../team/containers/branch/MainList.tsx | 10 +- .../team/containers/common/SettingSideBar.tsx | 80 +++++++++++ .../team/containers/department/MainList.tsx | 1 + .../team/containers/structure/Box.tsx | 9 +- .../settings/team/containers/unit/Form.tsx | 6 +- .../team/containers/unit/MainList.tsx | 10 +- .../src/modules/settings/team/styles.ts | 32 +++-- .../src/components/HeaderDescription.tsx | 2 +- packages/erxes-ui/src/layout/styles.ts | 7 +- 20 files changed, 417 insertions(+), 242 deletions(-) create mode 100644 packages/core-ui/src/modules/settings/team/containers/common/SettingSideBar.tsx diff --git a/packages/core-ui/src/modules/settings/main/components/Settings.tsx b/packages/core-ui/src/modules/settings/main/components/Settings.tsx index 3da156269bb..df566c29595 100644 --- a/packages/core-ui/src/modules/settings/main/components/Settings.tsx +++ b/packages/core-ui/src/modules/settings/main/components/Settings.tsx @@ -145,7 +145,7 @@ class Settings extends React.PureComponent { )} {this.renderBox( 'Structure', - '/images/icons/erxes-23.svg', + '/images/icons/erxes-15.svg', '/settings/structure', 'usersAll', teamPermissions diff --git a/packages/core-ui/src/modules/settings/team/components/branch/Form.tsx b/packages/core-ui/src/modules/settings/team/components/branch/Form.tsx index 5049fc427da..ecb2bda796f 100644 --- a/packages/core-ui/src/modules/settings/team/components/branch/Form.tsx +++ b/packages/core-ui/src/modules/settings/team/components/branch/Form.tsx @@ -9,7 +9,6 @@ import { __ } from 'modules/common/utils'; import { IBranch } from '@erxes/ui/src/team/types'; import SelectTeamMembers from '@erxes/ui/src/team/containers/SelectTeamMembers'; import ContactInfoForm from '../common/ContactInfoForm'; -import SelectBranches from '@erxes/ui/src/team/containers/SelectBranches'; type Props = { renderButton: (props: IButtonMutateProps) => JSX.Element; @@ -19,7 +18,7 @@ type Props = { }; export default function BranchForm(props: Props) { - const { closeModal, renderButton } = props; + const { closeModal, renderButton, branches } = props; const object = props.branch || ({} as IBranch); const [userIds, setUserIds] = useState( @@ -75,6 +74,14 @@ export default function BranchForm(props: Props) { const renderContent = (formProps: IFormProps) => { const { values, isSubmitted } = formProps; + const generateOptions = () => { + return branches.map(branch => ( + + )); + }; + return ( <> @@ -120,13 +127,16 @@ export default function BranchForm(props: Props) { {__('Parent')} - + componentClass="select" + defaultValue={parentId || null} + onChange={onChangeParent} + > + {__('Team Members')} diff --git a/packages/core-ui/src/modules/settings/team/components/branch/MainList.tsx b/packages/core-ui/src/modules/settings/team/components/branch/MainList.tsx index d8cca1e0789..6a4fa2605cf 100644 --- a/packages/core-ui/src/modules/settings/team/components/branch/MainList.tsx +++ b/packages/core-ui/src/modules/settings/team/components/branch/MainList.tsx @@ -2,7 +2,6 @@ import { Button, ModalTrigger, BarItems, - HeaderDescription, FormControl, Table, Wrapper, @@ -13,13 +12,15 @@ import { } from '@erxes/ui/src'; import { BranchesMainQueryResponse, IBranch } from '@erxes/ui/src/team/types'; import React from 'react'; -import SettingsSideBar from '../common/SettingsSideBar'; +import SettingsSideBar from '../../containers/common/SettingSideBar'; import Form from '../../containers/branch/Form'; import { generateTree } from '../../utils'; import { queries } from '@erxes/ui/src/team/graphql'; import { gql } from '@apollo/client'; import { generatePaginationParams } from '@erxes/ui/src/utils/router'; -import { DescriptionContentRow } from '../common/DescriptionContentRow'; +import ActionButtons from '@erxes/ui/src/components/ActionButtons'; +import Tip from '@erxes/ui/src/components/Tip'; +import Icon from '@erxes/ui/src/components/Icon'; type Props = { listQuery: BranchesMainQueryResponse; @@ -55,8 +56,24 @@ class MainList extends React.Component { } ]; + remove = (_id?: string) => { + if (_id) { + this.props.deleteBranches([_id], () => + this.setState({ selectedItems: [] }) + ); + } else { + this.props.deleteBranches(this.state.selectedItems, () => + this.setState({ selectedItems: [] }) + ); + } + }; + renderForm() { - const trigger = ; + const trigger = ( + + ); const content = ({ closeModal }) => (
{ const onclick = e => { e.stopPropagation(); }; + const trigger = ( + + ); + + return ( { {branch?.parent?.title || ''} {__(branch.address.replace(/\n/g, ''))} {branch.userCount} + + + ( + + )} + trigger={trigger} + /> + +