Skip to content

Commit 6855ade

Browse files
barshathakurishreeyash07
authored andcommitted
feat(eap): Add Early Action Protocal form and views
- Add EAP Application tab in account page - Add EAP Registration Form - Add simplified EAP form - Add export for simplified EAP - Add full EAP form - Add full EAP export - Add full EAP summary export - Add Admin2 input component - Add obsolete resolution modal for both EAP forms - Add save and submit functionality in both EAP forms - Add share functionality in both EAP forms and table - Make minor enhancements in various UI components - Add form variant in Heading - Add option to show border in container - Restructure radio icon size - Improve info popup icon size - Add TextBadge component for text limit counter - Update styling of TabLayout - Update 'step' variant TabLayout to match the designs - Add 'form' variant to Container - Fix styling of info popup - Update styling of InputLabel
1 parent 17f7c61 commit 6855ade

169 files changed

Lines changed: 21247 additions & 215 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@turf/bbox": "^6.5.0",
5353
"@turf/buffer": "^6.5.0",
5454
"exceljs": "^4.4.0",
55+
"diff": "^8.0.2",
5556
"file-saver": "^2.0.5",
5657
"html-to-image": "^1.11.11",
5758
"mapbox-gl": "^1.13.0",

app/src/App/routes/index.tsx

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,50 @@ const emergencyAdditionalInfo = customWrapRoute({
319319
},
320320
});
321321

