diff --git a/client/src/app-components/ticket-list.js b/client/src/app-components/ticket-list.js index 9739e4ce..3404ad0e 100644 --- a/client/src/app-components/ticket-list.js +++ b/client/src/app-components/ticket-list.js @@ -23,9 +23,8 @@ class TicketList extends React.Component { 'primary', 'secondary' ]), - showClosedTickets: React.PropTypes.bool, - filterClosedTickets: React.PropTypes.bool, - onShowClosedTicketsChange: React.PropTypes.func + closedTicketsShown: React.PropTypes.bool, + onClosedTicketsShownChange: React.PropTypes.func }; static defaultProps = { @@ -35,8 +34,7 @@ class TicketList extends React.Component { departments: [], ticketPath: '/dashboard/ticket/', type: 'primary', - showClosedTickets: false, - filterClosedTickets: false + closedTicketsShown: false }; state = { @@ -48,7 +46,7 @@ class TicketList extends React.Component { <div className="ticket-list"> <div className="ticket-list__filters"> {(this.props.type === 'secondary' && this.props.showDepartmentDropdown) ? this.renderDepartmentsDropDown() : null} - {this.props.filterClosedTickets ? this.renderFilterCheckbox() : null} + {this.props.onClosedTicketsShownChange ? this.renderFilterCheckbox() : null} </div> <Table {...this.getTableProps()} /> </div> @@ -57,7 +55,7 @@ class TicketList extends React.Component { renderFilterCheckbox() { - return <Checkbox className="ticket-list__checkbox" label="Show Closed Tickets" value={this.props.showClosedTickets} onChange={this.props.onShowClosedTicketsChange} wrapInLabel/> + return <Checkbox className="ticket-list__checkbox" label="Show Closed Tickets" value={this.props.closedTicketsShown} onChange={this.props.onClosedTicketsShownChange} wrapInLabel/> } renderDepartmentsDropDown() { 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 35c47b26..82d18344 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 @@ -23,7 +23,7 @@ class AdminPanelMyTickets extends React.Component { }; state = { - showClosedTickets: false + closedTicketsShown: false }; componentDidMount() { @@ -54,20 +54,19 @@ class AdminPanelMyTickets extends React.Component { return { userId: this.props.userId, departments: this.props.departments, - tickets: this.state.showClosedTickets ? this.props.tickets : this.filterOpenedTickets(this.props.tickets), + tickets: this.state.closedTicketsShown ? this.props.tickets : this.filterOpenedTickets(this.props.tickets), type: 'secondary', loading: this.props.loading, ticketPath: '/admin/panel/tickets/view-ticket/', - filterClosedTickets: true, - showClosedTickets: this.state.showClosedTickets, - onShowClosedTicketsChange: this.onShowClosedTicketsChange.bind(this) + closedTicketsShown: this.state.closedTicketsShown, + onClosedTicketsShownChange: this.onClosedTicketsShownChange.bind(this) }; } - onShowClosedTicketsChange() { + onClosedTicketsShownChange() { this.setState(function(state) { return { - showClosedTickets: !state.showClosedTickets + closedTicketsShown: !state.closedTicketsShown }; }); }