|
|
@ -40,6 +40,7 @@ import { MatMenuTrigger } from '@angular/material/menu'; |
|
|
|
import { MatSelectModule } from '@angular/material/select'; |
|
|
|
import { RouterModule } from '@angular/router'; |
|
|
|
import { Account, AssetClass, DataSource } from '@prisma/client'; |
|
|
|
import { differenceInYears } from 'date-fns'; |
|
|
|
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; |
|
|
|
import { EMPTY, Observable, Subject, merge, of } from 'rxjs'; |
|
|
|
import { |
|
|
@ -333,7 +334,10 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
|
this.accounts = this.user?.accounts ?? []; |
|
|
|
|
|
|
|
this.dateRangeOptions = [ |
|
|
|
{ label: $localize`Today`, value: '1d' }, |
|
|
|
{ |
|
|
|
label: $localize`Today`, |
|
|
|
value: '1d' |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: $localize`Week to date` + ' (' + $localize`WTD` + ')', |
|
|
|
value: 'wtd' |
|
|
@ -345,13 +349,19 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
|
{ |
|
|
|
label: $localize`Year to date` + ' (' + $localize`YTD` + ')', |
|
|
|
value: 'ytd' |
|
|
|
}, |
|
|
|
{ |
|
|
|
label: '1 ' + $localize`year` + ' (' + $localize`1Y` + ')', |
|
|
|
value: '1y' |
|
|
|
} |
|
|
|
]; |
|
|
|
|
|
|
|
if ( |
|
|
|
this.user?.dateOfFirstActivity && |
|
|
|
differenceInYears(new Date(), this.user.dateOfFirstActivity) >= 1 |
|
|
|
) { |
|
|
|
this.dateRangeOptions.push({ |
|
|
|
label: '1 ' + $localize`year` + ' (' + $localize`1Y` + ')', |
|
|
|
value: '1y' |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// TODO
|
|
|
|
// if (this.user?.settings?.isExperimentalFeatures) {
|
|
|
|
// this.dateRangeOptions = this.dateRangeOptions.concat(
|
|
|
@ -367,13 +377,20 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit { |
|
|
|
// );
|
|
|
|
// }
|
|
|
|
|
|
|
|
this.dateRangeOptions = this.dateRangeOptions.concat([ |
|
|
|
{ |
|
|
|
if ( |
|
|
|
this.user?.dateOfFirstActivity && |
|
|
|
differenceInYears(new Date(), this.user.dateOfFirstActivity) >= 5 |
|
|
|
) { |
|
|
|
this.dateRangeOptions.push({ |
|
|
|
label: '5 ' + $localize`years` + ' (' + $localize`5Y` + ')', |
|
|
|
value: '5y' |
|
|
|
}, |
|
|
|
{ label: $localize`Max`, value: 'max' } |
|
|
|
]); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
this.dateRangeOptions.push({ |
|
|
|
label: $localize`Max`, |
|
|
|
value: 'max' |
|
|
|
}); |
|
|
|
|
|
|
|
this.dateRangeFormControl.disable({ emitEvent: false }); |
|
|
|
|
|
|
|