Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dh): allow grid access provider to select energy supplier #3563

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
}
</div>

@if ((isFas$ | push) && form.controls.energySupplier) {
@if ((canSelectEnergySupplier$ | push) && form.controls.energySupplier) {
<div class="items-group">
<watt-dropdown
[label]="t('energySupplier')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,16 @@ export class DhRequestSettlementReportModalComponent extends WattTypedModal {
useApi: new FormControl<boolean>(false, { nonNullable: true }),
});

isFas$ = this.permissionService.isFas().pipe(
tap((isFas) => {
if (isFas) {
this.form.addControl(
'energySupplier',
new FormControl<string | null>(null, Validators.required)
);
}
canSelectEnergySupplier$ = this.canSelectEnergySupplier().pipe(
tap({
next: (canSelectEnergySupplier) => {
if (canSelectEnergySupplier) {
this.form.addControl(
'energySupplier',
new FormControl<string | null>(null, Validators.required)
);
}
},
})
);

Expand Down Expand Up @@ -309,7 +311,7 @@ export class DhRequestSettlementReportModalComponent extends WattTypedModal {
),
combineResultInASingleFile: combineResultsInOneFile,
preventLargeTextFiles: !allowLargeTextFiles,
energySupplier: energySupplier == ALL_ENERGY_SUPPLIERS ? null : energySupplier,
energySupplier: energySupplier === ALL_ENERGY_SUPPLIERS ? null : energySupplier,
csvLanguage: translate('selectedLanguageIso'),
useApi,
},
Expand Down Expand Up @@ -391,8 +393,17 @@ export class DhRequestSettlementReportModalComponent extends WattTypedModal {
return isFas$.pipe(map((isFas) => isFas || canSeeAllGridAreas));
}

private canSelectEnergySupplier(): Observable<boolean> {
const isFas$ = this.permissionService.isFas();
const isGridAccessProvider =
this.actorStorage.getSelectedActor().marketRole === EicFunction.GridAccessProvider;

return isFas$.pipe(map((isFas) => isFas || isGridAccessProvider));
}

private getGridAreaOptionsForActor(): Observable<WattDropdownOptions> {
const actorId = this.actorStorage.getSelectedActorId();

return this.apollo
.query({
query: GetActorByIdDocument,
Expand Down
Loading