diff --git a/client/src/actions/admin-data-actions.js b/client/src/actions/admin-data-actions.js
index 624f0b82..d332e0ae 100644
--- a/client/src/actions/admin-data-actions.js
+++ b/client/src/actions/admin-data-actions.js
@@ -10,5 +10,15 @@ export default {
data: {}
})
};
+ },
+
+ retrieveMyTickets() {
+ return {
+ type: 'MY_TICKETS',
+ payload: API.call({
+ path: '/staff/get-tickets',
+ data: {}
+ })
+ };
}
};
\ No newline at end of file
diff --git a/client/src/app-components/ticket-list.js b/client/src/app-components/ticket-list.js
index b788083a..7fe0f5d0 100644
--- a/client/src/app-components/ticket-list.js
+++ b/client/src/app-components/ticket-list.js
@@ -11,6 +11,7 @@ import DateTransformer from 'lib-core/date-transformer';
class TicketList extends React.Component {
static propTypes = {
+ loading: React.PropTypes.bool,
tickets: React.PropTypes.arrayOf(React.PropTypes.object),
type: React.PropTypes.oneOf([
'primary',
@@ -26,7 +27,7 @@ class TicketList extends React.Component {
render() {
return (
);
}
diff --git a/client/src/app/admin/panel/tickets/admin-panel-my-tickets.js b/client/src/app/admin/panel/tickets/admin-panel-my-tickets.js
index f717dcc9..02f5fc80 100644
--- a/client/src/app/admin/panel/tickets/admin-panel-my-tickets.js
+++ b/client/src/app/admin/panel/tickets/admin-panel-my-tickets.js
@@ -1,16 +1,46 @@
import React from 'react';
+import {connect} from 'react-redux';
import i18n from 'lib-app/i18n';
+import AdminDataAction from 'actions/admin-data-actions';
import Header from 'core-components/header';
+import DropDown from 'core-components/drop-down';
+import TicketList from 'app-components/ticket-list';
class AdminPanelMyTickets extends React.Component {
-
+
+ componentDidMount() {
+ this.props.dispatch(AdminDataAction.retrieveMyTickets());
+ }
+
render() {
return (
-
+
+
+
+
+
);
}
+
+ getProps() {
+ console.log(this.props.tickets);
+
+ return {
+ items: this.props.departments.map(function (obj) {
+ return {
+ content: obj.name
+ };
+ }),
+ size: 'medium'
+ };
+ }
}
-export default AdminPanelMyTickets;
\ No newline at end of file
+export default connect((store) => {
+ return {
+ departments: store.session.userDepartments,
+ tickets: store.adminData.myTickets
+ };
+})(AdminPanelMyTickets);
diff --git a/client/src/data/fixtures/staff-fixtures.js b/client/src/data/fixtures/staff-fixtures.js
index ea6afbcd..69272f39 100644
--- a/client/src/data/fixtures/staff-fixtures.js
+++ b/client/src/data/fixtures/staff-fixtures.js
@@ -14,10 +14,373 @@ module.exports = [
departments: [
{id: 1, name: 'Sales Support'},
{id: 2, name: 'Technical Issues'},
- {id: 3, name: 'System and Administration'}
+ {id: 3, name: 'System and Administration'},
+ {id: 4, name: 'Guillermo\'s department'}
]
}
};
}
+ },
+ {
+ path: '/staff/get-tickets',
+ time: 2000,
+ response: function () {
+ return {
+ status: 'success',
+ data: [
+ {
+ ticketNumber: '445441',
+ title: 'Problem with installation',
+ content: 'I had a problem with the installation of the php server',
+ department: {
+ id: 2,
+ name: 'Environment Setup'
+ },
+ date: '20160416',
+ file: 'http://www.opensupports.com/some_file.zip',
+ language: 'en',
+ unread: true,
+ closed: false,
+ priority: 'low',
+ author: {
+ id: 12,
+ name: 'Haskell Curry',
+ email: 'haskell@lambda.com'
+ },
+ owner: {
+ id: 15,
+ name: 'Steve Jobs',
+ email: 'steve@jobs.com'
+ },
+ actions: [
+ {
+ type: 'ASSIGN',
+ date: '20150409',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150409',
+ content: 'Do you have apache installed? It generally happens if you dont have apache.',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'UN_ASSIGN',
+ date: '20150410',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'DEPARTMENT_CHANGED',
+ date: '20150411',
+ content: 'System support',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150412',
+ content: 'I have already installed apache, but the problem persists',
+ author: {
+ name: 'Haskell Curry',
+ steve: 'haskell@lambda.com',
+ staff: false
+ }
+ },
+ {
+ type: 'PRIORITY_CHANGED',
+ date: '20150413',
+ content: 'MEDIUM',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150511',
+ content: 'Thanks!, I solved it by myself',
+ author: {
+ name: 'Haskell Curry',
+ steve: 'haskell@lambda.com',
+ staff: false
+ }
+ },
+ {
+ type: 'CLOSE',
+ date: '20150513',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'RE_OPEN',
+ date: '20151018',
+ author: {
+ name: 'Haskell Curry',
+ email: 'haskell@lambda.com',
+ staff: false
+ }
+ }
+ ]
+ },
+ {
+ ticketNumber: '878552',
+ title: 'Lorem ipsum door',
+ content: 'I had a problem with the installation of the php server',
+ department: {
+ id: 2,
+ name: 'Environment Setup'
+ },
+ date: '20160415',
+ file: 'http://www.opensupports.com/some_file.zip',
+ language: 'en',
+ unread: false,
+ closed: false,
+ priority: 'medium',
+ author: {
+ name: 'Haskell Curry',
+ email: 'haskell@lambda.com'
+ },
+ owner: {
+ name: 'Steve Jobs'
+ },
+ actions: [
+ {
+ type: 'ASSIGN',
+ date: '20150409',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150409',
+ content: 'Do you have apache installed? It generally happens if you dont have apache.',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'UN_ASSIGN',
+ date: '20150410',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'DEPARTMENT_CHANGED',
+ date: '20150411',
+ content: 'System support',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150412',
+ content: 'I have already installed apache, but the problem persists',
+ author: {
+ name: 'Haskell Curry',
+ steve: 'haskell@lambda.com',
+ staff: false
+ }
+ },
+ {
+ type: 'PRIORITY_CHANGED',
+ date: '20150413',
+ content: 'MEDIUM',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150511',
+ content: 'Thanks!, I soved it by myself',
+ author: {
+ name: 'Haskell Curry',
+ steve: 'haskell@lambda.com',
+ staff: false
+ }
+ },
+ {
+ type: 'CLOSE',
+ date: '20150513',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'RE_OPEN',
+ date: '20151018',
+ author: {
+ name: 'Haskell Curry',
+ email: 'haskell@lambda.com',
+ staff: false
+ }
+ }
+ ]
+ },
+ {
+ ticketNumber: '118551',
+ title: 'Lorem ipsum door',
+ content: 'I had a problem with the installation of the php server',
+ department: {
+ id: 2,
+ name: 'Environment Setup'
+ },
+ date: '20150409',
+ file: 'http://www.opensupports.com/some_file.zip',
+ language: 'en',
+ unread: false,
+ closed: false,
+ priority: 'high',
+ author: {
+ name: 'Haskell Curry',
+ email: 'haskell@lambda.com'
+ },
+ owner: {
+ name: 'Steve Jobs'
+ },
+ actions: [
+ {
+ type: 'ASSIGN',
+ date: '20150409',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150409',
+ content: 'Do you have apache installed? It generally happens if you dont have apache.',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'UN_ASSIGN',
+ date: '20150410',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'DEPARTMENT_CHANGED',
+ date: '20150411',
+ content: 'System support',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150412',
+ content: 'I have already installed apache, but the problem persists',
+ author: {
+ name: 'Haskell Curry',
+ steve: 'haskell@lambda.com',
+ staff: false
+ }
+ },
+ {
+ type: 'PRIORITY_CHANGED',
+ date: '20150413',
+ content: 'MEDIUM',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'COMMENT',
+ date: '20150511',
+ content: 'Thanks!, I soved it by myself',
+ author: {
+ name: 'Haskell Curry',
+ steve: 'haskell@lambda.com',
+ staff: false
+ }
+ },
+ {
+ type: 'CLOSE',
+ date: '20150513',
+ author: {
+ name: 'Emilia Clarke',
+ email: 'jobs@steve.com',
+ profilePic: 'http://i65.tinypic.com/9bep95.jpg',
+ staff: true
+ }
+ },
+ {
+ type: 'RE_OPEN',
+ date: '20151018',
+ author: {
+ name: 'Haskell Curry',
+ email: 'haskell@lambda.com',
+ staff: false
+ }
+ }
+ ]
+ }
+ ]
+ }
+ }
}
];
\ No newline at end of file
diff --git a/client/src/reducers/admin-data-reducer.js b/client/src/reducers/admin-data-reducer.js
index 60c59d20..ba6418e4 100644
--- a/client/src/reducers/admin-data-reducer.js
+++ b/client/src/reducers/admin-data-reducer.js
@@ -6,6 +6,8 @@ class AdminDataReducer extends Reducer {
getInitialState() {
return {
+ myTickets: [],
+ myTicketsLoaded: false,
customResponses: [],
customResponsesLoaded: false
};
@@ -13,7 +15,9 @@ class AdminDataReducer extends Reducer {
getTypeHandlers() {
return {
- 'CUSTOM_RESPONSES_FULFILLED': this.onCustomResponses
+ 'CUSTOM_RESPONSES_FULFILLED': this.onCustomResponses,
+ 'MY_TICKETS_FULFILLED': this.onMyTicketsRetrieved,
+ 'MY_TICKETS_PENDING': this.onMyTicketsPending
};
}
@@ -23,6 +27,19 @@ class AdminDataReducer extends Reducer {
customResponsesLoaded: true
});
}
+
+ onMyTicketsRetrieved(state, payload) {
+ return _.extend({}, state, {
+ myTickets: payload.data,
+ customResponsesLoaded: true
+ })
+ }
+
+ onMyTicketsPending(state) {
+ return _.extennd({}, state, {
+ myTicketsLoaded: true
+ })
+ }
}
export default AdminDataReducer.getInstance();
\ No newline at end of file