Skip to content

Commit

Permalink
Hadnled receive for facility and its wards
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikNoga committed Jun 14, 2024
1 parent e10994d commit b5cac95
Show file tree
Hide file tree
Showing 21 changed files with 1,212 additions and 130 deletions.
36 changes: 36 additions & 0 deletions src/admin-facility-view/admin-facility-view.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* This program is part of the OpenLMIS logistics management information system platform software.
* Copyright © 2017 VillageReach
*
* This program is free software: you can redistribute it and/or modify it under the terms
* of the GNU Affero General Public License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*  
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
* See the GNU Affero General Public License for more details. You should have received a copy of
* the GNU Affero General Public License along with this program. If not, see
* http://www.gnu.org/licenses.  For additional information contact [email protected]
*/

(function() {

'use strict';

/**
* @module admin-facility-view
*
* @description
* Provides facility view screen for administrator.
*/
angular.module('admin-facility-view', [
'openlmis-rights',
'openlmis-modal',
'referencedata-facility',
'referencedata-facility-type',
'referencedata-geographic-zone',
'referencedata-program',
'referencedata-user',
'ui.router'
]);
})();
30 changes: 27 additions & 3 deletions src/admin-facility-view/facility-view.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
'$q', '$state', 'facility', 'facilityTypes', 'geographicZones', 'facilityOperators',
'programs', 'FacilityRepository', 'loadingModalService', 'notificationService',
'tzPeriodService', 'messageService', 'confirmService', 'wards', 'wardService',
'WARDS_CONSTANTS'
'WARDS_CONSTANTS', 'currentUserService'
];

function controller($q, $state, facility, facilityTypes, geographicZones, facilityOperators,
programs, FacilityRepository, loadingModalService, notificationService,
tzPeriodService, messageService, confirmService, wards, wardService,
WARDS_CONSTANTS) {
WARDS_CONSTANTS, currentUserService) {

var vm = this;

Expand Down Expand Up @@ -174,6 +174,8 @@
*/
vm.wardFacilityType = undefined;

vm.currentUser = undefined;

/**
* @ngdoc method
* @propertyOf admin-facility-view.controller:FacilityViewController
Expand All @@ -199,6 +201,10 @@
});
vm.newWard = getInitialNewWardValue();

currentUserService.getUserInfo().then(function(user) {
vm.currentUser = user;
});

if (!vm.facilityWithPrograms.supportedPrograms) {
vm.facilityWithPrograms.supportedPrograms = [];
}
Expand Down Expand Up @@ -243,7 +249,7 @@
* @methodOf admin-facility-view.controller:FacilityViewController
* @name saveFacilityWithPrograms
*
* @description
* @descriptioncurrentUserService
* Saves facility with supported programs and redirects to facility list screen.
*/
function saveFacilityWithPrograms() {
Expand Down Expand Up @@ -406,6 +412,24 @@
});

var addedWardsPromisses = vm.addedWards.map(function(ward) {
// assign user a role 9e2ee288-b77c-476e-9e15-a05d25c3dcda and a7993216-de2a-4031-b641-18621e3085cb
// for this facility
// var rolesIds = ['9e2ee288-b77c-476e-9e15-a05d25c3dcda', 'a7993216-de2a-4031-b641-18621e3085cb'];

// var additionalRoleAssignments = vm.facility.supportedPrograms.map(function(program) {
// return [{
// programId: program.id,
// warehouseId: '',
// }];
// })

// $q.all(rolesIdsPromisses).then(function(responses) {
// console.log(responses);
// // var roleAssignments = currentUser.roleAssignments;

// // console.log(roleAssignments);
// });

return new FacilityRepository().create(ward);
});

Expand Down
Loading

0 comments on commit b5cac95

Please sign in to comment.