Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.

Commit 3aa2c10

Browse files
committed
Merge branch 'main' of github.com:DIPSAS/hello-open-dips
2 parents 332e2a5 + 5bc1818 commit 3aa2c10

3 files changed

Lines changed: 58 additions & 13 deletions

File tree

src/pages/appointments/[id].tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ const Patient: React.FC = () => {
5151
if (!extensions) return 'No details available';
5252
for (let i = 0; i < extensions.length; i++) {
5353
const extension = extensions?.[i];
54-
// console.log(extension);
5554
if (extension.valueCodeableConcept?.coding) {
5655
for (let j = 0; j < extension.valueCodeableConcept.coding.length; j++) {
5756
const coding = extension.valueCodeableConcept?.coding?.[j];
@@ -81,6 +80,7 @@ if (!patient) {
8180
);
8281
}
8382

83+
8484
if(patient && appointments && encounters){
8585

8686
return (
@@ -112,7 +112,7 @@ if(patient && appointments && encounters){
112112
<AppointmentsEncountersInfo title= "Appointments" onClose={handleCloseList}>
113113
<ul className={styles.appointmentList}>
114114
<div>
115-
<ul className={styles.appointmentWrapper}>
115+
{appointments?.total && <ul className={styles.appointmentWrapper}>
116116
{appointments?.entry?.map((entry) => {
117117
const resource = entry.resource as R4.IAppointment;
118118
const display = getDisplayFromExtensions(resource.extension);
@@ -125,7 +125,8 @@ if(patient && appointments && encounters){
125125
</li>
126126
);
127127
})}
128-
</ul>
128+
</ul>}
129+
{!appointments?.total && <p className="conditions-error">The patient has no appointments.</p>}
129130
</div>
130131
</ul>
131132
</AppointmentsEncountersInfo>
@@ -137,7 +138,7 @@ if(patient && appointments && encounters){
137138
<AppointmentsEncountersInfo title="Encounters" onClose={handleCloseList}>
138139
<ul className={styles.encounterList}>
139140
<div>
140-
<ul className={styles.appointmentWrapper}>
141+
{encounters?.total && <ul className={styles.appointmentWrapper}>
141142
{encounters?.entry?.map((entry) => {
142143
const resource = entry.resource as R4.IEncounter;
143144
return (
@@ -150,7 +151,8 @@ if(patient && appointments && encounters){
150151
</li>
151152
)
152153
})}
153-
</ul>
154+
</ul>}
155+
{!encounters?.total && <p className="conditions-error">The patient has no encounters.</p>}
154156
</div>
155157
</ul>
156158
</AppointmentsEncountersInfo>

src/pages/documents/[id].tsx

Lines changed: 50 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ const Documents: React.FC = () => {
104104

105105
if(documents){
106106
if(documents.entry){
107-
return (
108-
<div className={styles.total}>
107+
if(documents.total){
108+
109+
return (
110+
<div className={styles.total}>
109111
<div className={styles.goBack}>
110112
<PatientOverview patientId={patientId as string}/></div>
111113
<div className={styles.metaDataBox}>
@@ -125,20 +127,26 @@ const Documents: React.FC = () => {
125127
</p>
126128
</div>
127129
</div>
128-
{loading &&
130+
{(loading || !document) && currentDocumentID && !documentLoadError &&
129131
<span className={loadingstyles.loader}>
130132
<Spinner />
131133
</span>}
132134
{loading == false && currentDocumentID && !documentLoadError && document &&
133135
<div className={styles.documentViewer}>
134136
<iframe src={`data:application/pdf;base64,${document}`}/>
135137
</div>}
136-
{!currentDocumentID && !loading && !documentLoadError &&
138+
{!currentDocumentID && !loading && !documentLoadError && documents.total > 0 &&
137139
<div className={styles.documentInfo}>
138140
<p>
139141
Please select a document
140142
</p>
141143
</div>}
144+
{!currentDocumentID && !loading && !documentLoadError && documents.total == 0 &&
145+
<div className={styles.documentInfo}>
146+
<p>
147+
There is no documents here
148+
</p>
149+
</div>}
142150
{loading == false && currentDocumentID && documentLoadError &&
143151
<div className={styles.documentError}>
144152
<p>
@@ -155,16 +163,51 @@ const Documents: React.FC = () => {
155163

156164
</div>
157165
}
166+
158167
</div>
159168
)
169+
}
170+
else{
171+
return (
172+
<div className={styles.total}>
173+
<div className={styles.goBack}>
174+
<PatientOverview patientId={patientId as string}/>
175+
</div>
176+
<div className={styles.documentInfo}>
177+
<p>
178+
There is no documents here
179+
</p>
180+
</div>
181+
</div>)
182+
}
160183
}
161184
else{
162-
return <></>
185+
return (
186+
<div className={styles.total}>
187+
<div className={styles.goBack}>
188+
<PatientOverview patientId={patientId as string}/>
189+
</div>
190+
<div className={styles.documentInfo}>
191+
<p>
192+
Could not get any documents assosiated with the patient
193+
</p>
194+
</div>
195+
</div>)
163196
}
164-
197+
165198
}
166199
else if (!loading){
167-
return <h1> Could not find documents related to {patientId}</h1>
200+
return(
201+
<div className={styles.total}>
202+
<div className={styles.goBack}>
203+
<PatientOverview patientId={patientId as string}/>
204+
</div>
205+
<div className={styles.documentInfo}>
206+
<p>
207+
Could not find documents related to {patientId}
208+
</p>
209+
</div>
210+
</div>)
168211
}
169212
else if (loading){
170213
return (

src/styles/appointment.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
.appointmentList, .encounterList {
99
list-style-type: none;
1010
padding: 0;
11-
height: calc(90vh - 100pt);
11+
height: calc(80vh - 100pt);
1212
overflow-y: auto;
1313
}
1414

0 commit comments

Comments
 (0)