2022-05-26 13:57:37 +03:00

82 lines
2.3 KiB
TypeScript

import { ChangeDetectionStrategy, Component, OnInit, ViewEncapsulation } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
@Component({
selector : 'settings-plan-billing',
templateUrl : './plan-billing.component.html',
encapsulation : ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class SettingsPlanBillingComponent implements OnInit
{
planBillingForm: UntypedFormGroup;
plans: any[];
/**
* Constructor
*/
constructor(
private _formBuilder: UntypedFormBuilder
)
{
}
// -----------------------------------------------------------------------------------------------------
// @ Lifecycle hooks
// -----------------------------------------------------------------------------------------------------
/**
* On init
*/
ngOnInit(): void
{
// Create the form
this.planBillingForm = this._formBuilder.group({
plan : ['team'],
cardHolder : ['Brian Hughes'],
cardNumber : [''],
cardExpiration: [''],
cardCVC : [''],
country : ['usa'],
zip : ['']
});
// Setup the plans
this.plans = [
{
value : 'basic',
label : 'BASIC',
details: 'Starter plan for individuals.',
price : '10'
},
{
value : 'team',
label : 'TEAM',
details: 'Collaborate up to 10 people.',
price : '20'
},
{
value : 'enterprise',
label : 'ENTERPRISE',
details: 'For bigger businesses.',
price : '40'
}
];
}
// -----------------------------------------------------------------------------------------------------
// @ Public methods
// -----------------------------------------------------------------------------------------------------
/**
* Track by function for ngFor loops
*
* @param index
* @param item
*/
trackByFn(index: number, item: any): any
{
return item.id || index;
}
}