Renamed showClosedTickets to closedTicketsShown and updated

This commit is contained in:
Maxi Redigonda 2018-10-16 12:13:02 -03:00
parent 4c52f6c6f5
commit a2d3908c4d
2 changed files with 11 additions and 14 deletions

View File

@ -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() {

View File

@ -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
};
});
}