Ghost/ghost/admin/app/components/gh-products-price-billingperiod.js
Rishabh Garg 2555b70456 Wired new Products settings UI to API data (#1930)
refs TryGhost/Team#627

This updates the new Products settings screens to use real data from API for existing Custom Products and Prices to populate them on UI and allow site owners to edit them.

- List all Products of site and allow editing Product name
- List all Prices for a product and allow editing individual Price names
- Add new Prices on a Product
2021-04-26 23:52:04 +05:30

36 lines
821 B
JavaScript

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