Skip to content

Commit

Permalink
Merge pull request #107 from OpenLMIS-Angola/OAM-27
Browse files Browse the repository at this point in the history
OAM 27: partial solution
  • Loading branch information
olewandowski1 authored Jun 4, 2024
2 parents 726ad10 + e953051 commit 09e963d
Show file tree
Hide file tree
Showing 33 changed files with 964 additions and 187 deletions.
6 changes: 6 additions & 0 deletions src/admin-orderable-list/admin-orderable-list.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.orderable-list-buttons-group {
display: flex !important;
flex-direction: row;
gap: 1rem;
float: right !important;
}
3 changes: 2 additions & 1 deletion src/admin-orderable-list/messages_en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"adminOrderableList.export": "Export",
"adminOrderableList.includeQuarantined": "Include Quarantined Products",
"adminOrderableList.isQuarantined": "Quarantined"
"adminOrderableList.isQuarantined": "Quarantined",
"adminOrderableList.createUnit": "Create unit"
}
4 changes: 4 additions & 0 deletions src/admin-orderable-list/orderable-list.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@
vm.tableConfig = getTableConfig();
}

vm.addNewUnit = function() {
$state.go('openlmis.administration.orderables.unitAdd');
};

/**
* @ngdoc method
* @methodOf admin-orderable-list.controller:OrderableListController
Expand Down
26 changes: 14 additions & 12 deletions src/admin-orderable-list/orderable-list.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
<h2>{{'adminOrderableList.products' | message}}</h2>
<section class="openlmis-table-container">
<!-- AO-744: Extend Admin Products and Facilities pages with print option -->
<button id="print-facility" class="primary" ng-click="vm.goToPrintOrderablePage()">
{{'adminOrderableList.export' | message}}
</button>
<!-- AO-744: ends here -->
<button ng-if="vm.canAdd" class="add" ui-sref='.add'>{{'adminOrderableList.addProduct' | message}}</button>
<form ng-submit="vm.search()">
<fieldset class="form-group">
<label for="code">{{'adminOrderableList.code' | message}}</label>
<input type="text" id="code" ng-model="vm.code"/>
<input type="text" id="code" ng-model="vm.code" />
</fieldset>
<fieldset class="form-group">
<label for="name">{{'adminOrderableList.name' | message}}</label>
<input type="text" id="name" ng-model="vm.name"/>
<input type="text" id="name" ng-model="vm.name" />
</fieldset>
<fieldset class="form-group">
<label for="program">{{'adminOrderableList.program' | message}}</label>
<select id="program"
ng-options="program.code as program.name for program in vm.programs"
ng-model="vm.program">
<select id="program" ng-options="program.code as program.name for program in vm.programs"
ng-model="vm.program">
</select>
</fieldset>
<fieldset class="form-group">
Expand All @@ -28,8 +23,15 @@ <h2>{{'adminOrderableList.products' | message}}</h2>
{{:: 'adminOrderableList.includeQuarantined' | message}}
</label>
</fieldset>
<input type="submit" value="{{'adminOrderableList.search' | message}}"/>
<input type="submit" value="{{'adminOrderableList.search' | message}}" />
</form>
<div class="orderable-list-buttons-group">
<button ng-if="vm.canAdd" class="add" ui-sref='.add'>{{'adminOrderableList.addProduct' | message}}</button>
<button ng-click="vm.addNewUnit()">{{'adminOrderableList.createUnit' | message}}</button>
<button id="print-facility" class="primary" ng-click="vm.goToPrintOrderablePage()">
{{'adminOrderableList.export' | message}}
</button>
</div>
<openlmis-table table-config="vm.tableConfig"></openlmis-table>
<openlmis-pagination/>
</section>
<openlmis-pagination />
</section>
3 changes: 2 additions & 1 deletion src/messages_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"stockAddProductsModal.newLotCode": "Lot Code",
"stockAdjustmentCreation.newNotExpirationDate": "Expiration Date",
"stockAdjustmentCreation.newLotCode": "Lot Code",
"stockAdjustmentCreation.unit": "Unit of orderable",
"orderableGroupService.addMissingLot": "Add lot",
"stockPhysicalInventoryDraft.addLotFailed": "Failed to add lot.",
"digestConfiguration.requisition-actionRequired": "Requisition - Action Required",
Expand All @@ -66,7 +67,7 @@
"shipmentView.fillQuantityInPack": "Fill Quantity (in Packs)",
"shipmentView.packs": "Packs",
"shipmentView.doses": "Doses",
"stockAdjustmentCreation.quantityGreaterThanStockOnHand": "Quantity cannot be greater than stock on hand value.",
"stockAdjustmentCreation.quantityGreaterThanStockOnHand": "Total quantity cannot be greater than stock on hand value.",
"adminRoleForm.reportedAndOrderedProducts": "View Reported and Ordered Products Report",
"adminRoleForm.submissionOfMonthlyReports": "View Submission of Monthly Reports",
"adminRoleForm.aggregateConsumption": "View Aggregate Consumption Report",
Expand Down
9 changes: 9 additions & 0 deletions src/openlmis-unit-add/messages_en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"openlmisUnitAdd.form.header": "Create unit",
"openlmisUnitAdd.form.label.name": "Name",
"openlmisUnitAdd.form.label.description": "Description",
"openlmisUnitAdd.form.label.displayOrder": "Display order",
"openlmisUnitAdd.form.label.factor": "Factor",
"openlmisUnitAdd.cancel": "Cancel",
"openlmisUnitAdd.save": "Save"
}
34 changes: 34 additions & 0 deletions src/openlmis-unit-add/openlmis-unit-add.component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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';

/**
* @ngdoc component
* @name openlmis-unit-add.component:openlmisUnitAdd
*
* @description
* Component responsible for displaying modal panel where user can add a new unit
*/
angular
.module('openlmis-unit-add')
.component('openlmisUnitAdd', {
templateUrl: 'openlmis-unit-add/openlmis-unit-add.html',
controller: 'openlmisUnitAddController',
controllerAs: '$ctrl'
});
})();
57 changes: 57 additions & 0 deletions src/openlmis-unit-add/openlmis-unit-add.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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';

