Skip to content

Commit 4a880d7

Browse files
authored
(chore) : add queue empty states (#100)
* add privilegs * fix : add queue empty states * ffic : fix build error
1 parent 94745a3 commit 4a880d7

File tree

6 files changed

+324
-96
lines changed

6 files changed

+324
-96
lines changed

packages/esm-patient-queues-app/src/active-visit-patient-reception/active-visits-reception-table.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import StatusIcon from '../queue-entry-table-components/status-icon.component';
3939
import { SearchTypes } from '../types';
4040
import { usePatientQueuesList } from './active-visits-reception.resource';
4141
import styles from './active-visits-reception.scss';
42+
import EmptyState from '../utils/empty-state/empty-state.component';
4243

4344
type FilterProps = {
4445
rowIds: Array<string>;
@@ -347,7 +348,6 @@ function ActiveVisitsReceptionTable() {
347348
<div className={!isDesktop(layout) ? styles.tabletHeading : styles.desktopHeading}>
348349
<span className={styles.heading}>{`Checked In Patients`}</span>
349350
</div>
350-
{/* <UserHasAccess privilege={PRIVILEGE_CHECKIN}> */}
351351
<div className={styles.headerButtons}>
352352
<ExtensionSlot
353353
name="patient-search-button-slot"
@@ -376,8 +376,8 @@ function ActiveVisitsReceptionTable() {
376376
headerTitle={overlayHeader}
377377
/>
378378
)}
379-
{/* </UserHasAccess> */}
380379
</div>
380+
<EmptyState msg="No patient queue items to display" helper="" />
381381
</div>
382382
);
383383
}

packages/esm-patient-queues-app/src/active-visits/active-visits-table.component.tsx

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import styles from './active-visits-table.scss';
6262
import EditActionsMenu from './edit-action-menu.components';
6363
import { usePatientQueuesList } from './patient-queues.resource';
6464
import PickPatientActionMenu from '../queue-entry-table-components/pick-patient-queue-entry-menu.component';
65+
import EmptyState from '../utils/empty-state/empty-state.component';
6566

6667
type FilterProps = {
6768
rowIds: Array<string>;
@@ -385,70 +386,6 @@ const ActiveVisitsTable: React.FC<ActiveVisitsTableProps> = ({ status }) => {
385386
);
386387
}
387388

388-
return (
389-
<div className={styles.container}>
390-
{useQueueTableTabs === false ? (
391-
<>
392-
<div className={styles.headerContainer}>
393-
<UserHasAccess privilege={PRIVILEGE_CHECKIN}>
394-
<div className={styles.headerButtons}>
395-
<ExtensionSlot
396-
name="patient-search-button-slot"
397-
state={{
398-
buttonText: t('checkIn', 'Check In'),
399-
overlayHeader: t('checkIn', 'Check In'),
400-
buttonProps: {
401-
kind: 'secondary',
402-
renderIcon: (props) => <Add size={16} {...props} />,
403-
size: 'sm',
404-
},
405-
selectPatientAction: (selectedPatientUuid) => {
406-
setShowOverlay(true);
407-
setView(SearchTypes.SCHEDULED_VISITS);
408-
setViewState({ selectedPatientUuid });
409-
setOverlayTitle(t('checkIn', 'Check In'));
410-
},
411-
}}
412-
/>
413-
</div>
414-
</UserHasAccess>
415-
</div>
416-
</>
417-
) : null}
418-
<div className={styles.tileContainer}>
419-
<Tile className={styles.tile}>
420-
<p className={styles.content}>{t('noPatientsToDisplay', 'No patients to display')}</p>
421-
<UserHasAccess privilege={PRIVILEGE_CHECKIN}>
422-
<ExtensionSlot
423-
name="patient-search-button-slot"
424-
state={{
425-
buttonText: t('checkIn', 'Check In'),
426-
overlayHeader: t('checkIn', 'Check In'),
427-
buttonProps: {
428-
kind: 'ghost',
429-
renderIcon: (props) => <Add size={16} {...props} />,
430-
size: 'sm',
431-
},
432-
selectPatientAction: (selectedPatientUuid) => {
433-
setShowOverlay(true);
434-
setView(SearchTypes.SCHEDULED_VISITS);
435-
setViewState({ selectedPatientUuid });
436-
setOverlayTitle(t('checkIn', 'Check In'));
437-
},
438-
}}
439-
/>
440-
</UserHasAccess>
441-
</Tile>
442-
</div>
443-
{showOverlay && (
444-
<PatientSearch
445-
view={view}
446-
closePanel={() => setShowOverlay(false)}
447-
viewState={viewState}
448-
headerTitle={overlayHeader}
449-
/>
450-
)}
451-
</div>
452-
);
389+
return <EmptyState msg="No queue items to display" helper="" />;
453390
};
454391
export default ActiveVisitsTable;

