manual add duplicate
This commit is contained in:
parent
d76b9c97b5
commit
3881782019
|
@ -16,6 +16,7 @@
|
|||
<org-results-page orgs="searchOrgs"
|
||||
prev-function="search(searchValue, searchOrgs.number - 1, searchOrgs.size)"
|
||||
next-function="search(searchValue, searchOrgs.number + 1, searchOrgs.size)"
|
||||
on-select="selectOrg()"
|
||||
selected-org="selectedOrg"
|
||||
mode="select-modal"></org-results-page>
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<div class="modal-body">
|
||||
<div class="text-muted" ng-if="currentDuplicates.length == 0">No duplicates</div>
|
||||
<org-details org="currentOrgDetails" org-title="Registered organization" show="default"></org-details>
|
||||
<org-duplicates duplicates="currentDuplicates"></org-form-duplicates>
|
||||
<org-duplicates org-id="currentOrgDetails.id" duplicates="currentDuplicates"></org-form-duplicates>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<div class="card-body" ng-if="currentTab == 2 && (org.status == 'approved' || org.status == 'suggested')">
|
||||
<org-details org="org" org-title="Current organization" show="default"></org-details>
|
||||
<org-duplicates duplicates="duplicates" save-function="saveDuplicates()" show-save-button="1"></org-form-duplicates>
|
||||
<org-duplicates org-id="{{org.id}}" duplicates="duplicates" save-function="saveDuplicates()" show-save-button="1"></org-form-duplicates>
|
||||
</div>
|
||||
|
||||
<div class="card-body" ng-if="currentTab == 3 && (org.status == 'approved' || org.status == 'suggested')">
|
||||
|
|
|
@ -38,8 +38,15 @@
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="card-footer text-right" ng-if="showSaveButton && duplicates.length > 0">
|
||||
<button class="btn btn-sm btn-primary" ng-click="saveFunction()">save</button>
|
||||
<div class="card-footer text-right">
|
||||
<button class="btn btn-sm btn-primary" ng-click="saveFunction()" ng-if="showSaveButton && duplicates.length > 0">save</button>
|
||||
<button class="btn btn-sm btn-outline-primary" data-toggle="modal" data-target="#addDuplicateModal">add</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<select-org-modal modal-id="addDuplicateModal" selected-org="newDuplicate" filter-status="suggested,discarded" on-select="addDuplicate()"></select-org-modal>
|
||||
|
||||
|
||||
|
|
|
@ -45,17 +45,19 @@ orgsModule.controller('menuCtrl', function ($scope, suggestionInfo) {
|
|||
suggestionInfo.updateInfo(null);
|
||||
});
|
||||
|
||||
orgsModule.directive('selectOrgModal', function($http) {
|
||||
orgsModule.directive('selectOrgModal', function($http, $timeout) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
'modalId' : '@',
|
||||
'filterStatus' : '@',
|
||||
'selectedOrg' : '='
|
||||
'selectedOrg' : '=',
|
||||
'onSelect' : '&'
|
||||
},
|
||||
templateUrl: 'resources/html/modals/select_org.html',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
scope.searchOrgs = {};
|
||||
scope.searchText = '';
|
||||
scope.searchValue = '';
|
||||
|
||||
scope.search = function(text, page, size) {
|
||||
|
@ -69,6 +71,19 @@ orgsModule.directive('selectOrgModal', function($http) {
|
|||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
}
|
||||
|
||||
scope.selectOrg = function() {
|
||||
$timeout(function() {
|
||||
scope.searchText = '';
|
||||
scope.searchValue = '';
|
||||
scope.searchOrgs = {};
|
||||
}, 1000);
|
||||
|
||||
if (scope.onSelect) {
|
||||
scope.onSelect();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -216,6 +231,7 @@ orgsModule.directive('orgResultsPage', function($http, $location, $route) {
|
|||
'orgs' : '=',
|
||||
'nextFunction' : '&',
|
||||
'prevFunction' : '&',
|
||||
'onSelect' : '&',
|
||||
'selectedOrg' : '=',
|
||||
'mode' : '@'
|
||||
},
|
||||
|
@ -224,11 +240,16 @@ orgsModule.directive('orgResultsPage', function($http, $location, $route) {
|
|||
scope.selectOrg = function(o) {
|
||||
scope.selectedOrg.id = o.id;
|
||||
scope.selectedOrg.name = o.name;
|
||||
scope.selectedOrg.type = o.name;
|
||||
scope.selectedOrg.city = o.name;
|
||||
scope.selectedOrg.country = o.name;
|
||||
scope.selectedOrg.acronyms = o.name;
|
||||
scope.selectedOrg.approved = o.name;
|
||||
scope.selectedOrg.type = o.type;
|
||||
scope.selectedOrg.city = o.city;
|
||||
scope.selectedOrg.country = o.country;
|
||||
scope.selectedOrg.acronyms = o.acronyms;
|
||||
scope.selectedOrg.status = o.status;
|
||||
|
||||
if (scope.onSelect) {
|
||||
scope.onSelect();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,12 +259,41 @@ orgsModule.directive('orgDuplicates', function($http, $location, $route) {
|
|||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
'orgId' : '@',
|
||||
'duplicates' : '=',
|
||||
'showSaveButton' : '@',
|
||||
'saveFunction' : '&'
|
||||
},
|
||||
templateUrl: 'resources/html/parts/org_duplicates.html',
|
||||
link: function(scope, element, attrs, ctrl) {}
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
scope.newDuplicate = {};
|
||||
|
||||
scope.addDuplicate = function() {
|
||||
scope.duplicates.push({
|
||||
'localId' : scope.orgId,
|
||||
'oaOriginalId' : scope.newDuplicate.id,
|
||||
'oaName' : scope.newDuplicate.name,
|
||||
'oaAcronym' : scope.newDuplicate.acronyms,
|
||||
'oaCountry' : scope.newDuplicate.country,
|
||||
'oaUrl' : '-',
|
||||
'oaCollectedFrom' : 'user',
|
||||
'relType' : 'is_similar'
|
||||
});
|
||||
|
||||
|
||||
$http.get('api/organizations/duplicates?id=' + scope.newDuplicate.id).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
angular.forEach(res.data, function(dup) {
|
||||
dup.localId = scope.orgId;
|
||||
scope.duplicates.push(dup);
|
||||
});
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -526,7 +576,7 @@ orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $ro
|
|||
else { $scope.message = ''; }
|
||||
$window.scrollTo(0, 0);
|
||||
|
||||
$timeout(function() { $scope.message = ''; }, 3000)
|
||||
$timeout(function() { $scope.message = ''; }, 3000);
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue