Browse Source

Task/add component suffix to create or update activity dialog component (#5628)

* Add component suffix
pull/5627/head
Anirban Biswas 3 weeks ago
committed by GitHub
parent
commit
5375d0fee1
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 58
      apps/client/src/app/pages/portfolio/activities/activities-page.component.ts
  2. 4
      apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

58
apps/client/src/app/pages/portfolio/activities/activities-page.component.ts

@ -27,7 +27,7 @@ import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject, Subscription } from 'rxjs'; import { Subject, Subscription } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { GfCreateOrUpdateActivityDialog } from './create-or-update-activity-dialog/create-or-update-activity-dialog.component'; import { GfCreateOrUpdateActivityDialogComponent } from './create-or-update-activity-dialog/create-or-update-activity-dialog.component';
import { GfImportActivitiesDialogComponent } from './import-activities-dialog/import-activities-dialog.component'; import { GfImportActivitiesDialogComponent } from './import-activities-dialog/import-activities-dialog.component';
import { ImportActivitiesDialogParams } from './import-activities-dialog/interfaces/interfaces'; import { ImportActivitiesDialogParams } from './import-activities-dialog/interfaces/interfaces';
@ -306,15 +306,18 @@ export class GfActivitiesPageComponent implements OnDestroy, OnInit {
} }
public openUpdateActivityDialog(aActivity: Activity) { public openUpdateActivityDialog(aActivity: Activity) {
const dialogRef = this.dialog.open(GfCreateOrUpdateActivityDialog, { const dialogRef = this.dialog.open(
data: { GfCreateOrUpdateActivityDialogComponent,
activity: aActivity, {
accounts: this.user?.accounts, data: {
user: this.user activity: aActivity,
}, accounts: this.user?.accounts,
height: this.deviceType === 'mobile' ? '98vh' : '80vh', user: this.user
width: this.deviceType === 'mobile' ? '100vw' : '50rem' },
}); height: this.deviceType === 'mobile' ? '98vh' : '80vh',
width: this.deviceType === 'mobile' ? '100vw' : '50rem'
}
);
dialogRef dialogRef
.afterClosed() .afterClosed()
@ -347,23 +350,26 @@ export class GfActivitiesPageComponent implements OnDestroy, OnInit {
.subscribe((user) => { .subscribe((user) => {
this.updateUser(user); this.updateUser(user);
const dialogRef = this.dialog.open(GfCreateOrUpdateActivityDialog, { const dialogRef = this.dialog.open(
data: { GfCreateOrUpdateActivityDialogComponent,
accounts: this.user?.accounts, {
activity: { data: {
...aActivity, accounts: this.user?.accounts,
accountId: aActivity?.accountId, activity: {
date: new Date(), ...aActivity,
id: null, accountId: aActivity?.accountId,
fee: 0, date: new Date(),
type: aActivity?.type ?? 'BUY', id: null,
unitPrice: null fee: 0,
type: aActivity?.type ?? 'BUY',
unitPrice: null
},
user: this.user
}, },
user: this.user height: this.deviceType === 'mobile' ? '98vh' : '80vh',
}, width: this.deviceType === 'mobile' ? '100vw' : '50rem'
height: this.deviceType === 'mobile' ? '98vh' : '80vh', }
width: this.deviceType === 'mobile' ? '100vw' : '50rem' );
});
dialogRef dialogRef
.afterClosed() .afterClosed()

4
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts

@ -76,7 +76,7 @@ import { ActivityType } from './types/activity-type.type';
styleUrls: ['./create-or-update-activity-dialog.scss'], styleUrls: ['./create-or-update-activity-dialog.scss'],
templateUrl: 'create-or-update-activity-dialog.html' templateUrl: 'create-or-update-activity-dialog.html'
}) })
export class GfCreateOrUpdateActivityDialog implements OnDestroy { export class GfCreateOrUpdateActivityDialogComponent implements OnDestroy {
public activityForm: FormGroup; public activityForm: FormGroup;
public assetClassOptions: AssetClassSelectorOption[] = Object.keys(AssetClass) public assetClassOptions: AssetClassSelectorOption[] = Object.keys(AssetClass)
@ -110,7 +110,7 @@ export class GfCreateOrUpdateActivityDialog implements OnDestroy {
@Inject(MAT_DIALOG_DATA) public data: CreateOrUpdateActivityDialogParams, @Inject(MAT_DIALOG_DATA) public data: CreateOrUpdateActivityDialogParams,
private dataService: DataService, private dataService: DataService,
private dateAdapter: DateAdapter<any>, private dateAdapter: DateAdapter<any>,
public dialogRef: MatDialogRef<GfCreateOrUpdateActivityDialog>, public dialogRef: MatDialogRef<GfCreateOrUpdateActivityDialogComponent>,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
@Inject(MAT_DATE_LOCALE) private locale: string, @Inject(MAT_DATE_LOCALE) private locale: string,
private userService: UserService private userService: UserService

Loading…
Cancel
Save