Skip to content

Commit bcba278

Browse files
committed
fix(eap): implement feedback changes in eap sections and forms
- update strings throughout the EAP sections and forms - add missing required validation in form schema - Update total budget in full EAP from NumberInput to TextOutput
1 parent 5f4893b commit bcba278

10 files changed

Lines changed: 49 additions & 17 deletions

File tree

app/src/views/AccountMyFormsEap/EapTableActions/i18n.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
"startSimplifiedEapLinkLabel": "Start sEAP",
66
"editFullEapLinkLabel": "Edit Full EAP",
77
"viewFullEapLinkLabel": "View Full EAP",
8-
"exportWithChangesButtonLabel": "Export with changes",
8+
"exportWithChangesButtonLabel": "Export with track changes",
99
"exportButtonLabel": "Export",
1010
"exportSummaryButtonLabel": "Export Summary",
1111
"previewExportLinkLabel": "Preview export",
1212
"previewSummaryExportLinkLabel": "Preview summary export",
13-
"downloadReviewChecklistLinkLabel": "Download review checklist",
13+
"downloadReviewChecklistLinkLabel": "Download Review checklist",
1414
"downloadUpdatedChecklistLinkLabel": "Download updated checklist",
1515
"editSimplifiedEapLinkLabel": "Edit sEAP",
1616
"viewSimplifiedEapLinkLabel": "View sEAP",

app/src/views/AccountMyFormsLayout/i18n.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"strings": {
44
"fieldReportTabTitle": "Field Report",
55
"perTabTitle": "PER",
6-
"drefTabTitle": "DREF",
6+
"drefTabTitle": "DREF Applications",
77
"threeWTabTitle": "3W",
88
"eapApplications": "EAP Applications"
99
}
10-
}
10+
}

app/src/views/EapFullForm/FinanceLogistics/index.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { type PartialEapFullFormType } from '../schema';
2929
import SectionQualityCriteria from '../SectionQualityCriteria';
3030

3131
import i18n from './i18n.json';
32+
import NonFieldError from '#components/NonFieldError';
3233

3334
interface Props {
3435
value: PartialEapFullFormType;
@@ -162,15 +163,14 @@ function FinanceLogistics(props: Props) {
162163
)}
163164
withAsteriskOnTitle
164165
>
165-
<NumberInput
166+
<TextOutput
167+
valueType="number"
168+
strongLabel
166169
label={strings.financeTotalBudgetLabel}
167-
name="total_budget"
168170
value={value.total_budget}
171+
/>
172+
<NonFieldError
169173
error={error?.total_budget}
170-
onChange={setFieldValue}
171-
disabled={disabled}
172-
readOnly
173-
required
174174
/>
175175
<TextArea
176176
label={strings.financeDescriptionLabel}

