Project

General

Profile

« Previous | Next » 

Revision 58243

partial implementation of merge orgs modal

View differences:

modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/modals/resolve_conflicts.html
1
<div class="modal fade" id="{{modalId}}" tabindex="-1" role="dialog">
2
	<div class="modal-dialog modal-xl" role="document">
3
		<div class="modal-content">
4
			<div class="modal-header">
5
				<h5 class="modal-title">Select master</h5>
6
				<button type="button" class="close" data-dismiss="modal">&times;</button>
7
			</div>
8
			<div class="modal-body" style="min-height: 300px">
9
				<div ng-repeat="o in orgs">
10
					<div class="form-check">
11
						<input class="form-check-input" type="radio" name="org_op_master" id="org_op_mergein_{{$index}}" value="{{$index}}" />
12
						<div>
13
							<org-details org="o" org-title="Organization {{$index+1}}"></org-details>
14
							<div class="input-group input-group-sm mb-3">
15
								<div class="input-group-prepend">
16
									<label class="input-group-text" for="inputGroupSelect01">Operation</label>
17
								</div>
18
	  							<select class="custom-select">
19
									<option>merge to master</option>
20
									<option>mark as an invalid event</option>
21
									<option>skip</option>
22
								</select>
23
							</div>
24
						</div>
25
					</div>
26
				</div>
27
			</div>
28
			<div class="modal-footer">
29
				<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
30
				<button type="button" class="btn btn-primary" data-dismiss="modal" ng-click="resolveConflicts()">Save changes</button>
31
			</div>
32
		</div>
33
	</div>
34
</div>
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/forms/all_conflicts.html
23 23
			<tr ng-repeat="o in w">
24 24
				<th style="width:40px" class="text-center">#{{$index+1}}</th>
25 25
				<td><a href="#!/edit/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a></td>
26
				<td style="width:200px"><img ng-src="resources/images/flags/{{o.country}}.gif" /> {{o.city}}, {{o.country}}</td>
26
				<td style="width:250px"><img ng-src="resources/images/flags/{{o.country}}.gif" /> {{o.city}}, {{o.country}}</td>
27 27
				<td style="width:80px" class="text-right">{{o.type}}</td>
28 28
			</tr>
29 29
		</table>
30 30
		<div class="card-footer bg-secondary py-1">
31
			<button type="button" class="btn btn-sm btn-primary">merge</button>
31
			<button type="button" 
32
				class="btn btn-sm btn-primary" 
33
				data-toggle="modal" data-target="#resolveConflictsModal"
34
				ng-click="prepareConflictsModal(w)">resolve</button>
32 35
		</div>
33 36
	</div>
34
</div>
37

  
38
</div>
39

  
40
<resolve-conflicts-modal modal-id="resolveConflictsModal" orgs="orgs"></resolve-conflicts-modal>
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/forms/all_duplicates.html
47 47
			</div>
48 48
			<div class="modal-body">
49 49
				<div class="text-muted" ng-if="currentDuplicates.length == 0">No duplicates</div>
50
				<org-details org="currentOrgDetails"></org-details>
50
				<org-details org="currentOrgDetails" org-title="Registered organization"></org-details>
51 51
				<org-form-duplicates duplicates="currentDuplicates"></org-form-duplicates>
52 52
			</div>
53 53
			<div class="modal-footer">
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/parts/org_dedup_events.html
1 1
<div class="card-body">
2 2
	
3
	<org-details org="currentOrgDetails"></org-details>
3
	<org-details org="currentOrgDetails" org-title="Registered organization"></org-details>
4 4

  
5 5
	<org-form-duplicates duplicates="events.duplicates" save-function="saveDuplicates()" show-save-button="1"></org-form-duplicates>
6 6
					
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/html/parts/org_details.html
1 1
<div class="card mb-3">
2
	<div class="card-header bg-primary text-white py-1">Registered organization</div>
2
	<div class="card-header bg-primary text-white py-1">{{orgTitle}}</div>
3 3
	<table class="table table-sm table-condensed">
4 4
		<tr class="d-flex">
5 5
			<th class="col-4">Name</th>
modules/dnet-orgs-database-application/trunk/src/main/resources/static/resources/js/organizations.js
43 43
	}
44 44
});
45 45

  
46
orgsModule.directive('resolveConflictsModal', function($http) {
47
	return {
48
		restrict: 'E',
49
		scope: {
50
			'modalId' : '@',
51
			'orgs'    : '='
52
		},
53
		templateUrl: 'resources/html/modals/resolve_conflicts.html',
54
		link: function(scope, element, attrs, ctrl) {
55
			
56
			
57
			scope.resolveConflicts = function() {
58
				alert('todo');
59
			}		
60
		}
61
	}
62
});
46 63
		
47 64
orgsModule.directive('orgTabsMenu', function($http) {
48 65
	return {
......
182 199
	return {
183 200
		restrict: 'E',
184 201
		scope: {
185
			'org' : '='
202
			'org'      : '=',
203
			'orgTitle' : '@'
186 204
		},
187 205
		templateUrl: 'resources/html/parts/org_details.html',
188 206
		link: function(scope, element, attrs, ctrl) {}
......
210 228
});
211 229

  
212 230

  
213
orgsModule.directive('allConflicts', function($http, $location, $route) {
231
orgsModule.directive('allConflicts', function($http, $location, $route, $q) {
214 232
	return {
215 233
		restrict: 'E',
216 234
		scope: {
......
220 238
			'infoMethod'   : '&'
221 239
		},
222 240
		templateUrl: 'resources/html/forms/all_conflicts.html',
223
		link: function(scope, element, attrs, ctrl) {}
241
		link: function(scope, element, attrs, ctrl) {
242
			scope.orgs = [];
243
			
244
			scope.prepareConflictsModal = function(list) {
245
				scope.orgs = [];
246
				
247
				var gets = list.map((o) => $http.get('api/organizations/get?id=' + o.id));
248
				
249
				$q.all(gets).then(function(responses) {
250
					scope.orgs = responses.map((resp) => resp.data);
251
				});
252
				
253
				scope.orgs = list;
254
			}
255
			
256
		}
224 257
     }
225 258
});
226 259

  

Also available in: Unified diff