Skip to content

Commit

Permalink
Added filter by price in property view #16
Browse files Browse the repository at this point in the history
  • Loading branch information
alfdocimo committed Mar 10, 2017
1 parent dd07b43 commit 82ee7aa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
19 changes: 10 additions & 9 deletions src/main/webapp/app/entities/property/properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ <h2 data-translate="assessoriaTorrellesApp.property.home.title">Properties</h2>

<div class="col-md-8 col-sm-8 col-xs-9">
<form class="form-inline" role="form">
<span>Sort by : </span>
<span>Sort by </span>
<div class="form-group">
<label class="sr-only" for="sortby">Sort by : </label>
<select class="form-control">
<option>Most Recent</option>
<option>Price (Low &gt; High)</option>
<option>Price (High &gt; Low)</option>
<option>Most Popular (Low &gt; High)</option>
</select>
<label class="sr-only" for="sortby">Sort by price: </label>
<!--{{vm.orderCriteria.rev}}-->
<!--<select class="form-control" ng-model="vm.orderCriteria.rev">-->

<!--<option value="false">Price (Low &gt; High)</option>-->
<!--<option value="true">Price (High &gt; Low)</option>-->
<!--</select>-->
<button type="button" class="btn btn-success" ng-click="vm.changeOrder()">Price <span class="glyphicon glyphicon-euro"></span></button>
</div>
<span>Show : </span>
<div class="form-group">
Expand All @@ -58,7 +59,7 @@ <h2 data-translate="assessoriaTorrellesApp.property.home.title">Properties</h2>
<!-- end:sorting -->

<div class="row container-realestate">
<div class="col-md-4 col-sm-6 col-xs-12" ng-repeat="property in vm.listByFilter track by property.id">
<div class="col-md-4 col-sm-6 col-xs-12" ng-repeat="property in vm.listByFilter | orderBy:orderCriteria.criteria:vm.orderCriteria.rev track by property.id">
<div class="property-container">
<div class="property-image">
<img src="content/img/img02.jpg" ui-sref="property-detail({id:property.id})" alt="mikha real estate theme">
Expand Down
14 changes: 13 additions & 1 deletion src/main/webapp/app/entities/property/property.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,22 @@
vm.listByFilter = [];
vm.filterCritera = {};
// vm.filterCritera.location = 'Barcelona';

vm.isAuthenticated = null;
vm.account = null;

vm.orderCriteria = {};
vm.orderCriteria.criteria = 'price';
vm.orderCriteria.rev = true;

vm.changeOrder = function () {

if(vm.orderCriteria.rev ===true){
vm.orderCriteria.rev = false;
}else if(vm.orderCriteria.rev ===false){
vm.orderCriteria.rev = true;
}
};

$scope.$on('authenticationSuccess', function() {
getAccount();
});
Expand Down

0 comments on commit 82ee7aa

Please sign in to comment.