Skip to content

Commit

Permalink
Disable link for regions in rapid response personnel table
Browse files Browse the repository at this point in the history
  • Loading branch information
utsukta1 committed Jan 16, 2024
1 parent 3e8ad2d commit 1666240
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
16 changes: 12 additions & 4 deletions src/views/AllDeployedPersonnel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import Table from '#components/Table';
import DateInput from '#components/DateInput';
import useFilterState from '#hooks/useFilterState';

import { isDefined } from '@togglecorp/fujs';
import i18n from './i18n.json';

type PersonnelTableItem = NonNullable<GoApiResponse<'/api/v2/personnel/'>['results']>[number];
Expand Down Expand Up @@ -131,10 +132,17 @@ export function Component() {
item.country_from?.society_name
|| item.country_from?.name
),
(item) => ({
to: 'countriesLayout',
urlParams: { countryId: item.country_from?.id },
}),
(item) => {
if (isDefined(item.country_from?.record_type === 3)) {
return {
to: undefined,
};
}
return {
to: 'countriesLayout',
urlParams: { countryId: item.country_from?.id },
};
},
{ sortable: true },
),
createLinkColumn<PersonnelTableItem, number>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,15 @@ export default function RapidResponsePersonnelTable(props: Props) {
strings.personnelTableDeployedParty,
(item) => item.country_from?.society_name,
(item) => {
if (item.country_from?.id) {
if (isDefined(item.country_from?.record_type === 3)) {
return {
to: 'countriesLayout',
urlParams: { countryId: item.country_from?.id },
to: undefined,
};
}
return strings.emergencySurgePartyNotFound;
return {
to: 'countriesLayout',
urlParams: { countryId: item.country_from?.id },
};
},
{ sortable: true },
),
Expand Down Expand Up @@ -183,7 +185,6 @@ export default function RapidResponsePersonnelTable(props: Props) {
strings.personnelTableDeployedParty,
strings.personnelTableDeployedTo,
strings.personnelTableName,
strings.emergencySurgePartyNotFound,
getTypeName,
dateRange,
],
Expand Down
2 changes: 1 addition & 1 deletion src/views/EmergencySurge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import KeyFigure from '#components/KeyFigure';
import useTranslation from '#hooks/useTranslation';
import SurgeTable from './SurgeTable';
import RapidResponsePersonnelTable from './RapidResponsePerosnnelTable';
import RapidResponsePersonnelTable from './RapidResponsePersonnelTable';
import DeployedErusTable from './DeployedErusTable';

import i18n from './i18n.json';
Expand Down

0 comments on commit 1666240

Please sign in to comment.