- 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.html', 'client');
api.addFiles('client/components/basic/loadingText/loadingText.styl', '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.html', 'client');
api.addFiles('client/components/basic/removableBackdrop/removableBackdrop.styl', 'client'); api.addFiles('client/components/basic/removableBackdrop/removableBackdrop.styl', 'client');

View File

@ -48,7 +48,11 @@
{{/each}} {{/each}}
</tbody> </tbody>
</table> </table>
{{ #unless studies.count }} {{#if showLoadingText}}
{{>loadingText}} {{>loadingText}}
{{ /unless }} {{/if}}
{{#if showNotFoundMessage}}
{{>studyNotFound}}
{{/if}}
</template> </template>

View File

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