packages/esm-patient-queues-app/src/active-visits/change-status-dialog.component.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,25 @@ const ChangeStatus: React.FC<ChangeStatusDialogProps> = ({ queueEntry, currentEn
187187
// endvisit
188188
endVisitStatus;
189189

190-
// view patient summary
191-
navigate({ to: `\${openmrsSpaBase}/patient/${currentEntry.patientUuid}/chart` });
190+
// pick and route
191+
const status = 'Picked';
192+
updateQueueEntry(status, provider, currentEntry?.id, priorityComment, 'comment').then(
193+
() => {
194+
// view patient summary
195+
navigate({ to: `\${openmrsSpaBase}/patient/${currentEntry.patientUuid}/chart` });
196+
197+
closeModal();
198+
mutate();
199+
},
200+
(error) => {
201+
showNotification({
202+
title: t('queueEntryUpdateFailed', 'Error updating queue entry status'),
203+
kind: 'error',
204+
critical: true,
205+
description: error?.message,
206+
});
207+
},
208+
);
192209

193210
closeModal();
194211
mutate();
@@ -213,6 +230,7 @@ const ChangeStatus: React.FC<ChangeStatusDialogProps> = ({ queueEntry, currentEn
213230
closeModal,
214231
mutate,
215232
endVisitStatus,
233+
currentEntry?.id,
216234
currentEntry.patientUuid,
217235
],
218236
);
@@ -234,10 +252,10 @@ const ChangeStatus: React.FC<ChangeStatusDialogProps> = ({ queueEntry, currentEn
234252
&nbsp;
235253
{t('years', 'Years')}
236254
</h5>
237-
255+
<br></br>
256+
<hr />
238257
<br></br>
239258
<h4 className={styles.section}> Currently Serving :</h4>
240-
241259
<h5 className={styles.section}>
242260
{queueEntry.name} &nbsp; · &nbsp;{queueEntry.patientSex} &nbsp; · &nbsp;{queueEntry.patientAge}&nbsp;
243261
{t('years', 'Years')}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import React from 'react';
2+
import { Layer, Tile } from '@carbon/react';
3+
import styles from './empty-state.scss';
4+
5+
type EmptyStateProps = {
6+
msg: string;
7+
helper: string;
8+
};
9+
10+
const EmptyState: React.FC<EmptyStateProps> = ({ msg, helper }: EmptyStateProps) => {
11+
return (
12+
<Layer className={styles.layer}>
13+
<Tile className={styles.tile}>
14+
<svg width={64} height={64} viewBox="0 0 64 64">
15+
<title>Empty data illustration</title>
16+
<g fill="none" fillRule="evenodd">
17+
<path
18+
d="M38.133 13.186H21.947c-.768.001-1.39.623-1.39 1.391V50.55l-.186.057-3.97 1.216a.743.743 0 01-.927-.493L3.664 12.751a.742.742 0 01.492-.926l6.118-1.874 17.738-5.43 6.119-1.873a.741.741 0 01.926.492L38.076 13l.057.186z"
19+
fill="#F4F4F4"
20+
/>
21+
<path
22+
d="M41.664 13L38.026 1.117A1.576 1.576 0 0036.056.07l-8.601 2.633-17.737 5.43-8.603 2.634a1.578 1.578 0 00-1.046 1.97l12.436 40.616a1.58 1.58 0 001.969 1.046l5.897-1.805.185-.057v-.194l-.185.057-5.952 1.822a1.393 1.393 0 01-1.737-.923L.247 12.682a1.39 1.39 0 01.923-1.738L9.772 8.31 27.51 2.881 36.112.247a1.393 1.393 0 011.737.923L41.47 13l.057.186h.193l-.057-.185z"
23+
fill="#8D8D8D"
24+
/>
25+
<path
26+
d="M11.378 11.855a.836.836 0 01-.798-.59L9.385 7.361a.835.835 0 01.554-1.042l16.318-4.996a.836.836 0 011.042.554l1.195 3.902a.836.836 0 01-.554 1.043l-16.318 4.995a.831.831 0 01-.244.037z"
27+
fill="#C6C6C6"
28+
/>
29+
<circle fill="#C6C6C6" cx={17.636} cy={2.314} r={1.855} />
30+
<circle fill="#FFF" fillRule="nonzero" cx={17.636} cy={2.314} r={1.175} />
31+
<path
32+
d="M55.893 53.995H24.544a.79.79 0 01-.788-.789V15.644a.79.79 0 01.788-.788h31.349a.79.79 0 01.788.788v37.562a.79.79 0 01-.788.789z"
33+
fill="#F4F4F4"
34+
/>
35+
<path
36+
d="M41.47 13H21.948a1.579 1.579 0 00-1.576 1.577V52.4l.185-.057V14.577c.001-.768.623-1.39 1.391-1.39h19.581L41.471 13zm17.02 0H21.947a1.579 1.579 0 00-1.576 1.577v42.478c0 .87.706 1.576 1.576 1.577H58.49a1.579 1.579 0 001.576-1.577V14.577a1.579 1.579 0 00-1.576-1.576zm1.39 44.055c0 .768-.622 1.39-1.39 1.392H21.947c-.768-.001-1.39-.624-1.39-1.392V14.577c0-.768.622-1.39 1.39-1.39H58.49c.768 0 1.39.622 1.39 1.39v42.478z"
37+
fill="#8D8D8D"
38+
/>
39+
<path
40+
d="M48.751 17.082H31.686a.836.836 0 01-.835-.835v-4.081c0-.46.374-.834.835-.835H48.75c.461 0 .834.374.835.835v4.08c0 .462-.374.835-.835.836z"
41+
fill="#C6C6C6"
42+
/>
43+
<circle fill="#C6C6C6" cx={40.218} cy={9.755} r={1.855} />
44+
<circle fill="#FFF" fillRule="nonzero" cx={40.218} cy={9.755} r={1.13} />
45+
</g>
46+
</svg>
47+
<p className={styles.content}>{msg}</p>
48+
<p className={styles.explainer}>{helper}</p>
49+
</Tile>
50+
</Layer>
51+
);
52+
};
53+
54+
export default EmptyState;
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@use '@carbon/styles/scss/colors';
2+
@use "@carbon/styles/scss/spacing";
3+
@use "@carbon/styles/scss/type";
4+
5+
.desktopHeading {
6+
h4 {
7+
@include type.type-style("heading-compact-02");
8+
color: colors.$gray-70;
9+
}
10+
}
11+
12+
.tabletHeading {
13+
h4 {
14+
@include type.type-style("heading-03");
15+
color: colors.$gray-70;
16+
}
17+
}
18+
19+
.desktopHeading,
20+
.tabletHeading {
21+
text-align: left;
22+
text-transform: capitalize;
23+
margin-bottom: spacing.$spacing-05;
24+
25+
h4:after {
26+
content: "";
27+
display: block;
28+
width: 2rem;
29+
padding-top: 0.188rem;
30+
border-bottom: 0.375rem solid var(--brand-03);
31+
}
32+
}
33+
34+
.heading:after {
35+
content: "";
36+
display: block;
37+
width: 2rem;
38+
padding-top: 0.188rem;
39+
border-bottom: 0.375rem solid var(--brand-03);
40+
}
41+
42+
.tile {
43+
padding: 2rem;
44+
}
45+
46+
.layer {
47+
margin: 1rem 0;
48+
text-align: center;
49+
border: 1px solid colors.$gray-20;
50+
}
51+
52+
.content {
53+
@include type.type-style("heading-compact-02");
54+
color: colors.$gray-70;
55+
margin-top: spacing.$spacing-05;
56+
margin-bottom: spacing.$spacing-03;
57+
}
58+
59+
.explainer {
60+
@include type.type-style('body-compact-01');
61+
color: colors.$gray-70;
62+
}

0 commit comments

Comments
 (0)