| 78 | } |
| 79 | |
| 80 | onClickDeny (e) { |
| 81 | const trialRequestID = $(e.target).data('trial-request-id') |
| 82 | const trialRequest = _.find(this.trialRequests.models, a => a.id === trialRequestID) |
| 83 | if (!trialRequest) { |
| 84 | console.error('Could not find trial request model for', trialRequestID) |
| 85 | return |
| 86 | } |
| 87 | if (!window.confirm(`Deny ${trialRequest.get('properties').email}?`)) { return } |
| 88 | trialRequest.set('status', 'denied') |
| 89 | return trialRequest.patch({ |
| 90 | error: (model, response, options) => { |
| 91 | return console.error('Error patching trial request', response) |
| 92 | }, |
| 93 | success: (model, response, options) => { |
| 94 | return (typeof this.render === 'function' ? this.render() : undefined) |
| 95 | } |
| 96 | }) |
| 97 | } |
| 98 | } |
| 99 | TrialRequestsView.initClass() |
| 100 | return TrialRequestsView |