ui regactoring
This commit is contained in:
parent
f3cec6ab87
commit
d4cdf11384
|
@ -1,28 +1,29 @@
|
|||
<div class="card mb-3">
|
||||
<div class="card text-white mb-3">
|
||||
<div class="card-header bg-primary text-white py-1">Conflicts</div>
|
||||
|
||||
<div class="card-body text-muted" ng-if="conflicts.length == 0">No conflicts</div>
|
||||
|
||||
<table class="table table-sm mt-2" ng-if="conflicts.length > 0">
|
||||
<thead>
|
||||
<tr class="d-flex">
|
||||
<th class="col-6 pl-3" style="border-top: none;">Related organization</th>
|
||||
<th class="col-2 text-center" style="border-top: none;">Type</th>
|
||||
<th class="col-4 text-right" style="border-top: none;">Place</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="d-flex" ng-repeat="sr in conflicts">
|
||||
<td class="col-6 pl-3">{{sr.name}}<br /><a href="#!/edit/0/{{sr.id}}" class="small text-monospace">{{sr.id}}</a></td>
|
||||
<td class="col-2 text-center small">{{sr.type}}</td>
|
||||
<td class="col-4 text-right small"><img ng-src="resources/images/flags/{{sr.country}}.gif" /> {{sr.city || '-'}}, {{sr.country}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<table class="table table-sm" ng-if="conflicts.length > 0">
|
||||
|
||||
<tr>
|
||||
<th style="width:40px" class="text-center">#1</th>
|
||||
<td><a href="javascript:location.reload()" title="{{org.id}}">{{org.name}}</a> <span class="badge badge-primary">current</span></td>
|
||||
<td style="width:250px"><img ng-src="resources/images/flags/{{org.country}}.gif" /> {{org.city || '-'}}, {{org.country}}</td>
|
||||
<td style="width:80px" class="text-right">{{org.type}}</td>
|
||||
</tr>
|
||||
|
||||
<tr ng-repeat="sr in conflicts">
|
||||
<th style="width:40px" class="text-center">#{{$index+2}}</th>
|
||||
<td><a href="#!/edit/0/{{sr.id}}" title="{{sr.id}}">{{sr.name}}</a></td>
|
||||
<td style="width:250px"><img ng-src="resources/images/flags/{{sr.country}}.gif" /> {{sr.city || '-'}}, {{sr.country}}</td>
|
||||
<td style="width:80px" class="text-right">{{sr.type}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="card-footer text-right" ng-if="showSaveButton && conflicts.length > 0">
|
||||
<div class="card-footer bg-secondary py-1" ng-if="showSaveButton && conflicts.length > 0">
|
||||
<button class="btn btn-sm btn-primary" data-toggle="modal" data-target="#resolveConflictsModal" ng-click="prepareConflictsModal()">resolve conflicts</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<resolve-conflicts-modal modal-id="resolveConflictsModal" orgs="candidateConflicts" selected-orgs="selectedConflicts"></resolve-conflicts-modal>
|
||||
<resolve-conflicts-modal modal-id="resolveConflictsModal" orgs="candidateConflicts" selected-orgs="selectedConflicts"></resolve-conflicts-modal>
|
||||
|
||||
|
|
|
@ -1,297 +0,0 @@
|
|||
<div class="card-body">
|
||||
<form name="organizationForm">
|
||||
|
||||
<div ng-if="mode == 'approve'" class="alert alert-warning">
|
||||
This is a pending organization. Please evaluate it before approving.
|
||||
</div>
|
||||
<div ng-if="mode == 'readonly'" class="alert alert-secondary">
|
||||
This organization is managed by the system. You can not edit.
|
||||
</div>
|
||||
|
||||
|
||||
<fieldset ng-disabled="mode == 'readonly'">
|
||||
<legend>Official name and type</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">name</div>
|
||||
</div>
|
||||
<input name="org_nm" type="text" class="form-control"
|
||||
placeholder="organization name..." ng-model="org.name"
|
||||
required="required"
|
||||
ng-class="{'is-invalid' : organizationForm.org_nm.$error.required}" />
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">type</div>
|
||||
</div>
|
||||
<select name="org_tp" class="custom-select" ng-model="org.type"
|
||||
required="required"
|
||||
ng-class="{'is-invalid' : organizationForm.org_tp.$error.required}">
|
||||
<option disabled="disabled" value='' ng-if="!org.type">type...</option>
|
||||
<option ng-repeat="t in vocabularies.orgTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="mt-4" ng-disabled="mode == 'readonly'">
|
||||
<legend>Geographical location</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">city</div>
|
||||
</div>
|
||||
<input name="org_ct" type="text" class="form-control" placeholder=""
|
||||
ng-model="org.city" />
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">country</div>
|
||||
</div>
|
||||
|
||||
<select name="org_cntr" class="custom-select" ng-model="org.country"
|
||||
required="required"
|
||||
ng-class="{'is-invalid' : organizationForm.org_cntr.$error.required}">
|
||||
<option disabled="disabled" value='' ng-if="!org.country">country...</option>
|
||||
<option ng-repeat="c in vocabularies.countries"value="{{c.value}}">{{c.name}}</option>
|
||||
</select>
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">lat</div>
|
||||
</div>
|
||||
<input name="org_lat" type="text" class="form-control"
|
||||
placeholder="0.0" ng-model="org.lat" />
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">lng</div>
|
||||
</div>
|
||||
<input name="org_lng" type="text" class="form-control"
|
||||
placeholder="0.0" ng-model="org.lng" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="mt-4" ng-disabled="mode == 'readonly'">
|
||||
<legend>Other names and identifiers</legend>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Acronyms</div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr ng-repeat="a in org.acronyms">
|
||||
<td>{{a}}</td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
ng-click="org.acronyms.splice($index, 1)">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr ng-init="newAcronym=''">
|
||||
<td><input type="text" class="form-control form-control-sm"
|
||||
placeholder="new acronym..." ng-model='newAcronym' /></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
ng-click="org.acronyms.push(newAcronym); newAcronym=''"
|
||||
ng-disabled="!newAcronym || org.acronyms.indexOf(newAcronym) !== -1">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Aliases</div>
|
||||
<table class="table table-sm">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th style="width: 156px">language</th>
|
||||
<th style="width: 44px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="n in org.otherNames">
|
||||
<td>{{n.name}}</td>
|
||||
<td>{{n.lang}}</td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
ng-click="org.otherNames.splice($index, 1)">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr ng-init="newOtherName=newLang=''">
|
||||
<td><input type="text" class="form-control form-control-sm"
|
||||
placeholder="new alias..." ng-model="newOtherName" /></td>
|
||||
<td><select class="custom-select custom-select-sm"
|
||||
ng-model="newLang">
|
||||
<option disabled="disabled" value=''>language...</option>
|
||||
<option ng-repeat="l in vocabularies.languages" value="{{l.value}}">{{l.name}}</option>
|
||||
</select></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
ng-click="org.otherNames.push({'name': newOtherName, 'lang': newLang}); newOtherName=newLang=''"
|
||||
ng-disabled="!newOtherName || !newLang">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Identifiers</div>
|
||||
<table class="table table-sm">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>id</th>
|
||||
<th style="width: 156px">type</th>
|
||||
<th style="width: 44px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="id in org.otherIdentifiers">
|
||||
<td>{{id.id}}</td>
|
||||
<td>{{id.type}}</td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
ng-click="org.otherIdentifiers.splice($index, 1)">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr ng-init="newId=newIdType=''">
|
||||
<td><input type="text" class="form-control form-control-sm"
|
||||
placeholder="new id..." ng-model="newId" /></td>
|
||||
<td><select class="custom-select custom-select-sm"
|
||||
ng-model="newIdType">
|
||||
<option disabled="disabled" value=''>type...</option>
|
||||
<option ng-repeat="t in vocabularies.idTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
ng-click="org.otherIdentifiers.push({'id': newId, 'type': newIdType}); newId=newIdType=''"
|
||||
ng-disabled="!newId || !newIdType">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Urls</div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr ng-repeat="u in org.urls">
|
||||
<td><a href="{{u}}" target="_blank">{{u}}</a></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
ng-click="org.urls.splice($index, 1)">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr ng-init="newUrl=''">
|
||||
<td><input type="text" class="form-control form-control-sm"
|
||||
placeholder="http://..." ng-model="newUrl" /></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
ng-click="org.urls.push(newUrl); newUrl=''"
|
||||
ng-disabled="!newUrl || org.urls.indexOf(newUrl) !== -1">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="mt-4" ng-disabled="mode == 'readonly'">
|
||||
<legend>Relations</legend>
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Relations</div>
|
||||
<table class="table table-sm">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th class="pl-3" style="border-top: none;">Related organization</th>
|
||||
<th style="border-top: none; width: 156px">Type</th>
|
||||
<th style="border-top: none; width: 44px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-if="org.relations.length == 0">
|
||||
<td class="text-center text-muted" colspan="3">No relations</td>
|
||||
</tr>
|
||||
<tr ng-repeat="r in org.relations">
|
||||
<td class="pl-3"><a href="#!/edit/0/{{r.relatedOrgId}}" title="{{r.relatedOrgId}}">{{r.relatedOrgName}}</a></td>
|
||||
<td>{{r.type}}</td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger" ng-click="org.relations.splice($index, 1)"><i class="fa fa-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="text" placeholder="add a related organization..." readonly="readonly"
|
||||
class="form-control form-control-sm" style="background-color: white; color: #007bff;"
|
||||
ng-model="newRelation.name" ng-click="resetSelectedRelation()"
|
||||
data-toggle="modal" data-target="#selectRelatedOrgModal" ng-hide="mode == 'readonly'"/>
|
||||
<input type="text" placeholder="add a related organization..." disabled="disabled"
|
||||
class="form-control form-control-sm" ng-model="newRelation.name" ng-show="mode == 'readonly'"/>
|
||||
</td>
|
||||
<td>
|
||||
<select class="custom-select custom-select-sm" ng-model="newRelType">
|
||||
<option disabled="disabled" value=''>rel type...</option>
|
||||
<option ng-repeat="t in vocabularies.relTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="btn btn-sm btn-outline-success" ng-disabled="!newRelType || !newRelation.id" ng-click="addNewRelation()"><i class="fa fa-plus"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit" class="btn" ng-class="{'btn-primary' : mode != 'approve', 'btn-warning' : mode == 'approve'}" ng-click="save()" ng-disabled="organizationForm.$invalid" ng-hide="mode == 'readonly'">
|
||||
<span ng-if="mode != 'approve'">Save</span>
|
||||
<span ng-if="mode == 'approve'">Register as new Organization</span>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<select-org-modal modal-id="selectRelatedOrgModal" selected-org="newRelation"></select-org-modal>
|
|
@ -1,10 +0,0 @@
|
|||
<div class="card-header">
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
<li class="nav-item">
|
||||
<a href="javascript:void(0)" class="nav-link" ng-class="{'active': selected == 1}" ng-click="loadOrg()">Metadata Management</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="javascript:void(0)" class="nav-link" ng-class="{'active': selected == 2}" ng-click="loadDedupEvents()">Dedup Events <span class="badge badge-primary ml-2">{{info.nDuplicates}}</span> <span class="badge badge-danger">{{info.nConflicts}}</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
|
@ -8,11 +8,33 @@
|
|||
</p>
|
||||
|
||||
<div class="card">
|
||||
<org-tabs-menu org-id="{{orgId}}" info="info" org="org" events="events" selected="currentTab"></org-tabs-menu>
|
||||
|
||||
<org-form-metadata org-id="{{orgId}}" org="org" vocabularies="vocabularies" info-method="getInfo()" ng-if="currentTab == 1 && org.status == 'approved'" mode="update"></org-form-metadata>
|
||||
<org-form-metadata org-id="{{orgId}}" org="org" vocabularies="vocabularies" info-method="getInfo()" ng-if="currentTab == 1 && org.status == 'suggested'" mode="approve"></org-form-metadata>
|
||||
<org-form-metadata org-id="{{orgId}}" org="org" vocabularies="vocabularies" info-method="getInfo()" ng-if="currentTab == 1 && org.status != 'approved' && org.status != 'suggested'" mode="readonly"></org-form-metadata>
|
||||
<div class="card-header">
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
<li class="nav-item">
|
||||
<a href="javascript:void(0)" class="nav-link" ng-class="{'active': currentTab == 1}" ng-click="gotoTab(1)">Metadata Management</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="javascript:void(0)" class="nav-link" ng-class="{'active': currentTab == 2}" ng-click="gotoTab(2)">Duplicates <span class="badge badge-primary ml-2">{{info.nDuplicates}}</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="javascript:void(0)" class="nav-link" ng-class="{'active': currentTab == 3}" ng-click="gotoTab(3)">Conflicts <span class="badge badge-danger">{{info.nConflicts}}</span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="card-body" ng-if="currentTab == 1 && org.status">
|
||||
<org-form-metadata org-id="{{orgId}}" org="org" vocabularies="vocabularies" info-method="getInfo()" mode="update" ng-if="org.status == 'approved'"></org-form-metadata>
|
||||
<org-form-metadata org-id="{{orgId}}" org="org" vocabularies="vocabularies" info-method="getInfo()" mode="approve" ng-if="org.status == 'suggested'"></org-form-metadata>
|
||||
<org-form-metadata org-id="{{orgId}}" org="org" vocabularies="vocabularies" info-method="getInfo()" mode="readonly" ng-if="org.status != 'approved' && org.status != 'suggested'"></org-form-metadata>
|
||||
</div>
|
||||
|
||||
<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-form-duplicates 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')">
|
||||
<org-form-conflicts org="org" conflicts="conflicts" save-function="saveConflicts()" show-save-button="1"></org-form-conflicts>
|
||||
</div>
|
||||
|
||||
<org-dedup-events org-id="{{orgId}}" events="events" vocabularies="vocabularies" info-method="getInfo()" ng-if="currentTab == 2 && (org.status == 'approved' || org.status == 'suggested')"></org-dedup-events>
|
||||
</div>
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<div class="card-body">
|
||||
|
||||
<org-details org="currentOrgDetails" org-title="Current organization" show="default"></org-details>
|
||||
|
||||
<org-form-duplicates duplicates="events.duplicates" save-function="saveDuplicates()" show-save-button="1"></org-form-duplicates>
|
||||
|
||||
<org-form-conflicts conflicts="events.conflicts" save-function="saveConflicts()" org-id="{{currentOrgDetails.id}}" show-save-button="1"></org-form-conflicts>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
@ -0,0 +1,296 @@
|
|||
<form name="organizationForm">
|
||||
|
||||
<div ng-if="mode == 'approve'" class="alert alert-warning">
|
||||
This is a pending organization. Please evaluate it before approving.
|
||||
</div>
|
||||
<div ng-if="mode == 'readonly'" class="alert alert-secondary">
|
||||
This organization is managed by the system. You can not edit.
|
||||
</div>
|
||||
|
||||
|
||||
<fieldset ng-disabled="mode == 'readonly'">
|
||||
<legend>Official name and type</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">name</div>
|
||||
</div>
|
||||
<input name="org_nm" type="text" class="form-control"
|
||||
placeholder="organization name..." ng-model="org.name"
|
||||
required="required"
|
||||
ng-class="{'is-invalid' : organizationForm.org_nm.$error.required}" />
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">type</div>
|
||||
</div>
|
||||
<select name="org_tp" class="custom-select" ng-model="org.type"
|
||||
required="required"
|
||||
ng-class="{'is-invalid' : organizationForm.org_tp.$error.required}">
|
||||
<option disabled="disabled" value='' ng-if="!org.type">type...</option>
|
||||
<option ng-repeat="t in vocabularies.orgTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="mt-4" ng-disabled="mode == 'readonly'">
|
||||
<legend>Geographical location</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm">
|
||||
<div class="input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">city</div>
|
||||
</div>
|
||||
<input name="org_ct" type="text" class="form-control" placeholder=""
|
||||
ng-model="org.city" />
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">country</div>
|
||||
</div>
|
||||
|
||||
<select name="org_cntr" class="custom-select" ng-model="org.country"
|
||||
required="required"
|
||||
ng-class="{'is-invalid' : organizationForm.org_cntr.$error.required}">
|
||||
<option disabled="disabled" value='' ng-if="!org.country">country...</option>
|
||||
<option ng-repeat="c in vocabularies.countries"value="{{c.value}}">{{c.name}}</option>
|
||||
</select>
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">lat</div>
|
||||
</div>
|
||||
<input name="org_lat" type="text" class="form-control"
|
||||
placeholder="0.0" ng-model="org.lat" />
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text text-white" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">lng</div>
|
||||
</div>
|
||||
<input name="org_lng" type="text" class="form-control"
|
||||
placeholder="0.0" ng-model="org.lng" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="mt-4" ng-disabled="mode == 'readonly'">
|
||||
<legend>Other names and identifiers</legend>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Acronyms</div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr ng-repeat="a in org.acronyms">
|
||||
<td>{{a}}</td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
ng-click="org.acronyms.splice($index, 1)">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr ng-init="newAcronym=''">
|
||||
<td><input type="text" class="form-control form-control-sm"
|
||||
placeholder="new acronym..." ng-model='newAcronym' /></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
ng-click="org.acronyms.push(newAcronym); newAcronym=''"
|
||||
ng-disabled="!newAcronym || org.acronyms.indexOf(newAcronym) !== -1">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Aliases</div>
|
||||
<table class="table table-sm">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th style="width: 156px">language</th>
|
||||
<th style="width: 44px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="n in org.otherNames">
|
||||
<td>{{n.name}}</td>
|
||||
<td>{{n.lang}}</td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
ng-click="org.otherNames.splice($index, 1)">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr ng-init="newOtherName=newLang=''">
|
||||
<td><input type="text" class="form-control form-control-sm"
|
||||
placeholder="new alias..." ng-model="newOtherName" /></td>
|
||||
<td><select class="custom-select custom-select-sm"
|
||||
ng-model="newLang">
|
||||
<option disabled="disabled" value=''>language...</option>
|
||||
<option ng-repeat="l in vocabularies.languages" value="{{l.value}}">{{l.name}}</option>
|
||||
</select></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
ng-click="org.otherNames.push({'name': newOtherName, 'lang': newLang}); newOtherName=newLang=''"
|
||||
ng-disabled="!newOtherName || !newLang">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Identifiers</div>
|
||||
<table class="table table-sm">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>id</th>
|
||||
<th style="width: 156px">type</th>
|
||||
<th style="width: 44px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="id in org.otherIdentifiers">
|
||||
<td>{{id.id}}</td>
|
||||
<td>{{id.type}}</td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
ng-click="org.otherIdentifiers.splice($index, 1)">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr ng-init="newId=newIdType=''">
|
||||
<td><input type="text" class="form-control form-control-sm"
|
||||
placeholder="new id..." ng-model="newId" /></td>
|
||||
<td><select class="custom-select custom-select-sm"
|
||||
ng-model="newIdType">
|
||||
<option disabled="disabled" value=''>type...</option>
|
||||
<option ng-repeat="t in vocabularies.idTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
ng-click="org.otherIdentifiers.push({'id': newId, 'type': newIdType}); newId=newIdType=''"
|
||||
ng-disabled="!newId || !newIdType">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Urls</div>
|
||||
<table class="table table-sm">
|
||||
<tbody>
|
||||
<tr ng-repeat="u in org.urls">
|
||||
<td><a href="{{u}}" target="_blank">{{u}}</a></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger"
|
||||
ng-click="org.urls.splice($index, 1)">
|
||||
<i class="fa fa-trash"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr ng-init="newUrl=''">
|
||||
<td><input type="text" class="form-control form-control-sm"
|
||||
placeholder="http://..." ng-model="newUrl" /></td>
|
||||
<td class="text-right" style="width: 44px">
|
||||
<button type="button" class="btn btn-sm btn-outline-success"
|
||||
ng-click="org.urls.push(newUrl); newUrl=''"
|
||||
ng-disabled="!newUrl || org.urls.indexOf(newUrl) !== -1">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="mt-4" ng-disabled="mode == 'readonly'">
|
||||
<legend>Relations</legend>
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-white text-center py-1" ng-class="{'bg-primary' : mode != 'approve', 'bg-warning' : mode == 'approve'}">Relations</div>
|
||||
<table class="table table-sm">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th class="pl-3" style="border-top: none;">Related organization</th>
|
||||
<th style="border-top: none; width: 156px">Type</th>
|
||||
<th style="border-top: none; width: 44px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-if="org.relations.length == 0">
|
||||
<td class="text-center text-muted" colspan="3">No relations</td>
|
||||
</tr>
|
||||
<tr ng-repeat="r in org.relations">
|
||||
<td class="pl-3"><a href="#!/edit/0/{{r.relatedOrgId}}" title="{{r.relatedOrgId}}">{{r.relatedOrgName}}</a></td>
|
||||
<td>{{r.type}}</td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="btn btn-sm btn-outline-danger" ng-click="org.relations.splice($index, 1)"><i class="fa fa-trash"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="text" placeholder="add a related organization..." readonly="readonly"
|
||||
class="form-control form-control-sm" style="background-color: white; color: #007bff;"
|
||||
ng-model="newRelation.name" ng-click="resetSelectedRelation()"
|
||||
data-toggle="modal" data-target="#selectRelatedOrgModal" ng-hide="mode == 'readonly'"/>
|
||||
<input type="text" placeholder="add a related organization..." disabled="disabled"
|
||||
class="form-control form-control-sm" ng-model="newRelation.name" ng-show="mode == 'readonly'"/>
|
||||
</td>
|
||||
<td>
|
||||
<select class="custom-select custom-select-sm" ng-model="newRelType">
|
||||
<option disabled="disabled" value=''>rel type...</option>
|
||||
<option ng-repeat="t in vocabularies.relTypes" value="{{t.value}}">{{t.name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<button type="button" class="btn btn-sm btn-outline-success" ng-disabled="!newRelType || !newRelation.id" ng-click="addNewRelation()"><i class="fa fa-plus"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit" class="btn" ng-class="{'btn-primary' : mode != 'approve', 'btn-warning' : mode == 'approve'}" ng-click="save()" ng-disabled="organizationForm.$invalid" ng-hide="mode == 'readonly'">
|
||||
<span ng-if="mode != 'approve'">Save</span>
|
||||
<span ng-if="mode == 'approve'">Register as new Organization</span>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<select-org-modal modal-id="selectRelatedOrgModal" selected-org="newRelation"></select-org-modal>
|
|
@ -119,54 +119,6 @@ orgsModule.directive('resolveConflictsModal', function($http, $route) {
|
|||
}
|
||||
});
|
||||
|
||||
orgsModule.directive('orgTabsMenu', function($http) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
'orgId' : '@',
|
||||
'info' : '=',
|
||||
'selected' : '=',
|
||||
'org' : '=',
|
||||
'events' : '=',
|
||||
},
|
||||
templateUrl: 'resources/html/menu/org_tabs_menu.html',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
|
||||
scope.loadOrg = function() {
|
||||
scope.org = {};
|
||||
$http.get('api/organizations/get?id=' + scope.orgId).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
scope.org = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
scope.selected = 1;
|
||||
}
|
||||
|
||||
scope.loadDedupEvents = function() {
|
||||
scope.events = {};
|
||||
|
||||
$http.get('api/organizations/conflicts?id=' + scope.orgId).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
scope.events.conflicts = res.data;
|
||||
$http.get('api/organizations/duplicates?id=' + scope.orgId).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
scope.events.duplicates = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
scope.selected = 2;
|
||||
};
|
||||
|
||||
scope.loadOrg();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
orgsModule.directive('orgFormMetadata', function($http, $location, $route, $routeParams) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
|
@ -177,7 +129,7 @@ orgsModule.directive('orgFormMetadata', function($http, $location, $route, $rout
|
|||
'mode' : '@', // insert, update or approve
|
||||
'infoMethod' : '&'
|
||||
},
|
||||
templateUrl: 'resources/html/forms/org_metadata.html',
|
||||
templateUrl: 'resources/html/parts/org_metadata.form.html',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
|
||||
scope.newRelation = {};
|
||||
|
@ -213,47 +165,6 @@ orgsModule.directive('orgFormMetadata', function($http, $location, $route, $rout
|
|||
}
|
||||
});
|
||||
|
||||
orgsModule.directive('orgDedupEvents', function($http, $location, $route) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
'orgId' : '@',
|
||||
'events' : '=',
|
||||
'vocabularies' : '=',
|
||||
'infoMethod' : '&'
|
||||
},
|
||||
templateUrl: 'resources/html/parts/org_dedup_events.html',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
|
||||
scope.currentOrgDetails = {};
|
||||
|
||||
$http.get('api/organizations/get?id=' + scope.orgId).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
scope.currentOrgDetails = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
|
||||
scope.saveDuplicates = function() {
|
||||
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
||||
$http.post('api/organizations/duplicates', scope.events.duplicates).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
if (scope.infoMethod) { scope.infoMethod(); }
|
||||
alert('Events updated !!!');
|
||||
scope.events.duplicates = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
}
|
||||
|
||||
scope.saveConflicts = function() {
|
||||
alert('todo');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
orgsModule.directive('orgDetails', function($http, $location, $route) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
|
@ -310,7 +221,7 @@ orgsModule.directive('orgFormConflicts', function($http, $location, $route, $q)
|
|||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
'orgId' : '@',
|
||||
'org' : '=',
|
||||
'conflicts' : '=',
|
||||
'showSaveButton' : '@',
|
||||
'saveFunction' : '&'
|
||||
|
@ -324,7 +235,7 @@ orgsModule.directive('orgFormConflicts', function($http, $location, $route, $q)
|
|||
scope.candidateConflicts = [];
|
||||
scope.selectedConflicts = [];
|
||||
|
||||
var gets = [ $http.get('api/organizations/get?id=' + scope.orgId) ];
|
||||
var gets = [ $http.get('api/organizations/get?id=' + scope.org.id) ];
|
||||
angular.forEach(scope.conflicts, function(c) { gets.push($http.get('api/organizations/get?id=' + c.id)); });
|
||||
|
||||
$q.all(gets).then(function(responses) {
|
||||
|
@ -508,8 +419,11 @@ orgsModule.controller('byTypeCtrl', function ($scope, $http, $routeParams, $loca
|
|||
orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $route, $location, $timeout, $window, vocabulariesService) {
|
||||
$scope.orgId = $routeParams.id;
|
||||
$scope.org = {};
|
||||
$scope.events = {};
|
||||
$scope.duplicates = [];
|
||||
$scope.conflicts = [];
|
||||
$scope.info = {};
|
||||
$scope.currentTab = 1
|
||||
$scope.vocabularies = {};
|
||||
|
||||
$scope.getInfo = function() {
|
||||
$http.get('api/organizations/info?id=' + $scope.orgId).then(function successCallback(res) {
|
||||
|
@ -520,11 +434,62 @@ orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $ro
|
|||
});
|
||||
};
|
||||
|
||||
$scope.getInfo();
|
||||
$scope.gotoTab = function(tab) {
|
||||
$scope.org = {};
|
||||
$http.get('api/organizations/get?id=' + $scope.orgId).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
$scope.org = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
|
||||
if (tab == 2) {
|
||||
$scope.duplicates = [];
|
||||
$http.get('api/organizations/duplicates?id=' + $scope.orgId).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
$scope.duplicates = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
} else if (tab == 3) {
|
||||
$scope.conflicts = [];
|
||||
$http.get('api/organizations/conflicts?id=' + $scope.orgId).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
$scope.conflicts = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
}
|
||||
$scope.currentTab = tab;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.saveDuplicates = function() {
|
||||
$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
|
||||
$http.post('api/organizations/duplicates', $scope.duplicates).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
$scope.getInfo();
|
||||
alert('Events updated !!!');
|
||||
$scope.duplicates = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
}
|
||||
|
||||
$scope.saveConflicts = function() {
|
||||
alert('todo');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.vocabularies = {};
|
||||
vocabulariesService.getVocs(function(vocs) { $scope.vocabularies = vocs; });
|
||||
|
||||
$scope.getInfo();
|
||||
$scope.gotoTab(1);
|
||||
|
||||
if ($routeParams.msg == 1) { $scope.message = 'New organization registered !!!'; }
|
||||
else if ($routeParams.msg == 2) { $scope.message = 'Organization updated !!!'; }
|
||||
else if ($routeParams.msg == 3) { $scope.message = 'Pending organization registered !!!'; }
|
||||
|
@ -532,7 +497,7 @@ orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $ro
|
|||
$window.scrollTo(0, 0);
|
||||
|
||||
$timeout(function() { $scope.message = ''; }, 3000)
|
||||
|
||||
|
||||
});
|
||||
|
||||
orgsModule.controller('pendingOrgsCtrl', function ($scope, $http, $routeParams, $location, suggestionInfo) {
|
||||
|
|
Loading…
Reference in New Issue