Max - WIP [skip ci]

This commit is contained in:
ivan 2016-12-07 21:13:39 -03:00
parent d67d9ebfb1
commit c2ab1f9b6e
3 changed files with 85 additions and 42 deletions

View File

@ -1,10 +1,15 @@
import React from 'react'; import React from 'react';
import i18n from 'lib-app/i18n'; import i18n from 'lib-app/i18n';
import API from 'lib-app/api-call';
import SessionStore from 'lib-app/session-store';
import PeopleList from 'app-components/people-list'; import PeopleList from 'app-components/people-list';
import Header from 'core-components/header'; import Header from 'core-components/header';
import DropDown from 'core-components/drop-down'; import DropDown from 'core-components/drop-down';
import Button from 'core-components/button';
import Icon from 'core-components/icon';
import Loading from 'core-components/loading';
class AdminPanelStaffMembers extends React.Component { class AdminPanelStaffMembers extends React.Component {
@ -16,12 +21,28 @@ class AdminPanelStaffMembers extends React.Component {
departments: [] departments: []
}; };
state = {
selectedDepartment: 0,
staffList: [],
loading: true
};
componentDidMount() {
API.call({
path: '/staff/get-all',
data: {}
}).then(this.onStaffRetrieved.bind(this));
}
render() { render() {
return ( return (
<div> <div>
<Header title={i18n('STAFF_MEMBERS')} description={i18n('STAFF_MEMBERS_DESCRIPTION')} /> <Header title={i18n('STAFF_MEMBERS')} description={i18n('STAFF_MEMBERS_DESCRIPTION')} />
<DropDown {...this.getDepartmentDropdownProps()} /> <DropDown {...this.getDepartmentDropdownProps()} />
<PeopleList list={this.getStaffList()}/> <Button size="medium" onClick={() => {}} type="secondary" className="">
<Icon name="user-plus" className=""/> {i18n('ADD_NEW_STAFF')}
</Button>
{(this.state.loading) ? <Loading backgrounded /> : <PeopleList list={this.state.staffList} />}
</div> </div>
); );
} }
@ -31,7 +52,7 @@ class AdminPanelStaffMembers extends React.Component {
items: this.getDepartments(), items: this.getDepartments(),
onChange: (event) => { onChange: (event) => {
this.setState({ this.setState({
selectedDepartment: event.index && this.props.departments[event.index - 1].id selectedDepartment: event.index && this.props.departments[event.index - 1].id
}); });
}, },
size: 'medium' size: 'medium'
@ -39,7 +60,7 @@ class AdminPanelStaffMembers extends React.Component {
} }
getDepartments() { getDepartments() {
let departments = this.props.departments.map((department) => { let departments = SessionStore.getDepartments().map((department) => {
return {content: department.name}; return {content: department.name};
}); });
@ -50,44 +71,13 @@ class AdminPanelStaffMembers extends React.Component {
return departments; return departments;
} }
getStaffList() { onStaffRetrieved(result) {
return [ if(result.status == 'success'){
{ this.setState({
profilePic: 'http://www.opensupports.com/profilepic.jpg', loading: false,
name: 'Emilia Clarke', staffList: result.data
assignedTickets: 4, });
closedTickets: 21, }
lastLogin: 20161212
},
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Yulian A GUI Yermo',
assignedTickets: 9,
closedTickets: 0,
lastLogin: 20161212
},
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Miltona Costa',
assignedTickets: -1,
closedTickets: -1,
lastLogin: 20160212
},
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Emiliasnikova Rusachestkvuy',
assignedTickets: 100,
closedTickets: 21,
lastLogin: 20130101
},
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Laurita Morrechaga Rusachestkvuy',
assignedTickets: 1,
closedTickets: 1,
lastLogin: 2012050
}
];
} }
} }

View File

@ -577,5 +577,57 @@ module.exports = [
} }
} }
} }
},
{
path: '/staff/get-all',
time: 100,
response: function() {
return {
status: 'success',
data: [
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Emilia Clarke',
departments: [{id: 2, name: 'Technical issues'}],
assignedTickets: 4,
closedTickets: 21,
lastLogin: 20161212
},
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Yulian A GUI Yermo',
departments: [{id: 2, name: 'Technical issues'}, {id: 1, name: 'Sales Support'}],
assignedTickets: 9,
closedTickets: 0,
lastLogin: 20161212
},
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Miltona Costa',
departments: [{id: 1, name: 'Sales Support'}],
assignedTickets: -1,
closedTickets: -1,
lastLogin: 20160212
},
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Emiliasnikova Rusachestkvuy',
departments: [{id: 1, name: 'Sales Support'}, {id: 3, name: 'System and Administration'}],
assignedTickets: 100,
closedTickets: 21,
lastLogin: 20130101
},
{
profilePic: 'http://www.opensupports.com/profilepic.jpg',
name: 'Laurita Morrechaga Rusachestkvuy',
departments: [{id: 3, name: 'System and Administration'}],
assignedTickets: 1,
closedTickets: 1,
lastLogin: 2012050
}
]
};
}
} }
]; ];

View File

@ -98,6 +98,7 @@ export default {
'CLOSED_TICKETS': '{tickets} closed tickets', 'CLOSED_TICKETS': '{tickets} closed tickets',
'LAST_LOGIN': 'Last login', 'LAST_LOGIN': 'Last login',
'STAFF_MEMBERS': 'Staff members', 'STAFF_MEMBERS': 'Staff members',
'ADD_NEW_STAFF': 'Add new staff',
//VIEW DESCRIPTIONS //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.', '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.',