From bd70421c04740ea7d6374c95f7ed27d3281e8704 Mon Sep 17 00:00:00 2001
From: Domenico Gemoli
Date: Fri, 25 Oct 2024 12:08:20 +0200
Subject: [PATCH] portalicious: send messages review
AB#30741 AB#30920
---
e2e/portalicious/pages/BasePage.ts | 4 ++-
.../query-table/query-table.component.html | 3 +-
.../query-table/query-table.component.ts | 31 +++++++++++++---
.../metric-tile/metric-tile.component.html | 2 +-
.../project-payment.component.html | 1 +
.../project-payment.component.ts | 13 +++++++
.../custom-message-control.component.html | 35 ++++++++++++-------
.../custom-message-control.component.ts | 4 +--
.../project-registrations.page.html | 23 ++++++------
.../project-registrations.page.ts | 9 +++++
.../src/app/services/toast.service.ts | 1 +
.../Portalicious/src/locale/messages.nl.xlf | 30 +++++++++++-----
.../Portalicious/src/locale/messages.xlf | 25 ++++++++-----
13 files changed, 129 insertions(+), 52 deletions(-)
create mode 100644 interfaces/Portalicious/src/app/pages/project-payment/project-payment.component.html
create mode 100644 interfaces/Portalicious/src/app/pages/project-payment/project-payment.component.ts
diff --git a/e2e/portalicious/pages/BasePage.ts b/e2e/portalicious/pages/BasePage.ts
index 09cddfb106..5a7ba3b7ff 100644
--- a/e2e/portalicious/pages/BasePage.ts
+++ b/e2e/portalicious/pages/BasePage.ts
@@ -64,7 +64,9 @@ class BasePage {
async validateToastMessage(message: string) {
await expect(this.toast).toBeVisible();
expect(await this.toast.textContent()).toContain(message);
- await expect(this.toast).toBeHidden();
+ await expect(this.toast).toBeHidden({
+ timeout: 6000, // by default, toasts are visible for 5s
+ });
}
async validateFormError({ errorText }: { errorText: string }) {
diff --git a/interfaces/Portalicious/src/app/components/query-table/query-table.component.html b/interfaces/Portalicious/src/app/components/query-table/query-table.component.html
index 5b43db8e05..4439792182 100644
--- a/interfaces/Portalicious/src/app/components/query-table/query-table.component.html
+++ b/interfaces/Portalicious/src/app/components/query-table/query-table.component.html
@@ -9,6 +9,7 @@
[totalRecords]="totalRecords()"
[filterDelay]="serverSideFiltering() ? 500 : 0"
[filterLocale]="locale"
+ (onFilter)="selectAll.set(false)"
[rowHover]="contextMenuItems()"
[sortField]="initialSortField()"
[contextMenu]="contextMenu"
@@ -19,7 +20,7 @@
[rows]="10"
[rowsPerPageOptions]="[10, 20, 40, 80, 100]"
[showCurrentPageReport]="true"
- [currentPageReportTemplate]="currentPageReportTemplate"
+ [currentPageReportTemplate]="currentPageReportTemplate()"
stateStorage="local"
[stateKey]="localStorageKey()"
[expandedRowKeys]="expandedRowKeys()"
diff --git a/interfaces/Portalicious/src/app/components/query-table/query-table.component.ts b/interfaces/Portalicious/src/app/components/query-table/query-table.component.ts
index ef9c455e21..f21897d7e8 100644
--- a/interfaces/Portalicious/src/app/components/query-table/query-table.component.ts
+++ b/interfaces/Portalicious/src/app/components/query-table/query-table.component.ts
@@ -246,6 +246,7 @@ export class QueryTableComponent {
localStorage.removeItem(this.localStorageKey());
this.globalFilterVisible.set(false);
this.tableFilters.set({});
+ this.selectAll.set(false);
}
globalFilterValue = computed(() => {
@@ -372,6 +373,12 @@ export class QueryTableComponent {
}
}
+ selectedItemsCount = computed(() =>
+ this.selectAll()
+ ? this.serverSideTotalRecords()
+ : this.selectedItems().length,
+ );
+
/**
* EXPANDABLE ROWS
*/
@@ -394,9 +401,23 @@ export class QueryTableComponent {
/**
* PAGINATION
*/
- currentPageReportTemplate =
- $localize`:The contents of the square brackets should not be touched/changed:Showing [first] to [last] of [totalRecords] records`
- // this is a workaround because the i18n compiler does not support curly braces in the template
- .replaceAll('[', '{')
- .replaceAll(']', '}');
+ currentPageReportTemplate = computed(() => {
+ const baseTemplate =
+ $localize`:The contents of the square brackets should not be touched/changed:Showing [first] to [last] of [totalRecords] records`
+ // this is a workaround because the i18n compiler does not support curly braces in the template
+ .replaceAll('[', '{')
+ .replaceAll(']', '}');
+
+ const selectedItemsCount = this.selectedItemsCount();
+
+ if (!selectedItemsCount) {
+ return baseTemplate;
+ }
+
+ return (
+ baseTemplate +
+ ' ' +
+ $localize`(${selectedItemsCount.toString()} selected)`
+ );
+ });
}
diff --git a/interfaces/Portalicious/src/app/pages/project-monitoring/components/metric-tile/metric-tile.component.html b/interfaces/Portalicious/src/app/pages/project-monitoring/components/metric-tile/metric-tile.component.html
index 4f52d43319..07ef35dfff 100644
--- a/interfaces/Portalicious/src/app/pages/project-monitoring/components/metric-tile/metric-tile.component.html
+++ b/interfaces/Portalicious/src/app/pages/project-monitoring/components/metric-tile/metric-tile.component.html
@@ -17,7 +17,7 @@
}
@if (pending()) {
diff --git a/interfaces/Portalicious/src/app/pages/project-payment/project-payment.component.html b/interfaces/Portalicious/src/app/pages/project-payment/project-payment.component.html
new file mode 100644
index 0000000000..ce3b7acfe2
--- /dev/null
+++ b/interfaces/Portalicious/src/app/pages/project-payment/project-payment.component.html
@@ -0,0 +1 @@
+project-payment works!
diff --git a/interfaces/Portalicious/src/app/pages/project-payment/project-payment.component.ts b/interfaces/Portalicious/src/app/pages/project-payment/project-payment.component.ts
new file mode 100644
index 0000000000..729e89b796
--- /dev/null
+++ b/interfaces/Portalicious/src/app/pages/project-payment/project-payment.component.ts
@@ -0,0 +1,13 @@
+import { ChangeDetectionStrategy, Component } from '@angular/core';
+
+@Component({
+ selector: 'app-project-payment',
+ standalone: true,
+ imports: [],
+ templateUrl: './project-payment.component.html',
+ styles: ``,
+ changeDetection: ChangeDetectionStrategy.OnPush
+})
+export class ProjectPaymentComponent {
+
+}
diff --git a/interfaces/Portalicious/src/app/pages/project-registrations/components/custom-message-control/custom-message-control.component.html b/interfaces/Portalicious/src/app/pages/project-registrations/components/custom-message-control/custom-message-control.component.html
index e40e135464..96d8f5ed3b 100644
--- a/interfaces/Portalicious/src/app/pages/project-registrations/components/custom-message-control/custom-message-control.component.html
+++ b/interfaces/Portalicious/src/app/pages/project-registrations/components/custom-message-control/custom-message-control.component.html
@@ -12,9 +12,19 @@
/>
-
- Use @ to add personalized fields.
- Learn more
+
+ Use @ to add personalized fields.
+
+ Learn more
+
+
@@ -31,16 +41,15 @@
}"
>
- @if (error()) {
-
- } @else {
-
- (>20) characters.
-
- }
+
+ @if (customMessageInternalModel().length > 20) {
+ {{ customMessageInternalModel().length }}
+ } @else {
+ (>20)
+ }
+ characters.
+
+
diff --git a/interfaces/Portalicious/src/app/pages/project-registrations/components/custom-message-control/custom-message-control.component.ts b/interfaces/Portalicious/src/app/pages/project-registrations/components/custom-message-control/custom-message-control.component.ts
index 3206db7bb6..ae860f3007 100644
--- a/interfaces/Portalicious/src/app/pages/project-registrations/components/custom-message-control/custom-message-control.component.ts
+++ b/interfaces/Portalicious/src/app/pages/project-registrations/components/custom-message-control/custom-message-control.component.ts
@@ -53,8 +53,8 @@ export class CustomMessageControlComponent implements ControlValueAccessor {
customMessageInternalModel = model('');
customMessageDisabled = model(false);
- writeValue(value: string) {
- this.customMessageInternalModel.set(value);
+ writeValue(value: string | undefined) {
+ this.customMessageInternalModel.set(value ?? '');
}
registerOnChange(fn: (value: string) => void) {
diff --git a/interfaces/Portalicious/src/app/pages/project-registrations/project-registrations.page.html b/interfaces/Portalicious/src/app/pages/project-registrations/project-registrations.page.html
index 903431b494..b9fc64287b 100644
--- a/interfaces/Portalicious/src/app/pages/project-registrations/project-registrations.page.html
+++ b/interfaces/Portalicious/src/app/pages/project-registrations/project-registrations.page.html
@@ -60,12 +60,7 @@
(click)="changeStatus(RegistrationStatusEnum.paused)"
/>
}
- @if (
- authService.hasPermission({
- projectId: projectId(),
- requiredPermission: PermissionEnum.RegistrationNotificationREAD,
- })
- ) {
+ @if (canSendMessage()) {
}
-
+ @if (canChangeStatus(RegistrationStatusEnum.deleted)) {
+
+ }
diff --git a/interfaces/Portalicious/src/app/pages/project-registrations/project-registrations.page.ts b/interfaces/Portalicious/src/app/pages/project-registrations/project-registrations.page.ts
index 7c1e0f37d4..8142447b45 100644
--- a/interfaces/Portalicious/src/app/pages/project-registrations/project-registrations.page.ts
+++ b/interfaces/Portalicious/src/app/pages/project-registrations/project-registrations.page.ts
@@ -184,6 +184,7 @@ export class ProjectRegistrationsPageComponent {
canChangeStatus(
status:
| RegistrationStatusEnum.declined
+ | RegistrationStatusEnum.deleted
| RegistrationStatusEnum.included
| RegistrationStatusEnum.paused
| RegistrationStatusEnum.validated,
@@ -195,6 +196,7 @@ export class ProjectRegistrationsPageComponent {
PermissionEnum.RegistrationStatusIncludedUPDATE,
[RegistrationStatusEnum.declined]:
PermissionEnum.RegistrationStatusMarkAsDeclinedUPDATE,
+ [RegistrationStatusEnum.deleted]: PermissionEnum.RegistrationDELETE,
[RegistrationStatusEnum.paused]:
PermissionEnum.RegistrationStatusPausedUPDATE,
};
@@ -203,4 +205,11 @@ export class ProjectRegistrationsPageComponent {
requiredPermission: statusToPermissionMap[status],
});
}
+
+ canSendMessage = computed(() =>
+ this.authService.hasPermission({
+ projectId: this.projectId(),
+ requiredPermission: PermissionEnum.RegistrationNotificationCREATE,
+ }),
+ );
}
diff --git a/interfaces/Portalicious/src/app/services/toast.service.ts b/interfaces/Portalicious/src/app/services/toast.service.ts
index bdbb0f0332..78e7ef460a 100644
--- a/interfaces/Portalicious/src/app/services/toast.service.ts
+++ b/interfaces/Portalicious/src/app/services/toast.service.ts
@@ -15,6 +15,7 @@ export class ToastService {
showToast(message: Message) {
this.messageService.add({
...message,
+ life: message.life ?? 5000,
severity: message.severity ?? 'success',
summary: message.summary
? message.summary
diff --git a/interfaces/Portalicious/src/locale/messages.nl.xlf b/interfaces/Portalicious/src/locale/messages.nl.xlf
index af85923240..e5d0827831 100644
--- a/interfaces/Portalicious/src/locale/messages.nl.xlf
+++ b/interfaces/Portalicious/src/locale/messages.nl.xlf
@@ -999,14 +999,6 @@
Message:
-
-
- Use @ to add personalized fields. Learn more
-
-
-
- (>20) characters.
-
*Please make sure registration data is available for all used personalized fields.
@@ -1095,6 +1087,26 @@
Are you sure you want to send this message?
+
+
+ ( selected)
+
+
+
+ characters.
+
+
+
+ Delete
+
+
+
+ Use @ to add personalized fields.
+
+
+
+ Learn more
+