<%@ page extends="oneit.servlets.jsp.JSPInclude" %>

<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>
<%@ page import="oneit.security.SecUser"%>

<oneit:dynIncluded>
<script type="text/javascript">
    $(document).ready(function() {
        recalcFunction = setupRecalc ($("form#sign_up"), {'recalcOnError':true});
    });
</script>
<%
    CompanyUser companyUser     =   (CompanyUser) getData(request, "CompanyUser"); 
    Boolean     includePrivacy  =   (Boolean) getData(request, "IncludePrivacyStatements"); 
    Boolean     includePassword =   (Boolean) getData(request, "IncludePassword"); 

    Debug.assertion(companyUser != null, "Invalid CompanyUser in admin portal");

    SecUser     secUser     =   companyUser.getUser();
    Company     company     =   companyUser.getCompany();
    HiringTeam  hiringTeam  =   companyUser.getDefaultHiringTeam();
%>
    
    <div class="form-group text-left">
        <label>Email Address</label>
        <%
            if(companyUser.getStatus()==ObjectStatus.NEW || secUser.getEmail()==null)
            {
        %>
                <oneit:ormInput obj="<%= secUser %>"    type="text" attributeName="Email"   cssClass="form-control"    style="text-transform: lowercase"    required="true"/>
        <%
            }
            else
            {
        %>
                <oneit:ormInput obj="<%= secUser %>"    type="text" attributeName="Email"   cssClass="form-control"    readonly="true"  style="text-transform: lowercase"    required="true"/>
        <%
            }
        %>
    </div>
    <%
        if(CollectionUtils.equals(includePassword, Boolean.TRUE))
        {
            String  key =   Utils.getPwdKeyOfSecUser(request, secUser, true);
    %>
    
            <script type="text/javascript">
                $(document).ready(function() {
                    $('#myPassword').strength_meter({
                        "inputName" : "<%= key %>"
                    });
                });
            </script>
            <style>
                .email input[name$="Email"] {
                    opacity: 0;
                    position: absolute;
                }
            </style>
            <div class="form-group text-left email">
                <label style="display: none;"><oneit:ormlabel  obj="<%= secUser %>"    field="Email" /></label>
                <oneit:ormInput obj="<%= secUser %>"    type="text" attributeName="Email"       cssClass="form-control"/>
            </div>
            <div class="form-group text-left"   id="myPassword">
                <label>Password</label>
            </div>
            <div class="form-group text-left">
                <label>Confirm password</label>
                <oneit:input    type="password" name="<%= key + 2 %>"   class="form-control second-style reset-pw"/>
            </div>
    <%
        }
    %>
    <div class="row">
        <div class="form-group text-left col-sm-6 col-xs-12">
            <label><oneit:ormlabel  obj="<%= secUser %>"    field="FirstName" /></label>
            <oneit:ormInput obj="<%= secUser %>"    type="text" attributeName="FirstName"   cssClass="form-control second-style"    required="true" spellcheck="false"  />
        </div>
        <div class="form-group text-left col-sm-6 col-xs-12">
            <label><oneit:ormlabel  obj="<%= secUser %>"    field="LastName" /></label>
            <oneit:ormInput obj="<%= secUser %>"    type="text" attributeName="LastName"    cssClass="form-control second-style"    required="true" spellcheck="false"  />
        </div>
    </div>
    <div class="form-group text-left">
        <label><oneit:ormlabel  obj="<%= companyUser %>"    field="Phone" /></label>
        <oneit:ormInput obj="<%= companyUser %>"    type="text" attributeName="Phone"       cssClass="form-control"/>
    </div>
    <div class="form-group text-left">
        <label>Hiring Team</label>
        <%
            if(company.getIsVerified()==Boolean.TRUE || !CollectionUtils.equals(company.getAddedByUser(), companyUser))
            {
        %>
                <oneit:ormInput obj="<%= hiringTeam %>"    type="text" attributeName="HiringTeamName" cssClass="form-control"  readonly="true"    required="true" placeholder="Your company name"/>
        <%
            }
            else
            {
        %>
                <oneit:ormInput obj="<%= hiringTeam %>"    type="text" attributeName="HiringTeamName" cssClass="form-control" required="true" placeholder="Your company name"/>
        <%
            }
        %>
    </div>
    <%
        if(CollectionUtils.equals(includePrivacy, Boolean.TRUE))
        {
    %>
            <div class="form-group text-left">
                <div class="styled_checkboxes">
                    <div class="checkbox checkbox-primary">
                        <oneit:ormInput obj="<%= companyUser %>"  id="privacy-policy-agreed"  attributeName="PrivacyPolicyAgreed" type="checkbox" />
                        <oneit:recalcClass  htmlTag="span"  classScript="companyUser.showPrivacyPolicyAgreed() ? 'checked': 'unchecked'"    companyUser="<%= companyUser %>">
                            <label for="privacy-policy-agreed">
                                <oneit:label GUIName="I have read and agree to the " />
                                <a href="https://www.matchd.com/privacy/" target="_blank" class="privacy-link">Privacy Policy</a>
                            </label>
                        </oneit:recalcClass>
                    </div>
                </div>
            </div>
            <div class="form-group text-left">
                <div class="styled_checkboxes">
                    <div class="checkbox checkbox-primary">
                        <oneit:ormInput obj="<%= companyUser %>"  id="conditions-agreed"  attributeName="ConditionsAgreed" type="checkbox"   />
                        <oneit:recalcClass  htmlTag="span"  classScript="companyUser.showConditionsAgreed() ? 'checked': 'unchecked'"    companyUser="<%= companyUser %>">
                            <label for="conditions-agreed">
                                <oneit:label GUIName="I have read and agree to the " />
                                <a href="https://www.matchd.com/terms-of-service/" target="_blank" class="privacy-link">Terms & Conditions</a>
                            </label>
                        </oneit:recalcClass>
                    </div>
                </div>
            </div>
    <%
        }
    %>
</oneit:dynIncluded>
