Commit 18a3bc11 by Nilu

add hiring team and edit hiring team. Issue with manage billing

parent 2b4209ff
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.logging.LoggingArea;
import oneit.objstore.ObjectTransaction;
import oneit.objstore.StorageException;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.MultiException;
import performa.orm.Company;
import performa.orm.HiringTeam;
public class AddHiringTeamFP extends SaveFP
{
private static final LoggingArea LOG = LoggingArea.createLoggingArea("AddHiringTeamFP");
@Override
public void validate(ORMProcessState process, SubmissionDetails submission, MultiException exceptions, Map params) throws StorageException
{
HttpServletRequest request = submission.getRequest();
Company company = (Company) process.getAttribute("Company");
BusinessObjectParser.assertFieldCondition(company.getHiringTeamName() != null, company, Company.FIELD_HiringTeamName, "mandatory", exceptions, true, request);
BusinessObjectParser.assertFieldCondition(company.getOwner() != null, company, Company.SINGLEREFERENCE_Owner, "mandatory", exceptions, true, request);
if(!company.getManageOwnBilling())
{
BusinessObjectParser.assertFieldCondition(company.getBillingTeam() != null, company, Company.SINGLEREFERENCE_BillingTeam, "mandatory", exceptions, true, request);
}
super.validate(process, submission, exceptions, params);
}
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
ObjectTransaction objTran = process.getTransaction();
Company company = (Company) process.getAttribute("Company");
LogMgr.log(LOG, LogLevel.PROCESSING1, "Started to create new hiring team for company : ", company);
HiringTeam hiringTeam = HiringTeam.createHiringTeam(objTran);
hiringTeam.setHiringTeamName(company.getHiringTeamName());
hiringTeam.setAddedByUser(company.getOwner());
hiringTeam.setCompany(company);
hiringTeam.setManageOwnBilling(company.getManageOwnBilling());
if(hiringTeam.getManageOwnBilling())
{
hiringTeam.setBillingTeam(null);
}
else
{
hiringTeam.setBillingTeam(company.getBillingTeam());
}
LogMgr.log(LOG, LogLevel.PROCESSING1, "New hiring team created : ", hiringTeam);
return super.processForm(process, submission, params);
}
}
\ No newline at end of file
......@@ -15,6 +15,7 @@ import oneit.utils.CollectionUtils;
import oneit.utils.MultiException;
import performa.intercom.utils.IntercomUtils;
import performa.orm.Company;
import performa.orm.HiringTeam;
import performa.utils.StripeUtils;
......@@ -25,17 +26,30 @@ public class SaveCompanyFP extends SaveFP
{
HttpServletRequest request = submission.getRequest();
Company company = process.getAttribute("Company") != null ? (Company) process.getAttribute("Company") : (Company) request.getAttribute("Company");
HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam");
Boolean isPayment = (Boolean) request.getAttribute("IsPayment");
LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"In SaveCompanyFP saving company : ", company );
if(CollectionUtils.equals(company.getIsLogoDeleted(), Boolean.TRUE))
// if(CollectionUtils.equals(company.getIsLogoDeleted(), Boolean.TRUE))
// {
// company.setCompanyLogo(null);
//
// LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"In SaveCompanyFP setting comany logo to null of company : ", company );
// }
if(CollectionUtils.equals(hiringTeam.getIsLogoDeleted(), Boolean.TRUE))
{
company.setCompanyLogo(null);
hiringTeam.setHiringTeamLogo(null);
LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"In SaveCompanyFP setting comany logo to null of company : ", company );
LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"In SaveCompanyFP setting hiring team logo to null of hiring team : ", hiringTeam );
}
// if(hiringTeam.getManageOwnBilling())
// {
// hiringTeam.setBillingTeam(null);
// }
if(CollectionUtils.equals(isPayment, Boolean.TRUE) && company.getPaymentJobCount()!=null)
{
company.setPaymentPlan(company.getSelectedPaymentPlan());
......@@ -64,6 +78,7 @@ public class SaveCompanyFP extends SaveFP
HttpServletRequest request = submission.getRequest();
Company company = process.getAttribute("Company") != null ? (Company) process.getAttribute("Company") : (Company) request.getAttribute("Company");
Boolean isPayment = (Boolean) request.getAttribute("IsPayment");
HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam");
//to select payment plan when job open
if(CollectionUtils.equals(isPayment, Boolean.TRUE) && company.getPaymentJobCount()!=null)
......@@ -71,6 +86,11 @@ public class SaveCompanyFP extends SaveFP
BusinessObjectParser.assertFieldCondition(company.getSelectedPaymentPlan()!= null, company , Company.SINGLEREFERENCE_PaymentPlan, "mandatory", exceptions, true, request);
}
// if(hiringTeam != null && !hiringTeam.getManageOwnBilling())
// {
// BusinessObjectParser.assertFieldCondition(hiringTeam.getBillingTeam() != null, hiringTeam , HiringTeam.SINGLEREFERENCE_BillingTeam, "mandatory", exceptions, true, request);
// }
super.validate(process, submission, exceptions, params);
}
}
\ No newline at end of file
package performa.orm;
import oneit.objstore.ObjectStatus;
import oneit.objstore.ValidationContext;
import oneit.utils.StringUtils;
......@@ -15,19 +14,22 @@ public class HiringTeam extends BaseHiringTeam
// Do not add any code to this, always put it in initialiseNewObject
}
public boolean showHasClientSupport()
{
return isTrue(getHasClientSupport());
}
@Override
public void validate(ValidationContext context)
{
if(getStatus() != ObjectStatus.NEW)
{
context.check(getHiringTeamType() != null , this, FIELD_HiringTeamType, "mandatory");
}
// if(getStatus() != ObjectStatus.NEW)
// {
// context.check(getHiringTeamType() != null , this, FIELD_HiringTeamType, "mandatory");
// }
super.validate(context);
}
@Override
public String getToString()
{
......
......@@ -11,6 +11,8 @@
<MULTIPLEREFERENCE name="Users" type="CompanyUserHiringTeamLink" backreferenceName="HiringTeam" />
<!-- <MULTIPLEREFERENCE name="Clients" type="Client" backreferenceName="HiringTeam" />-->
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TABLE name="tl_hiring_team" tablePrefix="object">
<ATTRIB name="HiringTeamName" type="String" dbcol="hiring_team_name" mandatory="true" length="100" />
......
......@@ -171,6 +171,13 @@ public class Utils
}
public static Collection<HiringTeam> getHiringTeamsSorted(Collection<HiringTeam> hiringTeams, UserSortOption userSortOption)
{
Comparator comparator = (userSortOption == UserSortOption.ALPHA_Z_A) ? CollectionUtils.reverse(CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST) : CollectionUtils.DEFAULT_COMPARATOR_NULLS_FIRST;
return ObjstoreUtils.sort(hiringTeams, new ObjectTransform[]{HiringTeam.pipesHiringTeam().toHiringTeamName()}, new Comparator[]{comparator});
}
public static class ClientJobCountTransform implements ObjectTransform<Client, Integer>
{
......@@ -539,4 +546,11 @@ public class Utils
{
return companyUser.pipelineCompanyUser().toHiringTeams().toHiringTeam().uniqueVals().toArray(new HiringTeam[0]);
}
public static HiringTeam[] getOtherHiringTeams(HiringTeam hiringTeam)
{
Filter<HiringTeam> filter = HiringTeam.SearchByAll().andObjectID(new NotEqualsFilter<>(hiringTeam.getID().longID()));
return hiringTeam.pipelineHiringTeam().toCompany().toHiringTeams(filter).uniqueVals().toArray(new HiringTeam[0]);
}
}
\ No newline at end of file
......@@ -57,6 +57,7 @@
<FORM name="*.managePlans" factory="Participant" class="performa.form.ManagePlansFP"/>
<FORM name="*.updateCard" factory="Participant" class="performa.form.UpdateCardFP"/>
<FORM name="*.replaceCard" factory="Participant" class="performa.form.ReplaceCardFP"/>
<FORM name="*.addHiringTeam" factory="Participant" class="performa.form.AddHiringTeamFP"/>
</NODE>
<NODE name="job_assessment_criteria_add_jsp" factory="Participant">
......@@ -134,6 +135,10 @@
<INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/>
</NODE>
<NODE name="save_own_billing_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdminNoPriv"/>
</NODE>
<NODE name="ORMErrorConfig::ADMIN_PORTAL" factory="Participant" class="oneit.servlets.forms.ErrorReportConfig">
<format item="field.*.error.pageHeader_performa_errorPrefix">
<![CDATA[<div class="error-message message-common"><img src="${contextRoot}/images/error-alert.png" class="alert-icon" /><span class="message-txt" style="font-weight: bold">${translateLabel:Errors_Occurred:Errors occurred, please correct them and try again}</span><br/>]]>
......
......@@ -8,28 +8,25 @@
<oneit:dynIncluded>
<%
String currentPage = WebUtils.getArticleByShortCut(process.getTransaction(), WebUtils.MY_COMPANY).getLink(request);
String hiringTeamPage = WebUtils.getSamePageInRenderMode(request, "Page");
String hiringTeamPage = WebUtils.getSamePageInRenderMode(request, "HiringTeam");
ObjectTransaction objTran = process.getTransaction ();
SecUser secUser = SecUser.getTXUser(objTran);
Company company = (Company) process.getAttribute("Company");
CompanyUser comUser = secUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
UserSortOption userSortOpt = (UserSortOption) process.getAttribute("UserSortOption");
Collection<CompanyUser> companyUsers = (Collection<CompanyUser>) process.getAttribute("CompanyUsers");
Collection pendingUsers = (Collection<CompanyUser>) process.getAttribute("PendingUsers");
if(company==null)
if(company == null)
{
company = comUser.getCompany();
process.setAttribute("Company", company);
}
if(companyUsers == null || pendingUsers == null)
if(companyUsers == null)
{
companyUsers = CollectionFilter.filter(company.getUsersSet(), CompanyUser.SearchByAll().andIsAccountVerified(new EqualsFilter<>(Boolean.TRUE)));
pendingUsers = CollectionFilter.filter(company.getUsersSet(), CompanyUser.SearchByAll().andIsAccountVerified(new NotEqualsFilter<>(Boolean.TRUE)));
process.setAttribute("CompanyUsers", companyUsers);
process.setAttribute("PendingUsers", pendingUsers);
}
if( request.getParameter("UserSortOption") != null)
......@@ -44,13 +41,17 @@
process.setAttribute("UserSortOption", userSortOpt);
Collection<CompanyUser> sortedCompanyUsers = Utils.getUsersSorted(companyUsers, userSortOpt);
Collection<CompanyUser> sortedPendingUsers = Utils.getUsersSorted(pendingUsers, userSortOpt);
company.setRoleType(RoleType.STANDARD);
Collection<HiringTeam> sortedHiringTeams = Utils.getHiringTeamsSorted(company.getHiringTeamsSet(), userSortOpt);
%>
<oneit:form name="listHiringTeams" method="post" enctype="multipart/form-data">
<script type="text/javascript">
$(document).ready(function()
{
recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
});
</script>
<div class="dashboard-content-area second-part">
<oneit:dynInclude page="/extensions/applicantportal/inc/multifieldtext.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"/>
......@@ -65,7 +66,7 @@
<%
for (UserSortOption sortOption : UserSortOption.getUserSortOptionArray())
{
String optionLink = hiringTeamPage + "&UserSortOption=" + sortOption.getName() ;
String optionLink = currentPage + "?UserSortOption=" + sortOption.getName() ;
%>
<option <%= (userSortOpt != null && userSortOpt == sortOption ? "selected" : "" )%> value="<%= optionLink %>">
<oneit:toString value="<%= sortOption.getDescription() %>" mode="EscapeHTML"/>
......@@ -78,7 +79,7 @@
</div>
<div class="main-manage-userlist">
<%
for(HiringTeam hiringTeam : company.getHiringTeamsSet())
for(HiringTeam hiringTeam : sortedHiringTeams)
{
%>
<div class="user-list-row">
......@@ -94,6 +95,14 @@
</div>
</div>
</div>
<div class="m-user-right-padlock">
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", hiringTeamPage)
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.toMap() %>">
<span class="m-user-right-padlockicon"><img src="images/m-user-right-padlockicon.png"></span>
</oneit:button>
</div>
</div>
<%
}
......@@ -106,7 +115,7 @@
</div>
<div class="form-group">
<label><oneit:label GUIName="Hiring Team Name" /></label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="HiringTeamName" cssClass="form-control" style="text-transform: lowercase"/>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="HiringTeamName" cssClass="form-control" />
</div>
<div class="form-group">
<label><oneit:label GUIName="Team Owner/Admin" /></label>
......@@ -133,10 +142,10 @@
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="BillingTeam" options="<%= company.getHiringTeamsSet().toArray(new HiringTeam[0]) %>"/>
</div>
</div>
<oneit:button value="Add Team" name="sendUserInvites" cssClass="btn btn-invite"
<oneit:button value="Add Team" name="addHiringTeam" cssClass="btn btn-invite"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", currentPage)
.mapEntry ("restartProcess", Boolean.TRUE)
.mapEntry(NotificationUtils.NOTIFICATION_MSG_PARAM, "invitationSent")
.mapEntry ("attribNamesToRestore", Collections.singleton("HiringTeam"))
.toMap() %>" />
</div>
</div>
......
......@@ -22,7 +22,7 @@
<oneit:button value=" " name="gotoPage" skin="link"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", firstPage)
.toMap() %>">
Hiring Team Details
Team Details
</oneit:button>
</li>
<%
......
<%@ page extends="oneit.servlets.process.AJAXProcessJSP" %>
<%@ page import="oneit.servlets.jsp.*,oneit.servlets.orm.*,oneit.servlets.objstore.*,oneit.servlets.jsp.tabs.*,oneit.logging.*,oneit.sql.*,oneit.objstore.services.*" %>
<%@ page import="performa.orm.*,performa.orm.types.*,performa.utils.*, java.util.*, oneit.objstore.*, oneit.servlets.process.*, oneit.utils.*" %>
<%@ page import="oneit.utils.filter.Filter, oneit.objstore.rdbms.filters.EqualsFilter" %>
<%@ include file="../../../setuprequest.jsp" %>
<%! protected String getName (ServletConfig config) { return "save_own_billing_jsp"; } %>
<oneit:form method="POST">
<%
ORMProcessState process = (ORMProcessState)ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = ObjectTransaction.getTransaction();
Long hiringTeamID = Long.valueOf(request.getParameter ("hiringTeamID"));
boolean ownBilling = Boolean.valueOf(request.getParameter ("ownBilling"));
HiringTeam hiringTeam = HiringTeam.getHiringTeamByID(objTran, hiringTeamID);
hiringTeam.setManageOwnBilling(ownBilling);
if(ownBilling)
{
hiringTeam.setBillingTeam(null);
}
%>
</oneit:form>
\ No newline at end of file
......@@ -38,3 +38,10 @@ Company.HiringTeamType = Hiring Team
Company.CompanyName = Hiring Team Name
Company.PaymentPlan = Payment Plan
Company.ManageOwnBilling = Team manages its own billing
HiringTeam.TimeZone = Time zone
HiringTeam.HasClientSupport = We help clients with hiring
HiringTeam.HiringTeamLogo = Hiring Team Logo
HiringTeam.HiringTeamType = Hiring Team Type
HiringTeam.HiringTeamName = Hiring Team Name
HiringTeam.BillingTeam = Billing Team
......@@ -14,12 +14,13 @@
</NODE>
<NODE name="StorageMappings::Performa">
<MAP code="TestInput" class="performa.orm.TestInput"/>
<MAP code="JobApplication" class="performa.orm.JobApplication"/>
<MAP code="Candidate" class="performa.orm.Candidate"/>
<MAP code="CompanyUser" class="performa.orm.CompanyUser"/>
<MAP code="Client" class="performa.orm.Client"/>
<MAP code="Company" class="performa.orm.Company"/>
<MAP code="TestInput" class="performa.orm.TestInput" />
<MAP code="JobApplication" class="performa.orm.JobApplication" />
<MAP code="Candidate" class="performa.orm.Candidate" />
<MAP code="CompanyUser" class="performa.orm.CompanyUser" />
<MAP code="Client" class="performa.orm.Client" />
<MAP code="Company" class="performa.orm.Company" />
<MAP code="HiringTeam" class="performa.orm.HiringTeam" />
</NODE>
<NODE name="CONFIG.GLOBAL::Performa">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment