Commit 0b5a7203 by Nilu

Adding country to hiring team creation screens. Initial sign up no default for…

Adding country to hiring team creation screens. Initial sign up no default for country. additional hiring team creation should default to selected hiring teams country.

If a hiring team doesn't have billing set up, it shouldn't appear on billing teams drop down for "Billing managed by another team"
parent 3ecd2258
......@@ -14,7 +14,7 @@
<column name="industry" type="String" nullable="true" length="200"/>
<column name="time_zone" type="String" nullable="true" length="200"/>
<column name="state" type="String" nullable="true" length="200"/>
<column name="country" type="String" nullable="false" length="200"/>
<column name="country" type="String" nullable="true" length="200"/>
<column name="post_code" type="String" nullable="true" length="10"/>
<column name="city" type="String" nullable="true" length="100"/>
<column name="has_client_support" type="Boolean" nullable="true"/>
......
......@@ -14,7 +14,7 @@ CREATE TABLE tl_hiring_team (
industry varchar(200) NULL,
time_zone varchar(200) NULL,
state varchar(200) NULL,
country varchar(200) NOT NULL,
country varchar(200) NULL,
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
......
......@@ -15,7 +15,7 @@ CREATE TABLE tl_hiring_team (
industry varchar2(200) NULL,
time_zone varchar2(200) NULL,
state varchar2(200) NULL,
country varchar2(200) NOT NULL,
country varchar2(200) NULL,
post_code varchar2(10) NULL,
city varchar2(100) NULL,
has_client_support char(1) NULL,
......
......@@ -15,7 +15,7 @@ CREATE TABLE tl_hiring_team (
industry varchar(200) NULL,
time_zone varchar(200) NULL,
state varchar(200) NULL,
country varchar(200) NOT NULL,
country varchar(200) NULL,
post_code varchar(10) NULL,
city varchar(100) NULL,
has_client_support char(1) NULL,
......
......@@ -33,12 +33,13 @@ public class AddHiringTeamFP extends SaveFP
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);
BusinessObjectParser.assertFieldCondition(company.getHTCountry() != null, company, Company.FIELD_HTCountry, "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);
}
......@@ -57,6 +58,7 @@ public class AddHiringTeamFP extends SaveFP
hiringTeam.setAddedByUser(company.getOwner());
hiringTeam.setCompany(company);
hiringTeam.setManageOwnBilling(company.getManageOwnBilling());
hiringTeam.setCountry(company.getHTCountry());
CompanyUserHiringTeamLink link = CompanyUserHiringTeamLink.createCompanyUserHiringTeamLink(objTran);
......
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.objstore.parser.BusinessObjectParser;
import oneit.servlets.forms.NavigationFP;
import oneit.servlets.forms.SubmissionDetails;
import oneit.utils.MultiException;
import performa.orm.HiringTeam;
public class NavigateToInviteTeammatesFP extends NavigationFP
{
@Override
protected Map validate(SubmissionDetails submission, MultiException exceptions)
{
HttpServletRequest request = submission.getRequest();
HiringTeam hiringTeam = (HiringTeam)request.getAttribute("HiringTeam");
BusinessObjectParser.assertFieldCondition(hiringTeam.getCountry() != null, hiringTeam, HiringTeam.FIELD_Country, exceptions);
return super.validate(submission, exceptions);
}
}
\ No newline at end of file
package performa.orm;
import java.util.HashSet;
import java.util.Set;
import oneit.logging.LoggingArea;
import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.objstore.rdbms.filters.IsNotNullFilter;
import oneit.objstore.rdbms.filters.NotEqualsFilter;
import oneit.security.SecUser;
import oneit.utils.BusinessException;
import oneit.utils.CollectionUtils;
import oneit.utils.StringUtils;
import oneit.utils.filter.Filter;
import oneit.utils.math.NullArith;
import oneit.utils.parsers.FieldException;
import performa.orm.types.JobStatus;
......@@ -164,4 +169,13 @@ public class Company extends BaseCompany
{
return getHiringTeamsCount() > 0 ? getHiringTeamsAt(0) : null;
}
public Set<HiringTeam> getBillingTeams()
{
Filter<HiringTeam> filter = HiringTeam.SearchByBillingTeams()
.andCardID(new IsNotNullFilter<>())
.andManageOwnBilling(new EqualsFilter<>(Boolean.TRUE));
return pipelineCompany().toHiringTeams(filter).uniqueVals();
}
}
\ No newline at end of file
......@@ -13,6 +13,7 @@
<TRANSIENT name="HiringTeamName" type="String" />
<TRANSIENT name="ManageOwnBilling" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="HTCountry" type="Countries" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="CompletedProfile" type="Boolean" defaultValue="Boolean.FALSE"/>
<TRANSIENT name="PaymentJobCount" type="Integer" />
......
......@@ -14,7 +14,6 @@ import oneit.utils.DateDiff;
import oneit.utils.StringUtils;
import oneit.utils.filter.Filter;
import oneit.utils.parsers.FieldException;
import performa.orm.types.AssessmentType;
import performa.orm.types.CurrencyType;
import performa.orm.types.RoleType;
import performa.utils.StripeUtils;
......@@ -38,17 +37,6 @@ public class HiringTeam extends BaseHiringTeam
}
@Override
public void validate(ValidationContext context)
{
// if(getStatus() != ObjectStatus.NEW)
// {
// context.check(getHiringTeamType() != null , this, FIELD_HiringTeamType, "mandatory");
// }
super.validate(context);
}
@Override
public String getToString()
{
return StringUtils.subNulls(getHiringTeamName(), super.getToString());
......
......@@ -24,7 +24,7 @@
<ATTRIB name="Industry" type="Industry" dbcol="industry" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="TimeZone" type="TimeZone" dbcol="time_zone" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="State" type="State" dbcol="state" mandatory="false" defaultValue="State.WA" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Country" type="Countries" dbcol="country" mandatory="true" defaultValue="Countries.AU" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Country" type="Countries" dbcol="country" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="PostCode" type="String" dbcol="post_code" mandatory="false" length="10"/>
<ATTRIB name="City" type="String" dbcol="city" mandatory="false" length="100"/>
<ATTRIB name="HasClientSupport" type="Boolean" dbcol="has_client_support" mandatory="false" defaultValue="Boolean.FALSE"/>
......@@ -58,6 +58,9 @@
<SEARCH type="All" paramFilter="tl_hiring_team.object_id is not null" >
</SEARCH>
<SEARCH type="BillingTeams" paramFilter="tl_hiring_team.object_id is not null and (is_ppj = 'Y' or (is_ppj = 'N' and payment_plan_id is not null))" >
</SEARCH>
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
......@@ -388,6 +388,10 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
{
throw new RuntimeException ("NOT implemented: executeSearchQueryAll");
}
public ResultSet executeSearchQueryBillingTeams (SQLManager sqlMgr) throws SQLException
{
throw new RuntimeException ("NOT implemented: executeSearchQueryBillingTeams");
}
......@@ -537,6 +541,44 @@ public class HiringTeamPersistenceMgr extends ObjectPersistenceMgr
return results;
}
else if (searchType.equals (HiringTeam.SEARCH_BillingTeams))
{
// Local scope for transformed variables
{
}
String orderBy = " ";
String tables = " ";
Set<String> joinTableSet = new HashSet<String>();
String filter;
Object[] searchParams; // paramFilter: tl_hiring_team.object_id is not null and (is_ppj = 'Y' or (is_ppj = 'N' and payment_plan_id is not null))
String preFilter = "(tl_hiring_team.object_id is not null and (is_ppj = 'Y' or (is_ppj = 'N' and payment_plan_id is not null)))"
+ " ";
preFilter += context.getLoadingAttributes ().getCustomSQL() ;
SearchParamTransform tx = new SearchParamTransform (criteria);
filter = StringUtils.replaceParams (preFilter, tx);
searchParams = tx.getParamsArray();
Integer maxRows = context.getLoadingAttributes ().getMaxRows ();
boolean truncateExtra = !context.getLoadingAttributes ().isFailIfMaxExceeded();
String query = "SELECT " + SELECT_COLUMNS +
"FROM {PREFIX}tl_hiring_team " + tables + tableSetToSQL(joinTableSet) +
"WHERE " + SELECT_JOINS + " " + filter + orderBy;
BaseBusinessClass[] results = loadQuery (allPSets, sqlMgr, context, query, searchParams, maxRows, truncateExtra);
return results;
}
else
{
......
......@@ -582,7 +582,10 @@ public class Utils
public static HiringTeam[] getHiringTeamsWithOwnBilling(HiringTeam hiringTeam)
{
Filter<HiringTeam> filter = HiringTeam.SearchByAll().andManageOwnBilling(new EqualsFilter<>(Boolean.TRUE));
Filter<HiringTeam> filter = HiringTeam.SearchByBillingTeams()
.andManageOwnBilling(new EqualsFilter<>(Boolean.TRUE))
.andCardID(new IsNotNullFilter<>())
.andObjectID(new NotEqualsFilter<>(hiringTeam.getID().longID()));
return hiringTeam.pipelineHiringTeam().toCompany().toHiringTeams(filter).uniqueVals().toArray(new HiringTeam[0]);
}
......
......@@ -65,6 +65,7 @@
<FORM name="*.selectHiringTeam" factory="Participant" class="performa.form.SelectHiringTeamFP"/>
<FORM name="*.additionalTeam" factory="Participant" class="performa.form.AddAdditionalHiringTeamFP"/>
<FORM name="*.gotoCreateJob" factory="Participant" class="performa.form.NavigateToCreateJobFP"/>
<FORM name="*.gotoInviteTeammates" factory="Participant" class="performa.form.NavigateToInviteTeammatesFP"/>
<FORM name="*.search" factory="Participant" class="oneit.servlets.orm.RunSearchExecutorFP"/>
<DATA class="oneit.servlets.orm.RunSearchExecutorDF"/>
</NODE>
......
......@@ -91,11 +91,18 @@
<label><oneit:label GUIName="Time zone" /></label>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="TimeZone" cssClass="form-control"/>
</div>
<div class="form-group">
<label><oneit:label GUIName="Country" /></label>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Country" cssClass="form-control"/>
</div>
</div>
<div class="text-center company-profile-btn">
<oneit:button value="Confirm details & invite teammates" name="gotoPage" cssClass="btn btn-primary box-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>"/>
<oneit:button value="Confirm details & invite teammates" name="gotoInviteTeammates" cssClass="btn btn-primary box-btn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("HiringTeam", hiringTeam)
.toMap() %>"/>
</div>
</div>
......
......@@ -16,6 +16,7 @@
UserSortOption userSortOpt = (UserSortOption) process.getAttribute("UserSortOption");
Collection<CompanyUser> companyUsers = (Collection<CompanyUser>) process.getAttribute("CompanyUsers");
boolean readOnly = !comUser.isOwner();
HiringTeam selectedTeam = comUser.getActiveHiringTeam();
if(company == null)
{
......@@ -41,7 +42,9 @@
}
process.setAttribute("UserSortOption", userSortOpt);
company.setHTCountry(selectedTeam.getCountry());
Collection<HiringTeam> sortedHiringTeams = Utils.getHiringTeamsSorted(Arrays.asList(Utils.getHiringTeamsByUser(comUser)), userSortOpt);
%>
<oneit:form name="listHiringTeams" method="post" enctype="multipart/form-data">
......@@ -85,7 +88,6 @@
%>
<div class="user-list-row">
<div class="m-user-left">
<!--TODO: add hiring team icon-->
<div class="m-user-icon"><img src="images/hireteam-list-icon.png"></div>
<div class="m-user-info">
<div class="m-user-name">
......@@ -144,10 +146,14 @@
<oneit:recalcClass htmlTag="div" classScript="company.showTeamManagesOwnBilling() ? 'hide': 'show'" company="<%= company %>">
<label><oneit:label GUIName="Select Billing Team" /></label>
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="BillingTeam" options="<%= !readOnly ? company.getHiringTeamsSet().toArray(new HiringTeam[0]) : new HiringTeam[0] %>"/>
<tagfile:ormsingleasso_select obj="<%= company %>" assocName="BillingTeam" options="<%= !readOnly ? company.getBillingTeams().toArray(new HiringTeam[0]) : new HiringTeam[0] %>"/>
</div>
</oneit:recalcClass>
</div>
<div class="form-group">
<label><oneit:label GUIName="Country" /></label>
<oneit:ormEnum obj="<%= company %>" attributeName="HTCountry" cssClass="form-control"/>
</div>
<oneit:recalcClass htmlTag="div" classScript="readOnly ? 'hide': 'show'" readOnly="<%= readOnly%>">
<oneit:button value="Add Team" name="addHiringTeam" cssClass="btn btn-invite"
......
......@@ -41,6 +41,7 @@ Company.HiringTeamType = Hiring Team
Company.CompanyName = Hiring Team Name
Company.PaymentPlan = Payment Plan
Company.ManageOwnBilling = Team manages its own billing
Company.HTCountry = Country
HiringTeam.TimeZone = Time zone
HiringTeam.HasClientSupport = We help clients with hiring
......
......@@ -17,6 +17,7 @@
Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company");
boolean readOnly = hiringTeam.getObjectWriteability() == FieldWriteability.NOT_IN_GUI;
boolean assumedUser = Utils.isAssumedUser(request);
%>
<script type="text/javascript">
......@@ -220,21 +221,34 @@
<div class="form-group row own-billing">
<div class="col-md-6">
<div class="radio radio-primary second-radio-primary oneit-radio">
<label >
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="true"/>Yes
<label>
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="true" readonly="<%= !assumedUser %>"/>Yes
</label>
</div>
<div class="radio radio-primary second-radio-primary oneit-radio">
<label>
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="false"/>No
<oneit:ormInput obj="<%= hiringTeam %>" type="radio" attributeName="ManageOwnBilling" value="false" readonly="<%= !assumedUser %>"/>No
</label>
</div>
</div>
<div class="col-md-6">
<oneit:recalcClass htmlTag="div" classScript="hiringTeam.getManageOwnBilling() ? 'hide': 'show'" hiringTeam="<%= hiringTeam %>">
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= hiringTeam %>" assocName="BilledByTeam" options="<%= Utils.getHiringTeamsWithOwnBilling(hiringTeam) %>"/>
</div>
<%
if(assumedUser)
{
%>
<div class="wider-select">
<tagfile:ormsingleasso_select obj="<%= hiringTeam %>" assocName="BilledByTeam" options="<%= Utils.getHiringTeamsWithOwnBilling(hiringTeam) %>"/>
</div>
<%
}
else
{
%>
<oneit:toString value="<%= hiringTeam.getBilledByTeam() %>" mode="EscapeHTML"/>
<%
}
%>
</oneit:recalcClass>
</div>
</div>
......@@ -252,7 +266,7 @@
<div class="form-group row">
<div class="col-md-6">
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="Country" /></label>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Country" cssClass="form-control"/>
<oneit:ormEnum obj="<%= hiringTeam %>" attributeName="Country" cssClass="form-control" readonly="true"/>
</div>
<%-- <div class="col-md-4">
<label><oneit:ormlabel obj="<%= hiringTeam %>" field="State" /></label>
......
-- @AutoRun
ALTER TABLE tl_hiring_team ALTER COLUMN country DROP NOT NULL;
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