Skip to content

Commit 1655a2b

Browse files
Merge branch 'dev' into Jmpi-bug-notification-screen-pointing-to-deleted-GR-2
2 parents 6d11b4e + ff6f02b commit 1655a2b

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

JeMPI_Apps/JeMPI_UI/src/components/notificationWorklist/NotificationWorklist.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { useConfig } from 'hooks/useConfig'
2727
import CustomPagination from 'components/shared/CustomDataGridPagination'
2828
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker'
2929
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
30-
import MultiSelect from 'components/shared/MultiSelect'
30+
import SelectDropdown from 'components/shared/SelectDropdown'
3131

3232
const NotificationWorklist = () => {
3333
const navigate = useNavigate()
@@ -117,11 +117,12 @@ const NotificationWorklist = () => {
117117
}
118118
}}
119119
/>
120-
<MultiSelect
121-
listValues={[NotificationState.OPEN, NotificationState.CLOSED]}
120+
<SelectDropdown
121+
listValues={[NotificationState.ALL, NotificationState.OPEN, NotificationState.CLOSED]}
122122
label="States"
123123
setSelectedValues={setSelectedStates}
124124
defaultSelectedValues={[NotificationState.OPEN]}
125+
multiple={false}
125126
/>
126127
<Button variant="contained" onClick={() => refetch()} size="large">
127128
Filter

JeMPI_Apps/JeMPI_UI/src/components/shared/MultiSelect.tsx renamed to JeMPI_Apps/JeMPI_UI/src/components/shared/SelectDropdown.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@ function getStyles(value: string, personName: readonly string[], theme: Theme) {
3030
}
3131
}
3232

33-
type MultiSelectProps<T extends string> = {
33+
type SelectDropdownProps<T extends string> = {
3434
listValues: T[]
3535
label: string
3636
defaultSelectedValues: T[]
3737
setSelectedValues: Dispatch<SetStateAction<T[]>>
38+
multiple: boolean
3839
}
39-
const MultiSelect = <T extends string>({
40+
const SelectDropdown = <T extends string>({
4041
listValues,
4142
label,
4243
defaultSelectedValues,
43-
setSelectedValues
44-
}: MultiSelectProps<T>) => {
44+
setSelectedValues,
45+
multiple
46+
}: SelectDropdownProps<T>) => {
4547
const theme = useTheme()
4648
const [selectedValuesList, setSelectedValuesList] = useState(
4749
defaultSelectedValues
@@ -59,22 +61,21 @@ const MultiSelect = <T extends string>({
5961
}, [selectedValuesList])
6062
return (
6163
<FormControl>
62-
<InputLabel id="multiple-status-label">{label}</InputLabel>
64+
<InputLabel id="single-status-label">{label}</InputLabel>
6365
<Select
6466
sx={{ minWidth: 300, maxHeight: 55 }}
65-
labelId="multiple-status-label"
66-
id="multiple-chip"
67-
multiple
67+
labelId="single-status-label"
68+
id="single-chip"
69+
multiple={multiple}
6870
value={selectedValuesList}
6971
onChange={handleChange}
7072
input={<OutlinedInput label={label} />}
7173
renderValue={selected => (
7274
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.5 }}>
73-
{selected.map(value => (
74-
<Chip key={value} label={value} />
75-
))}
75+
<Chip key={selected.toString()} label={selected} />
7676
</Box>
77-
)}
77+
)
78+
}
7879
MenuProps={MenuProps}
7980
>
8081
{listValues.map(value => (
@@ -91,4 +92,4 @@ const MultiSelect = <T extends string>({
9192
)
9293
}
9394

94-
export default MultiSelect
95+
export default SelectDropdown

JeMPI_Apps/JeMPI_UI/src/services/ApiClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
DemographicData,
2828
PatientRecord
2929
} from 'types/PatientRecord'
30-
import { Notifications } from 'types/Notification'
30+
import { Notifications, NotificationState} from 'types/Notification'
3131
import { Config } from 'config'
3232
import axios from 'axios'
3333
import { getCookie } from '../utils/misc'
@@ -95,7 +95,8 @@ export class ApiClient {
9595
endDay: string,
9696
states: string[]
9797
): Promise<Notifications> {
98-
const url = `${ROUTES.GET_NOTIFICATIONS}?limit=${limit}&startDate=${startDay}&endDate=${endDay}&offset=${offset}&states=${states}`
98+
const notificationState = states.includes(NotificationState.ALL.toString()) ? [NotificationState.CLOSED, NotificationState.OPEN] : states;
99+
const url = `${ROUTES.GET_NOTIFICATIONS}?limit=${limit}&startDate=${startDay}&endDate=${endDay}&offset=${offset}&states=${notificationState}`
99100
const { data } = await this.client.get<NotificationResponse>(url)
100101
const { records, skippedRecords, count } = data
101102

JeMPI_Apps/JeMPI_UI/src/types/Notification.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export interface GoldenRecordCandidate {
2020

2121
export enum NotificationState {
2222
OPEN = 'OPEN',
23-
CLOSED = 'CLOSED'
23+
CLOSED = 'CLOSED',
24+
ALL = 'ALL'
2425
}
2526

2627
export type NotificationType = 'THRESHOLD' | 'MARGIN' | 'UPDATE'

0 commit comments

Comments
 (0)