Friday 20 November 2015

if we create brand than client should be hide (hiding drop down box logic)

<%

 long orgId = OrganizationLocalServiceUtil.getOrganizations(-1, -1).get(0).getOrganizationId();

 List<Organization> organizations = themeDisplay.getUser().getOrganizations();
 if(organizations.size() > 0)
 orgId = organizations.get(0).getOrganizationId();

 String tenet = JobUtil.getOrganizationType(orgId);

  List<Organization> orgs = OrganizationLocalServiceUtil.getSuborganizations(themeDisplay.getCompanyId(), orgId);

boolean brandExits=false;
boolean clientExits=false;

if(tenet.equalsIgnoreCase("regular-organization")){
if(orgs.size() >0){
for(Organization org:orgs){
String organizationType1 = JobUtil.getOrganizationType(org.getOrganizationId());

if(organizationType1.equalsIgnoreCase("client")){
clientExits=true;
}

/*  if(organizationType1.equalsIgnoreCase("brand")){
brandExits=true;
} */
}
}
}
System.out.println("brandExits  " +clientExits);

if(!clientExits){
%>
<style>
#clientType{
display:none;
}
</style>
<%
}
List<Organization> orgList = JobUtil.getOrganizationByCompanyId(themeDisplay.getCompanyId());
String organizationType = JobUtil.getOrganizationType(organizations.get(0).getOrganizationId());
String disabled = "false";

for(Organization org : orgList){
String orgType = JobUtil.getOrganizationType(org.getOrganizationId());
if(Validator.isNotNull(orgType)){
if(orgType.contains("client")){
orgId = org.getOrganizationId();
}
}}
%>

<div id="clientType">
<aui:select label="client" helpMessage="Choose your client" name="clientOrgId">
<%if(organizationType.equalsIgnoreCase("client")){%>
<aui:option value="<%=organizations.get(0).getOrganizationId() %>"><%=organizations.get(0).getName() %></aui:option>
<%}else if(!clientExits){%>
<aui:option value="<%=organizations.get(0).getOrganizationId() %>"><%=organizations.get(0).getName() %></aui:option>
<%}else{%>
<option selected disabled hidden value=''>--select client--</option>

<%for(Organization org : orgList){
String orgType = JobUtil.getOrganizationType(org.getOrganizationId());
System.out.println("orgType is---->"+orgType);
if(Validator.isNotNull(orgType)){
if(orgType.equalsIgnoreCase("client")){%>
<aui:option value="<%=org.getOrganizationId() %>"><%=org.getName() %></aui:option>
<%}}}} %>
</aui:select>
</div>

No comments:

Post a Comment