Skip to content

Address DREF Imminent changes feedback #1799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ function ActiveDrefTable(props: Props) {
}

const {
// unpublished_final_report_count,
unpublished_op_update_count,
is_published,
has_ops_update,
Expand Down
4 changes: 3 additions & 1 deletion app/src/views/AccountMyFormsDref/DrefTableActions/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"drefApprovalInProgressTitle": "Approval in progress...",
"drefAccountCouldNotCreate": "Could not create new operational update",
"drefAccountCouldNotCreateFinalReport": "Could not create final report",
"drefAccountConfirmMessage": "You're about to Approve this DREF. Once approved, it can no longer be edited. Are you sure, you want to Approve?"
"drefAccountConfirmMessage": "You're about to Approve this DREF. Once approved, it can no longer be edited. Are you sure you want to Approve?",
"dropdownActionImminentNewOpsUpdateConfirmationHeading": "Confirm addition of Operational Update",
"dropdownActionImminentNewOpsUpdateConfirmationMessage": "The DREF type will be changed to Response (from Imminent) for the Operational Update. Once created, you'll be able to change it to other types except Imminent. Are you sure you want to add an Operational Update?"
}
}
32 changes: 26 additions & 6 deletions app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ function DrefTableActions(props: Props) {
),
onSuccess: (response) => {
const exportData = {
allocationFor: response?.type_of_dref_display === 'Loan' ? 'Emergency Appeal' : 'DREF Operation',
allocationFor: response?.type_of_dref === DREF_TYPE_LOAN ? 'Emergency Appeal' : 'DREF Operation',
appealManager: response?.ifrc_appeal_manager_name,
projectManager: response?.ifrc_project_manager_name,
affectedCountry: response?.country_details?.name,
name: response?.title,
disasterType: response?.disaster_type_details?.name,
responseType:
response?.type_of_dref_display === 'Imminent'
// FIXME: can't compare imminent with Imminent Crisis directly
response?.type_of_dref === DREF_TYPE_IMMINENT
// FIXME: add translations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use translation.

? 'Imminent Crisis'
: response?.type_of_onset_display,
noOfPeopleTargeted: response?.number_of_people_targeted,
Expand All @@ -147,8 +147,8 @@ function DrefTableActions(props: Props) {
previousAllocation: response?.dref_allocated_so_far ?? 0,
totalDREFAllocation: response?.total_dref_allocation,
toBeAllocatedFrom:
response?.type_of_dref_display === 'Imminent'
// FIXME: can't compare imminent with Anticipatory Pillar
response?.type_of_dref === DREF_TYPE_IMMINENT
// FIXME: add translations
Comment on lines +150 to +151
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use translation.

? 'Anticipatory Pillar'
: 'Response Pillar',
focalPointName: response?.regional_focal_point_name,
Expand Down Expand Up @@ -380,6 +380,8 @@ function DrefTableActions(props: Props) {

const canApprove = status === DREF_STATUS_IN_PROGRESS && hasPermissionToApprove;

const shouldConfirmImminentAddOpsUpdate = drefType === DREF_TYPE_IMMINENT;

const disabled = fetchingDref
|| fetchingOpsUpdate
|| publishDrefPending
Expand Down Expand Up @@ -418,7 +420,25 @@ function DrefTableActions(props: Props) {
{strings.dropdownActionAllocationFormLabel}
</DropdownMenuItem>
)}
{canAddOpsUpdate && (
{canAddOpsUpdate && shouldConfirmImminentAddOpsUpdate && (
<DropdownMenuItem
name={undefined}
type="confirm-button"
icons={<AddLineIcon className={styles.icon} />}
confirmHeading={
strings.dropdownActionImminentNewOpsUpdateConfirmationHeading
}
confirmMessage={
strings.dropdownActionImminentNewOpsUpdateConfirmationMessage
}
onConfirm={handleAddOpsUpdate}
disabled={disabled}
persist
>
{strings.dropdownActionAddOpsUpdateLabel}
</DropdownMenuItem>
)}
{canAddOpsUpdate && !shouldConfirmImminentAddOpsUpdate && (
<DropdownMenuItem
name={undefined}
type="button"
Expand Down
2 changes: 0 additions & 2 deletions app/src/views/DrefApplicationExport/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@
"proposedActions": "Proposed Actions",
"proposedActionsActivities": "Activities",
"priorityActionsBudget": "Budget (CHF)",
"proposedActionsEarlyActions": "Early Actions",
"priorityActionsEarlyResponse": "Early Response",
"priorityActionsSubTotal": "Sub-total",
"priorityActionsSurgeDeployment": "Surge Deployment (if applicable)",
"priorityActionsIndirectCost": "Indirect Cost",
Expand Down
Loading