This commit is contained in:
NikolayRechkin 2019-12-26 16:22:37 +03:00
commit 043ae22384
15 changed files with 185 additions and 89 deletions

View File

@ -65,11 +65,11 @@ class PureArticleMainButtonContent extends React.Component {
label={t('InviteLinkTitle')}
onClick={this.onInvitationDialogClick}
/>
<DropDownItem
{/* <DropDownItem
icon="PlaneIcon"
label={t('LblInviteAgain')}
onClick={this.onNotImplementedClick.bind(this, "Invite again action")}
/>
/> */}
{false &&
<DropDownItem
icon="ImportIcon"

View File

@ -45,10 +45,11 @@ const MainContainer = styled.div`
.members_container {
position: relative;
max-width: 320px;
margin: 0;
}
.search_container {
margin-top: 16px;
margin-top: 32px;
}
.selected-members_container {
@ -64,7 +65,7 @@ const MainContainer = styled.div`
}
.buttons_container {
margin-top: 60px;
margin-top: 40px;
.cancel-button {
margin-left: 8px;
@ -320,7 +321,7 @@ class SectionBodyContent extends React.Component {
isDisabled={inLoading}
selectedOption={{
key: 0,
label: t("CustomAddEmployee", { typeUser })
label: t("AddMembers")
}}
scaled={true}
size="content"
@ -337,30 +338,32 @@ class SectionBodyContent extends React.Component {
/>
</FieldContainer>
{groupMembers && groupMembers.length > 0 && (
<div className="search_container">
<SearchInput
id="member-search"
isDisabled={inLoading}
scale={true}
placeholder="Search"
value={searchValue}
onChange={this.onSearchChange}
/>
</div>
<>
<div className="search_container">
<SearchInput
id="member-search"
isDisabled={inLoading}
scale={true}
placeholder={t("SearchAddedMembers")}
value={searchValue}
onChange={this.onSearchChange}
/>
</div>
<div className="selected-members_container">
{groupMembers.map(member => (
<SelectedItem
key={member.key}
text={member.label}
onClose={this.onSelectedItemClose.bind(this, member)}
isInline={true}
className="selected-item"
isDisabled={inLoading}
/>
))}
</div>
</>
)}
<div className="selected-members_container">
{groupMembers.map(member => (
<SelectedItem
key={member.key}
text={member.label}
onClose={this.onSelectedItemClose.bind(this, member)}
isInline={true}
className="selected-item"
isDisabled={inLoading}
/>
))}
</div>
<div>{error && <strong>{error}</strong>}</div>
{error && <div><strong>{error}</strong></div>}
<div className="buttons_container">
<Button
label={t("SaveButton")}

View File

@ -9,5 +9,7 @@
"CustomNewDepartment": "New {{department, lowercase}}",
"CustomEditDepartment": "Edit {{department, lowercase}}",
"CustomDepartmentName": "{{department}} name",
"Members": "Members"
"Members": "Members",
"AddMembers": "Add members",
"SearchAddedMembers": "Search added members"
}

View File

@ -9,5 +9,7 @@
"CustomNewDepartment": "Новый {{department, lowercase}}",
"CustomEditDepartment": "Редактирование {{department, lowercase}}",
"CustomDepartmentName": "Имя {{department}}",
"Members": "Участники"
"Members": "Участники",
"AddMembers": "Добавить участников",
"SearchAddedMembers": "Поиск добавленных участников"
}

View File

@ -1,12 +1,11 @@
import React, { useCallback } from "react";
import React, { useCallback, useState } from "react";
import styled from "styled-components";
import { withRouter } from "react-router";
import {
GroupButtonsMenu,
DropDownItem,
toastr,
ContextMenuButton,
IconButton
ContextMenuButton
} from "asc-web-components";
import { Headline } from 'asc-web-common';
import { connect } from "react-redux";
@ -22,10 +21,13 @@ import {
} from "../../../../../store/people/actions";
import {
typeUser,
typeGuest
typeGuest,
department
} from "../../../../../helpers/../helpers/customNames";
import { deleteGroup } from "../../../../../store/group/actions";
import { store, api, constants } from 'asc-web-common';
import { InviteDialog } from '../../../../dialogs';
const { isAdmin } = store.auth.selectors;
const { resendUserInvites, deleteUsers } = api.people;
const { EmployeeStatus, EmployeeType } = constants;
@ -54,6 +56,8 @@ const StyledContainer = styled.div`
`;
const SectionHeaderContent = props => {
const [dialogVisible, setDialogVisible] = useState(false);
const {
isHeaderVisible,
isHeaderIndeterminate,
@ -176,7 +180,7 @@ const SectionHeaderContent = props => {
);
}, [deleteGroup, group]);
const getContextOptions = useCallback(() => {
const getContextOptionsGroup = useCallback(() => {
return [
{
key: "edit-group",
@ -191,10 +195,53 @@ const SectionHeaderContent = props => {
];
}, [t, onEditGroup, onDeleteGroup]);
const onAddDepartmentsClick = useCallback(() => {
const goToEmployeeCreate = useCallback(() => {
history.push(`${settings.homepage}/create/user`);
}, [history, settings]);
const goToGuestCreate = useCallback(() => {
history.push(`${settings.homepage}/create/guest`);
}, [history, settings]);
const goToGroupCreate = useCallback(() => {
history.push(`${settings.homepage}/group/create`);
}, [history, settings]);
const onInvitationDialogClick = useCallback(() =>
setDialogVisible(!dialogVisible), [dialogVisible]
);
const getContextOptionsPlus = useCallback(() => {
return [
{
key: "new-employee",
label: t("CustomNewEmployee", { typeUser }),
onClick: goToEmployeeCreate
},
{
key: "new-guest",
label: t("CustomNewGuest", { typeGuest }),
onClick: goToGuestCreate
},
{
key: "new-group",
label: t("CustomNewDepartment", { department }),
onClick: goToGroupCreate
},
{ key: 'separator', isSeparator: true },
{
key: "make-invitation-link",
label: t("MakeInvitationLink"),
onClick: onInvitationDialogClick
}/* ,
{
key: "send-invitation",
label: t("SendInvitationAgain"),
onClick: onSentInviteAgain
} */
];
}, [t, goToEmployeeCreate, goToGuestCreate, goToGroupCreate, onInvitationDialogClick/* , onSentInviteAgain */]);
return (
<StyledContainer>
{isHeaderVisible ? (
@ -224,7 +271,7 @@ const SectionHeaderContent = props => {
iconName="VerticalDotsIcon"
size={16}
color="#A3A9AE"
getData={getContextOptions.bind(this, t)}
getData={getContextOptionsGroup}
isDisabled={false}
/>
)}
@ -233,15 +280,25 @@ const SectionHeaderContent = props => {
<>
<Headline type="content">Departments</Headline>
{isAdmin && (
<IconButton
<>
<ContextMenuButton
className="action-button"
size={16}
directionX="left"
title={t("Actions")}
iconName="PlusIcon"
color="#A3A9AE"
hoverColor="#657077"
isFill={true}
onClick={onAddDepartmentsClick}
size={16}
color="#657077"
getData={getContextOptionsPlus}
isDisabled={false}
/>
{dialogVisible &&
<InviteDialog
visible={dialogVisible}
onClose={onInvitationDialogClick}
onCloseButton={onInvitationDialogClick}
/>
}
</>
)}
</>
)}

View File

@ -55,5 +55,11 @@
"DefaultSelectLabel": "Select",
"FilterPlaceholder": "Search"
"FilterPlaceholder": "Search",
"CustomNewEmployee": "New {{typeUser, lowercase}}",
"CustomNewGuest": "New {{typeGuest, lowercase}}",
"CustomNewDepartment": "New {{department, lowercase}}",
"MakeInvitationLink": "Make invitation link",
"SendInvitationAgain": "Send invitation once"
}

View File

@ -55,5 +55,11 @@
"DefaultSelectLabel": "Выберите",
"FilterPlaceholder": "Поиск"
"FilterPlaceholder": "Поиск",
"CustomNewEmployee": "Новый {{typeUser, lowercase}}",
"CustomNewGuest": "Новый {{typeGuest, lowercase}}",
"CustomNewDepartment": "Новый {{department, lowercase}}",
"MakeInvitationLink": "Создать пригласительную ссылку",
"SendInvitationAgain": "Отправить приглашение ещё раз"
}

View File

@ -53,6 +53,12 @@ const StyledContainer = styled.div`
margin-left: auto;
}
}
.arrow-button {
@media (max-width: 1024px) {
padding: 8px 0 8px 8px;
margin-left: -8px;
}
}
`;
class SectionHeaderContent extends React.PureComponent {
@ -378,6 +384,7 @@ class SectionHeaderContent extends React.PureComponent {
hoverColor="#657077"
isFill={true}
onClick={this.onClickBack}
className="arrow-button"
/>
<HeaderContainer type='content' truncate={true}>
{profile.displayName}

View File

@ -5,4 +5,4 @@ export const employedSinceDate = 'Employed since';
export const typeGuest = 'Guest';
export const typeGuests = 'Guests';
export const typeUser = 'Employee';
export const headOfDepartment = 'Head of Department';
export const headOfDepartment = 'Head of department';

View File

@ -340,8 +340,6 @@ class PureAdminsSettings extends Component {
showLoader
} = this.state;
const countElements = filter.total;
console.log("Admins render_");
return (

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-common",
"version": "1.0.25",
"version": "1.0.26",
"description": "Ascensio System SIA common components and solutions library",
"license": "AGPL-3.0",
"files": [

View File

@ -97,9 +97,12 @@ const Selector = props => {
);
// Every row is loaded except for our loading indicator row.
const isItemLoaded = useCallback(index => {
return !hasNextPage || index < options.length;
}, [hasNextPage, options]);
const isItemLoaded = useCallback(
index => {
return !hasNextPage || index < options.length;
},
[hasNextPage, options]
);
const onOptionChange = useCallback(
e => {
@ -484,7 +487,13 @@ const Selector = props => {
</div>
);
},
[groups, currentGroup, isMultiSelect, selectedGroupList, allowGroupSelection]
[
groups,
currentGroup,
isMultiSelect,
selectedGroupList,
allowGroupSelection
]
);
const hasSelected = useCallback(() => {
@ -524,11 +533,7 @@ const Selector = props => {
allowGroupSelection={allowGroupSelection}
hasSelected={hasSelected()}
>
<Column
className="column-options"
displayType={displayType}
size={size}
>
<Column className="column-options" displayType={displayType} size={size}>
<Header className="header-options">
<SearchInput
className="options_searcher"
@ -554,28 +559,31 @@ const Selector = props => {
size="content"
onSelect={onGroupSelect}
/>
{isMultiSelect && allowGroupSelection && options && options.length > 0 && (
<Checkbox
className="options_group_select_all"
label={selectAllLabel}
isChecked={selectedAll}
isIndeterminate={false}
onChange={onSelectAllChange}
/>
)}
{isMultiSelect &&
allowGroupSelection &&
options &&
options.length > 0 && (
<Checkbox
className="options_group_select_all"
label={selectAllLabel}
isChecked={selectedAll}
isIndeterminate={false}
onChange={onSelectAllChange}
/>
)}
</>
)}
</Header>
<Body className="body-options">
<InfiniteLoader
ref={listOptionsRef}
isItemLoaded={isItemLoaded}
itemCount={itemCount}
loadMoreItems={loadMoreItems}
>
{({ onItemsRendered, ref }) => (
<AutoSizer>
{({ width, height }) => (
<AutoSizer>
{({ width, height }) => (
<InfiniteLoader
ref={listOptionsRef}
isItemLoaded={isItemLoaded}
itemCount={itemCount}
loadMoreItems={loadMoreItems}
>
{({ onItemsRendered, ref }) => (
<List
className="options_list"
height={height}
@ -589,9 +597,10 @@ const Selector = props => {
{renderOption}
</List>
)}
</AutoSizer>
</InfiniteLoader>
)}
</InfiniteLoader>
</AutoSizer>
{!hasNextPage && itemCount === 0 && (
<div className="row-block">
<Text>
@ -609,11 +618,7 @@ const Selector = props => {
</Body>
</Column>
{displayType === "dropdown" && groups && groups.length > 0 && (
<Column
className="column-groups"
displayType={displayType}
size={size}
>
<Column className="column-groups" displayType={displayType} size={size}>
<Header className="header-groups">
<Text as="p" className="group_header" fontSize="15px" isBold={true}>
{groupsHeaderLabel}

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-components",
"version": "1.0.273",
"version": "1.0.274",
"description": "Ascensio System SIA component library",
"license": "AGPL-3.0",
"main": "dist/asc-web-components.js",

View File

@ -40,21 +40,24 @@ function getVerticalCss() {
margin: 0 0 16px 0;
.field-label {
line-height: unset;
margin: 0 0 4px 0;
line-height: 13px;
height: 15px;
display: inline-block;
}
.field-label-icon {
display: inline-flex;
width: 100%;
line-height: 1.5;
margin: 0 0 8px 0;
}
.field-body {
width: 100%;
}
.icon-button {
position: relative;
line-height: unset;
margin-top: -12px;
margin: 0;
padding: 1px 6px;
width: 13px;
height: 13px;
}
`;
}

View File

@ -45,6 +45,13 @@ const CloseButton = styled.a`
width: 16px;
height: 16px;
&:hover {
&:before,
&:after {
background-color: #657077;
}
}
&:before,
&:after {
position: absolute;