Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add. select all drug orders for print #868

Open
wants to merge 2 commits into
base: Bahmni-IPD-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ angular.module('bahmni.clinical')
$scope.dispensePrivilege = Bahmni.Clinical.Constants.dispensePrivilege;
$scope.scheduledDate = DateUtil.getDateWithoutTime(DateUtil.addDays(DateUtil.now(), 1));
$scope.enableIPDFeature = appService.getAppDescriptor().getConfigValue("enableIPDFeature");
$scope.autoSelectNotAllowed = appService.getAppDescriptor().getConfigValue("autoSelectNotAllowed");
$scope.printPrescriptionFeature = appService.getAppDescriptor().getConfigValue("printPrescriptionFeature");
$scope.selectedDrugs = {};

Expand Down Expand Up @@ -97,6 +98,14 @@ angular.module('bahmni.clinical')
});
};

$scope.selectAllDrugs = function (drugOrderGroup, index) {
if (!$scope.autoSelectNotAllowed) {
angular.forEach(drugOrderGroup.drugOrders, function (drugOrder) {
$scope.selectedDrugs[index + "/" + drugOrder.uuid] = true;
});
}
};

$scope.printSelectedDrugs = function () {
var drugOrdersForPrint = [];
var promises = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="tabs">
<div class="tab" ng-repeat="drugOrderGroup in consultation.drugOrderGroups" ng-class="{'selected-tab': drugOrderGroup.selected }">
<input class="tab-radio" id="{{'drug-orders-tab-' + $index}}" name="tab-group-1" type="radio" ng-checked="drugOrderGroup.selected" ng-class="{}" tabindex="-1">
<label class="tab-label" for="{{'drug-orders-tab-' + $index}}">
<label class="tab-label" for="{{'drug-orders-tab-' + $index}}" ng-click="selectAllDrugs(drugOrderGroup, $index)" ng-init="selectAllDrugs(consultation.drugOrderGroups[0], 0)">
<span>{{drugOrderGroup.label | bahmniDate}}</span>
<i class="fa fa-star current-visit-icon" title="Current visit" ng-if="drugOrderGroup.isCurrentVisit"></i>
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,26 @@ describe("DrugOrderHistoryController", function () {
it("should get prescribed and active Drugorders with correct no of visits ", function () {
expect(_treatmentService.getPrescribedDrugOrders).toHaveBeenCalledWith("patientUuid", true, 4, undefined, undefined);
});
it("should selectAllDrugs for print", function () {
translate.instant.and.returnValue("Recent");
initController();
expect(scope.consultation.drugOrderGroups.length).toBe(3);

scope.selectAllDrugs(scope.consultation.drugOrderGroups[0], 0);
expect(Object.keys(scope.selectedDrugs).length).toBe(3);
expect()
})
it("should selectAllDrugs for print", function () {
translate.instant.and.returnValue("Recent");
initController();
expect(scope.consultation.drugOrderGroups.length).toBe(3);

scope.autoSelectNotAllowed = true

scope.selectAllDrugs(scope.consultation.drugOrderGroups[0], 0);
expect(Object.keys(scope.selectedDrugs).length).toBe(0);
expect()
})
});

describe("when conditionally enable or disable order reason text for drug stoppage", function () {
Expand Down
Loading