mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-30 01:05:18 +02:00
Ivan - Fix some staff edition issues [skip ci]
This commit is contained in:
parent
3a56a5410e
commit
2189c18a3c
@ -46,9 +46,11 @@ class TicketEvent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderStaffPic() {
|
renderStaffPic() {
|
||||||
|
let profilePicName = this.props.author.profilePic;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ticket-event__staff-pic">
|
<div className="ticket-event__staff-pic">
|
||||||
<img src={this.props.author.profilePic} className="ticket-event__staff-pic-img" />
|
<img src={(profilePicName) ? API.getFileLink(profilePicName) : (API.getURL() + '/images/profile.png')} className="ticket-event__staff-pic-img" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class AdminPanelStaffWidget extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="admin-panel-staff-widget__profile-pic-wrapper">
|
<div className="admin-panel-staff-widget__profile-pic-wrapper">
|
||||||
<img className="admin-panel-staff-widget__profile-pic" src={(this.props.session.userProfilePic) ? API.getFileLink(this.props.session.userProfilePic) : (API.getURL() + '/images/logo.png')} />
|
<img className="admin-panel-staff-widget__profile-pic" src={(this.props.session.userProfilePic) ? API.getFileLink(this.props.session.userProfilePic) : (API.getURL() + '/images/profile.png')} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -167,7 +167,7 @@ class AdminPanelSystemPreferences extends React.Component {
|
|||||||
'recaptcha-private': form.reCaptchaPrivate,
|
'recaptcha-private': form.reCaptchaPrivate,
|
||||||
'url': form['url'],
|
'url': form['url'],
|
||||||
'title': form['title'],
|
'title': form['title'],
|
||||||
'layout': form['layout'] == 1 ? 'Full width' : 'Boxed',
|
'layout': form['layout'] ? 'full-width' : 'boxed',
|
||||||
'time-zone': form['time-zone'],
|
'time-zone': form['time-zone'],
|
||||||
'no-reply-email': form['no-reply-email'],
|
'no-reply-email': form['no-reply-email'],
|
||||||
'smtp-host': form['smtp-host'],
|
'smtp-host': form['smtp-host'],
|
||||||
|
@ -17,6 +17,10 @@ class AddStaffModal extends React.Component {
|
|||||||
closeModal: React.PropTypes.func
|
closeModal: React.PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
onSuccess: React.PropTypes.func
|
||||||
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
loading: false,
|
loading: false,
|
||||||
errors: {},
|
errors: {},
|
||||||
@ -78,7 +82,13 @@ class AddStaffModal extends React.Component {
|
|||||||
level: form.level + 1,
|
level: form.level + 1,
|
||||||
departments: JSON.stringify(departments)
|
departments: JSON.stringify(departments)
|
||||||
}
|
}
|
||||||
}).then(this.context.closeModal).catch((result) => {
|
}).then(() => {
|
||||||
|
this.context.closeModal();
|
||||||
|
|
||||||
|
if(this.props.onSuccess) {
|
||||||
|
this.props.onSuccess();
|
||||||
|
}
|
||||||
|
}).catch((result) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
error: result.message
|
error: result.message
|
||||||
|
@ -26,10 +26,7 @@ class AdminPanelStaffMembers extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
API.call({
|
this.retrieveStaffMembers();
|
||||||
path: '/staff/get-all',
|
|
||||||
data: {}
|
|
||||||
}).then(this.onStaffRetrieved.bind(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -48,7 +45,7 @@ class AdminPanelStaffMembers extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onAddNewStaff() {
|
onAddNewStaff() {
|
||||||
ModalContainer.openModal(<AddStaffModal />);
|
ModalContainer.openModal(<AddStaffModal onSuccess={this.retrieveStaffMembers.bind(this)} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
getDepartmentDropdownProps() {
|
getDepartmentDropdownProps() {
|
||||||
@ -78,6 +75,7 @@ class AdminPanelStaffMembers extends React.Component {
|
|||||||
|
|
||||||
return staffList.map(staff => {
|
return staffList.map(staff => {
|
||||||
return _.extend({}, staff, {
|
return _.extend({}, staff, {
|
||||||
|
profilePic: (staff.profilePic) ? API.getFileLink(staff.profilePic) : (API.getURL() + '/images/profile.png'),
|
||||||
name: (
|
name: (
|
||||||
<Link className="admin-panel-staff-members__link" to={'/admin/panel/staff/view-staff/' + staff.id}>
|
<Link className="admin-panel-staff-members__link" to={'/admin/panel/staff/view-staff/' + staff.id}>
|
||||||
{staff.name}
|
{staff.name}
|
||||||
@ -99,6 +97,13 @@ class AdminPanelStaffMembers extends React.Component {
|
|||||||
return departments;
|
return departments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retrieveStaffMembers() {
|
||||||
|
API.call({
|
||||||
|
path: '/staff/get-all',
|
||||||
|
data: {}
|
||||||
|
}).then(this.onStaffRetrieved.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
onStaffRetrieved(result) {
|
onStaffRetrieved(result) {
|
||||||
if(result.status == 'success'){
|
if(result.status == 'success'){
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {browserHistory} from 'react-router';
|
import {browserHistory} from 'react-router';
|
||||||
|
import {connect} from 'react-redux';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
import i18n from 'lib-app/i18n';
|
import i18n from 'lib-app/i18n';
|
||||||
import API from 'lib-app/api-call';
|
import API from 'lib-app/api-call';
|
||||||
|
import SessionActions from 'actions/session-actions';
|
||||||
|
|
||||||
import StaffEditor from 'app/admin/panel/staff/staff-editor';
|
import StaffEditor from 'app/admin/panel/staff/staff-editor';
|
||||||
import Header from 'core-components/header';
|
import Header from 'core-components/header';
|
||||||
@ -17,12 +19,7 @@ class AdminPanelViewStaff extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
API.call({
|
this.retrieveStaff();
|
||||||
path: '/staff/get',
|
|
||||||
data: {
|
|
||||||
staffId: this.props.params.staffId
|
|
||||||
}
|
|
||||||
}).then(this.onStaffRetrieved.bind(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -37,15 +34,29 @@ class AdminPanelViewStaff extends React.Component {
|
|||||||
getProps() {
|
getProps() {
|
||||||
return _.extend({}, this.state.userData, {
|
return _.extend({}, this.state.userData, {
|
||||||
staffId: this.props.params.staffId * 1,
|
staffId: this.props.params.staffId * 1,
|
||||||
onDelete: this.onDelete.bind(this)
|
onDelete: this.onDelete.bind(this),
|
||||||
|
onChange: this.retrieveStaff.bind(this)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
retrieveStaff() {
|
||||||
|
API.call({
|
||||||
|
path: '/staff/get',
|
||||||
|
data: {
|
||||||
|
staffId: this.props.params.staffId
|
||||||
|
}
|
||||||
|
}).then(this.onStaffRetrieved.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
onStaffRetrieved(result) {
|
onStaffRetrieved(result) {
|
||||||
this.setState({
|
this.setState({
|
||||||
loading: false,
|
loading: false,
|
||||||
userData: result.data
|
userData: result.data
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(this.props.userId == this.props.params.staffId) {
|
||||||
|
this.props.dispatch(SessionActions.getUserData(null, null, true))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onDelete() {
|
onDelete() {
|
||||||
@ -53,4 +64,4 @@ class AdminPanelViewStaff extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AdminPanelViewStaff;
|
export default connect((store) => store.session)(AdminPanelViewStaff);
|
||||||
|
@ -73,7 +73,7 @@ class StaffEditor extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<label className={this.getPictureWrapperClass()}>
|
<label className={this.getPictureWrapperClass()}>
|
||||||
<div className="staff-editor__card-pic-background"></div>
|
<div className="staff-editor__card-pic-background"></div>
|
||||||
<img className="staff-editor__card-pic" src={(this.props.profilePic) ? API.getFileLink(this.props.profilePic) : (API.getURL() + '/images/logo.png')} />
|
<img className="staff-editor__card-pic" src={(this.props.profilePic) ? API.getFileLink(this.props.profilePic) : (API.getURL() + '/images/profile.png')} />
|
||||||
{(this.state.loadingPicture) ? <Loading className="staff-editor__card-pic-loading" size="large"/> : <Icon className="staff-editor__card-pic-icon" name="upload" size="4x"/>}
|
{(this.state.loadingPicture) ? <Loading className="staff-editor__card-pic-loading" size="large"/> : <Icon className="staff-editor__card-pic-icon" name="upload" size="4x"/>}
|
||||||
<input className="staff-editor__image-uploader" type="file" multiple={false} accept="image/x-png,image/gif,image/jpeg" onChange={this.onProfilePicChange.bind(this)}/>
|
<input className="staff-editor__image-uploader" type="file" multiple={false} accept="image/x-png,image/gif,image/jpeg" onChange={this.onProfilePicChange.bind(this)}/>
|
||||||
</label>
|
</label>
|
||||||
|
BIN
client/src/assets/images/profile.png
Normal file
BIN
client/src/assets/images/profile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
@ -27,8 +27,6 @@ let renderApplication = function () {
|
|||||||
render(<Provider store={store}>{routes}</Provider>, document.getElementById('app'));
|
render(<Provider store={store}>{routes}</Provider>, document.getElementById('app'));
|
||||||
};
|
};
|
||||||
window.store = store;
|
window.store = store;
|
||||||
store.dispatch(ConfigActions.init());
|
|
||||||
store.dispatch(SessionActions.initSession());
|
|
||||||
|
|
||||||
let unsubscribe = store.subscribe(() => {
|
let unsubscribe = store.subscribe(() => {
|
||||||
console.log(store.getState());
|
console.log(store.getState());
|
||||||
@ -38,3 +36,6 @@ let unsubscribe = store.subscribe(() => {
|
|||||||
renderApplication();
|
renderApplication();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
store.dispatch(ConfigActions.init());
|
||||||
|
store.dispatch(SessionActions.initSession());
|
||||||
|
@ -10,7 +10,7 @@ class GetStatsController extends Controller {
|
|||||||
'permission' => 'staff_1',
|
'permission' => 'staff_1',
|
||||||
'requestData' => [
|
'requestData' => [
|
||||||
'period' => [
|
'period' => [
|
||||||
'validation' => DataValidator::in(['week', 'month', 'quarter', 'year']),
|
'validation' => DataValidator::in(['WEEK', 'MONTH', 'QUARTER', 'YEAR']),
|
||||||
'error' => ERRORS::INVALID_PERIOD
|
'error' => ERRORS::INVALID_PERIOD
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -74,7 +74,7 @@ describe'/system/get-stats' do
|
|||||||
@result = request('/system/get-stats', {
|
@result = request('/system/get-stats', {
|
||||||
csrf_userid: $csrf_userid,
|
csrf_userid: $csrf_userid,
|
||||||
csrf_token: $csrf_token,
|
csrf_token: $csrf_token,
|
||||||
period: 'week'
|
period: 'WEEK'
|
||||||
})
|
})
|
||||||
|
|
||||||
def assertData(position, date, type, value)
|
def assertData(position, date, type, value)
|
||||||
@ -126,7 +126,7 @@ describe'/system/get-stats' do
|
|||||||
@result = request('/system/get-stats', {
|
@result = request('/system/get-stats', {
|
||||||
csrf_userid: $csrf_userid,
|
csrf_userid: $csrf_userid,
|
||||||
csrf_token: $csrf_token,
|
csrf_token: $csrf_token,
|
||||||
period: 'week',
|
period: 'WEEK',
|
||||||
staffId: '1'
|
staffId: '1'
|
||||||
})
|
})
|
||||||
assertData(0, yesterday, 'CLOSE', '4')
|
assertData(0, yesterday, 'CLOSE', '4')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user