national_admin_functions #1
|
@ -78,7 +78,7 @@ public class OrganizationController {
|
|||
} else if (StringUtils.isBlank(org.getType())) {
|
||||
throw new RuntimeException("Missing field: type");
|
||||
} else if (UserInfo.isSuperAdmin(authentication) || userCountryRepository.verifyAuthorizationForCountry(org.getCountry(), authentication.getName())) {
|
||||
final String orgId = databaseUtils.insertOrUpdateOrganization(org, authentication.getName(), StringUtils.isNotBlank(org.getId()));
|
||||
final String orgId = databaseUtils.insertOrUpdateOrganization(org, authentication.getName());
|
||||
return Arrays.asList(orgId);
|
||||
} else {
|
||||
throw new RuntimeException("User not authorized");
|
||||
|
@ -225,6 +225,23 @@ public class OrganizationController {
|
|||
}
|
||||
}
|
||||
|
||||
@GetMapping("/byCountry/{status}/{code}")
|
||||
public Iterable<OrganizationSimpleView> findPendingOrgsByCountry(@PathVariable final String status,
|
||||
@PathVariable final String code,
|
||||
final Authentication authentication) {
|
||||
if (UserInfo.isSuperAdmin(authentication) || userCountryRepository.verifyAuthorizationForCountry(code, authentication.getName())) {
|
||||
if (status.equalsIgnoreCase("approved")) {
|
||||
return organizationSimpleViewRepository.findByCountryAndApprovedOrderByName(code, true);
|
||||
} else if (status.equalsIgnoreCase("pending")) {
|
||||
return organizationSimpleViewRepository.findByCountryAndApprovedOrderByName(code, false);
|
||||
} else {
|
||||
return organizationSimpleViewRepository.findByCountryOrderByName(code);
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("User not authorized");
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/byType/{type}/{page}/{size}")
|
||||
public Page<OrganizationSimpleView> findByType(@PathVariable final String type,
|
||||
@PathVariable final int page,
|
||||
|
|
|
@ -13,6 +13,8 @@ public class SuggestionInfo {
|
|||
|
||||
private long nConflicts = 0;
|
||||
|
||||
private long nPendingOrgs = 0;
|
||||
|
||||
public long getnDuplicates() {
|
||||
return nDuplicates;
|
||||
}
|
||||
|
@ -29,10 +31,20 @@ public class SuggestionInfo {
|
|||
this.nConflicts = nConflicts;
|
||||
}
|
||||
|
||||
public long getnPendingOrgs() {
|
||||
return nPendingOrgs;
|
||||
}
|
||||
|
||||
public void setnPenfingOrgs(final long nPendingOrgs) {
|
||||
this.nPendingOrgs = nPendingOrgs;
|
||||
}
|
||||
|
||||
public void add(final SuggestionInfoViewByCountry infoCountry) {
|
||||
nDuplicates += infoCountry.getnDuplicates();
|
||||
nConflicts += infoCountry.getnConflicts();
|
||||
nPendingOrgs += infoCountry.getnPendingOrgs();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public SuggestionCounter total = new SuggestionCounter();;
|
||||
|
|
|
@ -70,6 +70,9 @@ public class OrganizationView implements Serializable {
|
|||
@Column(name = "relations", columnDefinition = "jsonb")
|
||||
private Set<RelationByOrg> relations;
|
||||
|
||||
@Column(name = "approved")
|
||||
private boolean approved = false;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -166,4 +169,12 @@ public class OrganizationView implements Serializable {
|
|||
this.relations = relations;
|
||||
}
|
||||
|
||||
public boolean isApproved() {
|
||||
return approved;
|
||||
}
|
||||
|
||||
public void setApproved(final boolean approved) {
|
||||
this.approved = approved;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,9 @@ public class SuggestionInfoViewByCountry implements Serializable {
|
|||
@Column(name = "n_conflicts")
|
||||
private long nConflicts;
|
||||
|
||||
@Column(name = "n_pending_orgs")
|
||||
private long nPendingOrgs;
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
@ -50,4 +53,12 @@ public class SuggestionInfoViewByCountry implements Serializable {
|
|||
this.nConflicts = nConflicts;
|
||||
}
|
||||
|
||||
public long getnPendingOrgs() {
|
||||
return nPendingOrgs;
|
||||
}
|
||||
|
||||
public void setnPendingOrgs(final long nPendingOrgs) {
|
||||
this.nPendingOrgs = nPendingOrgs;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,6 +21,10 @@ public interface OrganizationSimpleViewRepository extends ReadOnlyRepository<Org
|
|||
|
||||
Page<OrganizationSimpleView> findByCountryOrderByName(String country, Pageable pageable);
|
||||
|
||||
Iterable<OrganizationSimpleView> findByCountryOrderByName(String code);
|
||||
|
||||
Iterable<OrganizationSimpleView> findByCountryAndApprovedOrderByName(String code, boolean approved);
|
||||
|
||||
Page<OrganizationSimpleView> findByTypeOrderByName(String type, Pageable pageable);
|
||||
|
||||
@Query(value = "select o.* from organizations_simple_view o left outer join user_countries uc on (uc.country = o.country) where uc.email = ?2 and o.type = ?1 order by o.name", nativeQuery = true)
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.stream.Collectors;
|
|||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -89,12 +90,20 @@ public class DatabaseUtils {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public String insertOrUpdateOrganization(final OrganizationView orgView, final String user, final boolean update) {
|
||||
public String insertOrUpdateOrganization(final OrganizationView orgView, final String user) {
|
||||
|
||||
final boolean update = StringUtils.isNotBlank(orgView.getId());
|
||||
|
||||
if (update) {
|
||||
cleanOldRelations(orgView.getId());
|
||||
}
|
||||
|
||||
if (!orgView.isApproved()) {
|
||||
cleanOldRelations(orgView.getId());
|
||||
organizationRepository.deleteById(orgView.getId());
|
||||
orgView.setId(null);
|
||||
}
|
||||
|
||||
final Organization org = new Organization(update ? orgView.getId() : null,
|
||||
orgView.getName(),
|
||||
orgView.getType(),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
spring.main.banner-mode = off
|
||||
logging.level.root = INFO
|
||||
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/dnet_orgs
|
||||
spring.datasource.username=
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/oa_organizations
|
||||
spring.datasource.username=oa_organizations
|
||||
spring.datasource.password=
|
||||
|
||||
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
|
||||
|
|
|
@ -165,6 +165,7 @@ CREATE VIEW organizations_view AS SELECT
|
|||
org.lng,
|
||||
org.city,
|
||||
org.country,
|
||||
org.approved,
|
||||
COALESCE(jsonb_agg(DISTINCT jsonb_build_object('id', oid.otherid, 'type', oid.type)) FILTER (WHERE oid.otherid IS NOT NULL), '[]') AS other_ids,
|
||||
COALESCE(jsonb_agg(DISTINCT jsonb_build_object('name', n.name, 'lang', n.lang)) FILTER (WHERE n.name IS NOT NULL), '[]') AS other_names,
|
||||
COALESCE(jsonb_agg(DISTINCT a.acronym) FILTER (WHERE a.acronym IS NOT NULL), '[]') AS acronyms,
|
||||
|
@ -185,7 +186,8 @@ GROUP BY
|
|||
org.lat,
|
||||
org.lng,
|
||||
org.city,
|
||||
org.country;
|
||||
org.country,
|
||||
org.approved;
|
||||
|
||||
CREATE VIEW organizations_info_view AS SELECT
|
||||
org.id,
|
||||
|
@ -233,10 +235,12 @@ ORDER BY u.email;
|
|||
|
||||
CREATE VIEW suggestions_info_by_country_view AS SELECT c.val AS country,
|
||||
coalesce(t1.n_duplicates, 0) AS n_duplicates,
|
||||
coalesce(t2.n_conflicts, 0) AS n_conflicts
|
||||
coalesce(t2.n_conflicts, 0) AS n_conflicts,
|
||||
coalesce(t3.n_pending_orgs, 0) AS n_pending_orgs
|
||||
FROM countries c
|
||||
LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT d.*) AS n_duplicates FROM oa_duplicates d LEFT OUTER JOIN organizations o ON (d.local_id = o.id) WHERE d.reltype = 'suggested' GROUP BY o.country) AS t1 ON (t1.country = c.val)
|
||||
LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT c.idgroup) AS n_conflicts FROM oa_conflicts c LEFT OUTER JOIN organizations o ON (c.id1 = o.id) WHERE c.reltype = 'suggested' GROUP BY o.country) AS t2 ON (t2.country = c.val);
|
||||
LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT c.idgroup) AS n_conflicts FROM oa_conflicts c LEFT OUTER JOIN organizations o ON (c.id1 = o.id) WHERE c.reltype = 'suggested' GROUP BY o.country) AS t2 ON (t2.country = c.val)
|
||||
LEFT OUTER JOIN (SELECT o.country AS country, count(DISTINCT o.id) AS n_pending_orgs FROM organizations o WHERE o.approved = false GROUP BY o.country) AS t3 ON (t3.country = c.val);
|
||||
|
||||
CREATE VIEW conflict_groups_view AS SELECT
|
||||
c.idgroup AS idgroup,
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
<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-form-metadata>
|
||||
|
||||
<org-form-metadata org-id="{{orgId}}" org="org" vocabularies="vocabularies" info-method="getInfo()" ng-if="currentTab == 1 && org.approved" mode="update"></org-form-metadata>
|
||||
<org-form-metadata org-id="{{orgId}}" org="org" vocabularies="vocabularies" info-method="getInfo()" ng-if="currentTab == 1 && !org.approved" mode="approve"></org-form-metadata>
|
||||
|
||||
<org-dedup-events org-id="{{orgId}}" events="events" vocabularies="vocabularies" info-method="getInfo()" ng-if="currentTab == 2"></org-dedup-events>
|
||||
</div>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
<div class="text-muted" ng-if="conflicts.length == 0">No suggestions</div>
|
||||
|
||||
<div class="input-group input-group-sm mb-3" ng-if="conflicts.length > 0">
|
||||
<div class="input-group input-group-sm mb-3" ng-show="conflicts.length > 0">
|
||||
<input type="text" class="form-control" ng-model="conflictFilter" placeholder="Filter...">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text text-outline-primary" id="inputGroup-sizing-sm">Country:</span>
|
||||
<span class="input-group-text text-outline-primary">Country:</span>
|
||||
<button class="btn btn-outline-primary dropdown-toggle" data-toggle="dropdown">{{country}}</button>
|
||||
<div class="dropdown-menu">
|
||||
<small>
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
<div class="text-muted" ng-if="duplicates.length == 0">No suggestions</div>
|
||||
|
||||
<div class="input-group input-group-sm mb-3" ng-if="duplicates.length > 0">
|
||||
<div class="input-group input-group-sm mb-3" ng-show="duplicates.length > 0">
|
||||
<input type="text" class="form-control" ng-model="duplicateFilter" placeholder="Filter...">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text text-outline-primary" id="inputGroup-sizing-sm">Country:</span>
|
||||
<span class="input-group-text text-outline-primary">Country:</span>
|
||||
<button class="btn btn-outline-primary dropdown-toggle" data-toggle="dropdown">{{country}}</button>
|
||||
<div class="dropdown-menu">
|
||||
<small>
|
||||
|
|
|
@ -1,24 +1,29 @@
|
|||
<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>
|
||||
|
||||
<fieldset>
|
||||
<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">name</div>
|
||||
<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 bg-primary text-white">type</div>
|
||||
<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=''>type...</option>
|
||||
<option disabled="disabled" value='' ng-if="!org.type">type...</option>
|
||||
<option ng-repeat="t in vocabularies.orgTypes">{{t}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
@ -30,26 +35,27 @@
|
|||
<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">city</div>
|
||||
<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 bg-primary text-white">country</div>
|
||||
<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=''>country...</option>
|
||||
<option disabled="disabled" value='' ng-if="!org.country">country...</option>
|
||||
<option ng-repeat="c in vocabularies.countries">{{c}}</option>
|
||||
</select>
|
||||
<div class="input-group-append input-group-prepend">
|
||||
<div class="input-group-text bg-primary text-white">lat</div>
|
||||
<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 bg-primary text-white">lng</div>
|
||||
<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" />
|
||||
|
@ -63,7 +69,7 @@
|
|||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-white text-center py-1">Acronyms</div>
|
||||
<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">
|
||||
|
@ -97,7 +103,7 @@
|
|||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-white text-center py-1">Aliases</div>
|
||||
<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>
|
||||
|
@ -144,7 +150,7 @@
|
|||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-white text-center py-1">Identifiers</div>
|
||||
<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>
|
||||
|
@ -191,7 +197,7 @@
|
|||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-white text-center py-1">Urls</div>
|
||||
<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">
|
||||
|
@ -228,7 +234,7 @@
|
|||
<div class="form-group row">
|
||||
<div class="col-lg-8 mb-2">
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-white text-center py-1">Relations</div>
|
||||
<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>
|
||||
|
@ -274,7 +280,10 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit" class="btn btn-primary" ng-click="save()" ng-disabled="organizationForm.$invalid">save</button>
|
||||
<button type="submit" class="btn" ng-class="{'btn-primary' : mode != 'approve', 'btn-warning' : mode == 'approve'}" ng-click="save()" ng-disabled="organizationForm.$invalid">
|
||||
<span ng-if="mode != 'approve'">Save</span>
|
||||
<span ng-if="mode == 'approve'">Register as new Organization</span>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<div>
|
||||
|
||||
<div class="text-muted" ng-if="orgs.length == 0">No suggestions</div>
|
||||
|
||||
<div class="input-group input-group-sm mb-3" ng-show="orgs.length > 0">
|
||||
<input type="text" class="form-control" ng-model="orgFilter" placeholder="Filter..."/>
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text text-outline-primary">Country:</span>
|
||||
<button class="btn btn-outline-primary dropdown-toggle" data-toggle="dropdown">{{country}}</button>
|
||||
<div class="dropdown-menu">
|
||||
<small>
|
||||
<a class="dropdown-item" href="#!/suggestions/{{c}}/0"
|
||||
ng-repeat="(c, vals) in info.byCountry"
|
||||
ng-if="vals.nPendingOrgs > 0">
|
||||
{{c}} <span class="badge badge-primary float-right">{{vals.nPendingOrgs}}</span>
|
||||
</a>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-sm table-hover" ng-if="orgs.length > 0">
|
||||
<thead class="thead-light">
|
||||
<tr class="d-flex">
|
||||
<th class="col-6">Organization name</th>
|
||||
<th class="col-4">Place</th>
|
||||
<th class="col-1 text-center">Acronyms</th>
|
||||
<th class="col-1 text-right">Type</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="o in orgs | filter:orgFilter" class="d-flex">
|
||||
<td class="col-6">
|
||||
<a href="#!/edit/0/{{o.id}}" title="{{o.id}}">{{o.name}}</a>
|
||||
</td>
|
||||
<td class="col-4"><img ng-src="resources/images/flags/{{o.country}}.gif" /> {{o.city}}, {{o.country}}</td>
|
||||
<td class="col-1 text-center">{{o.acronyms.join()}}</td>
|
||||
<td class="col-1 text-right">{{o.type}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
|
@ -13,12 +13,11 @@
|
|||
</div>
|
||||
</div>
|
||||
<div ng-show="searchValue">
|
||||
|
||||
<org-results orgs="searchOrgs"
|
||||
<org-results-page orgs="searchOrgs"
|
||||
prev-function="search(searchValue, searchOrgs.number - 1, searchOrgs.size)"
|
||||
next-function="search(searchValue, searchOrgs.number + 1, searchOrgs.size)"
|
||||
selected-org="selectedOrg"
|
||||
mode="select-modal"></org-results>
|
||||
mode="select-modal"></org-results-page>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
<p ng-if="mode != 'select-modal'">
|
||||
<span ng-if="orgs.totalElements > 0">Page: {{orgs.number + 1}} / {{orgs.totalPages}}<br />Total elements: {{orgs.totalElements}}<br />{{searchMessage}}</span>
|
||||
<span ng-if="orgs.totalElements == 0">Page: -<br />Total elements: 0<br />{{searchMessage}}</span>
|
||||
<span ng-if="!(orgs.totalElements || orgs.totalElements === 0)">Page:<br />Total elements:<br />{{searchMessage}}</span>
|
||||
<span ng-if="orgs.totalElements > 0">
|
||||
Page: {{orgs.number + 1}} / {{orgs.totalPages}}<br />
|
||||
Total elements: {{orgs.totalElements}}<br />
|
||||
{{searchMessage}}
|
||||
</span>
|
||||
<span ng-if="orgs.totalElements == 0">
|
||||
Page: -<br />
|
||||
Total elements: 0<br />
|
||||
{{searchMessage}}
|
||||
</span>
|
||||
<span ng-if="!(orgs.totalElements || orgs.totalElements === 0)">
|
||||
Page:<br />
|
||||
Total elements:<br />
|
||||
{{searchMessage}}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p ng-if="mode == 'select-modal'" class="text-right">
|
||||
|
@ -14,6 +26,7 @@
|
|||
</h4>
|
||||
|
||||
<div ng-if="orgs.totalElements > 0">
|
||||
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center">
|
||||
<li class="page-item" ng-class="{'disabled' : orgs.first }">
|
||||
|
@ -25,7 +38,7 @@
|
|||
</ul>
|
||||
</nav>
|
||||
|
||||
<table class="table table-sm table-hover">
|
||||
<table class="table table-sm table-hover" ng-if="orgs.content.length > 0">
|
||||
<thead class="thead-light">
|
||||
<tr class="d-flex">
|
||||
<th class="col-6">Organization name</th>
|
||||
|
@ -47,4 +60,6 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<org-results search-message="Searching for country: {{fieldValue}}"
|
||||
<org-results-page search-message="Searching for country: {{fieldValue}}"
|
||||
orgs="orgs"
|
||||
prev-function="prev()"
|
||||
next-function="next()"></org-results>
|
||||
next-function="next()"></org-results-page>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<org-results search-message="Searching for type: {{fieldValue}}"
|
||||
<org-results-page search-message="Searching for type: {{fieldValue}}"
|
||||
orgs="orgs"
|
||||
prev-function="prev()"
|
||||
next-function="next()"></org-results>
|
||||
next-function="next()"></org-results-page>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<org-results search-message="Searching for: {{searchText}}"
|
||||
<org-results-page search-message="Searching for: {{searchText}}"
|
||||
orgs="orgs"
|
||||
prev-function="prev()"
|
||||
next-function="next()"></org-results>
|
||||
next-function="next()"></org-results-page>
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
<div class="card-header">
|
||||
<ul class="nav nav-tabs card-header-tabs">
|
||||
<li class="nav-item text-nowrap">
|
||||
<a href="#!/suggestions/_/0" class="nav-link" ng-class="{'active': currentTab == 0}">Pending Organizations <span class="badge badge-primary ml-2">{{info.total.nPendingOrgs}}</span></a>
|
||||
</li>
|
||||
<li class="nav-item text-nowrap">
|
||||
<a href="#!/suggestions/_/1" class="nav-link" ng-class="{'active': currentTab == 1}">New Duplicates <span class="badge badge-primary ml-2">{{info.total.nDuplicates}}</span></a>
|
||||
</li>
|
||||
|
@ -12,6 +15,7 @@
|
|||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<pending-orgs orgs="pendingOrgs" country="{{country}}" info="info" info-method="getInfo()" ng-if="currentTab == 0"></pending-orgs>
|
||||
<all-duplicates duplicates="duplicates" country="{{country}}" info="info" info-method="getInfo()" ng-if="currentTab == 1"></all-duplicates>
|
||||
<all-conflicts conflicts="conflicts" country="{{country}}" info="info" info-method="getInfo()" ng-if="currentTab == 2"></all-conflicts>
|
||||
</div>
|
||||
|
|
|
@ -146,7 +146,7 @@ orgsModule.directive('orgFormMetadata', function($http, $location, $route, $rout
|
|||
'orgId' : '@',
|
||||
'org' : '=',
|
||||
'vocabularies' : '=',
|
||||
'mode' : '@', // insert or update
|
||||
'mode' : '@', // insert, update or approve
|
||||
'infoMethod' : '&'
|
||||
},
|
||||
templateUrl: 'resources/html/forms/org_metadata.html',
|
||||
|
@ -174,6 +174,7 @@ orgsModule.directive('orgFormMetadata', function($http, $location, $route, $rout
|
|||
$http.post('api/organizations/save', scope.org).then(function successCallback(res) {
|
||||
if ((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
else if (scope.mode == 'insert') { $location.url('/edit/1/' + res.data[0]); }
|
||||
else if (scope.mode == 'approve') { $location.url('/edit/3/' + res.data[0]); }
|
||||
else if ($routeParams.msg == 2) { $route.reload(); }
|
||||
else { $location.url('/edit/2/' + res.data[0]); }
|
||||
}, function errorCallback(res) {
|
||||
|
@ -238,7 +239,7 @@ orgsModule.directive('orgDetails', function($http, $location, $route) {
|
|||
}
|
||||
});
|
||||
|
||||
orgsModule.directive('orgResults', function($http, $location, $route) {
|
||||
orgsModule.directive('orgResultsPage', function($http, $location, $route) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
|
@ -249,16 +250,21 @@ orgsModule.directive('orgResults', function($http, $location, $route) {
|
|||
'selectedOrg' : '=',
|
||||
'mode' : '@'
|
||||
},
|
||||
templateUrl: 'resources/html/parts/org_results.html',
|
||||
templateUrl: 'resources/html/parts/org_results_page.html',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
scope.selectOrg = function(o) {
|
||||
scope.selectedOrg = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
orgsModule.directive('allConflicts', function($http, $location, $route, $q) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
|
@ -288,6 +294,23 @@ orgsModule.directive('allConflicts', function($http, $location, $route, $q) {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
orgsModule.directive('pendingOrgs', function($http, $location, $route, $q) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
'orgs' : '=',
|
||||
'country' : '@',
|
||||
'info' : '=',
|
||||
'infoMethod' : '&'
|
||||
},
|
||||
templateUrl: 'resources/html/forms/pending_orgs.html',
|
||||
link: function(scope, element, attrs, ctrl) {
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
orgsModule.directive('orgFormDuplicates', function($http, $location, $route) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
|
@ -407,7 +430,7 @@ orgsModule.config(function($routeProvider) {
|
|||
.when('/edit/:msg/:id', { templateUrl: 'resources/html/edit.html', controller: 'showEditCtrl' })
|
||||
.when('/suggestions/:country/:tab', { templateUrl: 'resources/html/suggestions.html', controller: 'showSuggestionsCtrl' })
|
||||
.when('/users', { templateUrl: 'resources/html/users.html', controller: 'usersCtrl' })
|
||||
.otherwise({ redirectTo: '/suggestions/_/1' });
|
||||
.otherwise({ redirectTo: '/suggestions/_/0' });
|
||||
});
|
||||
|
||||
orgsModule.filter('escape', function() {
|
||||
|
@ -559,7 +582,7 @@ orgsModule.controller('byTypeCtrl', function ($scope, $http, $routeParams, $loca
|
|||
});
|
||||
|
||||
|
||||
orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $route, $location, $timeout, vocabulariesService) {
|
||||
orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $route, $location, $timeout, $window, vocabulariesService) {
|
||||
$scope.orgId = $routeParams.id;
|
||||
$scope.org = {};
|
||||
$scope.events = {};
|
||||
|
@ -581,7 +604,9 @@ orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $ro
|
|||
|
||||
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 !!!'; }
|
||||
else { $scope.message = ''; }
|
||||
$window.scrollTo(0, 0);
|
||||
|
||||
$timeout(function() { $scope.message = ''; }, 3000)
|
||||
|
||||
|
@ -589,8 +614,9 @@ orgsModule.controller('showEditCtrl', function ($scope, $http, $routeParams, $ro
|
|||
|
||||
orgsModule.controller('showSuggestionsCtrl', function ($scope, $http, $routeParams, $location) {
|
||||
$scope.info = {};
|
||||
$scope.conflicts = [];
|
||||
$scope.pendingOrgs = [];
|
||||
$scope.duplicates = [];
|
||||
$scope.conflicts = [];
|
||||
$scope.currentTab = $routeParams.tab;
|
||||
$scope.country = $routeParams.country;
|
||||
|
||||
|
@ -602,7 +628,7 @@ orgsModule.controller('showSuggestionsCtrl', function ($scope, $http, $routePara
|
|||
var found = '';
|
||||
|
||||
angular.forEach($scope.info.byCountry, function(values, c) {
|
||||
if (!found && (($scope.currentTab == 1 && values.nDuplicates > 0) || ($scope.currentTab == 2 && values.nConflicts > 0))) {
|
||||
if (!found && (($scope.currentTab == 0 && values.nPendingOrgs > 0) || ($scope.currentTab == 1 && values.nDuplicates > 0) || ($scope.currentTab == 2 && values.nConflicts > 0))) {
|
||||
found = c;
|
||||
}
|
||||
});
|
||||
|
@ -615,17 +641,22 @@ orgsModule.controller('showSuggestionsCtrl', function ($scope, $http, $routePara
|
|||
|
||||
|
||||
$scope.refresh = function() {
|
||||
$scope.conflicts = [];
|
||||
$scope.pendingOrgs = [];
|
||||
$scope.duplicates = [];
|
||||
$scope.conflicts = [];
|
||||
|
||||
if ($scope.country != '_') {
|
||||
if ($scope.currentTab == 1) {
|
||||
if ($scope.currentTab == 0) {
|
||||
$http.get('api/organizations/byCountry/pending/' + $scope.country).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
$scope.pendingOrgs = res.data;
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
} else if ($scope.currentTab == 1) {
|
||||
$http.get('api/organizations/duplicates/byCountry/' + $scope.country).then(function successCallback(res) {
|
||||
if((typeof res.data) == 'string') { alert("Session expired !"); location.reload(true); }
|
||||
$scope.duplicates = res.data;
|
||||
if ($scope.duplicates.length > 0) {
|
||||
//$scope.currentCountry = $scope.duplicates.
|
||||
}
|
||||
}, function errorCallback(res) {
|
||||
alert('ERROR: ' + res.data.error + ' (' + res.data.message + ')');
|
||||
});
|
||||
|
|
|
@ -45,7 +45,7 @@ fieldset > legend {
|
|||
|
||||
<div class="collapse navbar-collapse w-100 order-1" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item"><a class="nav-link" href="#!/suggestions/_/1">Last suggestions</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="#!/suggestions/_/0">Last suggestions</a></li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown">Search</a>
|
||||
<div class="dropdown-menu">
|
||||
|
|
Loading…
Reference in New Issue