app/src/views/EapFullForm/Overview/KeyActorsInput/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ function KeyActorsInput(props: Props) {
9797
/>
9898
<TextArea
9999
label={strings.overviewKeyActorsDescriptionLabel}
100+
error={error?.description}
100101
name="description"
101102
value={value?.description}
102103
onChange={onFieldChange}

app/src/views/EapFullForm/SelectionActions/OperationInput/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function OperationsInput(props: Props) {
8787
numPreferredGridColumns={3}
8888
>
8989
<NumberInput
90+
required
9091
label={strings.selectionActionsPlannedOperationPeopleTargeted}
9192
name="people_targeted"
9293
value={value?.people_targeted}
@@ -96,6 +97,7 @@ function OperationsInput(props: Props) {
9697
readOnly={readOnly}
9798
/>
9899
<NumberInput
100+
required
99101
label={strings.selectionActionsPlannedOperationBudget}
100102
name="budget_per_sector"
101103
value={value?.budget_per_sector}
@@ -105,6 +107,7 @@ function OperationsInput(props: Props) {
105107
readOnly={readOnly}
106108
/>
107109
<NumberInput
110+
required
108111
label={strings.selectionActionsPlannedOperationApCode}
109112
name="ap_code"
110113
value={value?.ap_code}

app/src/views/EapFullForm/TriggerModel/i18n.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"sourcesForecastDescription": "Add respective source(s) for the forecast and the link to the website, if applicable.",
1616
"forecastExplanatoryNote": "In order for the DREF to approve funding when a trigger occurs, there must be a certain probability the extreme event will take place. To safeguard this, it is crucial to select those forecasts that have a certain “skill” level (certain level of confidence). If observations are used, these can also be included in the table. Note that this information does not need to be calculated by the National Society but can be obtained by working with hydro-meteorological services, research institutions, experts etc.",
1717
"forecastSelectionTitle": "Forecast selection",
18-
"downloadForecastTableLabel": "Download Forecast table",
18+
"downloadForecastTableLabel": "Download Menu of Forecast",
1919
"forecastRequiredPoint1": "State clearly which forecast(s) and observations will be used and why they were chosen.",
2020
"forecastRequiredPoint2": "Include a table with all available forecasts for your hazard. The table must include: Name of forecast, Lead time, Source, False Alarm Ratio, Number of times the forecast has been issued for this hazard in the last 10 years ",
2121
"forecastSelectionDescription": "State clearly which forecast(s) and observations will be used and why they were chosen. Include a table with all available forecasts for your hazard. The table must include: Name of forecast, Lead time, Source, False Alarm Ratio, Number of times the forecast has been issued for this hazard in the last 10 years.",

app/src/views/EapFullForm/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,12 @@ export function Component() {
343343
return formValue?.cover_image_file?.client_id;
344344
}
345345

346+
match = matchArray(locations, ['key_actors', NUM]);
347+
if (isDefined(match)) {
348+
const [index] = match;
349+
return formValue?.key_actors?.[index!]?.client_id;
350+
}
351+
346352
match = matchArray(locations, ['partner_contacts', NUM]);
347353
if (isDefined(match)) {
348354
const [index] = match;
@@ -1075,6 +1081,7 @@ export function Component() {
10751081
name={undefined}
10761082
onClick={handleRequestForApprovalButtonClick}
10771083
disabled={readOnly}
1084+
styleVariant="filled"
10781085
>
10791086
{strings.submitButtonLabel}
10801087
</Button>

app/src/views/EapFullForm/schema.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import {
66
import {
77
addCondition,
88
emailCondition,
9+
lessThanOrEqualToCondition,
910
type LiteralSchema,
1011
nullValue,
1112
type ObjectSchema,
1213
type PartialForm,
1314
type PurgeNull,
15+
requiredListCondition,
1416
requiredStringCondition,
1517
undefinedValue,
1618
urlCondition,
@@ -632,6 +634,8 @@ export const formSchema: EapFullFormSchema = {
632634
},
633635

634636
key_actors: {
637+
required: isSubmit,
638+
validation: requiredListCondition,
635639
keySelector: (item) => item.client_id,
636640
member: () => ({
637641
fields: (): KeyActorsFormFields => ({
@@ -911,8 +915,12 @@ export const formSchema: EapFullFormSchema = {
911915
fields: (): PlannedOperationalFields => ({
912916
id: { defaultValue: undefinedValue },
913917
sector: {},
914-
budget_per_sector: {},
915-
ap_code: {},
918+
budget_per_sector: {
919+
required: isSubmit,
920+
},
921+
ap_code: {
922+
required: isSubmit,
923+
},
916924
indicators: {
917925
keySelector: (indicator) => indicator.client_id,
918926
member: () => indicatorSchema,
@@ -963,8 +971,12 @@ export const formSchema: EapFullFormSchema = {
963971
fields: (): EnableApproachesFields => ({
964972
id: { defaultValue: undefinedValue },
965973
approach: {},
966-
budget_per_approach: {},
967-
ap_code: {},
974+
budget_per_approach: {
975+
required: isSubmit,
976+
},
977+
ap_code: {
978+
required: isSubmit,
979+
},
968980
indicators: {
969981
keySelector: (indicator) => indicator.client_id,
970982
member: () => indicatorSchema,
@@ -1059,6 +1071,7 @@ export const formSchema: EapFullFormSchema = {
10591071
people_targeted: {
10601072
required: isSubmit,
10611073
validations: [
1074+
lessThanOrEqualToCondition(10000),
10621075
positiveIntegerCondition,
10631076
],
10641077
},

app/src/views/EapSimplifiedForm/RiskAnalysis/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function RiskAnalysis(props: Props) {
201201
error={error?.prioritized_hazard_and_impact}
202202
disabled={disabled}
203203
readOnly={readOnly}
204-
maxLength={charLimits.pre_positioning_budget}
204+
maxLength={charLimits.prioritized_hazard_and_impact}
205205
/>
206206
<MultiImageWithCaptionInput
207207
name="hazard_impact_images"

app/src/views/EapSimplifiedForm/schema.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
} from '@togglecorp/fujs';
66
import {
77
emailCondition,
8+
lessThanOrEqualToCondition,
89
type LiteralSchema,
910
type ObjectSchema,
1011
type PartialForm,
@@ -16,6 +17,7 @@ import {
1617
import indicatorSchema from '#components/domain/EapIndicatorInput/schema';
1718
import operationActivitySchema from '#components/domain/EapOperationActivityInput/schema';
1819
import { lengthSmallerOrEqualToCondition } from '#utils/common';
20+
import { positiveIntegerCondition } from '#utils/form';
1921
import { type GoApiBody } from '#utils/restRequest';
2022

2123
import { charLimits } from './common';
@@ -417,7 +419,13 @@ export const formSchema: FormSchema = {
417419
charLimits.potential_geographical_high_risk_areas,
418420
)],
419421
},
420-
people_targeted: { required: isSubmit },
422+
people_targeted: {
423+
required: isSubmit,
424+
validations: [
425+
positiveIntegerCondition,
426+
lessThanOrEqualToCondition(2000),
427+
],
428+
},
421429
assisted_through_operation: {
422430
required: isSubmit,
423431
requiredValidation: requiredStringCondition,

0 commit comments

Comments
 (0)