Skip to content

Commit

Permalink
Merge pull request #1534 from rodekruis/fix.email-design-review
Browse files Browse the repository at this point in the history
fix: email design review changes
  • Loading branch information
arsforza authored Aug 1, 2024
2 parents 102c94d + 054219f commit 67a80d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as juice from 'juice';
import {
EapAlertClassKeyEnum,
EventSummaryCountry,
TriggeredArea,
} from '../../../shared/data.model';
import { LeadTime } from '../../admin-area-dynamic-data/enum/lead-time.enum';
import { CountryTimeZoneMapping } from '../../country/country-time-zone-mapping';
Expand Down Expand Up @@ -264,6 +265,7 @@ export class EmailTemplateService {
event.triggerStatusLabel,
),
tableRows: this.getTablesRows(event),
isIndicatorAvailable: this.isIndicatorAvailable(event.triggeredAreas),
color: this.getIbfHexColor(
event.eapAlertClass?.color,
event.triggerStatusLabel,
Expand Down Expand Up @@ -291,8 +293,13 @@ export class EmailTemplateService {
return severityLabels[eapAlertClassKey] || '';
}

private isIndicatorAvailable(areas: TriggeredArea[]) {
return areas.some((area) => area.actionsValue);
}

private getTablesRows(event: NotificationDataPerEventDto) {
return event.triggeredAreas
.filter((area) => area.actionsValue)
.map((area) => {
const areaTemplate = this.readHtmlFile('table-row.html');
const areaData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@
<%= severityLabel %> <%= triggerStatusLabel %> <%= disasterTypeLabel
%>: <%= eventName %>
</div>
<% if (isIndicatorAvailable) { %>
<div
class="body-text body-text-normal body-text-normal-stretch text-centered body-text-12px padding-top padding-bottom"
>
Expected exposed <%= defaultAdminAreaLabelPlural %><% if
(triggerStatusLabel === 'Trigger') { %> in order of <%=
indicatorLabel.toLowerCase() %><% } %>:
Expected exposed <%= defaultAdminAreaLabelPlural %> in order of <%=
indicatorLabel.toLowerCase() %>:
</div>
<div>
<table align="center" style="margin-right: auto; margin-left: auto">
<tr class="table-row">
<% if (triggerStatusLabel === 'Trigger') { %>
<td class="table-cell body-text body-text-bold body-text-12px">
<%= indicatorLabel %>
</td>
<% } %>
<td class="table-cell body-text body-text-bold body-text-12px">
<%= defaultAdminAreaLabelSingular %> <% if
(defaultAdminAreaLabelParent != defaultAdminAreaLabelSingular) {
Expand All @@ -40,12 +38,11 @@
<%- tableRows %>
</table>
</div>
<% if (triggerStatusLabel === 'Warning') { %>
<% } else { %>
<div
class="body-text body-text-normal body-text-normal-stretch text-centered padding-top body-text-12px"
>
Please note: Information regarding <%= indicatorLabel %> not available
for medium warning level.
<%= indicatorLabel %> information is unavailable.
</div>
<% } %>
</div>
Expand Down

0 comments on commit 67a80d6

Please sign in to comment.