diff --git a/src/admin-orderable-list/admin-orderable-list.routes.js b/src/admin-orderable-list/admin-orderable-list.routes.js index 5eea272..1d9e225 100644 --- a/src/admin-orderable-list/admin-orderable-list.routes.js +++ b/src/admin-orderable-list/admin-orderable-list.routes.js @@ -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&includeQuarantined&name&description&program&page&size&sort', controller: 'OrderableListController', templateUrl: 'admin-orderable-list/orderable-list.html', controllerAs: 'vm', @@ -40,8 +40,12 @@ 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.includeQuarantined && $stateParams.includeQuarantined !== 'false') { + $stateParams.includeQuarantined = 'true'; + } + + return new OrderableResource().query($stateParams); }); }, canAdd: function(authorizationService, permissionService, ADMINISTRATION_RIGHTS) { diff --git a/src/admin-orderable-list/messages_en.json b/src/admin-orderable-list/messages_en.json index d8a7de3..129199d 100644 --- a/src/admin-orderable-list/messages_en.json +++ b/src/admin-orderable-list/messages_en.json @@ -1,5 +1,5 @@ { "adminOrderableList.export": "Export", - "adminOrderableList.showQuarantined": "Show Quarantined", + "adminOrderableList.includeQuarantined": "Include Quarantined Products", "adminOrderableList.isQuarantined": "Quarantined" } diff --git a/src/admin-orderable-list/orderable-list.controller.js b/src/admin-orderable-list/orderable-list.controller.js index eff93fe..a0fdc72 100644 --- a/src/admin-orderable-list/orderable-list.controller.js +++ b/src/admin-orderable-list/orderable-list.controller.js @@ -59,6 +59,16 @@ */ vm.programs = undefined; + /** + * @ngdoc property + * @propertyOf admin-orderable-list.controller:OrderableListController + * @name includeQuarantined + * + * @description + * Contains flag for including quarantined orderables. By default, quarantined products are listed. + */ + vm.includeQuarantined = undefined; + /** * @ngdoc property * @propertyOf admin-orderable-list.controller:OrderableListController @@ -118,6 +128,7 @@ vm.code = $stateParams.code; vm.name = $stateParams.name; vm.program = $stateParams.program; + vm.includeQuarantined = $stateParams.includeQuarantined; vm.canAdd = canAdd; vm.tableConfig = getTableConfig(); @@ -137,6 +148,7 @@ stateParams.code = vm.code; stateParams.name = vm.name; stateParams.program = vm.program; + stateParams.includeQuarantined = vm.includeQuarantined; $state.go('openlmis.administration.orderables', stateParams, { reload: true diff --git a/src/admin-orderable-list/orderable-list.html b/src/admin-orderable-list/orderable-list.html index 1d6acaf..d6633d4 100644 --- a/src/admin-orderable-list/orderable-list.html +++ b/src/admin-orderable-list/orderable-list.html @@ -22,6 +22,12 @@