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

<%@ include file="/setuprequest.jsp" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>

<oneit:dynIncluded>

    <script type="text/javascript">
        $(document.body).addClass('bg-color');

        $(document).ready(function() {
            recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
        
            $('input[type="text"]').keyup(function() {
                $(this).change();
            });
        });

    </script>
    <style>
        .btn-disabled button{
            opacity: 0.6;
            background-color: #0582ba;
        }
        #right-mark {
            width: 24px;
            height: 24px;
            border-radius: 30px;
            position: absolute;
            top: 51%;
            right: 37px;
            background-color: #67b413;
            padding-top: 5px;
        }

        #right-mark img {
            width: 15px;
            height: 15px;
            display: block;
            margin: auto auto;
        }
    </style>
<%
    ORMProcessState     process =   (ORMProcessState) ProcessDecorator.getDefaultProcess(request);
    ObjectTransaction   objTran =   process.getTransaction ();
    Job                 job     =   (Job) process.getAttribute("Job");
    String              id      =   request.getParameter("id");
    String              key     =   request.getParameter("key");
    
    if(id != null && key != null)
    {
        job =   Job.searchJobKey(objTran, Long.parseLong(id), key);
        process.setAttribute("Job", job);
    }

    Debug.assertion(job != null, "Invalid job in applicant portal");
%>
    <div class="main-verify-identity">
        <div class="login-logo"><img src="<%= request.getContextPath() %>/images/logo.png" /></div>
        <oneit:form name="forgotPassword"    method="post">
            <oneit:dynInclude   page="/extensions/applicantportal/inc/multifieldtext.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"/>
            <div class="main-box-layout login-box">
                <div class="text-left">
                    <p>
                        Enter your email address below. If we find a matching account, then you'll receive an email with a password reset link.
                    </p>
                </div>
                <div>&nbsp;</div>
                <div class="form-group text-left">
                    <label>Email Address</label>
                    <oneit:ormInput obj="<%= job %>"    type="text" attributeName="Email"   cssClass="form-control second-style"    style="text-transform: lowercase"   autocomplete="off"  spellcheck="false"/>
                    <oneit:recalcClass  htmlTag="div"   classScript="job.isEmailFound() ? 'show': 'hide'"  job="<%= job %>"    class="right-mark">
                        <span id="right-mark"><img src="images/right-mark.svg"/></span>
                    </oneit:recalcClass>
                </div>

                <div class="form-group">
                    <oneit:recalcClass  htmlTag="div"   classScript="job.isEmailFound() ? 'show': 'btn-disabled'"  job="<%= job %>">
                        <oneit:button   value="Send reset link" name="forgotPassword"   cssClass="box-btn send-btn"
                                        requestAttribs="<%= CollectionUtils.mapEntry("nextPage", WebUtils.getSamePageInRenderMode(request, "ResetPasswordSent"))
                                                                            .mapEntry ("restartProcess", Boolean.TRUE)
                                                                            .mapEntry ("attribNamesToRestore", Collections.singleton("Job"))
                                                                            .toMap() %>"/>
                    </oneit:recalcClass>
                </div>
            </div>
        </oneit:form>
    </div>
</oneit:dynIncluded>