Hello, I am trying to have a dropdown which permit, when it’s clicked, to change the active company.
I did the dropdown and succeeded in getting UserID, UserVersion and the chosen Company ID.
All i have to do know is to use the java method : userActive.setActiveCompany(CompanyChosen)
But without succeess. (I tried with API, with direct java, with beans, with MouseListenner (in java)…).
But I am now without options.
Could you please me explain how you would do that ?
Here is how I did my modif in index.jsp:
User userActive = AuthUtils.getUser();
Set<Company> c = userActive.getCompanySet();%>
<li class="divider-vertical"></li>
<li class="dropdown">
<a href="javascript:" class="dropdown-toggle nav-link-user" data-toggle="dropdown">
<i class="fa fa-building"></i>
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li>
<a href="#/preferences">
<span class="nav-link-user-name"><%=userActive.getActiveCompany().getName()%></span>
<span class="nav-link-user-sub">active</span>
</a>
</li>
<% if (tenantMap != null && tenantMap.size() > 1) { %>
<li class="divider"></li>
<li class="dropdown-submenu">
<a tabIndex="-1" href="" x-translate>More...</a>
<ul class="dropdown-menu">
<% for (String key : tenantMap.keySet()) { %>
<% if (!key.equals(tenantId)) { %>
<li><a href="callback?tenant=<%= key %>"><%= tenantMap.get(key) %>
</a></li>
<% } %>
<% } %>
</ul>
</li>
<% } %>
<li class="divider"></li>
<%
for (Company CompanyList : c) {
if (!userActive.getActiveCompany().getName().equals(CompanyList.getName())) {%>
<li><a class="myCompany" data-companyid="<%=CompanyList.getId()%>" data-userid="<%=userActive.getId()%>"
data-userversion="<%=userActive.getVersion()%>"><%=CompanyList.getName()%>
</a></li>
<% } %>
<% } %>