/**
* @ngdoc controller
* @name openlmis-unit-add.controller:openlmisUnitAddController *
* @description
* Manages the openlmis-unit-add component
*/
angular
.module('openlmis-unit-add')
.controller('openlmisUnitAddController', openlmisUnitAddController);

openlmisUnitAddController.$inject = ['openlmisUnitAddService', 'stateTrackerService'];

function openlmisUnitAddController(openlmisUnitAddService, stateTrackerService) {
var $ctrl = this;
$ctrl.newUnit = {
name: undefined,
description: undefined,
displayOrder: undefined,
factor: undefined
};
$ctrl.save = save;
$ctrl.goToPreviousState = stateTrackerService.goToPreviousState;
$ctrl.saveDisabled = saveDisabled;

function saveDisabled() {
return !$ctrl.newUnit.name ||
!$ctrl.newUnit.factor ||
!$ctrl.newUnit.displayOrder;
}

function save() {
openlmisUnitAddService.save($ctrl.newUnit)
.then(function() {
$ctrl.goToPreviousState();
});
}
}
})();
40 changes: 40 additions & 0 deletions src/openlmis-unit-add/openlmis-unit-add.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div class="modal" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1>{{:: 'openlmisUnitAdd.form.header' | message}}</h1>
</div>
<div class="modal-body">
<form id="add-unit-form" ng-submit="$ctrl.save()">
<div class="form-group">
<label for="unit-name">{{:: 'openlmisUnitAdd.form.label.name' | message}}</label>
<input id="unit-name" type="text" ng-model="$ctrl.newUnit.name" required>
</div>
<div class="form-group">
<label for="unit-description">{{:: 'openlmisUnitAdd.form.label.description' | message}}</label>
<input id="unit-description" type="text" ng-model="$ctrl.newUnit.description">
</div>
<div class="form-group">
<label for="unit-display-order">{{:: 'openlmisUnitAdd.form.label.displayOrder' | message}}</label>
<input id="unit-display-order" type="number" ng-model="$ctrl.newUnit.displayOrder" required>
</div>
<div class="form-group">
<label for="unit-factor">{{:: 'openlmisUnitAdd.form.label.factor' | message}}</label>
<input id="unit-factor" type="number" ng-model="$ctrl.newUnit.factor" required>
</div>
</form>
</div>
<div class="modal-footer">
<button id="cancel" ng-click="$ctrl.goToPreviousState()">{{'openlmisUnitAdd.cancel' | message}}</button>
<button
class="btn primary"
ng-disabled="$ctrl.saveDisabled()"
ng-class="{'btn-disabled': $ctrl.saveDisabled()}"
form="add-unit-form"
>
{{'openlmisUnitAdd.save' | message}}
</button>
</div>
</div>
</div>
</div>
26 changes: 26 additions & 0 deletions src/openlmis-unit-add/openlmis-unit-add.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* 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('openlmis-unit-add', [
'openlmis-modal',
'openlmis-templates',
'openlmis-state-tracker',
'openlmis-modal-state',
'openlmis-pagination'
]);
})();
49 changes: 49 additions & 0 deletions src/openlmis-unit-add/openlmis-unit-add.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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('openlmis-unit-add')
.config(routes);

routes.$inject = ['modalStateProvider'];

function routes(modalStateProvider) {

modalStateProvider.state('openlmis.stockmanagement.adjustment.creation.unitAdd', {
controller: 'openlmisUnitAddController',
controllerAs: '$ctrl',
templateUrl: 'openlmis-unit-add/openlmis-unit-add.html',
url: '/addUnit'
});

modalStateProvider.state('openlmis.stockmanagement.physicalInventory.draft.unitAdd', {
controller: 'openlmisUnitAddController',
controllerAs: '$ctrl',
templateUrl: 'openlmis-unit-add/openlmis-unit-add.html',
url: '/addUnit'
});

modalStateProvider.state('openlmis.administration.orderables.unitAdd', {
controller: 'openlmisUnitAddController',
controllerAs: '$ctrl',
templateUrl: 'openlmis-unit-add/openlmis-unit-add.html',
url: '/addUnit'
});
}
})();
Empty file.
34 changes: 34 additions & 0 deletions src/openlmis-unit-add/openlmis-unit-add.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* 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('openlmis-unit-add')
.service('openlmisUnitAddService', openlmisUnitAddService);

openlmisUnitAddService.$inject = ['unitOfOrderableService'];

function openlmisUnitAddService(unitOfOrderableService) {
return {
save: save
};

function save(unit) {
return unitOfOrderableService.create(unit);
}
}
})();
Loading

0 comments on commit 09e963d

Please sign in to comment.