);
}
renderSupervisedUserMessage(){
- if(this.state.message) {
- if(this.state.message != 'success'){
- return(
+ const { message } = this.state;
+
+ if(message) {
+ if(message != 'success') {
+ return (
- )
- }else{
- return(
+ );
+ } else {
+ return (
- )
+ );
}
}
}
@@ -133,11 +143,11 @@ class AdminPanelViewUser extends React.Component {
this.setState({
loading: true
});
-
+
const userIdList = this.state.userList.map((item) => {
return item.id;
});
-
+
API.call({
path: '/user/edit-supervised-list',
data: {
@@ -177,11 +187,16 @@ class AdminPanelViewUser extends React.Component {
const authorsListWithoutMe = r.data.authors.filter(author => author.id != this.props.params.userId);
return authorsListWithoutMe.map(author => {
+ const {
+ id,
+ name
+ } = author;
+
return {
- name: author.name,
+ name,
color: "gray",
- id: author.id*1,
- content:
,
isStaff: false
}});
}).catch((r) => {
@@ -192,10 +207,15 @@ class AdminPanelViewUser extends React.Component {
transformUserListToAutocomplete() {
return(
this.state.userList.map((user) => {
+ const {
+ id,
+ name
+ } = user;
+
return ({
- id: user.id*1,
- name: user.name,
- content:
,
+ id: id*1,
+ name,
+ content:
,
color: 'grey',
isStaff: false
});
@@ -215,37 +235,58 @@ class AdminPanelViewUser extends React.Component {
);
}
- renderCustomField(customfield) {
+ renderCustomField(_customfield) {
+ const {
+ customfield,
+ value,
+ id
+ } = _customfield;
+
return (
-
- {customfield.customfield}
+
+ {customfield}
- {customfield.value}
+ {value}
);
}
getTicketListProps() {
+ const {
+ tickets,
+ loading
+ } = this.state;
+
return {
type: 'secondary',
- tickets: this.state.tickets,
- loading: this.state.loading,
+ tickets,
+ loading,
departments: this.props.departments,
ticketPath: '/admin/panel/tickets/view-ticket/'
};
}
onUserRetrieved(result) {
+ const {
+ name,
+ email,
+ verified,
+ tickets,
+ disabled,
+ customfields,
+ userList
+ } = result.data;
+
this.setState({
- name: result.data.name,
- email: result.data.email,
- verified: result.data.verified,
- tickets: result.data.tickets,
- disabled: result.data.disabled,
- customfields: result.data.customfields,
+ name,
+ email,
+ verified,
+ tickets,
+ disabled,
+ customfields,
loading: false,
- userList: result.data.userList
+ userList
});
}
diff --git a/client/src/app/admin/panel/users/invite-user-widget.js b/client/src/app/admin/panel/users/invite-user-widget.js
index 8336724d..b54f7f45 100644
--- a/client/src/app/admin/panel/users/invite-user-widget.js
+++ b/client/src/app/admin/panel/users/invite-user-widget.js
@@ -1,5 +1,4 @@
import React from 'react';
-import ReactDOM from 'react-dom';
import _ from 'lodash';
import classNames from 'classnames';
@@ -13,6 +12,8 @@ import Form from 'core-components/form';
import FormField from 'core-components/form-field';
import Widget from 'core-components/widget';
import Header from 'core-components/header';
+import Button from 'core-components/button';
+import ModalContainer from 'app-components/modal-container';
class InviteUserWidget extends React.Component {
@@ -52,9 +53,11 @@ class InviteUserWidget extends React.Component {
-
{i18n('INVITE_USER')}
+
+
+ {i18n('INVITE_USER')}
+
-
{this.renderMessage()}
);
@@ -88,9 +91,9 @@ class InviteUserWidget extends React.Component {
renderMessage() {
switch (this.state.message) {
case 'success':
- return
{i18n('INVITE_USER_SUCCESS')};
+ return
{i18n('INVITE_USER_SUCCESS')};
case 'fail':
- return
{i18n('EMAIL_EXISTS')};
+ return
{i18n('EMAIL_EXISTS')};
default:
return null;
}
diff --git a/client/src/app/admin/panel/users/invite-user-widget.scss b/client/src/app/admin/panel/users/invite-user-widget.scss
index 9ecbf748..90b960f2 100644
--- a/client/src/app/admin/panel/users/invite-user-widget.scss
+++ b/client/src/app/admin/panel/users/invite-user-widget.scss
@@ -1,9 +1,8 @@
.invite-user-widget {
- padding: 30px;
+ padding: 10px;
text-align: center;
&__form {
- margin-bottom: 20px;
}
&__inputs {
@@ -16,4 +15,16 @@
height: 78px;
width: 304px;
}
+
+ &__buttons-container {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ }
+
+ &__success-message,
+ &__error-message {
+ margin-top: 20px;
+ }
}
diff --git a/client/src/app/main/dashboard/dashboard-create-ticket/create-ticket-form.js b/client/src/app/main/dashboard/dashboard-create-ticket/create-ticket-form.js
index 50672beb..81149352 100644
--- a/client/src/app/main/dashboard/dashboard-create-ticket/create-ticket-form.js
+++ b/client/src/app/main/dashboard/dashboard-create-ticket/create-ticket-form.js
@@ -2,7 +2,6 @@ import React from 'react';
import _ from 'lodash';
import {connect} from 'react-redux';
-import history from 'lib-app/history';
import i18n from 'lib-app/i18n';
import API from 'lib-app/api-call';
import SessionStore from 'lib-app/session-store';
@@ -45,36 +44,46 @@ class CreateTicketForm extends React.Component {
};
render() {
+ const {
+ userLogged,
+ isDefaultDepartmentLocked,
+ isStaff,
+ onlyOneSupportedLanguage,
+ allowAttachments
+ } = this.props;
+
return (
@@ -84,8 +93,8 @@ class CreateTicketForm extends React.Component {
renderEmailAndName() {
return (
-
-
+
+
);
}
@@ -101,7 +110,7 @@ class CreateTicketForm extends React.Component {
renderCaptcha() {
return (
-
+
);
}
@@ -118,10 +127,15 @@ class CreateTicketForm extends React.Component {
}
getFormProps() {
+ const {
+ loading,
+ form
+ } = this.state;
+
return {
- loading: this.state.loading,
+ loading,
onSubmit: this.onSubmit.bind(this),
- values: this.state.form,
+ values: form,
onChange: form => this.setState({form})
};
}
@@ -148,15 +162,16 @@ class CreateTicketForm extends React.Component {
}
onTicketSuccess(email, result) {
- let message = 'success'
- this.setState({
- loading: false,
- message: message
- }, () => {
- if(this.props.onSuccess) {
- this.props.onSuccess(result, email, message);
- }
- });
+ const { onSuccess } = this.props;
+ const message = 'success';
+
+ this.setState(
+ {
+ loading: false,
+ message
+ },
+ () => {onSuccess && onSuccess(result, email, message);}
+ );
}
onTicketFail() {
diff --git a/client/src/app/main/dashboard/dashboard-create-ticket/create-ticket-form.scss b/client/src/app/main/dashboard/dashboard-create-ticket/create-ticket-form.scss
index bc7d906e..0da4e3f1 100644
--- a/client/src/app/main/dashboard/dashboard-create-ticket/create-ticket-form.scss
+++ b/client/src/app/main/dashboard/dashboard-create-ticket/create-ticket-form.scss
@@ -8,6 +8,13 @@
margin-top: 20px;
}
+ &__buttons-container {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ }
+
&__captcha {
margin: 0 auto 20px;
height: 78px;
diff --git a/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.js b/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.js
index 88cb27e1..121711e5 100644
--- a/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.js
+++ b/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.js
@@ -43,54 +43,97 @@ class DashboardEditProfilePage extends React.Component {
return (
-
{i18n('EDIT_EMAIL')}
-
-
{i18n('EDIT_PASSWORD')}
-
+ {this.renderEditEmail()}
+ {this.renderEditPassword()}
{this.state.customFields.length ? this.renderCustomFields() : null}
);
}
- renderCustomFields() {
+ renderEditEmail() {
return (
-
+
+
+
{i18n('EDIT_EMAIL')}
+
+
+ );
+ }
+
+ renderEditPassword() {
+ return (
+
+
+
{i18n('EDIT_PASSWORD')}
+
+
+ );
+ }
+
+ renderCustomFields() {
+ const {
+ loadingCustomFields,
+ customFieldsFrom,
+ customFields
+ } = this.state;
+
+ return (
+
+
{i18n('ADDITIONAL_FIELDS')}
-
);
}
renderCustomField(customField, key) {
- if(customField.type === 'text') {
+ const {
+ type,
+ name,
+ description,
+ options
+ } = customField;
+
+ if(type === 'text') {
return (
-
+
);
} else {
- const items = customField.options.map(option => ({content: option.name, value: option.name}));
+ const items = options.map(option => ({content: option.name, value: option.name}));
return (
-
+
);
}
@@ -105,7 +148,6 @@ class DashboardEditProfilePage extends React.Component {
default:
return null;
}
-
}
renderMessagePass() {
@@ -121,13 +163,19 @@ class DashboardEditProfilePage extends React.Component {
onCustomFieldsSubmit(form) {
const {customFields} = this.state;
- const parsedFrom = {}
+ const parsedFrom = {};
customFields.forEach(customField => {
- if(customField.type === 'select') {
- parsedFrom[getCustomFieldParamName(customField.name)] = customField.options[form[customField.name]].name;
+ const {
+ type,
+ name,
+ options
+ } = customField;
+
+ if(type === 'select') {
+ parsedFrom[getCustomFieldParamName(name)] = options[form[name]].name;
} else {
- parsedFrom[getCustomFieldParamName(customField.name)] = form[customField.name];
+ parsedFrom[getCustomFieldParamName(name)] = form[name];
}
});
@@ -142,7 +190,6 @@ class DashboardEditProfilePage extends React.Component {
this.setState({loadingCustomFields: false});
this.props.dispatch(SessionActions.getUserData());
});
-
}
onSubmitEditEmail(formState) {
@@ -157,6 +204,7 @@ class DashboardEditProfilePage extends React.Component {
this.setState({
loadingEmail: true
});
+
return API.call({
path: "/user/edit-email",
data: {
@@ -179,6 +227,7 @@ class DashboardEditProfilePage extends React.Component {
this.setState({
loadingPass: true
});
+
return API.call({
path: "/user/edit-password",
data: {
@@ -206,12 +255,19 @@ class DashboardEditProfilePage extends React.Component {
.then(result => {
const customFieldsFrom = {};
const {userCustomFields} = this.props;
+
result.data.forEach(customField => {
- if(customField.type === 'select') {
- const index = _.indexOf(customField.options.map(option => option.name), userCustomFields[customField.name]);
- customFieldsFrom[customField.name] = (index === -1 ? 0 : index);
+ const {
+ type,
+ name,
+ options
+ } = customField;
+
+ if(type === 'select') {
+ const index = _.indexOf(options.map(option => option.name), userCustomFields[name]);
+ customFieldsFrom[name] = ((index === -1) ? 0 : index);
} else {
- customFieldsFrom[customField.name] = userCustomFields[customField.name] || '';
+ customFieldsFrom[name] = userCustomFields[name] || '';
}
});
diff --git a/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.scss b/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.scss
index 2e34fc98..9f2cf0d3 100644
--- a/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.scss
+++ b/client/src/app/main/dashboard/dashboard-edit-profile/dashboard-edit-profile-page.scss
@@ -22,4 +22,13 @@
display: inline-block;
margin-right: 20px;
}
+
+ &__change-email-container,
+ &__change-password-container,
+ &__edit-custom-field-form {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ }
}
diff --git a/client/src/app/main/main-check-ticket-page.js b/client/src/app/main/main-check-ticket-page.js
index 3e278ff7..c1421064 100644
--- a/client/src/app/main/main-check-ticket-page.js
+++ b/client/src/app/main/main-check-ticket-page.js
@@ -42,7 +42,7 @@ class MainCheckTicketPage extends React.Component {
-
{i18n('CHECK_TICKET')}
+
{i18n('CHECK_TICKET')}
diff --git a/client/src/core-components/listing.js b/client/src/core-components/listing.js
index 3211333d..3ea96e20 100644
--- a/client/src/core-components/listing.js
+++ b/client/src/core-components/listing.js
@@ -37,7 +37,7 @@ class Listing extends React.Component {
return (
);
diff --git a/client/src/data/languages/en.js b/client/src/data/languages/en.js
index a5ac7a43..f20f05d3 100644
--- a/client/src/data/languages/en.js
+++ b/client/src/data/languages/en.js
@@ -137,6 +137,7 @@ export default {
'UPDATE_EMAIL': 'Update email',
'UPDATE_PASSWORD': 'Update password',
'UPDATE_LEVEL': 'Update level',
+ 'UPDATE_CUSTOM_FIELDS': 'Update custom fields',
'UPDATE_DEPARTMENTS': 'Update departments',
'EDIT_STAFF': 'Edit staff member',
'ADD_DEPARTMENT': 'Add department',
@@ -416,6 +417,7 @@ export default {
'OLD_PASSWORD_INCORRECT': 'Old password is incorrect',
'WILL_LOSE_CHANGES': 'You haven\'t save. Your changes will be lost.',
'WILL_DELETE_CUSTOM_RESPONSE': 'The custom response will be deleted.',
+ 'WILL_DELETE_CUSTOM_TAG': 'The custom tag will be deleted.',
'WILL_DELETE_DEPARTMENT': 'The department will be deleted. All the tickets will be transfer to the department selected.',
'NO_STAFF_ASSIGNED': 'No staff member is assigned to this department.',
'NO_DEPARTMENT_ASSIGNED': 'No ticket department is assigned you.',