2020-10-22 13:39:00 +03:00
|
|
|
/* eslint-disable ghost/ember/alias-model-in-controller */
|
|
|
|
import Controller from '@ember/controller';
|
2021-04-20 19:25:30 +03:00
|
|
|
import {action} from '@ember/object';
|
2020-10-22 13:39:00 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2021-04-20 19:41:21 +03:00
|
|
|
import {task} from 'ember-concurrency-decorators';
|
|
|
|
import {tracked} from '@glimmer/tracking';
|
2020-10-22 13:39:00 +03:00
|
|
|
|
2021-04-20 19:25:30 +03:00
|
|
|
export default class MembersPaymentsController extends Controller {
|
|
|
|
@service settings;
|
2020-10-22 13:39:00 +03:00
|
|
|
|
2021-04-20 19:41:21 +03:00
|
|
|
@tracked showLeaveSettingsModal = false;
|
|
|
|
|
2021-04-20 19:25:30 +03:00
|
|
|
@action
|
|
|
|
setDefaultContentVisibility(value) {
|
|
|
|
this.settings.set('defaultContentVisibility', value);
|
|
|
|
}
|
2020-10-22 13:39:00 +03:00
|
|
|
|
2021-04-20 19:25:30 +03:00
|
|
|
@action
|
|
|
|
setStripeConnectIntegrationTokenSetting(stripeConnectIntegrationToken) {
|
|
|
|
this.settings.set('stripeConnectIntegrationToken', stripeConnectIntegrationToken);
|
|
|
|
}
|
2020-10-22 13:39:00 +03:00
|
|
|
|
2021-04-20 19:25:30 +03:00
|
|
|
@task({drop: true})
|
|
|
|
*saveSettings() {
|
|
|
|
return yield this.settings.save();
|
|
|
|
}
|
2020-10-22 13:39:00 +03:00
|
|
|
|
2021-04-20 19:41:21 +03:00
|
|
|
leaveRoute(transition) {
|
|
|
|
if (this.settings.get('hasDirtyAttributes')) {
|
|
|
|
transition.abort();
|
|
|
|
this.leaveSettingsTransition = transition;
|
|
|
|
this.showLeaveSettingsModal = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
async confirmLeave() {
|
|
|
|
this.settings.rollbackAttributes();
|
|
|
|
this.showLeaveSettingsModal = false;
|
|
|
|
this.leaveSettingsTransition.retry();
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
cancelLeave() {
|
|
|
|
this.showLeaveSettingsModal = false;
|
|
|
|
this.leaveSettingsTransition = null;
|
|
|
|
}
|
|
|
|
|
2020-10-22 13:39:00 +03:00
|
|
|
reset() {
|
|
|
|
// stripeConnectIntegrationToken is not a persisted value so we don't want
|
|
|
|
// to keep it around across transitions
|
|
|
|
this.settings.set('stripeConnectIntegrationToken', undefined);
|
|
|
|
}
|
2021-04-20 19:25:30 +03:00
|
|
|
}
|