2021-04-22 19:47:19 +03:00
|
|
|
import Component from '@glimmer/component';
|
2021-04-26 21:22:04 +03:00
|
|
|
import {action} from '@ember/object';
|
2021-04-22 19:47:19 +03:00
|
|
|
import {inject as service} from '@ember/service';
|
2021-04-09 14:00:41 +03:00
|
|
|
|
|
|
|
const PERIODS = [
|
2021-04-22 19:47:19 +03:00
|
|
|
{label: 'Monthly', period: 'month'},
|
|
|
|
{label: 'Yearly', period: 'year'}
|
2021-04-09 14:00:41 +03:00
|
|
|
];
|
|
|
|
|
2021-04-26 21:22:04 +03:00
|
|
|
export default class GhProductsPriceBillingPeriodComponent extends Component {
|
2021-04-22 19:47:19 +03:00
|
|
|
@service feature;
|
|
|
|
@service session;
|
|
|
|
@service settings;
|
|
|
|
|
2021-04-26 21:22:04 +03:00
|
|
|
constructor() {
|
|
|
|
super(...arguments);
|
|
|
|
this.availablePeriods = PERIODS;
|
|
|
|
}
|
|
|
|
|
2021-04-22 19:47:19 +03:00
|
|
|
get value() {
|
|
|
|
const {value} = this.args;
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
get disabled() {
|
|
|
|
const {disabled} = this.args;
|
|
|
|
return disabled || false;
|
|
|
|
}
|
2021-04-26 21:22:04 +03:00
|
|
|
|
|
|
|
@action
|
|
|
|
updatePeriod(newPeriod) {
|
|
|
|
if (this.args.updatePeriod) {
|
|
|
|
this.args.updatePeriod(this.args.value, newPeriod);
|
|
|
|
}
|
2021-04-09 14:00:41 +03:00
|
|
|
}
|
2021-04-22 19:47:19 +03:00
|
|
|
}
|