Skip to content

Commit

Permalink
portalicious: payment left metrics (#6276)
Browse files Browse the repository at this point in the history
parent c40b3cb
author Domenico Gemoli <domenicogemoli@gmail.com> 1733845746 +0100
committer Domenico Gemoli <domenicogemoli@gmail.com> 1734001577 +0100

portalicious: payment left metrics

AB#31324
  • Loading branch information
aberonni authored Dec 12, 2024
1 parent 3cf7b8d commit 1bb97db
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,40 @@
<div
class="grid gap-5 grid-areas-project-payment md:grid-cols-project-payment-wide md:grid-areas-project-payment-wide"
>
<app-metric-tile
class="grid-in-metric1"
[pending]="false"
[metricValue]="100"
metricLabel="TODO: AB#31324"
i18n-metricLabel
/>
@if (
paymentStatus.isPending() ||
transactions.isPending() ||
paymentStatus.data()?.inProgress
) {
<app-metric-tile
class="grid-in-metric1"
[pending]="paymentStatus.isPending() || transactions.isPending()"
[metricValue]="transactions.data()?.data?.length"
metricLabel="Transfers sent"
i18n-metricLabel
chipLabel="In progress"
i18n-chipLabel
chipIcon="pi pi-spinner"
chipVariant="orange"
/>
} @else {
<app-metric-tile
class="grid-in-metric1"
[pending]="false"
[metricValue]="transactions.data()?.data?.length"
metricLabel="Registrations included"
i18n-metricLabel
/>
}
<app-metric-tile
class="grid-in-metric2"
[pending]="false"
[metricValue]="100"
metricLabel="TODO: AB#31324"
[metricValue]="totalPaymentAmount()"
metricLabel="Total amount"
i18n-metricLabel
[chipLabel]="successfulPaymentsAmount()"
chipIcon="pi pi-check-circle"
chipVariant="green"
/>

@let paymentDetails = this.payment.data();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface TransactionsTableCellContext {
ProjectPaymentChartComponent,
SkeletonModule,
ExportPaymentInstructionsComponent,
CurrencyPipe,
],
templateUrl: './project-payment.page.html',
styles: ``,
Expand Down Expand Up @@ -123,6 +124,41 @@ export class ProjectPaymentPageComponent {
return $localize`Payment` + ' ' + this.paymentDate();
});

totalPaymentAmount = computed(() => {
if (!this.payment.isSuccess()) {
return '-';
}

const totalAmount =
this.payment.data().failed.amount +
this.payment.data().success.amount +
this.payment.data().waiting.amount;

return (
this.currencyPipe.transform(
totalAmount,
this.project.data()?.currency ?? 'EUR',
'symbol-narrow',
'1.0-0',
) ?? '0'
);
});

successfulPaymentsAmount = computed(() => {
if (!this.payment.isSuccess()) {
return '-';
}

return (
this.currencyPipe.transform(
this.payment.data().success.amount,
this.project.data()?.currency ?? 'EUR',
'symbol-narrow',
'1.0-0',
) ?? '0'
);
});

columns = computed(() => {
if (!this.project.isSuccess()) {
return [];
Expand Down
14 changes: 9 additions & 5 deletions interfaces/Portalicious/src/locale/messages.nl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1552,10 +1552,6 @@
<source>Transfer value</source>
<target state="new">Transfer value</target>
</trans-unit>
<trans-unit id="5391647417948016120" datatype="html">
<source>TODO: AB#31324</source>
<target state="new">TODO: AB#31324</target>
</trans-unit>
<trans-unit id="3595291210637281374" datatype="html">
<source>Transfers data</source>
<target state="new">Transfers data</target>
Expand All @@ -1580,6 +1576,14 @@
<source>You do not have permission to view this page.</source>
<target state="new">You do not have permission to view this page.</target>
</trans-unit>
<trans-unit id="4324437964498958057" datatype="html">
<source>Transfers sent</source>
<target state="new">Transfers sent</target>
</trans-unit>
<trans-unit id="4585448172507601196" datatype="html">
<source>Registrations included</source>
<target state="new">Registrations included</target>
</trans-unit>
</body>
</file>
</xliff>
</xliff>
9 changes: 6 additions & 3 deletions interfaces/Portalicious/src/locale/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1169,9 +1169,6 @@
<trans-unit id="3595291210637281374" datatype="html">
<source>Transfers data</source>
</trans-unit>
<trans-unit id="5391647417948016120" datatype="html">
<source>TODO: AB#31324</source>
</trans-unit>
<trans-unit id="9047634939215362248" datatype="html">
<source>Registrations selected:</source>
</trans-unit>
Expand All @@ -1187,6 +1184,12 @@
<trans-unit id="8108032945706896800" datatype="html">
<source>You do not have permission to view this page.</source>
</trans-unit>
<trans-unit id="4324437964498958057" datatype="html">
<source>Transfers sent</source>
</trans-unit>
<trans-unit id="4585448172507601196" datatype="html">
<source>Registrations included</source>
</trans-unit>
</body>
</file>
</xliff>

0 comments on commit 1bb97db

Please sign in to comment.