mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-28 16:24:42 +02:00
Merged in os-89-call-ticket-seen (pull request #72)
Max - call ticket seen from both admin and client [skip ci]
This commit is contained in:
commit
81dde8de87
@ -71,7 +71,7 @@ class AdminPanelViewTicket extends React.Component {
|
|||||||
retrieveTicket() {
|
retrieveTicket() {
|
||||||
API.call({
|
API.call({
|
||||||
path: '/ticket/get',
|
path: '/ticket/get',
|
||||||
date: {
|
data: {
|
||||||
ticketNumber: this.props.params.ticketNumber
|
ticketNumber: this.props.params.ticketNumber
|
||||||
}
|
}
|
||||||
}).then(this.onRetrieveSuccess.bind(this)).catch(this.onRetrieveFail.bind(this))
|
}).then(this.onRetrieveSuccess.bind(this)).catch(this.onRetrieveFail.bind(this))
|
||||||
@ -82,6 +82,15 @@ class AdminPanelViewTicket extends React.Component {
|
|||||||
loading: false,
|
loading: false,
|
||||||
ticket: result.data
|
ticket: result.data
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(result.data.unreadStaff) {
|
||||||
|
API.call({
|
||||||
|
path: '/ticket/seen',
|
||||||
|
data: {
|
||||||
|
ticketNumber: this.props.params.ticketNumber
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onRetrieveFail() {
|
onRetrieveFail() {
|
||||||
|
@ -2,6 +2,9 @@ import React from 'react';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import {connect} from 'react-redux';
|
import {connect} from 'react-redux';
|
||||||
|
|
||||||
|
import i18n from 'lib-app/i18n';
|
||||||
|
import API from 'lib-app/api-call';
|
||||||
|
|
||||||
import SessionActions from 'actions/session-actions';
|
import SessionActions from 'actions/session-actions';
|
||||||
import TicketViewer from 'app-components/ticket-viewer';
|
import TicketViewer from 'app-components/ticket-viewer';
|
||||||
|
|
||||||
@ -11,16 +14,35 @@ class DashboardTicketPage extends React.Component {
|
|||||||
tickets: React.PropTypes.array
|
tickets: React.PropTypes.array
|
||||||
};
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
let ticket = this.getTicketData();
|
||||||
|
|
||||||
|
if(ticket.unread) {
|
||||||
|
API.call({
|
||||||
|
path: '/ticket/seen',
|
||||||
|
data: {
|
||||||
|
ticketNumber: ticket.ticketNumber
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let ticketView = i18n('NO_PERMISSION');
|
||||||
|
|
||||||
|
if(!_.isEmpty(this.getTicketData())) {
|
||||||
|
ticketView = <TicketViewer ticket={this.getTicketData()} onChange={this.retrieveUserData.bind(this)}/>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="dashboard-ticket-page">
|
<div className="dashboard-ticket-page">
|
||||||
<TicketViewer ticket={this.getTicketData()} onChange={this.retrieveUserData.bind(this)}/>
|
{ticketView}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTicketData() {
|
getTicketData() {
|
||||||
return _.find(this.props.tickets, {ticketNumber: this.props.params.ticketNumber});
|
return _.find(this.props.tickets, {ticketNumber: this.props.params.ticketNumber}) || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
retrieveUserData() {
|
retrieveUserData() {
|
||||||
@ -32,4 +54,4 @@ export default connect((store) => {
|
|||||||
return {
|
return {
|
||||||
tickets: store.session.userTickets
|
tickets: store.session.userTickets
|
||||||
};
|
};
|
||||||
})(DashboardTicketPage);
|
})(DashboardTicketPage);
|
||||||
|
@ -78,6 +78,16 @@ module.exports = [
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/ticket/seen',
|
||||||
|
time: 200,
|
||||||
|
response: function () {
|
||||||
|
return {
|
||||||
|
status: 'success',
|
||||||
|
data: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/ticket/get',
|
path: '/ticket/get',
|
||||||
time: 1000,
|
time: 1000,
|
||||||
@ -96,6 +106,7 @@ module.exports = [
|
|||||||
file: 'http://www.opensupports.com/some_file.zip',
|
file: 'http://www.opensupports.com/some_file.zip',
|
||||||
language: 'en',
|
language: 'en',
|
||||||
unread: false,
|
unread: false,
|
||||||
|
unreadStaff: true,
|
||||||
closed: false,
|
closed: false,
|
||||||
priority: 'medium',
|
priority: 'medium',
|
||||||
author: {
|
author: {
|
||||||
@ -203,4 +214,4 @@ module.exports = [
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user