Filter members by date functionality added

This commit is contained in:
Aarni
2016-12-10 18:53:11 +02:00
parent 40e83ecdcc
commit b0753bf30a
2 changed files with 13 additions and 5 deletions
+3 -3
View File
@@ -25,7 +25,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="x in members | orderBy: 'last_name'">
<tr ng-repeat="x in shown_members | orderBy: 'last_name'">
<td>{{ x.last_name }}</td>
<td>{{ x.first_name }}</td>
<td>{{ x.email }}</td>
@@ -33,8 +33,8 @@
<td>{{ x.jas }}</td>
<td>{{ x.POR }}</td>
<td>{{ x.created }}</td>
<td>{{ x.paid }}</td>
<td>
<td>{{ x.paid }}</td>
<td>
<input type="button" value="Päivitä maksu" class="btn btn-success" ng-click="updatePayment(x.id)" />
</td>
<td>
+10 -2
View File
@@ -75,6 +75,7 @@ app.controller("getController", function($scope, $http, $window, $location){
m.jas = m.jas ? "Kyllä" : "Ei";
m.AYY = m.AYY ? "Kyllä" : "Ei";
});
$scope.shown_members = $scope.members;
});
};
$scope.getFunction();
@@ -103,11 +104,18 @@ app.controller("getController", function($scope, $http, $window, $location){
$scope.filter_by_date = function() {
if ($scope.datePicker == null)
{
$scope.shown_members = $scope.members;
}
else
{
$scope.shown_members = [];
for (var i = 0; i < $scope.members.length; i++)
{
if (moment($scope.members[i].paid) < $scope.datePicker)
{
$scope.shown_members.push($scope.members[i]);
}
}
}
};
$scope.clear_filter = function() {