Renamed showClosedTickets to closedTicketsShown and updated
This commit is contained in:
parent
4c52f6c6f5
commit
a2d3908c4d
|
@ -23,9 +23,8 @@ class TicketList extends React.Component {
|
||||||
'primary',
|
'primary',
|
||||||
'secondary'
|
'secondary'
|
||||||
]),
|
]),
|
||||||
showClosedTickets: React.PropTypes.bool,
|
closedTicketsShown: React.PropTypes.bool,
|
||||||
filterClosedTickets: React.PropTypes.bool,
|
onClosedTicketsShownChange: React.PropTypes.func
|
||||||
onShowClosedTicketsChange: React.PropTypes.func
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
|
@ -35,8 +34,7 @@ class TicketList extends React.Component {
|
||||||
departments: [],
|
departments: [],
|
||||||
ticketPath: '/dashboard/ticket/',
|
ticketPath: '/dashboard/ticket/',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
showClosedTickets: false,
|
closedTicketsShown: false
|
||||||
filterClosedTickets: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -48,7 +46,7 @@ class TicketList extends React.Component {
|
||||||
<div className="ticket-list">
|
<div className="ticket-list">
|
||||||
<div className="ticket-list__filters">
|
<div className="ticket-list__filters">
|
||||||
{(this.props.type === 'secondary' && this.props.showDepartmentDropdown) ? this.renderDepartmentsDropDown() : null}
|
{(this.props.type === 'secondary' && this.props.showDepartmentDropdown) ? this.renderDepartmentsDropDown() : null}
|
||||||
{this.props.filterClosedTickets ? this.renderFilterCheckbox() : null}
|
{this.props.onClosedTicketsShownChange ? this.renderFilterCheckbox() : null}
|
||||||
</div>
|
</div>
|
||||||
<Table {...this.getTableProps()} />
|
<Table {...this.getTableProps()} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -57,7 +55,7 @@ class TicketList extends React.Component {
|
||||||
|
|
||||||
|
|
||||||
renderFilterCheckbox() {
|
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() {
|
renderDepartmentsDropDown() {
|
||||||
|
|
|
@ -23,7 +23,7 @@ class AdminPanelMyTickets extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
showClosedTickets: false
|
closedTicketsShown: false
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -54,20 +54,19 @@ class AdminPanelMyTickets extends React.Component {
|
||||||
return {
|
return {
|
||||||
userId: this.props.userId,
|
userId: this.props.userId,
|
||||||
departments: this.props.departments,
|
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',
|
type: 'secondary',
|
||||||
loading: this.props.loading,
|
loading: this.props.loading,
|
||||||
ticketPath: '/admin/panel/tickets/view-ticket/',
|
ticketPath: '/admin/panel/tickets/view-ticket/',
|
||||||
filterClosedTickets: true,
|
closedTicketsShown: this.state.closedTicketsShown,
|
||||||
showClosedTickets: this.state.showClosedTickets,
|
onClosedTicketsShownChange: this.onClosedTicketsShownChange.bind(this)
|
||||||
onShowClosedTicketsChange: this.onShowClosedTicketsChange.bind(this)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onShowClosedTicketsChange() {
|
onClosedTicketsShownChange() {
|
||||||
this.setState(function(state) {
|
this.setState(function(state) {
|
||||||
return {
|
return {
|
||||||
showClosedTickets: !state.showClosedTickets
|
closedTicketsShown: !state.closedTicketsShown
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue