dnet-applications/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/parts/org_metadata.form.html

345 lines
16 KiB
HTML

<form name="organizationForm">
<div ng-if="mode == 'approve'" class="alert alert-warning">
This organization is not yet subsumed by an OpenOrg. You can resolve this anomaly by: <ul>
<li>creating a new OpenOrg ID for this organization, or</li>
<li>adding the organization as a duplicate of an existing OpenOrg</li>
</ul>
</div>
<div ng-if="mode == 'readonly'" class="alert alert-secondary">
<span class="badge badge-primary">{{org.status}}</span> This organization is managed by the system. You can not edit.
</div>
<div ng-if="mode == 'not_authorized'" class="alert alert-secondary">
<span class="badge badge-primary">{{org.status}}</span> You are not authorized to modify this organization.
</div>
<fieldset ng-disabled="mode == 'readonly' || mode == 'not_authorized'">
<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 bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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 bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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 class="input-group-append">
<a href="javascript:void(0)" class="btn btn-sm bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized'}" data-toggle="modal" data-target="#ecFlagsModal">EC flags</a>
</div>
</div>
</div>
</fieldset>
<fieldset class="mt-4" ng-disabled="mode == 'readonly' || mode == 'not_authorized'">
<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 bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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 bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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 bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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 bg-primary text-white" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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' || mode == 'not_authorized'">
<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 bg-primary" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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 bg-primary" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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 bg-primary" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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 bg-primary" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', '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' || mode == 'not_authorized'">
<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 bg-primary" ng-class="{'bg-light text-dark' : mode == 'readonly' || mode == 'not_authorized', 'bg-warning' : mode == 'approve'}">Relations</div>
<table class="table table-sm">
<tbody>
<tr ng-if="org.relations.length == 0">
<td class="text-center text-muted" colspan="4">No relations</td>
</tr>
<tr ng-repeat="r in org.relations">
<td class="pl-3" colspan="3">This organizazion
<!-- NB: The showed value MUST be the inverse -->
<span ng-switch="r.type">
<b ng-switch-when="Child">is parent of</b> <!-- I reverse to have a better label, but it should be has child -->
<b ng-switch-when="Parent">is child of</b> <!-- I reverse to have a better label, but it should be has parent -->
<b ng-switch-when="Merges">merges</b>
<b ng-switch-when="Merged_In">is merged in</b>
<b ng-switch-default>is related to</b>
</span>
<a href="#!/edit/0/{{r.relatedOrgId}}" title="{{r.relatedOrgId}}">{{r.relatedOrgName}}</a>
</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 class="text-right" style="width: 120px; vertical-align: middle;">This organization</td>
<td style="width: 140px;">
<select class="custom-select custom-select-sm" ng-model="newRelType">
<option disabled="disabled" value=''>rel type...</option>
<!-- NB: The showed value MUST be the inverse -->
<option value="Parent">is child of</option>
<option value="Child">is parent of</option>
</select>
</td>
<td>
<input type="text" placeholder="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="related organization..." disabled="disabled"
class="form-control form-control-sm" ng-model="newRelation.name" ng-show="mode == 'readonly'"/>
</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>
<fieldset ng-if="mode == 'update_full'">
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Save</button>
</fieldset>
<fieldset ng-if="mode == 'update_simple'">
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Save</button>
</fieldset>
<fieldset ng-if="mode == 'approve'">
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Approve as new Organization</button>
</fieldset>
<fieldset ng-if="mode == 'insert_full'">
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Register a new Organization</button>
</fieldset>
<fieldset ng-if="mode == 'insert_pending'">
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">Suggest a new Organization</button>
</fieldset>
</form>
<div class="modal fade" id="ecFlagsModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">European Commission Flags</h5>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<span class="badge" ng-class="{'badge-success': org.ecLegalBody, 'text-deleted': !org.ecLegalBody}">legal body</span>
<span class="badge" ng-class="{'badge-success': org.ecLegalPerson, 'text-deleted': !org.ecLegalPerson}">legal person</span>
<span class="badge" ng-class="{'badge-success': org.ecNonProfit, 'text-deleted': !org.ecNonProfit}">non profit</span>
<span class="badge" ng-class="{'badge-success': org.ecResearchOrganization, 'text-deleted': !org.ecResearchOrganization}">research organization</span>
<span class="badge" ng-class="{'badge-success': org.ecHigherEducation, 'text-deleted': !org.ecHigherEducation}">higher education</span>
<span class="badge" ng-class="{'badge-success': org.ecInternationalOrganizationEurInterests, 'text-deleted': !org.ecInternationalOrganizationEurInterests}">international organization Eur interests</span>
<span class="badge" ng-class="{'badge-success': org.ecInternationalOrganization, 'text-deleted': !org.ecInternationalOrganization}">international organization</span>
<span class="badge" ng-class="{'badge-success': org.ecEnterprise, 'text-deleted': !org.ecEnterprise}">enterprise</span>
<span class="badge" ng-class="{'badge-success': org.ecSmeValidated, 'text-deleted': !org.ecSmeValidated}">sme validated</span>
<span class="badge" ng-class="{'badge-success': org.ecNutscode, 'text-deleted': !org.ecNutscode}">nuts code</span>
</div>
</div>
</div>
</div>
<select-org-modal modal-id="selectRelatedOrgModal" selected-org="newRelation" filter-status="approved"></select-org-modal>