-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from OpenLMIS-Angola/feature/OAM-64
OAM-64: init of organizations
- Loading branch information
Showing
23 changed files
with
1,099 additions
and
2 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
src/admin-valid-destination-add/admin-valid-destination-add.routes.js
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,64 @@ | ||
/* | ||
* 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'; | ||
|
||
angular | ||
.module('admin-valid-destination-add') | ||
.config(routes); | ||
|
||
routes.$inject = ['modalStateProvider', 'ADMINISTRATION_RIGHTS']; | ||
|
||
function routes(modalStateProvider, ADMINISTRATION_RIGHTS) { | ||
|
||
modalStateProvider.state('openlmis.administration.validDestination.add', { | ||
controller: 'ValidDestinationAddController', | ||
controllerAs: 'vm', | ||
accessRights: [ADMINISTRATION_RIGHTS.STOCK_DESTINATIONS_MANAGE], | ||
templateUrl: 'admin-valid-destination-add/valid-destination-add.html', | ||
url: '/add', | ||
resolve: { | ||
organizations: organizationsResolve, | ||
geoLevels: geoLevelsResolve | ||
}, | ||
parentResolves: [ | ||
'facilities', | ||
'facilityTypes', | ||
'geographicLevelMap', | ||
'programs' | ||
] | ||
}); | ||
|
||
geoLevelsResolve.$inject = ['GeoLevelResource']; | ||
|
||
function geoLevelsResolve(GeoLevelResource) { | ||
return new GeoLevelResource().query() | ||
.then(function(resource) { | ||
return resource.content; | ||
}); | ||
} | ||
|
||
organizationsResolve.$inject = ['OrganizationResource']; | ||
|
||
function organizationsResolve(OrganizationResource) { | ||
return new OrganizationResource().query() | ||
.then(function(resource) { | ||
return resource.content; | ||
}); | ||
} | ||
} | ||
})(); |
89 changes: 89 additions & 0 deletions
89
src/admin-valid-destination-add/valid-destination-add.html
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,89 @@ | ||
<div class="modal" role="dialog" aria-hidden="true"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h1>{{:: 'adminValidDestinationAdd.addValidDestination' | message}}</h1> | ||
</div> | ||
<div class="modal-body"> | ||
<form id="add-valid-destination-form" ng-submit="vm.submit()"> | ||
<label for="program"> | ||
{{:: 'adminValidDestinationAdd.selectProgram' | message}} | ||
</label> | ||
<select id="program" | ||
ng-model="vm.program" | ||
ng-options="p.name for p in vm.programs track by p.id" required> | ||
</select> | ||
|
||
<label for="facilityType"> | ||
{{:: 'adminValidDestinationAdd.facilityType' | message}} | ||
</label> | ||
|
||
<select id="facilityType" | ||
ng-model="vm.facilityType" | ||
ng-options="f.name for f in vm.facilityTypes track by f.id" required> | ||
</select> | ||
|
||
<label for="facilityUnitType"> | ||
<input | ||
id="facilityUnitType" | ||
type="radio" | ||
ng-model="vm.unitType" | ||
value="facility" | ||
required> | ||
{{:: 'adminValidDestinationAdd.isFacility' | message}} | ||
</label> | ||
|
||
<label for="organizationUnitType"> | ||
<input | ||
id="organizationUnitType" | ||
type="radio" | ||
ng-model="vm.unitType" | ||
value="organization" | ||
required> | ||
{{:: 'adminValidDestinationAdd.isOrganization' | message}} | ||
</label> | ||
|
||
<div ng-if="vm.unitType === 'organization'"> | ||
<label for="organization"> | ||
{{:: 'adminValidDestinationAdd.organization' | message}} | ||
</label> | ||
|
||
<select id="organization" | ||
ng-model="vm.organization" | ||
ng-options="(o.disabled ? o.name + ' [DISABLED]' : o.name) for o in vm.organizations track by o.id" required> | ||
</select> | ||
</div> | ||
|
||
<div ng-if="vm.unitType === 'facility'"> | ||
<label for="facility"> | ||
{{:: 'adminValidDestinationAdd.facility' | message}} | ||
</label> | ||
|
||
<select id="facility" | ||
ng-model="vm.facility" | ||
ng-options="f.name for f in vm.facilities track by f.id" required> | ||
</select> | ||
</div> | ||
|
||
<label for="geoLevelAffinity"> | ||
{{:: 'adminValidDestinationAdd.geoLevelAffinity' | message}} | ||
</label> | ||
|
||
<select id="geoLevelAffinity" | ||
ng-model="vm.geoLevel" | ||
ng-options="g.code for g in vm.geoLevels track by g.id"> | ||
</select> | ||
</form> | ||
</div> | ||
<div class="modal-footer"> | ||
<button id="cancel" ng-click="vm.goToPreviousState()"> | ||
{{:: 'adminValidDestinationAdd.cancel' | message}} | ||
</button> | ||
<button class="primary" form="add-valid-destination-form"> | ||
{{:: 'adminValidDestinationAdd.add' | message}} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</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
64 changes: 64 additions & 0 deletions
64
src/admin-valid-source-add/admin-valid-source-add.routes.js
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,64 @@ | ||
/* | ||
* 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'; | ||
|
||
angular | ||
.module('admin-valid-source-add') | ||
.config(routes); | ||
|
||
routes.$inject = ['modalStateProvider', 'ADMINISTRATION_RIGHTS']; | ||
|
||
function routes(modalStateProvider, ADMINISTRATION_RIGHTS) { | ||
|
||
modalStateProvider.state('openlmis.administration.validSource.add', { | ||
controller: 'ValidSourceAddController', | ||
controllerAs: 'vm', | ||
accessRights: [ADMINISTRATION_RIGHTS.STOCK_SOURCES_MANAGE], | ||
templateUrl: 'admin-valid-source-add/valid-source-add.html', | ||
url: '/add', | ||
resolve: { | ||
organizations: organizationsResolve, | ||
geoLevels: geoLevelsResolve | ||
}, | ||
parentResolves: [ | ||
'facilities', | ||
'facilityTypes', | ||
'geographicLevelMap', | ||
'programs' | ||
] | ||
}); | ||
|
||
geoLevelsResolve.$inject = ['GeoLevelResource']; | ||
|
||
function geoLevelsResolve(GeoLevelResource) { | ||
return new GeoLevelResource().query() | ||
.then(function(resource) { | ||
return resource.content; | ||
}); | ||
} | ||
|
||
organizationsResolve.$inject = ['OrganizationResource']; | ||
|
||
function organizationsResolve(OrganizationResource) { | ||
return new OrganizationResource().query() | ||
.then(function(resource) { | ||
return resource.content; | ||
}); | ||
} | ||
} | ||
})(); |
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,89 @@ | ||
<div class="modal" role="dialog" aria-hidden="true"> | ||
<div class="modal-dialog"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h1>{{:: 'adminValidSourceAdd.addValidSource' | message}}</h1> | ||
</div> | ||
<div class="modal-body"> | ||
<form id="add-valid-source-form" ng-submit="vm.submit()"> | ||
<label for="program"> | ||
{{:: 'adminValidSourceAdd.selectProgram' | message}} | ||
</label> | ||
<select id="program" | ||
ng-model="vm.program" | ||
ng-options="p.name for p in vm.programs track by p.id" required> | ||
</select> | ||
|
||
<label for="facilityType"> | ||
{{:: 'adminValidSourceAdd.facilityType' | message}} | ||
</label> | ||
|
||
<select id="facilityType" | ||
ng-model="vm.facilityType" | ||
ng-options="f.name for f in vm.facilityTypes track by f.id" required> | ||
</select> | ||
|
||
<label for="facilityUnitType"> | ||
<input | ||
id="facilityUnitType" | ||
type="radio" | ||
ng-model="vm.unitType" | ||
value="facility" | ||
required> | ||
{{:: 'adminValidSourceAdd.isFacility' | message}} | ||
</label> | ||
|
||
<label for="organizationUnitType"> | ||
<input | ||
id="organizationUnitType" | ||
type="radio" | ||
ng-model="vm.unitType" | ||
value="organization" | ||
required> | ||
{{:: 'adminValidSourceAdd.isOrganization' | message}} | ||
</label> | ||
|
||
<div ng-if="vm.unitType === 'organization'"> | ||
<label for="organization"> | ||
{{'adminValidSourceAdd.organization' | message}} | ||
</label> | ||
|
||
<select id="organization" | ||
ng-model="vm.organization" | ||
ng-options="(o.disabled ? o.name + ' [DISABLED]' : o.name) for o in vm.organizations track by o.id" required> | ||
</select> | ||
</div> | ||
|
||
<div ng-if="vm.unitType === 'facility'"> | ||
<label for="facility"> | ||
{{:: 'adminValidSourceAdd.facility' | message}} | ||
</label> | ||
|
||
<select id="facility" | ||
ng-model="vm.facility" | ||
ng-options="f.name for f in vm.facilities track by f.id" required> | ||
</select> | ||
</div> | ||
|
||
<label for="geoLevelAffinity"> | ||
{{:: 'adminValidSourceAdd.geoLevelAffinity' | message}} | ||
</label> | ||
|
||
<select id="geoLevelAffinity" | ||
ng-model="vm.geoLevel" | ||
ng-options="g.code for g in vm.geoLevels track by g.id"> | ||
</select> | ||
</form> | ||
</div> | ||
<div class="modal-footer"> | ||
<button id="cancel" ng-click="vm.goToPreviousState()"> | ||
{{:: 'adminValidSourceAdd.cancel' | message}} | ||
</button> | ||
<button class="primary" form="add-valid-source-form"> | ||
{{:: 'adminValidSourceAdd.add' | message}} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</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
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,11 @@ | ||
{ | ||
"organizationAdd.addOrganization": "Add Organization", | ||
"organizationAdd.cancel": "Cancel", | ||
"organizationAdd.save": "Save", | ||
"organizationAdd.create": "Create", | ||
"organizationAdd.organizationName": "Organization Name", | ||
"organizationAdd.disabled": "Disabled", | ||
"organizationAdd.confirmationPrompt": "Are you sure you want to create organization?", | ||
"organizationAdd.organizationCreated": "Organization created successfully.", | ||
"organizationAdd.organizationCreateError": "Error while creating organization." | ||
} |
Oops, something went wrong.