-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
portalicious: export selected registrations
AB#31003
- Loading branch information
Showing
19 changed files
with
592 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
interfaces/Portalicious/src/app/domains/event/event.api.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { HttpParams } from '@angular/common/http'; | ||
import { Injectable, Signal } from '@angular/core'; | ||
|
||
import { DomainApiService } from '~/domains/domain-api.service'; | ||
|
||
const BASE_ENDPOINT = (projectId: Signal<number>) => [ | ||
'programs', | ||
projectId, | ||
'events', | ||
]; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class EventApiService extends DomainApiService { | ||
getEvents({ | ||
projectId, | ||
params, | ||
}: { | ||
projectId: Signal<number>; | ||
params: HttpParams; | ||
}) { | ||
return this.httpWrapperService.perform121ServiceRequest<Blob>({ | ||
method: 'GET', | ||
endpoint: this.pathToQueryKey([...BASE_ENDPOINT(projectId)]).join('/'), | ||
params, | ||
responseAsBlob: true, | ||
}); | ||
} | ||
|
||
public invalidateCache(projectId: Signal<number>): Promise<void> { | ||
return this.queryClient.invalidateQueries({ | ||
queryKey: this.pathToQueryKey(BASE_ENDPOINT(projectId)), | ||
}); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
interfaces/Portalicious/src/app/domains/metric/metric.api.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { HttpParams } from '@angular/common/http'; | ||
import { inject, Injectable, Signal } from '@angular/core'; | ||
|
||
import { ExportType } from '@121-service/src/metrics/enum/export-type.enum'; | ||
|
||
import { DomainApiService } from '~/domains/domain-api.service'; | ||
import { ProjectMetrics } from '~/domains/metric/metric.model'; | ||
import { PaginateQueryService } from '~/services/paginate-query.service'; | ||
|
||
const BASE_ENDPOINT = (projectId: Signal<number>) => [ | ||
'programs', | ||
projectId, | ||
'metrics', | ||
]; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class MetricApiService extends DomainApiService { | ||
paginateQueryService = inject(PaginateQueryService); | ||
|
||
getProjectSummaryMetrics(projectId: Signal<number>) { | ||
return this.generateQueryOptions<ProjectMetrics>({ | ||
path: [...BASE_ENDPOINT(projectId), 'program-stats-summary'], | ||
}); | ||
} | ||
|
||
exportMetrics({ | ||
projectId, | ||
type, | ||
params, | ||
}: { | ||
projectId: Signal<number>; | ||
type: ExportType; | ||
params: HttpParams; | ||
}) { | ||
return this.httpWrapperService.perform121ServiceRequest<Blob>({ | ||
method: 'GET', | ||
endpoint: this.pathToQueryKey([ | ||
...BASE_ENDPOINT(projectId), | ||
'export-list', | ||
type, | ||
]).join('/'), | ||
params, | ||
responseAsBlob: true, | ||
}); | ||
} | ||
|
||
public invalidateCache(projectId: Signal<number>): Promise<void> { | ||
return this.queryClient.invalidateQueries({ | ||
queryKey: this.pathToQueryKey(BASE_ENDPOINT(projectId)), | ||
}); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
interfaces/Portalicious/src/app/domains/metric/metric.model.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ProgramStats } from '@121-service/src/metrics/dto/program-stats.dto'; | ||
|
||
import { Dto } from '~/utils/dto-type'; | ||
// TODO: AB#30152 This type should be refactored to use Dto121Service | ||
export type ProjectMetrics = Dto<ProgramStats>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...project-registrations/components/export-registrations/export-registrations.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<p-splitButton | ||
label="Export" | ||
i18n-label="@@export" | ||
icon="pi pi-upload" | ||
rounded | ||
outlined | ||
[model]="exportOptions" | ||
(onClick)="exportSelectedRegistrations()" | ||
menuStyleClass="!left-auto right-0 w-auto [&_.p-menuitem-text]:whitespace-nowrap" | ||
/> | ||
<app-confirmation-dialog | ||
#exportSelectedDialog | ||
header="Export selected registrations" | ||
i18n-header="@@export-selected" | ||
headerIcon="pi pi-upload" | ||
[mutation]="exportRegistrationsMutation" | ||
[mutationData]="{ | ||
type: ExportType.allPeopleAffected, | ||
paginateQuery: exportSelectedActionData()?.query, | ||
}" | ||
> | ||
<p i18n> | ||
You're about to download an Excel file for | ||
{{ exportSelectedActionData()?.count }} selected registrations. | ||
</p> | ||
<app-latest-export-date | ||
[projectId]="projectId()" | ||
[exportType]="ExportType.allPeopleAffected" | ||
/> | ||
</app-confirmation-dialog> | ||
<app-confirmation-dialog | ||
#exportAllDialog | ||
header="Export all registrations" | ||
i18n-header="@@export-all" | ||
headerIcon="pi pi-upload" | ||
[mutation]="exportRegistrationsMutation" | ||
[mutationData]="{ | ||
type: ExportType.allPeopleAffected, | ||
}" | ||
> | ||
<p i18n>You're about to download an Excel file for all registrations.</p> | ||
<app-latest-export-date | ||
[projectId]="projectId()" | ||
[exportType]="ExportType.allPeopleAffected" | ||
/> | ||
</app-confirmation-dialog> |
Oops, something went wrong.