Merge branch 'master' into OS-78-My-tickets-view
# Conflicts: # client/src/data/languages/en.js
This commit is contained in:
commit
d8e48fc190
|
@ -71,7 +71,7 @@ class AdminPanelViewTicket extends React.Component {
|
|||
retrieveTicket() {
|
||||
API.call({
|
||||
path: '/ticket/get',
|
||||
date: {
|
||||
data: {
|
||||
ticketNumber: this.props.params.ticketNumber
|
||||
}
|
||||
}).then(this.onRetrieveSuccess.bind(this)).catch(this.onRetrieveFail.bind(this))
|
||||
|
@ -82,6 +82,15 @@ class AdminPanelViewTicket extends React.Component {
|
|||
loading: false,
|
||||
ticket: result.data
|
||||
});
|
||||
|
||||
if(result.data.unreadStaff) {
|
||||
API.call({
|
||||
path: '/ticket/seen',
|
||||
data: {
|
||||
ticketNumber: this.props.params.ticketNumber
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onRetrieveFail() {
|
||||
|
|
|
@ -15,6 +15,7 @@ const DropDown = require('core-components/drop-down');
|
|||
const Menu = require('core-components/menu');
|
||||
const Tooltip = require('core-components/tooltip');
|
||||
const Table = require('core-components/table');
|
||||
const InfoTooltip = require('core-components/info-tooltip');
|
||||
|
||||
let dropDownItems = [{content: 'English'}, {content: 'Spanish'}, {content: 'German'}, {content: 'Portuguese'}, {content: 'Japanese'}];
|
||||
let secondaryMenuItems = [
|
||||
|
@ -168,6 +169,12 @@ let DemoPage = React.createClass({
|
|||
return ans;
|
||||
}}/>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'InfoTooltip',
|
||||
render: (
|
||||
<InfoTooltip type="warning" text="No staff member is assigned to this department." />
|
||||
)
|
||||
}
|
||||
],
|
||||
|
||||
|
@ -197,4 +204,4 @@ let DemoPage = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
export default DemoPage;
|
||||
export default DemoPage;
|
||||
|
|
|
@ -2,6 +2,9 @@ import React from 'react';
|
|||
import _ from 'lodash';
|
||||
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 TicketViewer from 'app-components/ticket-viewer';
|
||||
|
||||
|
@ -11,16 +14,35 @@ class DashboardTicketPage extends React.Component {
|
|||
tickets: React.PropTypes.array
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
let ticket = this.getTicketData();
|
||||
|
||||
if(ticket.unread) {
|
||||
API.call({
|
||||
path: '/ticket/seen',
|
||||
data: {
|
||||
ticketNumber: ticket.ticketNumber
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
let ticketView = i18n('NO_PERMISSION');
|
||||
|
||||
if(!_.isEmpty(this.getTicketData())) {
|
||||
ticketView = <TicketViewer ticket={this.getTicketData()} onChange={this.retrieveUserData.bind(this)}/>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="dashboard-ticket-page">
|
||||
<TicketViewer ticket={this.getTicketData()} onChange={this.retrieveUserData.bind(this)}/>
|
||||
{ticketView}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
getTicketData() {
|
||||
return _.find(this.props.tickets, {ticketNumber: this.props.params.ticketNumber});
|
||||
return _.find(this.props.tickets, {ticketNumber: this.props.params.ticketNumber}) || {};
|
||||
}
|
||||
|
||||
retrieveUserData() {
|
||||
|
@ -32,4 +54,4 @@ export default connect((store) => {
|
|||
return {
|
||||
tickets: store.session.userTickets
|
||||
};
|
||||
})(DashboardTicketPage);
|
||||
})(DashboardTicketPage);
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import i18n from 'lib-app/i18n';
|
||||
import Icon from 'core-components/icon';
|
||||
import Tooltip from 'core-components/tooltip';
|
||||
|
||||
class InfoTooltip extends React.Component {
|
||||
static propTypes = {
|
||||
type: React.PropTypes.oneOf(['default', 'warning']),
|
||||
text: React.PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
type: 'default'
|
||||
};
|
||||
|
||||
render() {
|
||||
let name = (this.props.type === 'default') ? 'question-circle' : 'exclamation-triangle';
|
||||
|
||||
return (
|
||||
<div className={this.getClass()}>
|
||||
<Tooltip content={this.renderText()} openOnHover>
|
||||
<span className="info-tooltip__icon">
|
||||
<Icon name={name}/>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderText() {
|
||||
let message = (this.props.type === 'default') ? i18n('INFO') : i18n('WARNING');
|
||||
return (
|
||||
<div className="info-tooltip__text">
|
||||
<div className="info-tooltip__text-title">
|
||||
{message}
|
||||
</div>
|
||||
{this.props.text}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
getClass() {
|
||||
let classes = {
|
||||
'info-tooltip': true,
|
||||
'info-tooltip_warning': (this.props.type === 'warning')
|
||||
};
|
||||
|
||||
return classNames(classes);
|
||||
}
|
||||
}
|
||||
|
||||
export default InfoTooltip;
|
|
@ -0,0 +1,26 @@
|
|||
@import "../scss/vars";
|
||||
|
||||
.info-tooltip {
|
||||
&__text {
|
||||
&-title {
|
||||
color: $secondary-blue;
|
||||
font-size: $font-size--md;
|
||||
}
|
||||
}
|
||||
|
||||
&__icon {
|
||||
color: $secondary-blue;
|
||||
}
|
||||
|
||||
&_warning {
|
||||
.info-tooltip__icon {
|
||||
color: $primary-red;
|
||||
}
|
||||
|
||||
.info-tooltip__text {
|
||||
&-title {
|
||||
color: $primary-red;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -78,6 +78,16 @@ module.exports = [
|
|||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/ticket/seen',
|
||||
time: 200,
|
||||
response: function () {
|
||||
return {
|
||||
status: 'success',
|
||||
data: {}
|
||||
};
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/ticket/get',
|
||||
time: 1000,
|
||||
|
@ -96,6 +106,7 @@ module.exports = [
|
|||
file: 'http://www.opensupports.com/some_file.zip',
|
||||
language: 'en',
|
||||
unread: false,
|
||||
unreadStaff: true,
|
||||
closed: false,
|
||||
priority: 'medium',
|
||||
author: {
|
||||
|
@ -203,4 +214,4 @@ module.exports = [
|
|||
};
|
||||
}
|
||||
}
|
||||
];
|
||||
];
|
||||
|
|
|
@ -72,6 +72,8 @@ export default {
|
|||
'UN_ASSIGN': 'Unassign',
|
||||
'VIEW_TICKET': 'View Ticket',
|
||||
'SELECT_CUSTOM_RESPONSE': 'Select a custom response...',
|
||||
'WARNING': 'Warning',
|
||||
'INFO': 'Information',
|
||||
'ALL_DEPARTMENTS': 'All Departments',
|
||||
|
||||
//VIEW DESCRIPTIONS
|
||||
|
@ -112,4 +114,4 @@ 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.'
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue