From d40e273543782eb8b36d88212a65918e9e1ab51f Mon Sep 17 00:00:00 2001 From: Quang Son Le Date: Thu, 19 Dec 2024 14:21:15 +0100 Subject: [PATCH] POLIO-1803: fix vaccine dropdown - show individual vaccines for bOPV & nOPV2 campaigns - Include subactivities vaccines --- plugins/polio/js/src/constants/types.ts | 2 ++ .../VaccineModule/SupplyChain/constants.ts | 15 +++++++++++++++ .../VaccineModule/SupplyChain/hooks/api/vrf.tsx | 10 +++++----- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/plugins/polio/js/src/constants/types.ts b/plugins/polio/js/src/constants/types.ts index c8694e6b9f..50cb69f58e 100644 --- a/plugins/polio/js/src/constants/types.ts +++ b/plugins/polio/js/src/constants/types.ts @@ -260,6 +260,7 @@ export type RoundDateHistoryEntry = { export type Round = { id: number; + vaccine_names_extended:string; started_at: Nullable; ended_at: Nullable; mop_up_started_at: Nullable; // date @@ -308,6 +309,7 @@ export type Campaign = { created_at: string; updated_at: string; deleted_at: Nullable; + single_vaccines?: string; rounds: Round[]; org_unit: { id: number; diff --git a/plugins/polio/js/src/domains/VaccineModule/SupplyChain/constants.ts b/plugins/polio/js/src/domains/VaccineModule/SupplyChain/constants.ts index 29f4495c8e..30c570e8da 100644 --- a/plugins/polio/js/src/domains/VaccineModule/SupplyChain/constants.ts +++ b/plugins/polio/js/src/domains/VaccineModule/SupplyChain/constants.ts @@ -22,3 +22,18 @@ export const defaultVaccineOptions = [ value: 'nOPV2 & bOPV', }, ]; + +export const singleVaccinesList = [ + { + label: 'nOPV2', + value: 'nOPV2', + }, + { + label: 'mOPV2', + value: 'mOPV2', + }, + { + label: 'bOPV', + value: 'bOPV', + }, +] diff --git a/plugins/polio/js/src/domains/VaccineModule/SupplyChain/hooks/api/vrf.tsx b/plugins/polio/js/src/domains/VaccineModule/SupplyChain/hooks/api/vrf.tsx index 1ed21eb288..7801c4efb4 100644 --- a/plugins/polio/js/src/domains/VaccineModule/SupplyChain/hooks/api/vrf.tsx +++ b/plugins/polio/js/src/domains/VaccineModule/SupplyChain/hooks/api/vrf.tsx @@ -39,7 +39,7 @@ import { CampaignCategory, useGetCampaigns, } from '../../../../Campaigns/hooks/api/useGetCampaigns'; -import { apiUrl, defaultVaccineOptions } from '../../constants'; +import { apiUrl, defaultVaccineOptions, singleVaccinesList } from '../../constants'; import MESSAGES from '../../messages'; import { CampaignDropdowns, @@ -133,15 +133,15 @@ export const useCampaignDropDowns = ( label: c.obr_name, value: c.obr_name, })); - const vaccines = selectedCampaign?.vaccines - ? selectedCampaign.vaccines.split(',').map(vaccineName => ({ + const vaccines = selectedCampaign?.single_vaccines + ? selectedCampaign.single_vaccines.split(',').map(vaccineName => ({ label: vaccineName, value: vaccineName, })) - : defaultVaccineOptions; + : singleVaccinesList; const rounds = vaccine ? (selectedCampaign?.rounds ?? []) - .filter(round => round.vaccine_names.includes(vaccine)) + .filter(round => round.vaccine_names_extended.includes(vaccine)) .map(round => ({ label: `Round ${round.number}`, value: `${round.number}`,