Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: advanced search pills #8041

Merged
merged 8 commits into from
Nov 25, 2024
29 changes: 26 additions & 3 deletions packages/client/src/search/advancedSearch/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,11 @@ const getLabelForRegistrationStatus = (
DECLARATION_UPDATED: [RegStatus.DeclarationUpdated],
DECLARED: [RegStatus.Declared],
IN_PROGRESS: [RegStatus.InProgress],
REGISTERED: [RegStatus.Registered],
REGISTERED: [RegStatus.Registered, RegStatus.Issued, RegStatus.Certified],
REJECTED: [RegStatus.Rejected],
VALIDATED: [RegStatus.Validated],
WAITING_VALIDATION: [RegStatus.WaitingValidation]
WAITING_VALIDATION: [RegStatus.WaitingValidation],
CORRECTION_REQUESTED: [RegStatus.CorrectionRequested]
}
const statusType = Object.keys(statusLabelMapping).find((key) => {
if (isEqual([...statusList].sort(), [...statusLabelMapping[key]].sort())) {
Expand Down Expand Up @@ -648,6 +649,16 @@ const getLabelForRegistrationStatus = (
{
value: RegStatus.Archived,
label: intl.formatMessage(advancedSearchForm.recordStatusAchived)
},
{
value: RegStatus.CorrectionRequested,
label: intl.formatMessage(
advancedSearchForm.recordStatusCorrectionRequested
)
},
{
value: RegStatus.Validated,
label: intl.formatMessage(advancedSearchForm.recordStatusValidated)
}
]

Expand Down Expand Up @@ -710,6 +721,12 @@ export const getFormattedAdvanceSearchParamPills = (
intl: IntlShape,
offlineData: IOfflineData
): pillKeyValueMap => {
const pillLabelFromTimePeriod = {
[TIME_PERIOD.LAST_90_DAYS]: advancedSearchForm.timePeriodLast90Days,
[TIME_PERIOD.LAST_30_DAYS]: advancedSearchForm.timePeriodLast30Days,
[TIME_PERIOD.LAST_7_DAYS]: advancedSearchForm.timePeriodLast7Days,
[TIME_PERIOD.LAST_YEAR]: advancedSearchForm.timePeriodLastYear
}
const intlFormattedMapOfParams: pillKeyValueMap = {
event:
advancedSearchParamsState.event === 'birth'
Expand All @@ -725,7 +742,13 @@ export const getFormattedAdvanceSearchParamPills = (
)
: '',

timePeriodFrom: advancedSearchParamsState.timePeriodFrom,
timePeriodFrom:
advancedSearchParamsState.timePeriodFrom &&
intl.formatMessage(
pillLabelFromTimePeriod[
advancedSearchParamsState.timePeriodFrom as TIME_PERIOD
]
),
trackingId: advancedSearchParamsState.trackingId,
regNumber: advancedSearchParamsState.registrationNumber,
childFirstName: advancedSearchParamsState.childFirstNames,
Expand Down
Loading