multiple selection

This commit is contained in:
Michele Artini 2022-04-19 09:47:20 +02:00
parent f143d1f0c9
commit 035d1da34f
3 changed files with 15 additions and 13 deletions

View File

@ -49,7 +49,8 @@
<tbody> <tbody>
<tr ng-repeat="o in orgs.content" class="d-flex" ng-class="{'table-warning' : showStatus && o.status != 'approved'}"> <tr ng-repeat="o in orgs.content" class="d-flex" ng-class="{'table-warning' : showStatus && o.status != 'approved'}">
<td class="col-6"> <td class="col-6">
<a ng-if="mode == 'select-modal'" href="javascript:void(0)" title="{{o.id}}" ng-click="selectOrg(o)" data-dismiss="modal">{{o.name}}</a> <a ng-if="(mode == 'select-modal') && !o.selected" href="javascript:void(0)" title="{{o.id}}" ng-click="selectOrg(o)">{{o.name}}</a>
<span ng-if="(mode == 'select-modal') && o.selected" title="{{o.id}}" class="text-muted">{{o.name}} <b>(SELECTED)</b></span>
<a ng-if="mode != 'select-modal'" href="#!/edit/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a> <a ng-if="mode != 'select-modal'" href="#!/edit/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a>
<span class="badge badge-warning" ng-if="showStatus && o.status != 'approved'">{{o.status}}</span> <span class="badge badge-warning" ng-if="showStatus && o.status != 'approved'">{{o.status}}</span>
</td> </td>

View File

@ -6,12 +6,14 @@
<button type="button" class="close" data-dismiss="modal">&times;</button> <button type="button" class="close" data-dismiss="modal">&times;</button>
</div> </div>
<div class="modal-body" style="min-height: 300px"> <div class="modal-body" style="min-height: 300px">
<div class="input-group input-group-sm"> <form>
<input type="text" class="form-control" ng-model="searchText" /> <div class="input-group input-group-sm">
<div class="input-group-append"> <input type="text" class="form-control" ng-model="searchText" />
<button type="button" class="btn btn-outline-primary" ng-click="search(searchText, 0, 25)">Search</button> <div class="input-group-append">
<button type="submit" class="btn btn-outline-primary" ng-click="search(searchText, 0, 25)">Search</button>
</div>
</div> </div>
</div> </form>
<div ng-show="searchValue"> <div ng-show="searchValue">
<org-results-page orgs="searchOrgs" <org-results-page orgs="searchOrgs"
prev-function="search(searchValue, searchOrgs.number - 1, searchOrgs.size)" prev-function="search(searchValue, searchOrgs.number - 1, searchOrgs.size)"
@ -22,6 +24,9 @@
</div> </div>
</div> </div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -63,12 +63,6 @@ orgsModule.directive('selectOrgModal', function($http, $timeout) {
} }
scope.selectOrg = function() { scope.selectOrg = function() {
$timeout(function() {
scope.searchText = '';
scope.searchValue = '';
scope.searchOrgs = {};
}, 1000);
if (scope.onSelect) { if (scope.onSelect) {
scope.onSelect(); scope.onSelect();
} }
@ -219,6 +213,8 @@ orgsModule.directive('orgResultsPage', function($http, $location, $route) {
templateUrl: 'resources/html/parts/org_results_page.html', templateUrl: 'resources/html/parts/org_results_page.html',
link: function(scope, element, attrs, ctrl) { link: function(scope, element, attrs, ctrl) {
scope.selectOrg = function(o) { scope.selectOrg = function(o) {
o.selected = true;
scope.selectedOrg.id = o.id; scope.selectedOrg.id = o.id;
scope.selectedOrg.name = o.name; scope.selectedOrg.name = o.name;
scope.selectedOrg.type = o.type; scope.selectedOrg.type = o.type;
@ -555,7 +551,7 @@ orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $ro
$scope.saveDuplicates = function() { $scope.saveDuplicates = function() {
call_http_post($http, 'api/organizations/duplicates', $scope.duplicates, function(res) { call_http_post($http, 'api/organizations/duplicates', $scope.duplicates, function(res) {
$scope.getInfo(); $scope.getInfo();
alert('Events updated !!!'); alert('Duplicates updated !!!');
$scope.duplicates = res.data; $scope.duplicates = res.data;
}); });
} }