Skip to content

Commit

Permalink
ANGOLASUP-918: product name filter added
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikNoga committed Sep 4, 2024
1 parent 2da2026 commit d81339e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

service.$inject = [
'$q', 'programService', 'authorizationService', 'facilityService', 'currentUserService',
'permissionService'
'permissionService', 'loadingModalService'
];

function service($q, programService, authorizationService, facilityService, currentUserService,
permissionService) {
permissionService, loadingModalService) {

var modulesWithRights = {},
facilities = [],
Expand Down Expand Up @@ -162,7 +162,7 @@
*/
function loadData(moduleName) {
var userId = authorizationService.getUser().user_id;

loadingModalService.open();
return $q.all([
facilityService.getFacilitiesWithoutWards(),
programService.getUserPrograms(userId),
Expand All @@ -178,6 +178,7 @@

var currentUserDetails = responses[3];
homeFacility = getFacilityById(currentUserDetails.homeFacilityId);
loadingModalService.close();
});
}

Expand Down
10 changes: 10 additions & 0 deletions src/requisition-view-tab/_requisition-view-tab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
flex-direction: row-reverse;
}

.toolbar {
display: flex;
flex-direction: row;
align-items: center !important;

.requisition-indicator {
margin-left: auto;
}
}

.hide-line-item {
@extend button.danger;
@include icon-only('remove');
Expand Down
3 changes: 1 addition & 2 deletions src/requisition-view-tab/messages_en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"requisitionPatientsViewTab.name": "Name",
"requisitionPatientsViewTab.search": "Search"
"requisitionPatientsViewTab.filterPlaceholder": "Filter by product name"
}
5 changes: 2 additions & 3 deletions src/requisition-view-tab/requisition-view-tab.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,9 @@
}

vm.filterByOrderableParams = function() {
console.log('filter works!');
console.log(vm.orderableFilterProperties);
vm.filteredItems = vm.lineItems.filter(function(item) {
return item.name.includes(vm.orderableFilterProperties.name);
return item.orderable.fullProductName.toLowerCase()
.includes(vm.orderableFilterProperties.name.toLowerCase());
});
};

Expand Down
17 changes: 5 additions & 12 deletions src/requisition-view-tab/requisition-view-tab.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,10 @@ <h4 ng-show="vm.showSkipControls">{{'requisitionViewTab.skip' | message}}</h4>
<span ng-if="vm.showAddFullSupplyProductControls">
{{ vm.skippedFullSupplyProductCountMessage() }}
</span>
<form ng-submit="vm.filterByOrderableParams()">
<!-- <fieldset class="form-group">
<label for="code">{{'adminOrderableList.code' | message}}</label>
<input type="text" id="code" ng-model="vm.code" />
</fieldset> -->
<fieldset class="form-group">
<label for="name">{{'requisitionPatientsViewTab.name' | message}}</label>
<input type="text" id="name" ng-model="vm.orderableFilterProperties.name" />
</fieldset>
<input type="submit" value="{{'requisitionPatientsViewTab.search' | message}}" />
</form>
<div class="productNameFilter">
<input type="text" placeholder="{{ 'requisitionPatientsViewTab.filterPlaceholder' | message}}"
ng-model="vm.orderableFilterProperties.name" ng-change="vm.filterByOrderableParams()">
</div>
<button class="add" ng-if="vm.showAddFullSupplyProductsButton" ng-click="vm.addFullSupplyProducts()" >{{'requisitionViewTab.addProduct' | message}}</button>
<button class="add" ng-if="vm.showAddNonFullSupplyProductsButton" ng-click="vm.addNonFullSupplyProducts()" >{{'requisitionViewTab.addProduct' | message}}</button>
<button class="add" ng-if="vm.showUnskipFullSupplyProductsButton" ng-click="vm.unskipFullSupplyProducts()" >{{'requisitionViewTab.addProduct' | message}}</button>
Expand Down Expand Up @@ -55,7 +48,7 @@ <h4 ng-show="vm.showSkipControls">{{'requisitionViewTab.skip' | message}}</h4>
</tbody>
</table>
<openlmis-pagination
list="vm.lineItems"
list="vm.filteredItems"
paged-list="vm.items"
pagination-id="vm.paginationId"
on-page-change="vm.cacheRequisition"/>
Expand Down

0 comments on commit d81339e

Please sign in to comment.