Skip to content

Commit

Permalink
Dubey, Anjaly | shr-1442 | Fixing problem if more than one consecutiv…
Browse files Browse the repository at this point in the history
…e spaces in given name. Hide/show print area on every click .
  • Loading branch information
anjalyj committed Mar 3, 2017
1 parent da82cea commit f7ee756
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions shrclient-omod/src/main/webapp/pages/patientHids.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@
jQuery('#user, #fromDate, #toDate').change(toggleGetAllButton);
jQuery('#getAll').click(function (e) {
jQuery('#printArea').hide();
jQuery('#info').hide();
jQuery('.errorMessage').hide();
var userId = jQuery('#user').val();
var fromDate = jQuery('#fromDate').val();
var toDate = jQuery('#toDate').val();
Expand All @@ -123,7 +127,7 @@
return;
}
infoMessage = "Showing " + noOfHIDCards + " Health ID card(s).";
jQuery("#info").text(infoMessage).show();
jQuery("#info").text(infoMessage);
template = template || printArea.html();
Mustache.parse(template);
Expand Down Expand Up @@ -170,17 +174,25 @@
return function (text,render) {
var name = render(text);
return name.split(" ").map(function (part) {
if(!part) return;
return part[0].toUpperCase() + part.slice(1).toLowerCase();
}).join(" ");
}
}
var rendered = Mustache.render(template, data);
printArea.html(rendered);
JsBarcode(".barcode").init();
printArea.show();
jQuery('#print').prop('disabled', false);
try {
var rendered = Mustache.render(template, data);
printArea.html(rendered);
JsBarcode(".barcode").init();
jQuery('#info').show();
printArea.show();
jQuery('#print').prop('disabled', false);
} catch (e) {
jQuery('.errorMessage').text("Error while showing HID cards")
jQuery('.errorMessage').show();
console.log(e)
}
}).fail(onError);
})
})
Expand Down

0 comments on commit f7ee756

Please sign in to comment.