|
|
@ -8,11 +8,10 @@ import { |
|
|
import { |
|
|
import { |
|
|
ChangeDetectionStrategy, |
|
|
ChangeDetectionStrategy, |
|
|
Component, |
|
|
Component, |
|
|
|
|
|
computed, |
|
|
DestroyRef, |
|
|
DestroyRef, |
|
|
EventEmitter, |
|
|
|
|
|
Input, |
|
|
Input, |
|
|
OnInit, |
|
|
output |
|
|
Output |
|
|
|
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
@ -41,17 +40,20 @@ import { GfRuleSettingsDialogComponent } from './rule-settings-dialog/rule-setti |
|
|
styleUrls: ['./rule.component.scss'], |
|
|
styleUrls: ['./rule.component.scss'], |
|
|
templateUrl: './rule.component.html' |
|
|
templateUrl: './rule.component.html' |
|
|
}) |
|
|
}) |
|
|
export class GfRuleComponent implements OnInit { |
|
|
export class GfRuleComponent { |
|
|
@Input() categoryName: string; |
|
|
@Input() categoryName: string; |
|
|
@Input() hasPermissionToUpdateUserSettings: boolean; |
|
|
@Input() hasPermissionToUpdateUserSettings: boolean; |
|
|
@Input() isLoading: boolean; |
|
|
@Input() isLoading: boolean; |
|
|
@Input() locale: string; |
|
|
@Input() locale?: string; |
|
|
@Input() rule: PortfolioReportRule; |
|
|
@Input() rule: PortfolioReportRule; |
|
|
@Input() settings: XRayRulesSettings['AccountClusterRiskCurrentInvestment']; |
|
|
@Input() settings: XRayRulesSettings['AccountClusterRiskCurrentInvestment']; |
|
|
|
|
|
|
|
|
@Output() ruleUpdated = new EventEmitter<UpdateUserSettingDto>(); |
|
|
public readonly ruleUpdated = output<UpdateUserSettingDto>(); |
|
|
|
|
|
|
|
|
|
|
|
private readonly deviceType = computed(() => { |
|
|
|
|
|
return this.deviceDetectorService.deviceInfo().deviceType; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
private deviceType: string; |
|
|
|
|
|
public constructor( |
|
|
public constructor( |
|
|
private destroyRef: DestroyRef, |
|
|
private destroyRef: DestroyRef, |
|
|
private deviceDetectorService: DeviceDetectorService, |
|
|
private deviceDetectorService: DeviceDetectorService, |
|
|
@ -67,11 +69,7 @@ export class GfRuleComponent implements OnInit { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public ngOnInit() { |
|
|
protected onCustomizeRule(rule: PortfolioReportRule) { |
|
|
this.deviceType = this.deviceDetectorService.getDeviceInfo().deviceType; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public onCustomizeRule(rule: PortfolioReportRule) { |
|
|
|
|
|
const dialogRef = this.dialog.open< |
|
|
const dialogRef = this.dialog.open< |
|
|
GfRuleSettingsDialogComponent, |
|
|
GfRuleSettingsDialogComponent, |
|
|
RuleSettingsDialogParams |
|
|
RuleSettingsDialogParams |
|
|
@ -82,7 +80,7 @@ export class GfRuleComponent implements OnInit { |
|
|
locale: this.locale, |
|
|
locale: this.locale, |
|
|
settings: this.settings |
|
|
settings: this.settings |
|
|
}, |
|
|
}, |
|
|
width: this.deviceType === 'mobile' ? '100vw' : '50rem' |
|
|
width: this.deviceType() === 'mobile' ? '100vw' : '50rem' |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
dialogRef |
|
|
dialogRef |
|
|
@ -99,7 +97,7 @@ export class GfRuleComponent implements OnInit { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onUpdateRule(rule: PortfolioReportRule) { |
|
|
protected onUpdateRule(rule: PortfolioReportRule) { |
|
|
const settings: UpdateUserSettingDto = { |
|
|
const settings: UpdateUserSettingDto = { |
|
|
xRayRules: { |
|
|
xRayRules: { |
|
|
[rule.key]: { isActive: !rule.isActive } |
|
|
[rule.key]: { isActive: !rule.isActive } |
|
|
|