@@ -32,12 +32,11 @@ import StatusIcon from '../queue-entry-table-components/status-icon.component';
3232import { getOriginFromPathName } from './active-visits-table.resource' ;
3333import styles from './active-visits-table.scss' ;
3434import EditActionsMenu from './edit-action-menu.components' ;
35- import { usePatientQueuesList } from './patient-queues.resource' ;
35+ import { useParentLocation , usePatientQueuesList } from './patient-queues.resource' ;
3636import PickPatientActionMenu from '../queue-entry-table-components/pick-patient-queue-entry-menu.component' ;
3737import ViewActionsMenu from './view-action-menu.components' ;
3838import NotesActionsMenu from './notes-action-menu.components' ;
3939import { PRIVILEGE_ENABLE_EDIT_DEMOGRAPHICS } from '../constants' ;
40- import PatientSearch from '../patient-search/patient-search.component' ;
4140import { QueueStatus } from '../utils/utils' ;
4241import MovetoNextPointAction from './move-patient-to-next-action-menu.components' ;
4342
@@ -54,18 +53,18 @@ const ActiveVisitsTable: React.FC<ActiveVisitsTableProps> = ({ status }) => {
5453 const { t } = useTranslation ( ) ;
5554 const session = useSession ( ) ;
5655 const layout = useLayoutType ( ) ;
56+ const [ isToggled , setIsToggled ] = useState ( false ) ;
5757
58- const { patientQueueEntries, isLoading } = usePatientQueuesList (
59- session ?. sessionLocation ?. uuid ,
60- status ,
61- session . user . systemId ,
62- ) ;
58+ const handleToggleChange = ( ) => {
59+ setIsToggled ( ! isToggled ) ;
60+ } ;
61+ const { location } = useParentLocation ( session ?. sessionLocation ?. uuid ) ;
62+
63+ const activeLocationUuid = isToggled ? location ?. parentLocation ?. uuid : session ?. sessionLocation ?. uuid ;
64+
65+ const { patientQueueEntries, isLoading } = usePatientQueuesList ( activeLocationUuid || '' , status , isToggled ) ;
6366
64- const [ showOverlay , setShowOverlay ] = useState ( false ) ;
65- const [ view , setView ] = useState ( '' ) ;
66- const [ viewState , setViewState ] = useState < { selectedPatientUuid : string } > ( null ) ;
6767 const [ searchTerm , setSearchTerm ] = useState ( '' ) ;
68- const [ overlayHeader , setOverlayTitle ] = useState ( '' ) ;
6968
7069 const currentPathName : string = window . location . pathname ;
7170 const fromPage : string = getOriginFromPathName ( currentPathName ) ;
@@ -227,17 +226,34 @@ const ActiveVisitsTable: React.FC<ActiveVisitsTableProps> = ({ status }) => {
227226 >
228227 { ( { rows, headers, getHeaderProps, getTableProps, getRowProps } ) => (
229228 < TableContainer className = { styles . tableContainer } >
230- < TableToolbar style = { { position : 'static' , height : '3rem' , overflow : 'visible' , backgroundColor : 'color' } } >
231- < TableToolbarContent className = { styles . toolbarContent } >
232- < Layer className = { styles . toolbarContentLayer } >
233- < TableToolbarSearch
234- expanded
235- className = { styles . search }
236- onChange = { handleSearchInputChange }
237- placeholder = { t ( 'searchThisList' , 'Search this list' ) }
238- size = "sm"
239- />
240- </ Layer >
229+ < TableToolbar
230+ style = { {
231+ position : 'static' ,
232+ overflow : 'visible' ,
233+ backgroundColor : 'color' ,
234+ } }
235+ >
236+ < TableToolbarContent
237+ style = { {
238+ display : 'flex' ,
239+ alignItems : 'center' ,
240+ } }
241+ >
242+ < TableToolbarSearch
243+ expanded
244+ className = { styles . search }
245+ onChange = { handleSearchInputChange }
246+ placeholder = { t ( 'searchThisList' , 'Search this list' ) }
247+ size = "sm"
248+ />
249+ < Toggle
250+ className = { styles . toggle }
251+ labelA = "Off"
252+ labelB = "On"
253+ id = "toggle-1"
254+ toggled = { isToggled }
255+ onToggle = { handleToggleChange }
256+ />
241257 </ TableToolbarContent >
242258 </ TableToolbar >
243259 < Table { ...getTableProps ( ) } className = { styles . activeVisitsTable } >
@@ -292,16 +308,6 @@ const ActiveVisitsTable: React.FC<ActiveVisitsTableProps> = ({ status }) => {
292308 </ TableContainer >
293309 ) }
294310 </ DataTable >
295- { showOverlay && (
296- < PatientSearch
297- view = { view }
298- closePanel = { ( ) => setShowOverlay ( false ) }
299- viewState = { {
300- selectedPatientUuid : viewState . selectedPatientUuid ,
301- } }
302- headerTitle = { overlayHeader }
303- />
304- ) }
305311 </ div >
306312 ) ;
307313} ;
0 commit comments