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

portalicious: exports in registrations page #6000

Merged
merged 1 commit into from
Nov 5, 2024
Merged
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
4 changes: 2 additions & 2 deletions interfaces/Portalicious/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "1MB",
"maximumError": "2MB"
"maximumWarning": "3MB",
"maximumError": "5MB"
},
{
"type": "anyComponentStyle",
Expand Down
6 changes: 4 additions & 2 deletions interfaces/Portalicious/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ module.exports = tseslint.config(
'p-button[icon]',
'p-button[iconPos]',
'p-columnFilter[display]',
'p-contextMenu[appendTo]',
'p-dropdown[appendTo]',
'p-iconField[iconPosition]',
'p-sidebar[position]',
'p-splitButton[icon]',
'p-splitButton[menuStyleClass]',
'p-table[stateKey]',
'p-table[stateStorage]',
'appendTo',
'inputId',
'styleClass',
'severity',
'th[pSortableColumn]',
Expand Down
95 changes: 95 additions & 0 deletions interfaces/Portalicious/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions interfaces/Portalicious/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"primeng": "^17.18.9",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"xlsx": "^0.18.5",
"zone.js": "~0.14.3"
},
"devDependencies": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<p-confirmDialog
#confirmDialog
closeOnEscape
[closeOnEscape]="true"
[dismissableMask]="true"
class="[&_.p-dialog-content]:max-w-[632px]"
>
<ng-template pTemplate="header">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { FormErrorComponent } from '~/components/form-error/form-error.component
export class ConfirmationDialogComponent<TMutationData = unknown> {
private confirmationService = inject(ConfirmationService);

mutation =
input.required<CreateMutationResult<unknown, Error, TMutationData>>();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
mutation = input.required<CreateMutationResult<any, Error, TMutationData>>();
mutationData = input.required<TMutationData>();
header = input($localize`:@@confirmation-dialog-header:Are you sure?`);
headerIcon = input<string>('pi pi-question');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<!-- eslint-disable-next-line @angular-eslint/template/label-has-associated-control -->
<label class="block [&_input]:w-full [&_textarea]:w-full">
<label
class="block [&_.p-calendar]:w-full [&_input]:w-full [&_textarea]:w-full"
>
<strong class="mb-2 block">
{{ label() }}
</strong>
Expand Down
37 changes: 37 additions & 0 deletions interfaces/Portalicious/src/app/domains/event/event.api.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { HttpParamsOptions } 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: HttpParamsOptions['fromObject'];
}) {
return this.generateQueryOptions<Blob>({
path: BASE_ENDPOINT(projectId),
requestOptions: {
params,
responseAsBlob: true,
},
});
}

public invalidateCache(projectId: Signal<number>): Promise<void> {
return this.queryClient.invalidateQueries({
queryKey: this.pathToQueryKey(BASE_ENDPOINT(projectId)),
});
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { HttpParamsOptions } from '@angular/common/http';
import { 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';

Expand All @@ -19,6 +22,24 @@ export class MetricApiService extends DomainApiService {
});
}

exportMetrics({
projectId,
type,
params,
}: {
projectId: Signal<number>;
type: ExportType;
params: HttpParamsOptions['fromObject'];
}) {
return this.generateQueryOptions<Blob>({
path: [...BASE_ENDPOINT(projectId), 'export-list', type],
requestOptions: {
params,
responseAsBlob: true,
},
});
}

public invalidateCache(projectId: Signal<number>): Promise<void> {
return this.queryClient.invalidateQueries({
queryKey: this.pathToQueryKey(BASE_ENDPOINT(projectId)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { inject, Injectable, Signal } from '@angular/core';

import { uniqBy } from 'lodash';

import { ActionReturnDto } from '@121-service/src/actions/dto/action-return.dto';
import { ExportType } from '@121-service/src/metrics/enum/export-type.enum';
import { CommercialBankEthiopiaValidationReportDto } from '@121-service/src/payments/fsp-integration/commercial-bank-ethiopia/dto/commercial-bank-ethiopia-validation-report.dto';

import { DomainApiService } from '~/domains/domain-api.service';
import { ATTRIBUTE_LABELS } from '~/domains/project/project.helper';
import {
Expand All @@ -14,6 +18,7 @@ import {
} from '~/domains/project/project.model';
import { Role } from '~/domains/role/role.model';
import { TranslatableStringService } from '~/services/translatable-string.service';
import { Dto } from '~/utils/dto-type';

const BASE_ENDPOINT = 'programs';

Expand Down Expand Up @@ -245,6 +250,35 @@ export class ProjectApiService extends DomainApiService {
});
}

getCbeVerificationReport(projectId: Signal<number>) {
return this.generateQueryOptions<
Dto<CommercialBankEthiopiaValidationReportDto>
>({
path: [
BASE_ENDPOINT,
projectId,
'financial-service-providers/commercial-bank-ethiopia/account-enquiries',
],
});
}

getLatestAction({
projectId,
actionType,
}: {
projectId: Signal<number>;
actionType: ExportType;
}) {
return this.generateQueryOptions<Dto<ActionReturnDto>>({
path: [BASE_ENDPOINT, projectId, 'actions'],
requestOptions: {
params: {
actionType,
},
},
});
}

public invalidateCache(projectId?: Signal<number>): Promise<void> {
const path: (Signal<number> | string)[] = [BASE_ENDPOINT];

Expand Down
Loading
Loading