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

OAM-127: add additional quarantined parameter to products page #89

Merged
merged 2 commits into from
May 17, 2024
Merged
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
12 changes: 9 additions & 3 deletions src/admin-orderable-list/admin-orderable-list.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$stateProvider.state('openlmis.administration.orderables', {
showInNavigation: true,
label: 'adminOrderableList.products',
url: '/orderables?code&name&description&program&page&size&sort',
url: '/orderables?code&name&quarantined&description&program&page&size&sort',
controller: 'OrderableListController',
templateUrl: 'admin-orderable-list/orderable-list.html',
controllerAs: 'vm',
Expand All @@ -40,8 +40,14 @@
return new ProgramResource().query();
},
orderables: function(paginationService, OrderableResource, $stateParams) {
return paginationService.registerUrl($stateParams, function(stateParams) {
return new OrderableResource().query(stateParams);
return paginationService.registerUrl($stateParams, function() {
if ($stateParams.quarantined === undefined) {
$stateParams.quarantined = 'true';
}

var params = angular.copy($stateParams);

return new OrderableResource().query(params);
});
},
canAdd: function(authorizationService, permissionService, ADMINISTRATION_RIGHTS) {
Expand Down
3 changes: 2 additions & 1 deletion src/admin-orderable-list/messages_en.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"adminOrderableList.export": "Export"
"adminOrderableList.export": "Export",
"adminOrderableList.showQuarantined": "Show Quarantined"
}
15 changes: 15 additions & 0 deletions src/admin-orderable-list/orderable-list.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@
*/
vm.programs = undefined;

/**
* @ngdoc property
* @propertyOf admin-orderable-list.controller:OrderableListController
* @name showQuarantined
* @type {String}
*
* @description
* Contains quarantined param for searching products.
*/
vm.showQuarantined = undefined;

/**
* @ngdoc property
* @propertyOf admin-orderable-list.controller:OrderableListController
Expand Down Expand Up @@ -114,9 +125,12 @@
function onInit() {
vm.orderables = orderables;
vm.programs = programs;

vm.showQuarantined = $stateParams.quarantined;
vm.code = $stateParams.code;
vm.name = $stateParams.name;
vm.program = $stateParams.program;

vm.canAdd = canAdd;
vm.tableConfig = getTableConfig();
}
Expand All @@ -132,6 +146,7 @@
function search() {
var stateParams = angular.copy($stateParams);

stateParams.quarantined = vm.showQuarantined;
stateParams.code = vm.code;
stateParams.name = vm.name;
stateParams.program = vm.program;
Expand Down
6 changes: 6 additions & 0 deletions src/admin-orderable-list/orderable-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ <h2>{{'adminOrderableList.products' | message}}</h2>
<!-- 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="showQuarantined" class="checkbox">
<input type="checkbox" id="showQuarantined" ng-model="vm.showQuarantined" ng-true-value="'true'" ng-false-value="'false'" />
{{:: 'adminOrderableList.showQuarantined' | message}}
</label>
</fieldset>
<fieldset class="form-group">
<label for="code">{{'adminOrderableList.code' | message}}</label>
<input type="text" id="code" ng-model="vm.code"/>
Expand Down
Loading