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
......@@ -62,6 +62,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public static final String FIELD_CardID = "CardID";
public static final String FIELD_PlanRenewedOn = "PlanRenewedOn";
public static final String FIELD_UsedCredits = "UsedCredits";
public static final String FIELD_IsLogoDeleted = "IsLogoDeleted";
public static final String SINGLEREFERENCE_Company = "Company";
public static final String BACKREF_Company = "";
public static final String SINGLEREFERENCE_BillingTeam = "BillingTeam";
......@@ -93,6 +94,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final DefaultAttributeHelper<HiringTeam> HELPER_CardID = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_PlanRenewedOn = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_UsedCredits = DefaultAttributeHelper.INSTANCE;
private static final DefaultAttributeHelper<HiringTeam> HELPER_IsLogoDeleted = DefaultAttributeHelper.INSTANCE;
// Private attributes corresponding to business object data
......@@ -114,6 +116,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private String _CardID;
private Date _PlanRenewedOn;
private Integer _UsedCredits;
private Boolean _IsLogoDeleted;
// Private attributes corresponding to single references
......@@ -131,6 +134,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
private static final Map ATTRIBUTES_METADATA_HiringTeam = new HashMap ();
// Arrays of validators for each attribute
private static final AttributeValidator[] FIELD_IsLogoDeleted_Validators;
private static final AttributeValidator[] FIELD_HiringTeamName_Validators;
private static final AttributeValidator[] FIELD_HiringTeamLogo_Validators;
private static final AttributeValidator[] FIELD_HiringTeamType_Validators;
......@@ -169,6 +173,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
setupAssocMetaData_BillingTeam();
setupAssocMetaData_AddedByUser();
setupAssocMetaData_PaymentPlan();
FIELD_IsLogoDeleted_Validators = (AttributeValidator[])setupAttribMetaData_IsLogoDeleted(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HiringTeamName_Validators = (AttributeValidator[])setupAttribMetaData_HiringTeamName(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HiringTeamLogo_Validators = (AttributeValidator[])setupAttribMetaData_HiringTeamLogo(validatorMapping).toArray (new AttributeValidator[0]);
FIELD_HiringTeamType_Validators = (AttributeValidator[])setupAttribMetaData_HiringTeamType(validatorMapping).toArray (new AttributeValidator[0]);
......@@ -277,6 +282,24 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
// Meta Info setup
private static List setupAttribMetaData_IsLogoDeleted(Map validatorMapping)
{
Map metaInfo = new HashMap ();
metaInfo.put ("defaultValue", "Boolean.FALSE");
metaInfo.put ("name", "IsLogoDeleted");
metaInfo.put ("type", "Boolean");
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG2, "Metadata for HiringTeam.IsLogoDeleted:", metaInfo);
ATTRIBUTES_METADATA_HiringTeam.put (FIELD_IsLogoDeleted, Collections.unmodifiableMap (metaInfo));
List validators = BaseBusinessClass.getAttribValidators(HiringTeam.class, "IsLogoDeleted", metaInfo, validatorMapping);
LogMgr.log (BUSINESS_OBJECTS, LogLevel.DEBUG1, "Validators for HiringTeam.IsLogoDeleted:", validators);
return validators;
}
// Meta Info setup
private static List setupAttribMetaData_HiringTeamName(Map validatorMapping)
{
Map metaInfo = new HashMap ();
......@@ -677,6 +700,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_CardID = (String)(HELPER_CardID.initialise (_CardID));
_PlanRenewedOn = (Date)(HELPER_PlanRenewedOn.initialise (_PlanRenewedOn));
_UsedCredits = (Integer)(HELPER_UsedCredits.initialise (_UsedCredits));
_IsLogoDeleted = (Boolean)(Boolean.FALSE);
}
......@@ -2476,6 +2500,104 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
}
}
/**
* Get the attribute IsLogoDeleted
*/
public Boolean getIsLogoDeleted ()
{
assertValid();
Boolean valToReturn = _IsLogoDeleted;
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
valToReturn = bhd.getIsLogoDeleted ((HiringTeam)this, valToReturn);
}
return valToReturn;
}
/**
* Called prior to the attribute changing. Subclasses need not call super. If a field exception
* is thrown, the attribute change will fail. The new value is different to the old value.
*/
protected void preIsLogoDeletedChange (Boolean newIsLogoDeleted) throws FieldException
{
}
/**
* Called after the attribute changes.
* If a field exception is thrown, the value is still changed, however it
* may lead to the TX being rolled back
*/
protected void postIsLogoDeletedChange () throws FieldException
{
}
public FieldWriteability getWriteability_IsLogoDeleted ()
{
return getFieldWritabilityUtil (FieldWriteability.TRUE);
}
/**
* Set the attribute IsLogoDeleted. Checks to ensure a new value
* has been supplied. If so, marks the field as altered and sets the attribute.
*/
public void setIsLogoDeleted (Boolean newIsLogoDeleted) throws FieldException
{
boolean oldAndNewIdentical = HELPER_IsLogoDeleted.compare (_IsLogoDeleted, newIsLogoDeleted);
try
{
for (HiringTeamBehaviourDecorator bhd : HiringTeam_BehaviourDecorators)
{
newIsLogoDeleted = bhd.setIsLogoDeleted ((HiringTeam)this, newIsLogoDeleted);
oldAndNewIdentical = HELPER_IsLogoDeleted.compare (_IsLogoDeleted, newIsLogoDeleted);
}
if (FIELD_IsLogoDeleted_Validators.length > 0)
{
Object newIsLogoDeletedObj = HELPER_IsLogoDeleted.toObject (newIsLogoDeleted);
if (newIsLogoDeletedObj != null)
{
int loopMax = FIELD_IsLogoDeleted_Validators.length;
Map metadata = (Map)ATTRIBUTES_METADATA_HiringTeam.get (FIELD_IsLogoDeleted);
for (int v = 0 ; v < loopMax ; ++v)
{
FIELD_IsLogoDeleted_Validators[v].checkAttribute (this, FIELD_IsLogoDeleted, metadata, newIsLogoDeletedObj);
}
}
}
}
catch (FieldException e)
{
if (!oldAndNewIdentical)
{
e.setWouldModify ();
}
throw e;
}
if (!oldAndNewIdentical)
{
assertValid();
Debug.assertion (getWriteability_IsLogoDeleted () != FieldWriteability.FALSE, "Field IsLogoDeleted is not writeable");
preIsLogoDeletedChange (newIsLogoDeleted);
markFieldChange (FIELD_IsLogoDeleted);
_IsLogoDeleted = newIsLogoDeleted;
postFieldChange (FIELD_IsLogoDeleted);
postIsLogoDeletedChange ();
}
}
/**
......@@ -3609,6 +3731,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_CardID = sourceHiringTeam._CardID;
_PlanRenewedOn = sourceHiringTeam._PlanRenewedOn;
_UsedCredits = sourceHiringTeam._UsedCredits;
_IsLogoDeleted = sourceHiringTeam._IsLogoDeleted;
}
}
......@@ -3688,6 +3811,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
_CardID = (String)(HELPER_CardID.readExternal (_CardID, vals.get(FIELD_CardID))); //
_PlanRenewedOn = (Date)(HELPER_PlanRenewedOn.readExternal (_PlanRenewedOn, vals.get(FIELD_PlanRenewedOn))); //
_UsedCredits = (Integer)(HELPER_UsedCredits.readExternal (_UsedCredits, vals.get(FIELD_UsedCredits))); //
_IsLogoDeleted = (Boolean)(HELPER_IsLogoDeleted.readExternal (_IsLogoDeleted, vals.get(FIELD_IsLogoDeleted))); //
_Company.readExternalData(vals.get(SINGLEREFERENCE_Company));
_BillingTeam.readExternalData(vals.get(SINGLEREFERENCE_BillingTeam));
_AddedByUser.readExternalData(vals.get(SINGLEREFERENCE_AddedByUser));
......@@ -3722,6 +3846,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
vals.put (FIELD_CardID, HELPER_CardID.writeExternal (_CardID));
vals.put (FIELD_PlanRenewedOn, HELPER_PlanRenewedOn.writeExternal (_PlanRenewedOn));
vals.put (FIELD_UsedCredits, HELPER_UsedCredits.writeExternal (_UsedCredits));
vals.put (FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.writeExternal (_IsLogoDeleted));
vals.put (SINGLEREFERENCE_Company, _Company.writeExternalData());
vals.put (SINGLEREFERENCE_BillingTeam, _BillingTeam.writeExternalData());
vals.put (SINGLEREFERENCE_AddedByUser, _AddedByUser.writeExternalData());
......@@ -3831,6 +3956,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
super.visitAttributes (visitor);
visitor.visitField(this, FIELD_IsLogoDeleted, HELPER_IsLogoDeleted.toObject(getIsLogoDeleted()));
}
......@@ -4273,6 +4399,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HELPER_UsedCredits.toObject (getUsedCredits ());
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
return HELPER_IsLogoDeleted.toObject (getIsLogoDeleted ());
}
else
{
return super.getAttribute (attribName);
......@@ -4358,6 +4488,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return HELPER_UsedCredits;
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
return HELPER_IsLogoDeleted;
}
else
{
return super.getAttributeHelper (attribName);
......@@ -4443,6 +4577,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
setUsedCredits ((Integer)(HELPER_UsedCredits.fromObject (_UsedCredits, attribValue)));
}
else if (attribName.equals (FIELD_IsLogoDeleted))
{
setIsLogoDeleted ((Boolean)(HELPER_IsLogoDeleted.fromObject (_IsLogoDeleted, attribValue)));
}
else
{
super.setAttribute (attribName, attribValue);
......@@ -4555,6 +4693,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return getWriteability_PaymentPlan ();
}
else if (fieldName.equals (FIELD_IsLogoDeleted))
{
return getWriteability_IsLogoDeleted ();
}
else
{
return super.getWriteable (fieldName);
......@@ -4655,6 +4797,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
fields.add (FIELD_UsedCredits);
}
if (getWriteability_IsLogoDeleted () != FieldWriteability.TRUE)
{
fields.add (FIELD_IsLogoDeleted);
}
super.putUnwriteable (fields);
}
......@@ -4682,6 +4829,7 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
result.add(HELPER_CardID.getAttribObject (getClass (), _CardID, false, FIELD_CardID));
result.add(HELPER_PlanRenewedOn.getAttribObject (getClass (), _PlanRenewedOn, false, FIELD_PlanRenewedOn));
result.add(HELPER_UsedCredits.getAttribObject (getClass (), _UsedCredits, false, FIELD_UsedCredits));
result.add(HELPER_IsLogoDeleted.getAttribObject (getClass (), _IsLogoDeleted, false, FIELD_IsLogoDeleted));
return result;
}
......@@ -5074,6 +5222,24 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
return newUsedCredits;
}
/**
* Get the attribute IsLogoDeleted
*/
public Boolean getIsLogoDeleted (HiringTeam obj, Boolean original)
{
return original;
}
/**
* Change the value set for attribute IsLogoDeleted.
* May modify the field beforehand
* Occurs before validation.
*/
public Boolean setIsLogoDeleted (HiringTeam obj, Boolean newIsLogoDeleted) throws FieldException
{
return newIsLogoDeleted;
}
}
......@@ -5130,6 +5296,10 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
{
return toUsers ();
}
if (name.equals ("IsLogoDeleted"))
{
return toIsLogoDeleted ();
}
if (name.equals ("HiringTeamName"))
{
return toHiringTeamName ();
......@@ -5224,6 +5394,8 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
}
public PipeLine<From, Boolean> toIsLogoDeleted () { return pipe(new ORMAttributePipe<Me, Boolean>(FIELD_IsLogoDeleted)); }
public PipeLine<From, String> toHiringTeamName () { return pipe(new ORMAttributePipe<Me, String>(FIELD_HiringTeamName)); }
public PipeLine<From, BinaryContent> toHiringTeamLogo () { return pipe(new ORMAttributePipe<Me, BinaryContent>(FIELD_HiringTeamLogo)); }
......@@ -5295,6 +5467,11 @@ public abstract class BaseHiringTeam extends BaseBusinessClass
public boolean isTransientAttrib(String attribName)
{
if(CollectionUtils.equals(attribName, "IsLogoDeleted"))
{
return true;
}
return super.isTransientAttrib(attribName);
}
......
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
......@@ -9,9 +9,12 @@
SecUser loggedInUser = SecUser.getTXUser(transaction);
CompanyUser companyUser = loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
Company company = companyUser.getCompany();
HiringTeam hiringTeam = (HiringTeam) process.getAttribute("HiringTeam");
Debug.assertion(company != null , "Invalid company in admin portal my company");
Debug.assertion(company != null , "Invalid hiring team in admin portal my company");
String nextPage = WebUtils.getSamePageInRenderMode(request, "Page");
%>
<script type="text/javascript">
......@@ -27,12 +30,42 @@
removeLogo();
});
});
function saveOwnBilling(ownBilling)
{
ajaxProcessAddJQ ("<%= request.getContextPath() %>/extensions/adminportal/inc/save_own_billing.jsp", 'form' ,
{hiringTeamID : <%= hiringTeam.getID().longValue() %>, ownBilling : ownBilling},
function () {},
function (jqXHR, textStatus, errorThrown) {
if (jqXHR.status === 0) {
log("Empty Response. Status : " + jqXHR.status + " TextStatus : " + textStatus);
} else {
window.alert("Error processing request:" + errorThrown);
}
},
"POST");
if(ownBilling === true)
{
$('#billing_label').removeClass("show");
$('#billing_label').addClass("hide");
$('#billing_team').removeClass("show");
$('#billing_team').addClass("hide");
}
else
{
$('#billing_label').removeClass("hide");
$('#billing_label').addClass("show");
$('#billing_team').removeClass("hide");
$('#billing_team').addClass("show");
}
}
</script>
<div class="container-fluid">
<div class="row content">
<div class="main-content-area">
<h1 class="page-title">My Hiring Team</h1>
<h1 class="page-title"><%= hiringTeam.getHiringTeamName() %></h1>
<div class="my-company-area">
<oneit:form name="editCompany" method="post" enctype="multipart/form-data">
......@@ -47,29 +80,29 @@
<div class="tab-content">
<div class="tab-pane active" id="company-detail">
<div class="tabpage-title">
<label class="label-20">Hiring Team Details</label>
<label class="label-20">Team Details</label>
</div>
<div class="form-group">
<label><oneit:ormlabel obj="<%= company %>" field="CompanyName" /></label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="CompanyName" cssClass="form-control" />
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="HiringTeamName" /></label>
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="HiringTeamName" cssClass="form-control" />
</div>
<div class="form-group">
<label><oneit:ormlabel obj="<%= company %>" field="CompanyLogo" /></label>
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="HiringTeamLogo" /></label>
<div class="main-upload-logo">
<span class="u-img-tag" style="<%= company.getCompanyLogo() != null ? "" : "display: none" %>">
<tagfile:img src="<%= ThumbnailUtils.filterImage(DiskFileBinaryContent.getRelativeURL(company.getCompanyLogo()), "KEEP", new ScaleWithin (0,90)) %>"
<span class="u-img-tag" style="<%= hiringTeam.getHiringTeamLogo() != null ? "" : "display: none" %>">
<tagfile:img src="<%= ThumbnailUtils.filterImage(DiskFileBinaryContent.getRelativeURL(hiringTeam.getHiringTeamLogo()), "KEEP", new ScaleWithin (0,90)) %>"
class="upload-img-w-h" id="client-logo"/>
<span class="remove-logo-btn">
<img src="images/logo-remove-btn.png" id="remove-logo">
<oneit:ormInput obj="<%= company %>" type="text" attributeName="IsLogoDeleted" style="display:none;" />
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="IsLogoDeleted" style="display:none;" />
</span>
</span>
<span class="up-rep-btn">
<oneit:ormInput obj="<%= company %>" type="file" attributeName="CompanyLogo" accept="image/*" id="upload"
<oneit:ormInput obj="<%= hiringTeam %>" type="file" attributeName="HiringTeamLogo" accept="image/*" id="upload"
style="visibility: hidden; width: 1px; height: 1px"/>
<a href="javascript:void(0)" onclick="document.getElementById('upload').click(); return false" id="replace-btn">
<%= company.getCompanyLogo() != null ? "Replace" : "Upload" %>
<%= hiringTeam.getHiringTeamLogo() != null ? "Replace" : "Upload" %>
</a>
</span>
</div>
......@@ -77,50 +110,91 @@
<div class="form-group row">
<div class="col-md-6">
<label><oneit:label GUIName="Industry" /></label>
<oneit:ormEnum obj="<%= company %>" attributeName="Industry" cssClass="form-control" displayType="autocomplete"/>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Industry" cssClass="form-control" displayType="autocomplete"/>
</div>
</div>
<div class="form-group">
<div class="styled_checkboxes">
<div class="checkbox checkbox-primary">
<oneit:ormInput obj="<%= company %>" id="has-client-support" attributeName="HasClientSupport" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="company.showHasClientSupport() ? 'checked': 'unchecked'" company="<%= company %>">
<oneit:ormInput obj="<%= hiringTeam %>" id="has-client-support" attributeName="HasClientSupport" type="checkbox"/>
<oneit:recalcClass htmlTag="span" classScript="hiringTeam.showHasClientSupport() ? 'checked': 'unchecked'" hiringTeam="<%= hiringTeam %>">
<label for="has-client-support">
<oneit:ormlabel obj="<%= company %>" field="HasClientSupport" />
<oneit:ormlabel obj="<%= hiringTeam %>" field="HasClientSupport" />
</label>
</oneit:recalcClass>
</div>
</div>
</div>
<div class="form-brack-line-sub"></div>
<div class="form-group row">
<div class="col-md-6">
<label><oneit:label GUIName="Will this team manage its own billing?" /></label>
</div>
<div id="billing_label" class="<%= "col-md-6 " + (hiringTeam.getManageOwnBilling() ? "hide" : "show") %>" >
<label><oneit:label GUIName="Which team will manage the billing?"/></label>
</div>
</div>
<div class="form-group row">
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="true"/>Yes
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="false"/>No
</div>
<div class="form-group row">
<%
String trueID = hiringTeam.getObjectID() + "_Y";
String falseID = hiringTeam.getObjectID() + "_N";
String trueSelected = CollectionUtils.equals(hiringTeam.getManageOwnBilling(), Boolean.TRUE) ? "checked" : "";
String falseSelected = CollectionUtils.equals(hiringTeam.getManageOwnBilling(), Boolean.FALSE) ? "checked" : "";
%>
<div class="col-md-6">
<div class="radio radio-primary second-radio-primary">
<input type="radio" name="<%= hiringTeam.getObjectID() %>" value="true" id="<%= trueID %>" <%= trueSelected %> onchange="saveOwnBilling(true);"/>
<label for="<%= trueID %>">
Yes
</label>
</div>
<div class="radio radio-primary second-radio-primary">
<input type="radio" name="<%= hiringTeam.getObjectID() %>" value="false" id="<%= falseID %>" <%= falseSelected %> onchange="saveOwnBilling(false);"/>
<label for="<%= falseID %>">
No
</label>
</div>
</div>
<div id="billing_team" class="<%= "col-md-6 " + (hiringTeam.getManageOwnBilling() ? "hide" : "show") %>" >
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= hiringTeam %>" assocName="BillingTeam" options="<%= Utils.getOtherHiringTeams(hiringTeam) %>"/>
</div>
</div>
</div>
<div class="form-brack-line-sub"></div>
<div class="form-group row">
<div class="col-md-4">
<label><oneit:ormlabel obj="<%= company %>" field="Country" /></label>
<oneit:ormEnum obj="<%= company %>" attributeName="Country" cssClass="form-control"/>
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="Country" /></label>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Country" cssClass="form-control"/>
</div>
<div class="col-md-4">
<label><oneit:ormlabel obj="<%= company %>" field="State" /></label>
<oneit:ormEnum obj="<%= company %>" attributeName="State" cssClass="form-control"/>
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="State" /></label>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="State" cssClass="form-control"/>
</div>
<div class="col-md-4">
<label><oneit:ormlabel obj="<%= company %>" field="PostCode" /></label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="PostCode" cssClass="form-control" />
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="PostCode" /></label>
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="PostCode" cssClass="form-control" />
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label><oneit:ormlabel obj="<%= company %>" field="City" /></label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="City" cssClass="form-control" />
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="City" /></label>
<oneit:ormInput obj="<%= hiringTeam %>" type="text" attributeName="City" cssClass="form-control" />
</div>
<div class="col-md-6">
<label><oneit:label GUIName="Default Timezone" /></label>
<oneit:ormEnum obj="<%= company %>" attributeName="TimeZone" cssClass="form-control"/>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="TimeZone" cssClass="form-control"/>
</div>
</div>
<div class="text-center form-group">
<oneit:button value="Save Updates" name="saveCompany" cssClass="btn btn-primary largeBtn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
.mapEntry("Company", company)
.toMap() %>" />
</div>
......
......@@ -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