- Add "Study Not Found" message

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

No files matched your search

@@ -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>
@@ -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);
}
});
}