Skip to content

Commit df338b1

Browse files
committed
Fix event condition for dref exports
1 parent 53802b5 commit df338b1

File tree

5 files changed

+53
-11
lines changed

5 files changed

+53
-11
lines changed

src/views/DrefApplicationExport/index.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -482,15 +482,19 @@ export function Component() {
482482
</Container>
483483
)}
484484
{eventTextDefined && (
485-
<Container
486-
heading={strings.approximateDateOfImpactHeading}
487-
headingLevel={3}
488-
>
485+
<Container heading={strings.approximateDateOfImpactHeading}>
489486
<DescriptionText>
490487
{drefResponse.event_text}
491488
</DescriptionText>
492489
</Container>
493490
)}
491+
{eventDateDefined && (
492+
<Container heading={strings.dateWhenTheTriggerWasMetHeading}>
493+
<DateOutput
494+
value={drefResponse?.event_date}
495+
/>
496+
</Container>
497+
)}
494498
{isTruthyString(drefResponse?.event_map_file?.file) && (
495499
<Container>
496500
<Image
@@ -499,13 +503,6 @@ export function Component() {
499503
/>
500504
</Container>
501505
)}
502-
{eventDateDefined && (
503-
<Container heading={strings.dateWhenTheTriggerWasMetHeading}>
504-
<DateOutput
505-
value={drefResponse?.event_date}
506-
/>
507-
</Container>
508-
)}
509506
{eventDescriptionDefined && (
510507
<Container
511508
heading={drefResponse?.type_of_dref === DREF_TYPE_IMMINENT

src/views/DrefFinalReportExport/i18n.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
"additionalAllocationRequestedLabel": "Additional Allocation Requested",
2626
"targetedAreasLabel": "Targeted Areas",
2727
"eventDescriptionSectionHeading": "Description of the Event",
28+
"approximateDateOfImpactHeading": "Approximate date of impact",
29+
"dateWhenTheTriggerWasMetHeading": "Date of event / Date when the trigger was met",
2830
"whatWhereWhenSectionHeading": "What happened, where and when?",
2931
"situationUpdateSectionHeading": "Provide any updates in the situation since the field report and explain what is expected to happen.",
3032
"anticipatoryActionsHeading": "Why your National Society is acting now and what criteria is used to launch this operation.",

src/views/DrefFinalReportExport/index.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import Image from '#components/printable/Image';
1414
import Heading from '#components/printable/Heading';
1515
import Link from '#components/printable/Link';
1616

17+
import DateOutput from '#components/DateOutput';
1718
import DescriptionText from '#components/printable/DescriptionText';
1819
import NumberOutput from '#components/NumberOutput';
1920
import useTranslation from '#hooks/useTranslation';
@@ -144,9 +145,15 @@ export function Component() {
144145
const imagesFileDefined = isDefined(drefResponse)
145146
&& isDefined(drefResponse.images_file)
146147
&& drefResponse.images_file.length > 0;
148+
const eventDateDefined = drefResponse?.type_of_dref !== DREF_TYPE_IMMINENT
149+
&& isDefined(drefResponse?.event_date);
150+
const eventTextDefined = drefResponse?.type_of_dref === DREF_TYPE_IMMINENT
151+
&& isDefined(drefResponse?.event_text);
147152
const showEventDescriptionSection = eventDescriptionDefined
148153
|| eventScopeDefined
149154
|| imagesFileDefined
155+
|| eventDateDefined
156+
|| eventTextDefined
150157
|| isDefined(drefResponse?.event_map_file?.file);
151158

152159
const ifrcActionsDefined = isTruthyString(drefResponse?.ifrc?.trim());
@@ -394,6 +401,20 @@ export function Component() {
394401
/>
395402
</Container>
396403
)}
404+
{eventTextDefined && (
405+
<Container heading={strings.approximateDateOfImpactHeading}>
406+
<DescriptionText>
407+
{drefResponse.event_text}
408+
</DescriptionText>
409+
</Container>
410+
)}
411+
{eventDateDefined && (
412+
<Container heading={strings.dateWhenTheTriggerWasMetHeading}>
413+
<DateOutput
414+
value={drefResponse?.event_date}
415+
/>
416+
</Container>
417+
)}
397418
{eventDescriptionDefined && (
398419
<Container
399420
heading={drefResponse?.type_of_dref === DREF_TYPE_IMMINENT

src/views/DrefOperationalUpdateExport/i18n.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
"situationUpdateSectionHeading": "Provide any updates in the situation since the field report and explain what is expected to happen.",
3030
"anticipatoryActionsHeading": "Why your National Society is acting now and what criteria is used to launch this operation.",
3131
"scopeAndScaleSectionHeading": "Scope and Scale",
32+
"approximateDateOfImpactHeading": "Approximate date of impact",
33+
"dateWhenTheTriggerWasMetHeading": "Date of event / Date when the trigger was met",
3234

3335
"summaryOfChangesSectionHeading": "Summary of Changes",
3436
"changingTimeFrameLabel":"Are you changing the timeframe of the operation",

src/views/DrefOperationalUpdateExport/index.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,18 @@ export function Component() {
163163
const imagesFileDefined = isDefined(drefResponse)
164164
&& isDefined(drefResponse.images_file)
165165
&& drefResponse.images_file.length > 0;
166+
const eventDateDefined = drefResponse?.type_of_dref !== DREF_TYPE_IMMINENT
167+
&& isDefined(drefResponse?.event_date);
168+
const eventTextDefined = drefResponse?.type_of_dref === DREF_TYPE_IMMINENT
169+
&& isDefined(drefResponse?.event_text);
166170
const anticipatoryActionsDefined = drefResponse?.type_of_dref === DREF_TYPE_IMMINENT
167171
&& isTruthyString(drefResponse?.anticipatory_actions?.trim());
168172
const showEventDescriptionSection = eventDescriptionDefined
169173
|| eventScopeDefined
170174
|| imagesFileDefined
171175
|| anticipatoryActionsDefined
176+
|| eventDateDefined
177+
|| eventTextDefined
172178
|| isDefined(drefResponse?.event_map_file?.file);
173179

174180
const ifrcActionsDefined = isTruthyString(drefResponse?.ifrc?.trim());
@@ -458,6 +464,20 @@ export function Component() {
458464
/>
459465
</Container>
460466
)}
467+
{eventTextDefined && (
468+
<Container heading={strings.approximateDateOfImpactHeading}>
469+
<DescriptionText>
470+
{drefResponse.event_text}
471+
</DescriptionText>
472+
</Container>
473+
)}
474+
{eventDateDefined && (
475+
<Container heading={strings.dateWhenTheTriggerWasMetHeading}>
476+
<DateOutput
477+
value={drefResponse?.event_date}
478+
/>
479+
</Container>
480+
)}
461481
{eventDescriptionDefined && (
462482
<Container
463483
heading={drefResponse?.type_of_dref === DREF_TYPE_IMMINENT

0 commit comments

Comments
 (0)