buttons form merge all

This commit is contained in:
Michele Artini 2021-01-18 15:20:08 +01:00
parent 33697d60cf
commit cfdfed43b1
2 changed files with 35 additions and 5 deletions

View File

@ -31,10 +31,17 @@
</table>
<div class="card-footer bg-secondary py-1">
<button class="btn btn-sm btn-outline-primary" data-toggle="modal" data-target="#addNewConflictModal" ng-click="prepareAddConflictModal(w)">add</button>
<button type="button"
class="btn btn-sm btn-primary"
data-toggle="modal" data-target="#resolveConflictsModal"
ng-click="prepareConflictsModal(w)">resolve</button>
<div class="btn-group">
<button type="button"
class="btn btn-sm btn-primary pull-right"
data-toggle="modal" data-target="#resolveConflictsModal"
ng-click="prepareConflictsModal(w)">resolve manually</button>
<button type="button"
class="btn btn-sm btn-warning pull-right" ng-click="resolveConflictGroup(w, true)">merge all</button>
<button type="button"
class="btn btn-sm btn-danger pull-right" ng-click="resolveConflictGroup(w, false)">all differents</button>
</div>
</div>
</div>

View File

@ -642,7 +642,30 @@ orgsModule.controller('conflictsCtrl', function ($scope, $http, $routeParams, $l
angular.forEach($scope.orgs, function(org) { org.show = 'secondary'; });
});
}
$scope.resolveConflictGroup = function(group, merge) {
if (group.length > 1) {
if (merge && !confirm("You are merging " + group.length + " organization(s).\n\nDo you confirm?" )) {
return;
}
if (!merge && !confirm("You are marking as different " + group.length + " organization(s).\n\nDo you confirm?" )) {
return;
}
var ids = [];
angular.forEach(group, function(o, pos) { ids.push(o.id); });
var url = "/api/organizations/conflicts/fix/";
if (merge) { url += "similar"; }
else { url += "different"; }
call_http_post($http, url, ids, function(res) { $route.reload(); });
} else {
alert('Invalid group !!!');
}
}
$scope.getInfo = function() {
suggestionInfo.updateInfo(function(info) {
if ($scope.country == '_') {