- Add "Study Not Found" message

- Hide loading text after WorklistSearch method is called
This commit is contained in:
Aysel Afsar 2016-02-19 16:49:32 -05:00
parent fb7024d20e
commit 1dc7eb71c0
5 changed files with 52 additions and 5 deletions

View File

@ -0,0 +1,5 @@
<template name="studyNotFound">
<div class="studyNotFound">
<h5>Study not found</h5>
</div>
</template>

View File

@ -0,0 +1,6 @@
.studyNotFound
margin: 30px
h5
text-align: center
color: #888888

View File

@ -41,6 +41,9 @@ Package.onUse(function(api) {
api.addFiles('client/components/basic/loadingText/loadingText.html', 'client');
api.addFiles('client/components/basic/loadingText/loadingText.styl', 'client');
api.addFiles('client/components/basic/studyNotFound/studyNotFound.html', 'client');
api.addFiles('client/components/basic/studyNotFound/studyNotFound.styl', 'client');
api.addFiles('client/components/basic/removableBackdrop/removableBackdrop.html', 'client');
api.addFiles('client/components/basic/removableBackdrop/removableBackdrop.styl', 'client');

View File

@ -44,11 +44,15 @@
</thead>
<tbody id="studyListData">
{{#each studies}}
{{ >worklistStudy }}
{{>worklistStudy }}
{{/each}}
</tbody>
</table>
{{ #unless studies.count }}
{{ >loadingText }}
{{ /unless }}
{{#if showLoadingText}}
{{>loadingText}}
{{/if}}
{{#if showNotFoundMessage}}
{{>studyNotFound}}
{{/if}}
</template>

View File

@ -1,3 +1,5 @@
Session.setDefault("searchResults", {showLoadingText: true, showNotFoundMessage: false});
Template.worklistResult.helpers({
/**
* Returns a sorted instance of the WorklistStudies Collection
@ -10,6 +12,15 @@ Template.worklistResult.helpers({
studyDate: 1
}
});
},
showLoadingText: function() {
return Session.get("searchResults").showLoadingText;
},
showNotFoundMessage: function() {
return Session.get("searchResults").showNotFoundMessage;
}
});
@ -73,6 +84,12 @@ function convertStringToStudyDate(dateStr) {
* Inserts the identified studies into the WorklistStudies Collection
*/
function search() {
// Show loading message
var searchResults = Session.get("searchResults");
searchResults.showLoadingText = true;
searchResults.showNotFoundMessage = false;
Session.set("searchResults", searchResults);
// Create the filters to be used for the Worklist Search
filter = {
patientName: getFilter($('input#patientName').val()),
@ -94,10 +111,14 @@ function search() {
return;
}
// Hide loading text
searchResults.showLoadingText = false;
Session.set("searchResults", searchResults);
if (!studies) {
return;
}
// Loop through all identified studies
studies.forEach(function(study) {
@ -110,6 +131,14 @@ function search() {
}
});
if (WorklistStudies.find().count() === 0) {
// Show notFound text
searchResults.showNotFoundMessage = true;
Session.set("searchResults", searchResults);
}
});
}