Skip to content

Commit

Permalink
Merge pull request #296 from IFRCGo/fix/dref-super-ticket-issues
Browse files Browse the repository at this point in the history
Add content from dref form to dref export
  • Loading branch information
samshara authored Nov 28, 2023
2 parents 7c10cb1 + 2dc1277 commit ac46096
Show file tree
Hide file tree
Showing 30 changed files with 471 additions and 465 deletions.
1 change: 1 addition & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

--base-font-size: 0.875rem;
--font-multiplier: 1.5;
--go-ui-dref-super-ticket-size: 0.688rem;

--go-ui-font-size-2xs: calc(var(--base-font-size) * 0.625);
--go-ui-font-size-xs: calc(var(--base-font-size) * 0.75);
Expand Down
7 changes: 6 additions & 1 deletion src/views/DrefApplicationExport/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"targetedAreasLabel": "Targeted Areas",
"eventDescriptionSectionHeading": "Description of the Event",
"whatWhereWhenSectionHeading": "What happened, where and when?",
"dateWhenTheTriggerWasMetHeading": "Date of event / Date when the trigger was met",
"situationUpdateSectionHeading": "Provide any updates in the situation since the field report and explain what is expected to happen.",
"anticipatoryActionsHeading": "Why your National Society is acting now and what criteria is used to launch this operation.",
"scopeAndScaleSectionHeading": "Scope and Scale",
Expand All @@ -36,6 +37,8 @@
"recurrentEventJustificationLabel": "If you have answered yes to all questions above, justify why the use of DREF for a recurrent event, or how this event should not be considered recurrent",
"lessonsLearnedLabel": "Lessons learned",
"currentNationalSocietyActionsHeading": "Current National Society Actions",
"nationalSocietyActionsHeading": "National Society anticipatory actions started",
"drefFormNsResponseStarted": "Start date of National Society actions",
"movementPartnersActionsHeading": "IFRC Network Actions Related To The Current Event",
"secretariatLabel": "Secretariat",
"participatingNsLabel": "Participating National Societies",
Expand Down Expand Up @@ -88,6 +91,8 @@
"mediaContactHeading": "Media Contact",
"imageLogoIFRCAlt": "IFRC",
"drefApplicationExportRisk": "Risk",
"drefApplicationExportMitigation": "Mitigation action"
"drefApplicationExportMitigation": "Mitigation action",
"drefApplicationSupportingDocumentation": "Supporting Documentation",
"drefAssessmentReportLink": "Assessment Report"
}
}
102 changes: 75 additions & 27 deletions src/views/DrefApplicationExport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ export function Component() {
const lessonsLearnedDefined = isTruthyString(drefResponse?.lessons_learned?.trim());
const showPreviousOperations = drefResponse?.type_of_dref !== DREF_TYPE_ASSESSMENT && (
isDefined(drefResponse?.did_it_affect_same_area)
|| isDefined(drefResponse?.did_it_affect_same_population)
|| isDefined(drefResponse?.did_ns_respond)
|| isDefined(drefResponse?.did_ns_request_fund)
|| isTruthyString(drefResponse?.ns_request_text?.trim())
|| isTruthyString(drefResponse?.dref_recurrent_text?.trim())
|| lessonsLearnedDefined
|| isDefined(drefResponse?.did_it_affect_same_population)
|| isDefined(drefResponse?.did_ns_respond)
|| isDefined(drefResponse?.did_ns_request_fund)
|| isTruthyString(drefResponse?.ns_request_text?.trim())
|| isTruthyString(drefResponse?.dref_recurrent_text?.trim())
|| lessonsLearnedDefined
);

const ifrcActionsDefined = isTruthyString(drefResponse?.ifrc?.trim());
Expand Down Expand Up @@ -287,8 +287,8 @@ export function Component() {
value={drefResponse?.disaster_category_display}
valueClassName={_cs(
isDefined(drefResponse)
&& isDefined(drefResponse.disaster_category)
&& colorMap[drefResponse.disaster_category],
&& isDefined(drefResponse.disaster_category)
&& colorMap[drefResponse.disaster_category],
)}
strongValue
/>
Expand Down Expand Up @@ -383,6 +383,14 @@ export function Component() {
/>
</Container>
)}
<Container
heading={drefResponse?.type_of_dref !== DREF_TYPE_IMMINENT
&& strings.dateWhenTheTriggerWasMetHeading}
>
<DescriptionText>
{drefResponse?.event_date}
</DescriptionText>
</Container>
{eventDescriptionDefined && (
<Container
heading={drefResponse?.type_of_dref === DREF_TYPE_IMMINENT
Expand Down Expand Up @@ -425,6 +433,15 @@ export function Component() {
</DescriptionText>
</Container>
)}
{drefResponse?.supporting_document_details?.file && (
<Link
href={drefResponse?.supporting_document_details?.file}
external
withUnderline
>
{strings.drefApplicationSupportingDocumentation}
</Link>
)}
</>
)}
{showPreviousOperations && (
Expand Down Expand Up @@ -481,22 +498,39 @@ export function Component() {
</Container>
)}
{showNsAction && (
<Container
heading={strings.currentNationalSocietyActionsHeading}
childrenContainerClassName={styles.nsActionsContent}
headingLevel={2}
>
{drefResponse?.national_society_actions?.map(
(nsAction) => (
<BlockTextOutput
key={nsAction.id}
label={nsAction.title_display}
value={nsAction.description}
valueType="text"
strongLabel
/>
),
)}
<Container>
<Container
heading={strings.currentNationalSocietyActionsHeading}
childrenContainerClassName={styles.nsActionsContent}
headingLevel={2}
>
{drefResponse?.national_society_actions?.map(
(nsAction) => (
<BlockTextOutput
key={nsAction.id}
label={nsAction.title_display}
value={nsAction.description}
valueType="text"
strongLabel
/>
),
)}
</Container>
<Container>
{drefResponse?.ns_respond_date && (
<Container
heading={
drefResponse?.type_of_dref === DREF_TYPE_IMMINENT
? strings.nationalSocietyActionsHeading
: strings.drefFormNsResponseStarted
}
>
<DescriptionText>
{drefResponse?.ns_respond_date}
</DescriptionText>
</Container>
)}
</Container>
</Container>
)}
{showMovementPartnersActionsSection && (
Expand Down Expand Up @@ -578,12 +612,12 @@ export function Component() {
)}
{showNeedsIdentifiedSection && (
<>
<Heading level={2}>
{strings.needsIdentifiedSectionHeading}
</Heading>
{needsIdentifiedDefined && drefResponse?.needs_identified?.map(
(identifiedNeed) => (
<Fragment key={identifiedNeed.id}>
<Heading level={2}>
{strings.needsIdentifiedSectionHeading}
</Heading>
<Heading className={styles.needsIdentifiedHeading}>
<img
className={styles.icon}
Expand All @@ -605,6 +639,13 @@ export function Component() {
</DescriptionText>
</Container>
)}
<Link
href={drefResponse?.assessment_report_details?.file}
external
withUnderline
>
{strings.drefAssessmentReportLink}
</Link>
</>
)}
{showOperationStrategySection && (
Expand Down Expand Up @@ -787,6 +828,13 @@ export function Component() {
{plannedIntervention.title_display}
</Heading>
<Container>
<TextOutput
label={strings.drefAllocationLabel}
value={drefResponse?.amount_requested}
valueType="number"
prefix={strings.chfPrefix}
strongLabel
/>
<TextOutput
label={strings.budgetLabel}
value={plannedIntervention.budget}
Expand Down
2 changes: 1 addition & 1 deletion src/views/DrefApplicationExport/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--pdf-element-bg: var(--go-ui-color-background);

font-family: 'Open Sans', sans-serif;
font-size: var(--go-ui-font-size-sm);
font-size: var(--go-ui-dref-super-ticket-size);

@media screen {
margin: var(--go-ui-spacing-xl) auto;
Expand Down
17 changes: 15 additions & 2 deletions src/views/DrefApplicationForm/EventDetail/i18n.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
{
"namespace": "drefApplicationForm",
"strings": {
"drefFormAffectedthePopulationTitle": "Did it affect the same population groups?",
"drefFormAffectedThePopulationTitle": "Did it affect the same population groups?",
"drefFormAffectSameArea": "Has a similar event affected the same area(s) in the last 3 years?",
"drefFormApproximateDateOfImpact": "Approximate date of impact",
"drefFormDescriptionEvent": "Description of the Event",
"drefFormEventDate": "Date of the Event",
"numericDetailsSectionTitle": "Numeric Details",
"drefFormPeopleAffectedDescriptionSlowSudden": "People Affected include all those whose lives and livelihoods have been impacted as a direct result of the shock or stress.",
"drefFormClickEmergencyResponseFramework": "Click to view Emergency Response Framework",
"drefFormEstimatedPeopleInNeed": "Estimated people in need (Optional)",
"drefFormPeopleTargetedDescription": "Include all those whose the National Society is aiming or planning to assist",
"drefFormPeopleInNeed": "People in need (Optional)",
"drefFormPeopleTargeted": "Number of people targeted",
"drefFormPeopleAffected": "Total affected population",
"drefFormRiskPeopleLabel": "Total population at risk",
"drefFormPeopleInNeedDescriptionImminent": "Include all those whose physical security, basic rights, dignity, living conditions or livelihoods are threatened or have been disrupted, and whose current level of access to basic services, goods and social protection will be inadequate to re-establish normal living conditions without additional assistance",
"drefFormPeopleInNeedDescriptionSlowSudden": "People in Need (PIN) are those members whose physical security, basic rights, dignity, living conditions or livelihoods are threatened or have been disrupted, and whose current level of access to basic services, goods and social protection is inadequate to re-establish normal living conditions without additional assistance.",
"drefFormPeopleAffectedDescriptionImminent": "Includes all those whose lives and livelihoods are at risk as a direct result of the shock or stress.",
"drefFormImminentDisaster": "Provide any updates in the situation since the field report and explain what is expected to happen.",
"drefFormLessonsLearnedDescription": "Specify how the lessons learnt from these previous operations are being used to mitigate similar challenges in the current operation",
"drefFormLessonsLearnedTitle": "Lessons learned",
Expand All @@ -26,7 +38,8 @@
"drefFormUploadSupportingDocumentButtonLabel": "Upload document",
"drefFormUploadSupportingDocumentDescription": "Here the National Society can upload documentation that substantiates their decision to launch this operation now. For example: seasonal outlooks, forecast information, reports from credible sources...etc.",
"drefFormWhatWhereWhen": "What happened, where and when?",
"drefOperationalLearningPlatformLabel": "To access lessons from previous operations, please visit the DREF Operational Learning Platform",
"drefOperationalLearningPlatformLabel": "To access the Operational Learning Dashboard and check learnings for the country, click",
"drefOperationalLearningPlatformLink": "HERE",
"drefFormSelectImages": "Select images"
}
}
87 changes: 49 additions & 38 deletions src/views/DrefApplicationForm/EventDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ function EventDetail(props: Props) {
heading={strings.drefFormPreviousOperations}
className={styles.previousOperations}
headerDescription={(
<Link
href={operationalLearningPlatformUrl}
external
>
<div className={styles.learningPlatformLink}>
{strings.drefOperationalLearningPlatformLabel}
</Link>
<Link
href={operationalLearningPlatformUrl}
external
withUnderline
withLinkIcon
>
{strings.drefOperationalLearningPlatformLink}
</Link>
</div>
)}
>
<InputSection
Expand All @@ -79,39 +84,45 @@ function EventDetail(props: Props) {
disabled={disabled}
/>
</InputSection>
<InputSection
title={strings.drefFormAffectedthePopulationTitle}
>
<BooleanInput
name="did_it_affect_same_population"
value={value.did_it_affect_same_population}
onChange={setFieldValue}
error={error?.did_it_affect_same_population}
disabled={disabled}
/>
</InputSection>
<InputSection
title={strings.drefFormNsRespond}
>
<BooleanInput
name="did_ns_respond"
value={value.did_ns_respond}
onChange={setFieldValue}
error={error?.did_ns_respond}
disabled={disabled}
/>
</InputSection>
<InputSection
title={strings.drefFormNsRequestFund}
>
<BooleanInput
name="did_ns_request_fund"
value={value.did_ns_request_fund}
onChange={setFieldValue}
error={error?.did_ns_request_fund}
disabled={disabled}
/>
</InputSection>
{value.did_it_affect_same_area && (
<InputSection
title={strings.drefFormAffectedThePopulationTitle}
>
<BooleanInput
name="did_it_affect_same_population"
value={value.did_it_affect_same_population}
onChange={setFieldValue}
error={error?.did_it_affect_same_population}
disabled={disabled}
/>
</InputSection>
)}
{value.did_it_affect_same_population && (
<InputSection
title={strings.drefFormNsRespond}
>
<BooleanInput
name="did_ns_respond"
value={value.did_ns_respond}
onChange={setFieldValue}
error={error?.did_ns_respond}
disabled={disabled}
/>
</InputSection>
)}
{value.did_ns_respond && (
<InputSection
title={strings.drefFormNsRequestFund}
>
<BooleanInput
name="did_ns_request_fund"
value={value.did_ns_request_fund}
onChange={setFieldValue}
error={error?.did_ns_request_fund}
disabled={disabled}
/>
</InputSection>
)}
{value.did_ns_request_fund && (
<InputSection
title={strings.drefFormNsFundingDetail}
Expand Down
5 changes: 5 additions & 0 deletions src/views/DrefApplicationForm/EventDetail/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
flex-direction: column;
gap: var(--go-ui-spacing-2xl);
}

.learning-platform-link {
display: flex;
gap: var(--go-ui-spacing-2xs);
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ function CopyFieldReportSection(props: Props) {
);
}));

const government_assistance = value?.government_requested_assistance
?? fieldReportResponse.request_assistance;

const num_affected = value?.num_affected
?? fieldReportResponse.num_affected
?? fieldReportResponse.gov_num_affected
Expand All @@ -119,8 +122,6 @@ function CopyFieldReportSection(props: Props) {
?? fieldReportResponse.actions_taken?.find((a) => a.organization === 'PNS')?.summary;
const ifrc = value?.ifrc
?? fieldReportResponse.actions_taken?.find((a) => a.organization === 'FDRN')?.summary;
const icrc = value?.icrc
?? fieldReportResponse.actions_taken?.find((a) => a.organization === 'NTLS')?.summary;

let {
national_society_contact_name,
Expand Down Expand Up @@ -210,7 +211,7 @@ function CopyFieldReportSection(props: Props) {
setFieldValue(num_affected, 'num_affected');
setFieldValue(partner_national_society, 'partner_national_society');
setFieldValue(ifrc, 'ifrc');
setFieldValue(icrc, 'icrc');
setFieldValue(government_assistance, 'government_requested_assistance');

// set field_report_option and districts

Expand Down
Loading

0 comments on commit ac46096

Please sign in to comment.