-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(registration report): implement clientside
This commit implements the client PDF report using the Receipt service created by @sfount. Because the client-side filters do not have a good data model, printing with filtering has been left for later. There are several prominent TODOs in this commit: 1. Filtering on the client should be additive, and use a key:value model, so that each filter takes in one parameter. For example, `name:jniles` would be stored in the JSON `{ name : 'jniles' }`, and be sent to the server as `?name=jniles`. 2. The Receipt Service is now overloaded with reports. We need to cleanly separate Receipts as a subset of reports, and ensure that the modal and controllers are appropriately named.
- Loading branch information
Showing
11 changed files
with
146 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<div class="modal-header"> | ||
<div style="display : inline-block"> | ||
<ol class="headercrumb"> | ||
<li class="title">{{ "PATIENT_REG.PAGE_TITLE | translate }}</li> | ||
</ol> | ||
</div> | ||
</div> | ||
|
||
<!-- Temporary Loading State --> | ||
<div style="padding : 10px;" ng-hide="PatientRegistryPrintCtrl.report"> | ||
<p class="text-muted"><i class="fa fa-spin fa-cog"></i> {{"RECEIPTS.LOADING"}}</p> | ||
</div> | ||
|
||
<!-- ng-if used in favour of ng-switch to allow dynamic states --> | ||
<div> | ||
|
||
<!-- PDF --> | ||
<div ng-if="PatientRegistryPrintCtrl.renderer === PatientRegistryPrintCtrl.renderers.PDF"> | ||
|
||
<iframe | ||
id="pdf" | ||
ng-src="{{PatientRegistryPrintCtrl.report}}" | ||
type="application/pdf" | ||
style="width : 100%; height : 50vh; margin-bottom : -5px; border : none;"> | ||
</iframe> | ||
</div> | ||
|
||
<!-- HTML --> | ||
<div ng-if="PatientRegistryPrintCtrl.renderer === PatientRegistryPrintCtrl.renderers.HTML"> | ||
|
||
<div class="bh-modal-content"> | ||
<div ng-bind-html="PatientRegistryPrintCtrl.receipt"></div> | ||
</div> | ||
</div> | ||
|
||
<!-- CSV --> | ||
|
||
<!-- Excel --> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button class="btn btn-default btn-sm" ng-click="PatientRegistryPrintCtrl.close()" data-action="close">Close</button> | ||
<button class="btn btn-primary btn-sm" ng-click="PatientRegistryPrintCtrl.print()" data-action="print"> | ||
<span class="glyphicon glyphicon-print"></span> Print | ||
</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
angular.module('bhima.controllers') | ||
.controller('PatientRegistryPrintController', PatientRegistryPrintCtrl); | ||
|
||
PatientRegistryPrintCtrl.$inject = [ | ||
'$http', '$uibModalInstance', 'filters' | ||
]; | ||
|
||
function PatientRegistryPrintCtrl($http, ModalInstance, data) { | ||
var vm = this; | ||
vm.data = data; | ||
|
||
// request the report from the server | ||
$http.get(data.url, { params : data.params }) | ||
.then(function (report) { | ||
vm.report = report; | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters