diff --git a/client/src/app-components/articles-list.js b/client/src/app-components/articles-list.js
index 5b757ae5..ed77d30c 100644
--- a/client/src/app-components/articles-list.js
+++ b/client/src/app-components/articles-list.js
@@ -58,7 +58,7 @@ class ArticlesList extends React.Component {
editable={this.props.editable}
onChange={this.retrieveArticles.bind(this)}
articlePath={this.props.articlePath} />
-
+
);
})}
diff --git a/client/src/app-components/articles-list.scss b/client/src/app-components/articles-list.scss
index df4325bd..75ea34a2 100644
--- a/client/src/app-components/articles-list.scss
+++ b/client/src/app-components/articles-list.scss
@@ -11,12 +11,4 @@
left: 10px;
margin-top: -4px;
}
-
- &__topic-separator {
- background-color: $grey;
- display: block;
- height: 1px;
- margin: 30px 0;
- width: 100%;
- }
}
\ No newline at end of file
diff --git a/client/src/app/admin/panel/staff/staff-editor.js b/client/src/app/admin/panel/staff/staff-editor.js
index a53cf78e..79cb1800 100644
--- a/client/src/app/admin/panel/staff/staff-editor.js
+++ b/client/src/app/admin/panel/staff/staff-editor.js
@@ -3,6 +3,8 @@ import _ from 'lodash';
import i18n from 'lib-app/i18n';
import API from 'lib-app/api-call';
+import SessionStore from 'lib-app/session-store';
+import TicketList from 'app-components/ticket-list';
import Form from 'core-components/form';
import FormField from 'core-components/form-field';
@@ -10,12 +12,19 @@ import SubmitButton from 'core-components/submit-button';
class StaffEditor extends React.Component {
static propTypes = {
- name: React.PropTypes.string,
- profilePic: React.PropTypes.string,
- level: React.PropTypes.number,
- tickets: React.PropTypes.array,
- email: React.PropTypes.string,
- departments: React.PropTypes.array
+ staffId: React.PropTypes.number,
+ email: React.PropTypes.string.isRequired,
+ name: React.PropTypes.string.isRequired,
+ profilePic: React.PropTypes.string.isRequired,
+ level: React.PropTypes.number.isRequired,
+ tickets: React.PropTypes.array.isRequired,
+ departments: React.PropTypes.array.isRequired
+ };
+
+ state = {
+ email: this.props.email,
+ level: this.props.level - 1,
+ departments: this.getUserDepartments()
};
render() {
@@ -56,32 +65,36 @@ class StaffEditor extends React.Component {
- DEPARTMENTS
+
{i18n('Departments')}
+
@@ -90,9 +103,61 @@ class StaffEditor extends React.Component {
+
+
);
}
+
+ getTicketListProps() {
+ return {
+ type: 'secondary',
+ tickets: this.props.tickets,
+ departments: this.props.departments,
+ ticketPath: '/admin/panel/tickets/view-ticket/'
+ };
+ }
+
+ getUserDepartments() {
+ let userDepartments = this.props.departments.map(department => department.name);
+ let departmentIndexes = [];
+
+ _.forEach(this.getDepartments(), (department, index) => {
+ if(_.includes(userDepartments, department)) {
+ departmentIndexes.push(index);
+ }
+ });
+
+ return departmentIndexes;
+ }
+
+ getDepartments() {
+ return SessionStore.getDepartments().map(department => department.name);
+ }
+
+ onSubmit(form) {
+ let departments;
+
+ if(form.departments) {
+ departments = _.filter(SessionStore.getDepartments(), (department, index) => {
+ return _.includes(form.departments, index);
+ }).map(department => department.id)
+ }
+
+ API.call({
+ path: '/staff/edit',
+ data: {
+ staffId: this.props.staffId,
+ email: form.email,
+ password: form.password,
+ level: (form.level !== undefined) ? form.level + 1 : null,
+ departments: departments && JSON.stringify(departments)
+ }
+ });
+ }
}
export default StaffEditor;
\ No newline at end of file
diff --git a/client/src/app/admin/panel/staff/staff-editor.scss b/client/src/app/admin/panel/staff/staff-editor.scss
index 3f77115c..5ebcb51d 100644
--- a/client/src/app/admin/panel/staff/staff-editor.scss
+++ b/client/src/app/admin/panel/staff/staff-editor.scss
@@ -79,4 +79,43 @@
}
}
}
+
+ &__form {
+
+ }
+
+ &__submit-button {
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ width: 180px;
+ }
+
+ &__update-email,
+ &__update-password,
+ &__update-level {
+ position: relative;
+ }
+
+ &__departments {
+ border: 1px solid $grey;
+ padding: 20px 50px;
+ text-align: left;
+ }
+
+ &__departments-title {
+ font-size: $font-size--md;
+ text-align: center;
+ }
+
+ &__tickets {
+ padding: 0 20px;
+ margin-top: 20px;
+ }
+
+ &__tickets-title {
+ font-size: $font-size--md;
+ text-align: left;
+ margin-bottom: 20px;
+ }
}
\ No newline at end of file
diff --git a/client/src/app/admin/panel/users/admin-panel-view-user.js b/client/src/app/admin/panel/users/admin-panel-view-user.js
index 10c62423..3b56f132 100644
--- a/client/src/app/admin/panel/users/admin-panel-view-user.js
+++ b/client/src/app/admin/panel/users/admin-panel-view-user.js
@@ -68,7 +68,7 @@ class AdminPanelViewUser extends React.Component {
-
+
{i18n('TICKETS')}
diff --git a/client/src/app/admin/panel/users/admin-panel-view-user.scss b/client/src/app/admin/panel/users/admin-panel-view-user.scss
index 730301fe..98b3f25a 100644
--- a/client/src/app/admin/panel/users/admin-panel-view-user.scss
+++ b/client/src/app/admin/panel/users/admin-panel-view-user.scss
@@ -24,14 +24,6 @@
margin-top: 20px;
}
- &__separator {
- background-color: $grey;
- display: block;
- margin: 30px 0;
- height: 1px;
- width: 100%;
- }
-
&__tickets-title {
font-size: $font-size--md;
margin-bottom: 20px;
diff --git a/client/src/core-components/checkbox-group.js b/client/src/core-components/checkbox-group.js
index a5e97e76..76f6eb5c 100644
--- a/client/src/core-components/checkbox-group.js
+++ b/client/src/core-components/checkbox-group.js
@@ -27,7 +27,7 @@ class CheckboxGroup extends React.Component {
return (
-
+
);
}
diff --git a/client/src/data/fixtures/staff-fixtures.js b/client/src/data/fixtures/staff-fixtures.js
index b0180b7b..343c81d1 100644
--- a/client/src/data/fixtures/staff-fixtures.js
+++ b/client/src/data/fixtures/staff-fixtures.js
@@ -641,5 +641,15 @@ module.exports = [
}
};
}
+ },
+ {
+ path: '/staff/edit',
+ time: 100,
+ response: function () {
+ return {
+ status: 'success',
+ data: {}
+ };
+ }
}
];
\ No newline at end of file
diff --git a/client/src/data/languages/en.js b/client/src/data/languages/en.js
index d67c1dcb..665dd2ec 100644
--- a/client/src/data/languages/en.js
+++ b/client/src/data/languages/en.js
@@ -6,6 +6,7 @@ export default {
'SUBMIT': 'Submit',
'EMAIL': 'Email',
'PASSWORD': 'Password',
+ 'REPEAT_PASSWORD': 'Repeat password',
'LOG_IN': 'Log in',
'SIGN_UP': 'Sign up',
'FORGOT_PASSWORD': 'Forgot your password?',
@@ -104,7 +105,11 @@ export default {
'LEVEL': 'Level',
'LEVEL_1': 'Level 1 (Tickets)',
'LEVEL_2': 'Level 2 (Tickets + Articles)',
- 'LEVEL_3': 'Level 2 (Tickets + Articles + Staff)',
+ 'LEVEL_3': 'Level 3 (Tickets + Articles + Staff)',
+ 'UPDATE_EMAIL': 'Update email',
+ 'UPDATE_PASSWORD': 'Update password',
+ 'UPDATE_LEVEL': 'Update level',
+ 'UPDATE_DEPARTMENTS': 'Update departments',
//VIEW DESCRIPTIONS
'CREATE_TICKET_DESCRIPTION': 'This is a form for creating tickets. Fill the form and send us your issues/doubts/suggestions. Our support system will answer it as soon as possible.',
diff --git a/client/src/scss/_base.scss b/client/src/scss/_base.scss
index 11a6fffb..8f558d7f 100644
--- a/client/src/scss/_base.scss
+++ b/client/src/scss/_base.scss
@@ -1,8 +1,18 @@
+@import "vars";
+
* {
- box-sizing: border-box;
+ box-sizing: border-box;
}
body {
- font-family: Helvetica, sans-serif;
- background-color: $light-grey;
+ font-family: Helvetica, sans-serif;
+ background-color: $light-grey;
+}
+
+.separator {
+ background-color: $grey;
+ display: block;
+ margin: 30px 0;
+ height: 1px;
+ width: 100%;
}
\ No newline at end of file