<%@ page extends="oneit.servlets.jsp.JSPInclude" %>
<%@ include file="/inc/stdimports50.jsp" %><%-- This is in cougar --%>
<%@ include file="/inc/stdcms.jsp" %><%-- This is in cougar --%>
<%@ include file="/extensions/performa/inc/stdimports.jsp" %>

<oneit:dynIncluded>
<%
    ObjectTransaction   objTran         = process.getTransaction ();
    String              nextPage        = WebUtils.getSamePageInRenderMode(request, "WorkplaceCulture");
    JobApplication      jobApplication  = (JobApplication) process.getAttribute("JobApplication");
    Job                 job             = jobApplication.getJob();
    String              exitPage        = WebUtils.getArticleLink(request, objTran, WebUtils.APPLY_JOB, "Page");
    exitPage                            = exitPage + "&id=" + job.getID() + "&key=" + job.getRandomKey();
%>
    <script>
        $(document.body).addClass('bg-color');
    </script>
    
    <div class="main-application-outline">
        <div class="selection-aust-logo">
            <img src="images/australia-post.png" />
            <span><oneit:toString value="<%= job.getJobTitle() %>"  mode="EscapeHTML"/></span>
        </div>
        <div class="show-mobile-title">
            <div class="mobile-estimated">Estimated time to complete: <b>5 mins</b></div>
        </div>
        <div class="section-c-title m-hide">
            Requirements
        <span class="estimated-time">Estimated time to complete:
            <span>5 mins</span>
        </span>
        </div>
        <div class="section-tab-view">
            
            <oneit:form name="editApplication"  method="post"   enctype="multipart/form-data">
            
                <oneit:dynInclude   page="/extensions/applicantportal/inc/multifieldtext.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"/>
                
                <oneit:dynInclude   page="/extensions/applicantportal/inc/application_main_tabs.jsp"    PageNumber="1"  data="<%= CollectionUtils.EMPTY_MAP%>"/>

                <div class="section-page-area">
                    <div class="main-sc-section">
                        <p>
                            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean semper at magna a
                            tristique. Ut ut magna ut mauris sagittis placerat. Suspendisse vitae tempus sem. Lorem
                            ipsum dolor sit amet, consectetur adipiscing elit.
                        </p>
                    </div>         
                    <%
                        FormTag     applicationForm =   FormTag.getActiveFormTag(request);
                        FormBuilder formBuilder     =   applicationForm.getFormBuilder();
                        
                        for(CriteriaType ct: CriteriaType.getCriteriaTypeArray())
                        {
                            Collection<AssessmentCriteriaAnswer>    answerList  =   jobApplication.getACAnswersByType(ct);

                            if(!answerList.isEmpty())
                            {
                    %>
                                <div class="selection-br-line"></div>
                                <div class="main-sc-section">
                                    <div class="selection-form-title"><oneit:toString value="<%= ct %>" mode="EscapeHTML"/></div>
                                    <%
                                        for(AssessmentCriteriaAnswer answer: answerList)
                                        {
                                            String  optionKey       =   WebUtils.getInputKey(request, answer, AssessmentCriteriaAnswer.FIELD_Answer);
                                            String  formValue       =   formBuilder.fieldValue (optionKey, answer.getAnswer() == null ? "" : String.valueOf(answer.getAnswer()));
                                            String  trueID          =   answer.getObjectID() + "_Y";
                                            String  falseID         =   answer.getObjectID() + "_N";
                                            String  trueSelected    =   CollectionUtils.equals("true", formValue) ? "checked" : "";
                                            String  falseSelected   =   CollectionUtils.equals("false", formValue) ? "checked" : "";
                                    %>
                                            <div class="form-group-new question-y-n">
                                                <label class="second-label"><oneit:toString value="<%= answer.getAssessmentCriteria() %>" mode="EscapeHTML"/></label>
                                                <div class="radio radio-primary second-radio-primary">
                                                    <input type="radio" name="<%= optionKey %>" value="true"    id="<%= trueID%>" <%= trueSelected %>/>
                                                    <label for="<%= trueID%>">
                                                        Yes
                                                    </label>
                                                </div>
                                                <div class="radio radio-primary second-radio-primary">
                                                    <input type="radio" name="<%= optionKey %>" value="false"   id="<%= falseID%>" <%= falseSelected %>/>
                                                    <label for="<%= falseID%>">
                                                        No
                                                    </label>
                                                </div>
                                            </div>              
                                            <div class="textarea-box">
                                                <textarea class="form-control second-style" placeholder="Please add any notes to support your answer"></textarea>
                                            </div>
                                    <%
                                        }
                                    %>
                                </div>
                    <%
                            }
                        }
                    %>
                    <div class="selection-br-line"></div>
                    <div class="main-sc-section btn-remove-padd">
                        <div class="section-btn text-center">
                            <oneit:button   value="Save and exit"   name="save" cssClass="box-btn-gray"
                                            requestAttribs="<%= CollectionUtils.mapEntry("nextPage", exitPage)
                                                                            .mapEntry ("procParams", Collections.singletonMap("JobApplication", jobApplication))
                                                                            .toMap() %>"/>
                            <oneit:button   value="Proceed to step 2"   name="gotoPage" cssClass="box-btn"
                                            requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
                                                                            .mapEntry("procParams", CollectionUtils.mapEntry("JobApplication", jobApplication).toMap())
                                                                            .toMap() %>"/>
                        </div>
                    </div>
                </div>
            </oneit:form>
        </div>
    </div>
</oneit:dynIncluded>