People.Client: ProfileAction: applied real custom names

This commit is contained in:
Daniil Senkiv 2020-01-22 13:45:43 +03:00
parent ead82ac91e
commit 2c09e6cf10
5 changed files with 23 additions and 33 deletions

View File

@ -14,7 +14,6 @@ import RadioField from './FormFields/RadioField'
import DepartmentField from './FormFields/DepartmentField'
import ContactsField from './FormFields/ContactsField'
import InfoFieldContainer from './FormFields/InfoFieldContainer'
import { departments, department, position, employedSinceDate } from '../../../../../helpers/customNames';
import { api } from "asc-web-common";
const {
createThumbnailsAvatar,
@ -320,6 +319,7 @@ class CreateUserForm extends React.Component {
render() {
const { isLoading, errors, profile, selector } = this.state;
const { t, settings, i18n } = this.props;
const { regDateCaption, userPostCaption, groupCaption, groupsCaption } = settings.customNames;
const pattern = getUserContactsPattern();
const contacts = getUserContacts(profile.contacts);
@ -440,7 +440,7 @@ class CreateUserForm extends React.Component {
/>
<DateField
calendarHeaderContent={t("CalendarSelectDate")}
labelText={`${t("CustomEmployedSinceDate", { employedSinceDate })}:`}
labelText={`${regDateCaption}:`}
inputName="workFrom"
inputValue={profile.workFrom ? new Date(profile.workFrom) : undefined}
inputIsDisabled={isLoading}
@ -456,7 +456,7 @@ class CreateUserForm extends React.Component {
inputTabIndex={7}
/>
<TextField
labelText={`${t("CustomPosition", { position })}:`}
labelText={`${userPostCaption}:`}
inputName="title"
inputValue={profile.title}
inputIsDisabled={isLoading}
@ -464,7 +464,7 @@ class CreateUserForm extends React.Component {
inputTabIndex={8}
/>
<DepartmentField
labelText={`${t("CustomDepartment", { department })}:`}
labelText={`${groupCaption}:`}
isDisabled={isLoading}
showGroupSelectorButtonTitle={t("AddButton")}
onShowGroupSelector={this.onShowGroupSelector}
@ -474,7 +474,7 @@ class CreateUserForm extends React.Component {
searchPlaceHolderLabel={t("SearchDepartments")}
selectorOptions={selector.options}
selectorSelectedOptions={selector.selected}
selectorAddButtonText={t("CustomAddDepartments", { departments })}
selectorAddButtonText={t("CustomAddDepartments", { groupsCaption })}
selectorSelectAllText={t("SelectAll")}
selectorOnSearchGroups={this.onSearchGroups}
selectorOnSelectGroups={this.onSelectGroups}

View File

@ -13,7 +13,6 @@ import RadioField from './FormFields/RadioField'
import DepartmentField from './FormFields/DepartmentField'
import ContactsField from './FormFields/ContactsField'
import InfoFieldContainer from './FormFields/InfoFieldContainer'
import { departments, department, position, employedSinceDate, typeGuest, typeUser } from '../../../../../helpers/customNames';
import styled from "styled-components";
import { api } from "asc-web-common";
import { ChangeEmailDialog, ChangePasswordDialog, ChangePhoneDialog } from '../../../../dialogs';
@ -366,7 +365,8 @@ class UpdateUserForm extends React.Component {
render() {
const { isLoading, errors, profile, selector, dialogsVisible } = this.state;
const { t, i18n } = this.props;
const { t, i18n, settings } = this.props;
const { guestCaption, userCaption, regDateCaption, userPostCaption, groupCaption, groupsCaption } = settings.customNames;
const pattern = getUserContactsPattern();
const contacts = getUserContacts(profile.contacts);
@ -563,8 +563,8 @@ class UpdateUserForm extends React.Component {
radioName="isVisitor"
radioValue={profile.isVisitor.toString()}
radioOptions={[
{ value: "true", label: t("CustomTypeGuest", { typeGuest }) },
{ value: "false", label: t("CustomTypeUser", { typeUser }) }
{ value: "true", label: guestCaption },
{ value: "false", label: userCaption }
]}
radioIsDisabled={isLoading}
radioOnChange={this.onUserTypeChange}
@ -574,7 +574,7 @@ class UpdateUserForm extends React.Component {
/>
<DateField
calendarHeaderContent={t("CalendarSelectDate")}
labelText={`${t("CustomEmployedSinceDate", { employedSinceDate })}:`}
labelText={`${regDateCaption}:`}
inputName="workFrom"
inputValue={profile.workFrom ? new Date(profile.workFrom) : undefined}
inputIsDisabled={isLoading}
@ -590,7 +590,7 @@ class UpdateUserForm extends React.Component {
inputTabIndex={8}
/>
<TextField
labelText={`${t("CustomPosition", { position })}:`}
labelText={`${userPostCaption}:`}
inputName="title"
inputValue={profile.title}
inputIsDisabled={isLoading}
@ -598,7 +598,7 @@ class UpdateUserForm extends React.Component {
inputTabIndex={9}
/>
<DepartmentField
labelText={`${t("CustomDepartment", { department })}:`}
labelText={`${groupCaption}:`}
isDisabled={isLoading}
showGroupSelectorButtonTitle={t("AddButton")}
onShowGroupSelector={this.onShowGroupSelector}
@ -608,7 +608,7 @@ class UpdateUserForm extends React.Component {
searchPlaceHolderLabel={t("SearchDepartments")}
selectorOptions={selector.options}
selectorSelectedOptions={selector.selected}
selectorAddButtonText={t("CustomAddDepartments", { departments })}
selectorAddButtonText={t("CustomAddDepartments", { groupsCaption })}
selectorSelectAllText={t("SelectAll")}
selectorOnSearchGroups={this.onSearchGroups}
selectorOnSelectGroups={this.onSelectGroups}

View File

@ -5,7 +5,6 @@ import { withRouter } from "react-router";
import { IconButton } from 'asc-web-components';
import { Headline } from 'asc-web-common';
import { useTranslation } from 'react-i18next';
import { typeUser, typeGuest } from './../../../../../helpers/customNames';
const Wrapper = styled.div`
display: flex;
@ -24,14 +23,15 @@ const Wrapper = styled.div`
`;
const SectionHeaderContent = (props) => {
const { profile, history, match } = props;
const { profile, history, match, settings } = props;
const { userCaption, guestCaption } = settings.customNames;
const { type } = match.params;
const { t } = useTranslation();
const headerText = type
? type === "guest"
? t('CustomNewGuest', { typeGuest })
: t('CustomNewEmployee', { typeUser })
? t('CustomNewGuest', { guestCaption })
: t('CustomNewEmployee', { userCaption })
: profile
? `${t('EditProfile')} (${profile.displayName})`
: "";

View File

@ -42,14 +42,9 @@
"EditProfile": "Edit profile",
"SearchDepartments": "Search departments",
"CustomEmployedSinceDate": "{{employedSinceDate}}",
"CustomPosition": "{{position}}",
"CustomDepartment": "{{department}}",
"CustomTypeGuest": "{{typeGuest}}",
"CustomTypeUser": "{{typeUser}}",
"CustomNewEmployee": "New {{typeUser, lowercase}}",
"CustomNewGuest": "New {{typeGuest, lowercase}}",
"CustomAddDepartments": "Add {{departments, lowercase}}",
"CustomNewEmployee": "New {{userCaption, lowercase}}",
"CustomNewGuest": "New {{guestCaption, lowercase}}",
"CustomAddDepartments": "Add {{groupCaption, lowercase}}",
"chooseFileLabel": "Drop file here, or click to select file",
"chooseMobileFileLabel": "Click to select files",

View File

@ -42,14 +42,9 @@
"EditProfile": "Редактирование профиля",
"SearchDepartments": "Поиск группы",
"CustomEmployedSinceDate": "{{employedSinceDate}}",
"CustomPosition": "{{position}}",
"CustomDepartment": "{{department}}",
"CustomTypeGuest": "{{typeGuest}}",
"CustomTypeUser": "{{typeUser}}",
"CustomNewEmployee": "Новый {{typeUser, lowercase}}",
"CustomNewGuest": "Новый {{typeGuest, lowercase}}",
"CustomAddDepartments": "Добавить {{departments, lowercase}}",
"CustomNewEmployee": "Новый {{userCaption, lowercase}}",
"CustomNewGuest": "Новый {{guestCaption, lowercase}}",
"CustomAddDepartments": "Добавить {{groupCaption, lowercase}}",
"chooseFileLabel": "Перетащите файл сюда или нажмите, чтобы выбрать файл",
"chooseMobileFileLabel": "Нажмите сюда, чтобы выбрать файл",