1
-
2
1
import { Component , Inject , OnInit } from '@angular/core' ;
3
2
import { FormBuilder , FormControl , FormGroup , Validators } from '@angular/forms' ;
4
3
import { ActivatedRoute , Router } from '@angular/router' ;
@@ -38,7 +37,7 @@ export class AddPlanComponent implements OnInit {
38
37
currencyOptions : AnyObject ;
39
38
selectedFeatures : Features [ ] ;
40
39
featureOption : Features [ ] ;
41
- featureValue : PlanWithFeatures | any ;
40
+ featureValue : PlanWithFeatures ;
42
41
planId : string ;
43
42
featureId : string ;
44
43
isEditMode = false ;
@@ -135,8 +134,7 @@ export class AddPlanComponent implements OnInit {
135
134
domainData . features = featuresGroup ? featuresGroup . value : { } ;
136
135
137
136
this . billingplanService . addPlan ( generalDetailsData ) . subscribe (
138
- resp =>
139
- {
137
+ resp => {
140
138
this . planId = resp . id ;
141
139
const obj : FeatureValues [ ] = [ ] ;
142
140
const planFeatureDetailData = Object . keys ( selectedFeatures )
@@ -211,7 +209,6 @@ export class AddPlanComponent implements OnInit {
211
209
. getPlanById ( this . activateRoute . snapshot . params . id )
212
210
. subscribe ( response => {
213
211
const tierName = response . tier ;
214
-
215
212
216
213
this . addPlanForm = this . fb . group ( {
217
214
name : [ response . name , Validators . required ] ,
@@ -233,9 +230,11 @@ export class AddPlanComponent implements OnInit {
233
230
const featuresGroup = this . addPlanForm . get ( 'features' ) as FormGroup ;
234
231
if ( featuresGroup ) {
235
232
Object . keys ( featuresGroup . controls ) . forEach ( controlName => {
236
- featuresGroup . get ( controlName ) ?. setValue (
237
- features . find ( item => item . key === controlName ) ?. value ?. value ,
238
- ) ;
233
+ featuresGroup
234
+ . get ( controlName )
235
+ ?. setValue (
236
+ features . find ( item => item . key === controlName ) ?. value ?. value ,
237
+ ) ;
239
238
} ) ;
240
239
}
241
240
} ) ;
@@ -324,7 +323,8 @@ export class AddPlanComponent implements OnInit {
324
323
}
325
324
}
326
325
onTierChange ( selectedTier : string ) : void {
327
- this . showStorageSize = selectedTier === 'STANDARD' || selectedTier === 'PREMIUM' ;
326
+ this . showStorageSize =
327
+ selectedTier === 'STANDARD' || selectedTier === 'PREMIUM' ;
328
328
if ( ! this . showStorageSize ) {
329
329
this . addPlanForm . get ( 'size' ) ?. reset ( ) ;
330
330
}
@@ -355,18 +355,19 @@ export class AddPlanComponent implements OnInit {
355
355
this . billingplanService . getCurrencyDetails ( ) . subscribe ( response => {
356
356
this . currencyOptions = response ;
357
357
if ( this . currencyOptions . length > 0 ) {
358
- this . defaultCurrencyId = this . currencyOptions [ 0 ] . id ;
358
+ this . defaultCurrencyId = this . currencyOptions [ 0 ] . id ;
359
359
this . addPlanForm . get ( 'currencyId' ) . setValue ( this . defaultCurrencyId ) ;
360
360
}
361
-
362
361
} ) ;
363
362
}
364
363
getBillingCycleDetails ( ) {
365
364
this . billingplanService . getBillingCycles ( ) . subscribe ( cycleResp => {
366
365
this . billingOptions = cycleResp ;
367
366
if ( this . billingOptions . length > 0 ) {
368
- this . defaultBillingCycleId = this . billingOptions [ 0 ] . id ;
369
- this . addPlanForm . get ( 'billingCycleId' ) . setValue ( this . defaultBillingCycleId ) ;
367
+ this . defaultBillingCycleId = this . billingOptions [ 0 ] . id ;
368
+ this . addPlanForm
369
+ . get ( 'billingCycleId' )
370
+ . setValue ( this . defaultBillingCycleId ) ;
370
371
}
371
372
} ) ;
372
373
}
@@ -381,4 +382,4 @@ export class AddPlanComponent implements OnInit {
381
382
const completedCount = this . task . subtasks ! . filter ( t => t . completed ) . length ;
382
383
return completedCount > 0 && completedCount < this . task . subtasks ! . length ;
383
384
}
384
- }
385
+ }
0 commit comments