Skip to content

Commit

Permalink
Merge pull request #669 from OpenOlitor/fix/OO#148_abotyp_filter_show…
Browse files Browse the repository at this point in the history
…s_activ_or_inactive_abotyp

Fix/oo#148 abotyp filter shows activ or inactive abotyp
  • Loading branch information
mcmpp committed Dec 11, 2023
2 parents 6b9232e + 60d80a9 commit 5527c84
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions app/scripts/abos/overview/abosoverview.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ angular.module('openolitor-admin')
$scope.model = {};
$scope.vertriebL = [];
$scope.initGJ = false;
$scope.displayedAbotypen = [];

$scope.navigateToKunde = function(id) {
$scope.filteredEntries = [];
Expand Down Expand Up @@ -74,7 +75,8 @@ angular.module('openolitor-admin')
$scope.abotypL.push({
'id': abotyp.id,
'title': abotyp.name,
'price': abotyp.preis
'price': abotyp.preis,
'aktiv': abotyp.aktiv
});
});
});
Expand Down Expand Up @@ -234,7 +236,10 @@ angular.module('openolitor-admin')

$scope.filteredEntries = dataSet;
updateIds();

$scope.displayedAbotypen.length = 0;
angular.forEach(fillFilter(params.filter().aktiv), function(abotyp) {
$scope.displayedAbotypen.push(abotyp);
});
params.total(dataSet.length);

$location.search({
Expand All @@ -255,6 +260,18 @@ angular.module('openolitor-admin')
}
}

function fillFilter(aktiv) {
var da = [];
angular.forEach($scope.abotypL, function(abotyp) {
if ( aktiv === true && abotyp.aktiv === true){
da.push({'id':abotyp.id, 'title':abotyp.title});
} else if (aktiv !== true ) {
da.push({'id':abotyp.id, 'title':abotyp.title});
}
});
return da;
}

function updateIds() {
var ids = [];
var checkedItems = [];
Expand All @@ -270,7 +287,7 @@ angular.module('openolitor-admin')
$scope.checkboxes.items = Object.fromEntries(items);
$scope.updateChecked();
}

$scope.selectedGeschaeftsjahr = function(gj) {
if(angular.isDefined(gj)) {
$scope.geschaeftsjahr = gj;
Expand Down Expand Up @@ -339,7 +356,7 @@ angular.module('openolitor-admin')

AbosOverviewModel.query({
f: $scope.search.filterQuery,
q: $scope.search.queryQuery,
q: $scope.search.queryQuery,
x: $scope.search.complexFlags,
g: /^\d+$/.test($scope.geschaeftsjahr)?$scope.geschaeftsjahr:'',
}, function(entries) {
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/abos/overview/abosoverview.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h3 class="panel-title"><span class="navbar-brand" translate>Abos</span>
<td data-title="'Nr.'|translate" sortable="'id'" filter="{id: 'text'}">
<a ng-click="selectAbo(abo, 'selectedRow_' + abo.id)">{{abo.id}}&nbsp;<i class="fa fa-chevron-right"></i></a>
</td>
<td data-title="'Abotyp'|translate" sortable="'abotypName'" filter="{abotypId: 'select'}" filter-data="abotypL">
<td data-title="'Abotyp'|translate" sortable="'abotypName'" filter="{abotypId: 'select'}" filter-data="displayedAbotypen">
{{abo.abotypName}} &nbsp; <a target="_blank" rel="noopener noreferrer" ng-href="#/abotypen/{{abo.abotypId}}"><i class="glyphicon small glyphicon-new-window"></i></a>
&nbsp;
<span ng-if="abo.zusatzAboIds.length > 0">
Expand Down

0 comments on commit 5527c84

Please sign in to comment.