File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
EmergencySurge/RapidResponsePersonnelTable Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -28,10 +28,10 @@ import {
2828 useRequest ,
2929} from '#utils/restRequest' ;
3030import { resolveToComponent } from '#utils/translation' ;
31+ import { COUNTRY_RECORD_TYPE_REGION } from '#utils/constants' ;
32+ import { countryIdToRegionIdMap } from '#utils/domain/country' ;
3133
3234import i18n from './i18n.json' ;
33- import { COUNTRY_RECORD_TYPE_COUNTRY , COUNTRY_RECORD_TYPE_REGION } from '#utils/constants' ;
34- import { countryIdToRegionIdMap } from '#utils/domain/country' ;
3535
3636type PersonnelTableItem = NonNullable < GoApiResponse < '/api/v2/personnel/' > [ 'results' ] > [ number ] ;
3737function keySelector ( personnel : PersonnelTableItem ) {
Original file line number Diff line number Diff line change @@ -316,13 +316,13 @@ const schema: DrefFormSchema = {
316316 lessons_learned : { } ,
317317 event_scope : { } ,
318318 people_in_need : { validations : [ positiveIntegerCondition ] } ,
319- event_text : { validations : [ max500CharCondition ] } ,
320319 } ;
321320 }
322321
323322 if ( val ?. type_of_dref === TYPE_IMMINENT ) {
324323 conditionalFields = {
325324 ...conditionalFields ,
325+ event_text : { validations : [ max500CharCondition ] } ,
326326 anticipatory_actions : { } ,
327327 supporting_document : { } ,
328328 } ;
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ import {
2828 maxSafe ,
2929 minSafe ,
3030} from '#utils/common' ;
31+ import { COUNTRY_RECORD_TYPE_REGION } from '#utils/constants' ;
32+ import { countryIdToRegionIdMap } from '#utils/domain/country' ;
3133
3234import i18n from './i18n.json' ;
3335import styles from './styles.module.css' ;
@@ -142,14 +144,26 @@ export default function RapidResponsePersonnelTable(props: Props) {
142144 strings . personnelTableDeployedParty ,
143145 ( item ) => item . country_from ?. society_name ,
144146 ( item ) => {
145- if ( isDefined ( item . country_from ?. record_type === 3 ) ) {
147+ if ( isNotDefined ( item . country_from ) ) {
148+ return { to : undefined } ;
149+ }
150+
151+ const countryId = item . country_from . id ;
152+
153+ if ( item . country_from . record_type === COUNTRY_RECORD_TYPE_REGION ) {
154+ const regionId = isDefined ( countryId )
155+ ? countryIdToRegionIdMap [ countryId ]
156+ : undefined ;
157+
146158 return {
147- to : undefined ,
159+ to : 'regionsLayout' ,
160+ urlParams : { regionId } ,
148161 } ;
149162 }
163+
150164 return {
151165 to : 'countriesLayout' ,
152- urlParams : { countryId : item . country_from ?. id } ,
166+ urlParams : { countryId } ,
153167 } ;
154168 } ,
155169 { sortable : true } ,
You can’t perform that action at this time.
0 commit comments