Skip to content

Commit 4ac6880

Browse files
committed
fix(arc-saas): review changes
review changes GH-64
1 parent 04d2eec commit 4ac6880

File tree

5 files changed

+34
-31
lines changed

5 files changed

+34
-31
lines changed

projects/saas-ui/src/app/main/commands/add-features.command.ts renamed to projects/saas-ui/src/app/main/commands/add-features-for-plan.command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {PostAPICommand, ApiService, IAdapter} from '@project-lib/core/api';
22
import {IAnyObject} from '@project-lib/core/i-any-object';
33
import {Plan} from '../../shared/models';
44
import {Feature} from '../../shared/interfaces/features';
5-
export class AddFeaturesCommand<T> extends PostAPICommand<Feature[]> {
5+
export class AddFeaturesForPlanCommand<T> extends PostAPICommand<Feature[]> {
66
parameters: any;
77

88
constructor(

projects/saas-ui/src/app/main/commands/get-features.command.ts renamed to projects/saas-ui/src/app/main/commands/get-features-for-plan.command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {IApiService, IAdapter, GetAPICommand} from '@project-lib/core/api';
22
import {IAnyObject} from '@project-lib/core/i-any-object';
33
import {Features} from '../../shared/models/feature.model';
44

5-
export class GetFeaturesCommand<T> extends GetAPICommand<Features[]> {
5+
export class GetFeaturesForPlanCommand<T> extends GetAPICommand<Features[]> {
66
constructor(
77
apiService: IApiService,
88
adapter: IAdapter<Features[]>,

projects/saas-ui/src/app/main/commands/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export * from './get-total-lead.command';
1515
export * from './get-total-tenant.command';
1616
export * from './get-total-plan.command';
1717
export * from './get-total-billing-plan.command';
18-
export * from './add-features.command';
18+
export * from './add-features-for-plan.command';
1919
export * from './edit-features-by-planid.command';
2020
export * from './get-feature-by-planid.command';
21-
export * from './get-features.command';
21+
export * from './get-features-for-plan.command';

projects/saas-ui/src/app/main/components/add-plan/add-plan.component.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import {Component, Inject, OnInit} from '@angular/core';
32
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
43
import {ActivatedRoute, Router} from '@angular/router';
@@ -38,7 +37,7 @@ export class AddPlanComponent implements OnInit {
3837
currencyOptions: AnyObject;
3938
selectedFeatures: Features[];
4039
featureOption: Features[];
41-
featureValue: PlanWithFeatures | any;
40+
featureValue: PlanWithFeatures;
4241
planId: string;
4342
featureId: string;
4443
isEditMode = false;
@@ -135,8 +134,7 @@ export class AddPlanComponent implements OnInit {
135134
domainData.features = featuresGroup ? featuresGroup.value : {};
136135

137136
this.billingplanService.addPlan(generalDetailsData).subscribe(
138-
resp =>
139-
{
137+
resp => {
140138
this.planId = resp.id;
141139
const obj: FeatureValues[] = [];
142140
const planFeatureDetailData = Object.keys(selectedFeatures)
@@ -211,7 +209,6 @@ export class AddPlanComponent implements OnInit {
211209
.getPlanById(this.activateRoute.snapshot.params.id)
212210
.subscribe(response => {
213211
const tierName = response.tier;
214-
215212

216213
this.addPlanForm = this.fb.group({
217214
name: [response.name, Validators.required],
@@ -233,9 +230,11 @@ export class AddPlanComponent implements OnInit {
233230
const featuresGroup = this.addPlanForm.get('features') as FormGroup;
234231
if (featuresGroup) {
235232
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+
);
239238
});
240239
}
241240
});
@@ -324,7 +323,8 @@ export class AddPlanComponent implements OnInit {
324323
}
325324
}
326325
onTierChange(selectedTier: string): void {
327-
this.showStorageSize = selectedTier === 'STANDARD' || selectedTier === 'PREMIUM';
326+
this.showStorageSize =
327+
selectedTier === 'STANDARD' || selectedTier === 'PREMIUM';
328328
if (!this.showStorageSize) {
329329
this.addPlanForm.get('size')?.reset();
330330
}
@@ -355,18 +355,19 @@ export class AddPlanComponent implements OnInit {
355355
this.billingplanService.getCurrencyDetails().subscribe(response => {
356356
this.currencyOptions = response;
357357
if (this.currencyOptions.length > 0) {
358-
this.defaultCurrencyId = this.currencyOptions[0].id;
358+
this.defaultCurrencyId = this.currencyOptions[0].id;
359359
this.addPlanForm.get('currencyId').setValue(this.defaultCurrencyId);
360360
}
361-
362361
});
363362
}
364363
getBillingCycleDetails() {
365364
this.billingplanService.getBillingCycles().subscribe(cycleResp => {
366365
this.billingOptions = cycleResp;
367366
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);
370371
}
371372
});
372373
}
@@ -381,4 +382,4 @@ export class AddPlanComponent implements OnInit {
381382
const completedCount = this.task.subtasks!.filter(t => t.completed).length;
382383
return completedCount > 0 && completedCount < this.task.subtasks!.length;
383384
}
384-
}
385+
}

projects/saas-ui/src/app/shared/services/feature-list-service.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import {GetPlanAdapter} from '../../on-boarding/adapters';
1212
import {GetPlanCommand} from '../../on-boarding/commands';
1313
import {IAnyObject} from '@project-lib/core/i-any-object';
1414
import {APP_CONFIG} from '@project-lib/app-config';
15-
import {GetFeaturesCommand} from '../../main/commands/get-features.command';
15+
import {GetFeaturesForPlanCommand} from '../../main/commands/get-features-for-plan.command';
1616
import {Features} from '../models/feature.model';
1717
import {Observable, catchError, throwError} from 'rxjs';
18-
import {AddFeaturesCommand} from '../../main/commands/add-features.command';
18+
import {AddFeaturesForPlanCommand} from '../../main/commands/add-features-for-plan.command';
1919
import {FeatureValues} from '../models/feature-values.model';
2020
import {AuthTokenSkipHeader} from '@project-lib/core/constants';
2121
import {EditFeaturesByPlanIdCommand} from '../../main/commands/edit-features-by-planid.command';
@@ -43,24 +43,26 @@ export class FeatureListService {
4343
) {}
4444

4545
getFeatures(): Observable<Features[]> {
46-
const command: GetFeaturesCommand<Features[]> = new GetFeaturesCommand(
47-
this.apiService,
48-
this.anyAdapter,
49-
this.appConfig,
50-
);
46+
const command: GetFeaturesForPlanCommand<Features[]> =
47+
new GetFeaturesForPlanCommand(
48+
this.apiService,
49+
this.anyAdapter,
50+
this.appConfig,
51+
);
5152
return command.execute();
5253
}
5354

5455
addFeatures(
5556
featureValue: FeatureValues[],
5657
planId: string,
5758
): Observable<Features[]> {
58-
const command: AddFeaturesCommand<Features[]> = new AddFeaturesCommand(
59-
this.apiService,
60-
this.anyAdapter,
61-
planId,
62-
this.appConfig,
63-
);
59+
const command: AddFeaturesForPlanCommand<Features[]> =
60+
new AddFeaturesForPlanCommand(
61+
this.apiService,
62+
this.anyAdapter,
63+
planId,
64+
this.appConfig,
65+
);
6466
command.parameters = {
6567
data: featureValue,
6668
};

0 commit comments

Comments
 (0)