322+
type DefaultDrefDetailChild = 'dref-detail';
323+
const drefProcessLayout = customWrapRoute({
324+
parent: rootLayout,
325+
path: 'dref-process',
326+
forwardPath: 'dref-detail' satisfies DefaultDrefDetailChild,
327+
component: {
328+
render: () => import('#views/DrefProcess'),
329+
props: {},
330+
},
331+
wrapperComponent: Auth,
332+
context: {
333+
title: 'DREF Process',
334+
visibility: 'anything',
335+
},
336+
});
337+
338+
const drefDetail = customWrapRoute({
339+
parent: drefProcessLayout,
340+
path: 'dref-detail' satisfies DefaultDrefDetailChild,
341+
component: {
342+
render: () => import('#views/DrefDetail'),
343+
props: {},
344+
},
345+
wrapperComponent: Auth,
346+
context: {
347+
title: 'Response and Imminent DREF',
348+
visibility: 'anything',
349+
},
350+
});
351+
352+
const eapDetail = customWrapRoute({
353+
parent: drefProcessLayout,
354+
path: 'eap-detail',
355+
component: {
356+
render: () => import('#views/EarlyActionProtocols'),
357+
props: {},
358+
},
359+
wrapperComponent: Auth,
360+
context: {
361+
title: 'Early Action Protocols',
362+
visibility: 'anything',
363+
},
364+
});
365+
322366
type DefaultPreparednessChild = 'global-summary';
323367
const preparednessLayout = customWrapRoute({
324368
parent: rootLayout,
@@ -715,6 +759,49 @@ const accountMyFormsThreeW = customWrapRoute({
715759
},
716760
});
717761

762+
const accountMyFormsEap = customWrapRoute({
763+
parent: accountMyFormsLayout,
764+
path: 'eap-applications',
765+
component: {
766+
render: () => import('#views/AccountMyFormsEap'),
767+
props: {},
768+
},
769+
context: {
770+
title: 'Account - EAP Applications',
771+
visibility: 'is-authenticated',
772+
permissions: ({ isGuestUser }) => !isGuestUser,
773+
},
774+
});
775+
776+
const fullEapForm = customWrapRoute({
777+
parent: rootLayout,
778+
path: 'eap/:eapId/full',
779+
component: {
780+
render: () => import('#views/EapFullForm'),
781+
props: {},
782+
},
783+
wrapperComponent: Auth,
784+
context: {
785+
title: 'EAP Full Forms',
786+
visibility: 'is-authenticated',
787+
permissions: ({ isGuestUser }) => !isGuestUser,
788+
},
789+
});
790+
791+
const simplifiedEapForm = customWrapRoute({
792+
parent: rootLayout,
793+
path: 'eap/:eapId/simplified',
794+
component: {
795+
render: () => import('#views/EapSimplifiedForm'),
796+
props: {},
797+
},
798+
wrapperComponent: Auth,
799+
context: {
800+
title: 'Simplified EAP Form',
801+
visibility: 'is-authenticated',
802+
},
803+
});
804+
718805
const accountNotifications = customWrapRoute({
719806
parent: accountLayout,
720807
path: 'notifications',
@@ -1094,6 +1181,93 @@ const fieldReportDetails = customWrapRoute({
10941181
},
10951182
});
10961183

1184+
type DefaultEapRegistrationChild = 'new';
1185+
const eapRegistrationLayout = customWrapRoute({
1186+
parent: rootLayout,
1187+
path: 'eap-registration',
1188+
forwardPath: 'new' satisfies DefaultEapRegistrationChild,
1189+
component: {
1190+
render: () => import('#views/EapRegistration'),
1191+
props: {},
1192+
},
1193+
wrapperComponent: Auth,
1194+
context: {
1195+
title: 'EAP Process',
1196+
visibility: 'is-authenticated',
1197+
},
1198+
});
1199+
1200+
const newEapDevelopmentRegistration = customWrapRoute({
1201+
parent: eapRegistrationLayout,
1202+
path: 'new' satisfies DefaultEapRegistrationChild,
1203+
component: {
1204+
render: () => import('#views/EapRegistration'),
1205+
props: {},
1206+
},
1207+
wrapperComponent: Auth,
1208+
context: {
1209+
title: 'New EAP Development Registration',
1210+
visibility: 'is-authenticated',
1211+
permissions: ({ isGuestUser }) => !isGuestUser,
1212+
},
1213+
});
1214+
1215+
const eapDevelopmentRegistrationForm = customWrapRoute({
1216+
parent: eapRegistrationLayout,
1217+
path: ':eapId/',
1218+
component: {
1219+
render: () => import('#views/EapRegistration'),
1220+
props: {},
1221+
},
1222+
wrapperComponent: Auth,
1223+
context: {
1224+
title: 'View EAP',
1225+
visibility: 'is-authenticated',
1226+
},
1227+
});
1228+
1229+
const eapFullExport = customWrapRoute({
1230+
parent: rootLayout,
1231+
path: 'eap/:eapId/export/full',
1232+
component: {
1233+
render: () => import('#views/EapFullExport'),
1234+
props: {},
1235+
},
1236+
wrapperComponent: Auth,
1237+
context: {
1238+
title: 'EAP Export',
1239+
visibility: 'is-authenticated',
1240+
},
1241+
});
1242+
1243+
const eapSimplifiedExport = customWrapRoute({
1244+
parent: rootLayout,
1245+
path: 'eap/:eapId/export/simplified',
1246+
component: {
1247+
render: () => import('#views/EapSimplifiedExport'),
1248+
props: {},
1249+
},
1250+
wrapperComponent: Auth,
1251+
context: {
1252+
title: 'EAP Export',
1253+
visibility: 'is-authenticated',
1254+
},
1255+
});
1256+
1257+
const eapSummaryExport = customWrapRoute({
1258+
parent: rootLayout,
1259+
path: 'eap/:eapId/export/summary',
1260+
component: {
1261+
render: () => import('#views/EapSummaryExport'),
1262+
props: {},
1263+
},
1264+
wrapperComponent: Auth,
1265+
context: {
1266+
title: 'EAP Full Summary Export',
1267+
visibility: 'is-authenticated',
1268+
},
1269+
});
1270+
10971271
type DefaultPerProcessChild = 'new';
10981272
const perProcessLayout = customWrapRoute({
10991273
parent: rootLayout,
@@ -1317,6 +1491,7 @@ const wrappedRoutes = {
13171491
accountMyFormsPer,
13181492
accountMyFormsDref,
13191493
accountMyFormsThreeW,
1494+
accountMyFormsEap,
13201495
resources,
13211496
search,
13221497
allThreeWProject,
@@ -1353,6 +1528,9 @@ const wrappedRoutes = {
13531528
termsAndConditions,
13541529
operationalLearning,
13551530
montandonLandingPage,
1531+
newEapDevelopmentRegistration,
1532+
fullEapForm,
1533+
simplifiedEapForm,
13561534
...regionRoutes,
13571535
...countryRoutes,
13581536
...surgeRoutes,
@@ -1363,6 +1541,14 @@ const wrappedRoutes = {
13631541
// Redirects
13641542
preparednessOperationalLearning,
13651543
obsoleteFieldReportDetails,
1544+
drefDetail,
1545+
eapDetail,
1546+
drefProcessLayout,
1547+
eapRegistrationLayout,
1548+
eapDevelopmentRegistrationForm,
1549+
eapFullExport,
1550+
eapSimplifiedExport,
1551+
eapSummaryExport,
13661552
};
13671553

13681554
export const unwrappedRoutes = unwrapRoute(Object.values(wrappedRoutes));

app/src/components/GoMapContainer/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ interface Props {
5050
presentationModeAdditionalAfterContent?: React.ReactNode;
5151
onPresentationModeChange?: (newPresentationMode: boolean) => void;
5252
children?: React.ReactNode;
53+
withFullHeight?: boolean;
5354
}
5455

5556
function GoMapContainer(props: Props) {
@@ -63,6 +64,7 @@ function GoMapContainer(props: Props) {
6364
presentationModeAdditionalAfterContent,
6465
onPresentationModeChange,
6566
children,
67+
withFullHeight,
6668
} = props;
6769

6870
const strings = useTranslation(i18n);
@@ -161,6 +163,7 @@ function GoMapContainer(props: Props) {
161163
styles.goMapContainer,
162164
printMode && styles.printMode,
163165
presentationMode && styles.presentationMode,
166+
withFullHeight && styles.withFullHeight,
164167
className,
165168
)}
166169
headingLevel={2}
@@ -236,12 +239,15 @@ function GoMapContainer(props: Props) {
236239
withPadding={presentationMode}
237240
>
238241
<ListView
242+
className={styles.viewContainer}
239243
layout="block"
240244
spacing={presentationMode ? 'lg' : 'none'}
241245
>
242246
{presentationMode && presentationModeAdditionalBeforeContent}
243247
<div className={styles.relativeWrapper}>
244-
<MapContainer className={styles.map} />
248+
<MapContainer
249+
className={styles.map}
250+
/>
245251
<InfoPopup
246252
infoLabel={strings.infoLabel}
247253
className={styles.mapDisclaimer}

app/src/components/GoMapContainer/styles.module.css

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@
6666
}
6767
}
6868

69+
&.with-full-height {
70+
flex-grow: 1;
71+
height: 100%;
72+
73+
.view-container {
74+
height: 100%;
75+
76+
.relative-wrapper {
77+
height: 100%;
78+
79+
.map {
80+
height: 100%;
81+
}
82+
}
83+
}
84+
}
85+
6986
&.presentation-mode {
7087
background-color: var(--go-ui-color-background);
7188
width: 100vw;

app/src/components/Navbar/i18n.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"userMenuDrefProcessDescription":"Disaster Response Emergency Fund (DREF) is the quickest way of getting funding directly to local humanitarian actors. Use one of the links below to submit a DREF Application or an update.",
4141
"userMenuCreateDrefApplication":"Create DREF Application",
4242
"myDrefApplications": "My DREF Applications",
43+
"earlyActionProtocols": "Early Action Protocols (EAP)",
4344
"userMenuSurge":"The section displays the summary of deployments within current and ongoing emergencies. Login to see available details",
4445
"userMenuSurgeGlobalOverview":"Surge Global Overview",
4546
"userMenuOperationalToolbox":"Operational Toolbox",

app/src/components/Navbar/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,14 @@ function Navbar(props: Props) {
353353
>
354354
{strings.myDrefApplications}
355355
</DropdownMenuItem>
356+
<DropdownMenuItem
357+
type="link"
358+
to="accountMyFormsEap"
359+
styleVariant="action"
360+
withoutFullWidth
361+
>
362+
{strings.earlyActionProtocols}
363+
</DropdownMenuItem>
356364
</NavDropdownTabDetails>
357365
<NavDropdownTabDetails
358366
name="surge"

app/src/components/NonFieldError/index.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,11 @@ function NonFieldError<T>(props: Props<T>) {
4949
}
5050

5151
return (
52-
<div className={_cs(
53-
styles.nonFieldError,
54-
className,
55-
)}
52+
<div
53+
className={_cs(
54+
styles.nonFieldError,
55+
className,
56+
)}
5657
>
5758
<AlertLineIcon className={styles.icon} />
5859
<div>

app/src/components/NonFieldError/styles.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
animation-delay: var(--go-ui-duration-animation-slow);
66
gap: var(--go-ui-spacing-sm);
77
color: var(--go-ui-color-red);
8-
font-weight: var(--go-ui-font-weight-medium);
98

109
.icon {
1110
flex-shrink: 0;

app/src/components/PerExportModal/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ import {
1414

1515
import Link from '#components/Link';
1616
import { type components } from '#generated/types';
17-
import { useRequest } from '#utils/restRequest';
17+
import {
18+
type GoApiBody,
19+
useRequest,
20+
} from '#utils/restRequest';
1821

1922
import i18n from './i18n.json';
2023

2124
type ExportStatusEnum = components<'read'>['schemas']['ExportStatusEnum'];
25+
type ExportBody = GoApiBody<'/api/v2/pdf-export/', 'POST'>;
2226

2327
const EXPORT_STATUS_PENDING = 0 satisfies ExportStatusEnum;
2428
const EXPORT_STATUS_COMPLETED = 1 satisfies ExportStatusEnum;
@@ -45,8 +49,11 @@ function PerExportModal(props: Props) {
4549
export_id: Number(perId),
4650
export_type: 'per' as const,
4751
per_country: Number(countryId),
48-
is_pga: false,
49-
}),
52+
is_pga: undefined,
53+
summary: undefined,
54+
version: undefined,
55+
diff: undefined,
56+
} satisfies ExportBody),
5057
[perId, countryId],
5158
);
5259

0 commit comments

Comments
 (0)