Skip to content

Commit

Permalink
Merge pull request #651 from IFRCGo/feature/fix-dref-loan
Browse files Browse the repository at this point in the history
Fix dref loan type
  • Loading branch information
frozenhelium authored Apr 2, 2024
2 parents 770fe9c + b3e3873 commit 5a2c3bb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/src/components/domain/ImageWithCaptionInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function ImageWithCaptionInput<const N extends string | number>(props: Props<N>)
>
{label}
</GoSingleFileInput>
{value?.id && (
{value?.id && isDefined(fileUrl) && (
<TextInput
className={styles.captionInput}
name="caption"
Expand Down
2 changes: 2 additions & 0 deletions app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {

import useUserMe from '#hooks/domain/useUserMe';
import useFilterState from '#hooks/useFilterState';
import { DREF_TYPE_LOAN } from '#utils/constants';
import { useRequest } from '#utils/restRequest';

import DrefTableActions, { type Props as DrefTableActionsProps } from '../DrefTableActions';
Expand Down Expand Up @@ -236,6 +237,7 @@ function ActiveDrefTable(props: Props) {
const canCreateFinalReport = !has_final_report
&& (applicationType === 'DREF' || applicationType === 'OPS_UPDATE')
&& (is_published ?? false)
&& (item.type_of_dref !== DREF_TYPE_LOAN)
&& (
!has_ops_update
|| (has_ops_update && unpublished_op_update_count === 0)
Expand Down
2 changes: 0 additions & 2 deletions app/src/views/DrefApplicationForm/EventDetail/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
"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",
Expand Down
4 changes: 2 additions & 2 deletions app/src/views/DrefFinalReportForm/EventDetail/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"drefFormEstimatedPeopleInNeed": "Estimated people in need (Optional)",
"drefFormPeopleInNeed": "People in need (Optional)",
"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",
"finalReportPeopleTargeted": "Number of people targeted",
"drefFormPeopleTargetedDescription": "Include all those whose the National Society is aiming or planning to assist",
"drefFormPeopleAssisted": "Number of people assisted",
"drefFormPeopleAssistedDescription": "Include all those whose the National Society is aiming or planning to assist",
"drefFormPeopleTargeted": "Number of people targeted",
"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.",
"drefFormSourceInformationAddButton": "Add New Source Information",
Expand Down
7 changes: 3 additions & 4 deletions app/src/views/DrefFinalReportForm/EventDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function EventDetail(props: Props) {
<NumberInput
label={(
<>
{strings.finalReportPeopleTargeted}
{strings.drefFormPeopleTargeted}
<Link
title={strings.drefFormClickEmergencyResponseFramework}
href={peopleTargetedLink}
Expand All @@ -202,13 +202,12 @@ function EventDetail(props: Props) {
value={value.number_of_people_targeted}
onChange={setFieldValue}
error={error?.number_of_people_targeted}
hint={strings.drefFormPeopleTargetedDescription}
disabled={disabled}
/>
<NumberInput
label={(
<>
{strings.drefFormPeopleTargeted}
{strings.drefFormPeopleAssisted}
<Link
title={strings.drefFormClickEmergencyResponseFramework}
href={peopleTargetedLink}
Expand All @@ -222,7 +221,7 @@ function EventDetail(props: Props) {
value={value?.num_assisted}
onChange={setFieldValue}
error={error?.num_assisted}
hint={strings.drefFormPeopleTargetedDescription}
hint={strings.drefFormPeopleAssistedDescription}
disabled={disabled}
/>
{/* NOTE: Empty div to preserve the layout */}
Expand Down
11 changes: 9 additions & 2 deletions app/src/views/DrefFinalReportForm/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ import useDisasterType from '#hooks/domain/useDisasterType';
import useGlobalEnums from '#hooks/domain/useGlobalEnums';
import { type GoApiResponse } from '#utils/restRequest';

import { TYPE_IMMINENT } from '../common';
import {
TYPE_IMMINENT,
TYPE_LOAN,
} from '../common';
import { type PartialFinalReport } from '../schema';

import i18n from './i18n.json';
Expand Down Expand Up @@ -130,6 +133,10 @@ function Overview(props: Props) {
user,
}), []);

const filteredTypeOfDrefOptions = (typeOfDrefOptions ?? []).filter(
(option) => option.key !== TYPE_LOAN,
);

const error = getErrorObject(formError);

return (
Expand Down Expand Up @@ -183,7 +190,7 @@ function Overview(props: Props) {
<SelectInput
name="type_of_dref"
label={strings.drefFormTypeOfDref}
options={typeOfDrefOptions}
options={filteredTypeOfDrefOptions}
keySelector={typeOfDrefKeySelector}
labelSelector={stringValueSelector}
onChange={setFieldValue}
Expand Down

0 comments on commit 5a2c3bb

Please sign in to comment.