Skip to content

Commit

Permalink
Added requisitionless orders filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikNoga committed May 10, 2024
1 parent 1f34ec4 commit 5e45926
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/order-view/messages_en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"orderView.view": "View details",
"orderView.isRequisitionless": "Requisitionless"
"orderView.requisitionless": "Requisitionless"
}
16 changes: 16 additions & 0 deletions src/order-view/order-view.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@
*/
vm.tableConfig = undefined;

/**
* @ngdoc property
* @propertyOf order-view.controller:OrderViewController
* @name requisitionless
* @type {boolean}
*
* @description
* Sets requisitionless flag
*/
vm.requisitionless = undefined;

/**
* @ngdoc method
* @methodOf order-view.controller:OrderViewController
Expand Down Expand Up @@ -195,6 +206,10 @@
vm.periodEndDate = $stateParams.periodEndDate;
}

if ($stateParams.requisitionless) {
vm.requisitionless = $stateParams.requisitionless;
}

if ($stateParams.status) {
vm.status = vm.orderStatuses.filter(function(status) {
return $stateParams.status === status.value;
Expand Down Expand Up @@ -236,6 +251,7 @@
stateParams.periodStartDate = vm.periodStartDate ? $filter('isoDate')(vm.periodStartDate) : null;
stateParams.periodEndDate = vm.periodEndDate ? $filter('isoDate')(vm.periodEndDate) : null;
stateParams.sort = 'createdDate,desc';
stateParams.requisitionless = vm.requisitionless;

$state.go('openlmis.orders.view', stateParams, {
reload: true
Expand Down
8 changes: 5 additions & 3 deletions src/order-view/order-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ <h2>{{'orderView.viewOrders' | message}}</h2>
<input id="periodStartDate" type="date" ng-model="vm.periodStartDate" max-date="vm.periodEndDate" />
<label for=periodEndDate>{{'orderView.periodEnd' | message}}</label>
<input id="periodEndDate" type="date" ng-model="vm.periodEndDate" min-date="vm.periodStartDate" />
<label for="">{{:: 'orderView.isRequisitionless' | message}}</label>
<input type="checkbox" id="isRequisitionless">
<div>
<label for="requisitionless">{{:: 'orderView.requisitionless' | message}}</label>
<input type="checkbox" ng-model="vm.requisitionless" id="requisitionless" ng-true-value="'true'" ng-false-value="'false'">
</div>
<input type="submit" class="btn btn-primary" value="{{'orderView.search' | message}}" />
</form>
<openlmis-table table-config="vm.tableConfig"></openlmis-table>
<openlmis-pagination />
</section>
</section>

0 comments on commit 5e45926

Please sign in to comment.