Skip to content

Commit 7575c81

Browse files
authored
Merge pull request #1890 from IFRCGo/fix/dref-per-minor-fix
Dref operation update form for imminent
2 parents b0a4c33 + e51a80f commit 7575c81

File tree

14 files changed

+72
-44
lines changed

14 files changed

+72
-44
lines changed

.changeset/spotty-tigers-hide.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"go-web-app": patch
3+
---
4+
5+
Update the action for the DREF Ops update form for imminent. - Remove change to response modal in the ops update form for type imminent.
6+
Fix the order of the field in operational timeframe tab.
7+
Add description text under upload assessment report button in DREF operation update form
8+
Handle the error while viewing PER process for specific countries.

app/src/views/AccountMyFormsDref/ActiveDrefTable/index.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
import useUserMe from '#hooks/domain/useUserMe';
3131
import useFilterState from '#hooks/useFilterState';
3232
import {
33-
DREF_TYPE_IMMINENT,
3433
DREF_TYPE_LOAN,
3534
type TypeOfDrefEnum,
3635
} from '#utils/constants';
@@ -239,12 +238,7 @@ function ActiveDrefTable(props: Props) {
239238
const canAddOpsUpdate = (is_published ?? false)
240239
&& (applicationType === 'DREF' || applicationType === 'OPS_UPDATE')
241240
&& !has_final_report
242-
&& unpublished_op_update_count === 0
243-
// NOTE: Adding this to disable updates just for the old imminents
244-
&& (item.type_of_dref !== DREF_TYPE_IMMINENT
245-
|| (item.type_of_dref === DREF_TYPE_IMMINENT
246-
&& !!is_dref_imminent_v2)
247-
);
241+
&& unpublished_op_update_count === 0;
248242

249243
const canCreateFinalReport = !has_final_report
250244
&& (applicationType === 'DREF' || applicationType === 'OPS_UPDATE')
@@ -268,6 +262,7 @@ function ActiveDrefTable(props: Props) {
268262
drefId: originalDref.id,
269263
drefType,
270264
status: item.status,
265+
isDrefImminentV2: is_dref_imminent_v2,
271266
applicationType,
272267
canAddOpsUpdate,
273268
canCreateFinalReport,

app/src/views/AccountMyFormsDref/DrefTableActions/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export interface Props {
5252
canAddOpsUpdate: boolean;
5353
canCreateFinalReport: boolean;
5454
hasPermissionToApprove?: boolean;
55+
isDrefImminentV2?: boolean;
5556

5657
onPublishSuccess?: () => void;
5758
drefType?: TypeOfDrefEnum | null | undefined;
@@ -66,6 +67,7 @@ function DrefTableActions(props: Props) {
6667
canAddOpsUpdate,
6768
canCreateFinalReport,
6869
hasPermissionToApprove,
70+
isDrefImminentV2,
6971
onPublishSuccess,
7072
drefType,
7173
} = props;
@@ -383,7 +385,7 @@ function DrefTableActions(props: Props) {
383385

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

386-
const shouldConfirmImminentAddOpsUpdate = drefType === DREF_TYPE_IMMINENT;
388+
const shouldConfirmImminentAddOpsUpdate = drefType === DREF_TYPE_IMMINENT && isDrefImminentV2;
387389

388390
const disabled = fetchingDref
389391
|| fetchingOpsUpdate

app/src/views/CountryPreparedness/PrivateCountryPreparedness/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ function PrivateCountryPreparedness() {
497497
/>
498498
<TextOutput
499499
label={strings.typeOfAssessmentLabel}
500-
value={perOverview?.type_of_assessment.name}
500+
value={perOverview?.type_of_assessment?.name}
501501
strongValue
502502
/>
503503
<TextOutput

app/src/views/CountryPreparedness/PublicCountryPreparedness/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function PublicCountryPreparedness() {
204204
/>
205205
<TextOutput
206206
label={strings.publicTypeOfAssessmentLabel}
207-
value={perStats?.type_of_assessment.name}
207+
value={perStats?.type_of_assessment?.name}
208208
strongValue
209209
/>
210210
<TextOutput

app/src/views/DrefFinalReportForm/Overview/index.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ interface Props {
8484
setFieldValue: (...entries: EntriesAsList<PartialFinalReport>) => void;
8585
error: Error<PartialFinalReport> | undefined;
8686
disabled?: boolean;
87+
isPreviousImminent: boolean;
8788

8889
fileIdToUrlMap: Record<number, string>;
8990
setFileIdToUrlMap?: React.Dispatch<React.SetStateAction<Record<number, string>>>;
@@ -96,6 +97,7 @@ function Overview(props: Props) {
9697
const {
9798
value,
9899
setFieldValue,
100+
isPreviousImminent,
99101
error: formError,
100102
fileIdToUrlMap,
101103
setFileIdToUrlMap,
@@ -153,6 +155,12 @@ function Overview(props: Props) {
153155
user,
154156
}), []);
155157

158+
const imminentFilteredTypeOfDrefOptions = useMemo(() => (
159+
typeOfDrefOptions?.filter(
160+
(option) => option.key !== TYPE_LOAN,
161+
)
162+
), [typeOfDrefOptions]);
163+
156164
const filteredTypeOfDrefOptions = useMemo(() => (
157165
typeOfDrefOptions?.filter(
158166
(option) => option.key !== TYPE_LOAN && option.key !== TYPE_IMMINENT,
@@ -241,7 +249,10 @@ function Overview(props: Props) {
241249
<SelectInput
242250
name="type_of_dref"
243251
label={strings.drefFormTypeOfDref}
244-
options={filteredTypeOfDrefOptions}
252+
options={
253+
isPreviousImminent ? imminentFilteredTypeOfDrefOptions
254+
: filteredTypeOfDrefOptions
255+
}
245256
keySelector={typeOfDrefKeySelector}
246257
labelSelector={stringValueSelector}
247258
onChange={setFieldValue}

app/src/views/DrefFinalReportForm/Submission/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,6 @@ function Submission(props: Props) {
388388
error={error?.national_society_integrity_contact_name}
389389
disabled={disabled}
390390
/>
391-
<TextInput
392-
label={strings.drefFormIntegrityContactEmailLabel}
393-
name="national_society_integrity_contact_email"
394-
value={value.national_society_integrity_contact_email}
395-
onChange={setFieldValue}
396-
error={error?.national_society_integrity_contact_email}
397-
disabled={disabled}
398-
/>
399391
<TextInput
400392
label={strings.drefFormIntegrityContactTitleLabel}
401393
name="national_society_integrity_contact_title"
@@ -404,6 +396,14 @@ function Submission(props: Props) {
404396
error={error?.national_society_integrity_contact_title}
405397
disabled={disabled}
406398
/>
399+
<TextInput
400+
label={strings.drefFormIntegrityContactEmailLabel}
401+
name="national_society_integrity_contact_email"
402+
value={value.national_society_integrity_contact_email}
403+
onChange={setFieldValue}
404+
error={error?.national_society_integrity_contact_email}
405+
disabled={disabled}
406+
/>
407407
<TextInput
408408
label={strings.drefFormIntegrityContactPhoneNumberLabel}
409409
name="national_society_integrity_contact_phone_number"

app/src/views/DrefFinalReportForm/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import NonFieldError from '#components/NonFieldError';
3838
import Page from '#components/Page';
3939
import useCurrentLanguage from '#hooks/domain/useCurrentLanguage';
4040
import useAlert from '#hooks/useAlert';
41+
import { DREF_TYPE_IMMINENT } from '#utils/constants';
4142
import {
4243
type GoApiResponse,
4344
useLazyRequest,
@@ -97,6 +98,7 @@ export function Component() {
9798
const formContentRef = useRef<ElementRef<'div'>>(null);
9899

99100
const [activeTab, setActiveTab] = useState<TabKeys>('overview');
101+
const [isPreviousImminent, setIsPreviousImminent] = useState(false);
100102
const [fileIdToUrlMap, setFileIdToUrlMap] = useState<Record<number, string>>({});
101103
const [districtOptions, setDistrictOptions] = useState<
102104
DistrictItem[] | undefined | null
@@ -206,6 +208,7 @@ export function Component() {
206208
} : undefined,
207209
onSuccess: (response) => {
208210
handleFinalReportLoad(response);
211+
setIsPreviousImminent(response.type_of_dref === DREF_TYPE_IMMINENT);
209212

210213
const {
211214
planned_interventions,
@@ -482,6 +485,7 @@ export function Component() {
482485
value={value}
483486
setFieldValue={setFieldValue}
484487
fileIdToUrlMap={fileIdToUrlMap}
488+
isPreviousImminent={isPreviousImminent}
485489
setFileIdToUrlMap={setFileIdToUrlMap}
486490
error={formError}
487491
disabled={disabled}

app/src/views/DrefOperationalUpdateForm/Actions/i18n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"strings": {
44
"drefFormActionFieldsLabel": "Select the needs that apply.",
55
"drefFormAssessmentReportUploadButtonLabel": "Upload assessment report",
6+
"drefFormAssessmentReportUploadDescription": "Assessment report file type: pdf, docx, pptx, xlsx.",
67
"drefFormAssessmentReportUploadLabel": "Assessment Report (Optional)",
78
"drefFormCoordinationMechanism": "Are there major coordination mechanisms in place?",
89
"drefFormCoordinationMechanismDescription": "List coordination mechanisms/platform in place at local/district and national level. Indicate the lead authorities/agencies. How the National Society is involved/positioned in this coordination. Does the NS in any lead/co-lead role? Any identified gap/overlap in the coordination (e.g., sector missing…)?",

app/src/views/DrefOperationalUpdateForm/Actions/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ function Actions(props: Props) {
273273
>
274274
{strings.drefFormAssessmentReportUploadButtonLabel}
275275
</GoSingleFileInput>
276+
{strings.drefFormAssessmentReportUploadDescription}
276277
</InputSection>
277278
)}
278279
<InputSection

0 commit comments

Comments
 (0)