
<%@ 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" %>
<%@page import="oneit.net.LoopbackHTTP"%>

<oneit:dynIncluded>
<%
    boolean toRedirect  =   GenericObjDF.getOrCreateObject (request, "Job", Job.REFERENCE_Job);
    Job     job         =   (Job) process.getAttribute("Job");

    Debug.assertion(job != null, "Job is null in admin portal create job");

    String  url         =   job.getShortenedUrlLink();
    boolean fromJob     =   request.getParameter("fromJob") != null ? Boolean.parseBoolean(request.getParameter("fromJob")) : false;
    String  nextPage    =   WebUtils.getSamePageInRenderMode(request, (fromJob ? "Page" : WebUtils.VIEW_APPLICANTS));

    HiringTeam  hiringTeam  =   job.getHiringTeam();
    HiringTeam  billingTeam =   hiringTeam.getManageOwnBilling() ? hiringTeam : hiringTeam.getBilledByTeam();
%>
    <script>
        function copyToClipboard() {
            
            var aux = document.createElement("input");
            aux.setAttribute("value", $("#jobURL").attr('href'));
            document.body.appendChild(aux);
            aux.select();
            document.execCommand("copy");
            document.body.removeChild(aux);
            alert("Link copied to clipboard");
        }
    </script>
    <oneit:form name="editJob" method="post"    enctype="multipart/form-data">
        
        <oneit:dynInclude   page="/extensions/applicantportal/inc/multifieldtext.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"/>
        
        <div class="main-created-job">
            <h1 class="page-title created-job-title">
                <%
                    if(fromJob)
                    {
                %>
                        Congratulations! Your job is now open
                <%
                    }
                %>
                <a href="<%= url %>" id="jobURL" style="display:none;">
                    <%= url %>
                </a>
            </h1>
            <div class="form-page-area no-float">
                <div class="job-share-icon">
                    <ul>
                        <li class="share-link" onclick="copyToClipboard()">
                            <a class="linked-col" href="#">                               
                                <div><%= url %></div>
                                <span class="copy-link">(Copy link to clipboard)</span>
                            </a>
                        </li>
<!--                        <li class="share-btn"><a href="#">Share</a></li>
                        <li class="linkdin-icon"><a href="#"><img src="images/linkedin-icon.png" /></a></li>
                        <li class="facebook-icon"><a href="#"><img src="images/facebook-icon.png"/></a></li>
                        <li class="shape-icon"><a href="#"><img src="images/shape.png" /></a></li>
                        <li class="more-icon"><a href="#"><img src="images/more-icon.png" /></a></li>-->
                    </ul>
                </div>
                <p class="job-txt">
                    This job will be open for 30 days until&nbsp;<oneit:toString value="<%= job.getApplyBy() %>" mode="PerformaDate"/>.
                </p>
                <div class="text-center">
                    <oneit:button   value="<%= "Go to Job" + (fromJob ? "s" : "")%>"  name="gotoPage" cssClass="btn btn-primary largeBtn"
                                    requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>'/>
                </div>
                <%
                    if(!billingTeam.isTrue(hiringTeam.getIsPPJ()))
                    {
                        Integer activeCount =   billingTeam.getUsedCredits();
                        Integer totCount    =   billingTeam.getAvailableCredits();
                        Integer remCount    =   totCount - activeCount > 0 ?  totCount - activeCount : 0;
                %>
                        <div class="space-55">You have <%= remCount %> jobs remaining for this month.</div>
                <%
                    }
                %>
                
            </div>
            <div class="job-desc-box">
                <div class="sample-job-advertise">
                    <span>
                        Sample job advertisement text
                    </span>
                        <a class="copy-to-clipboard" onclick="copyToClipboard()">
                        COPY TO CLIPBOARD
                    </a>
                </div>
                <div class="details-box">
                    <p><oneit:toString value="<%= job.getJobDescription() %>"  mode="ParagraphHTML" /></p>

                    <strong>Organisation Culture Statement</strong>    
                    <p><oneit:toString value="<%= job.getCultureStatement() %>"  mode="ParagraphHTML" /></p>

                    <strong>Requirements</strong>    
                    <ul>
                    <%
                        for (AssessmentCriteria criteria : job.getAssessmentCriteriasSet())
                        {
                    %>
                            <li><oneit:toString value="<%= criteria.getName() %>" mode="EscapeHTML"/></li>
                    <%
                        }
                    %>
                    </ul>

                </div>
            </div>
        </div>
        <style>
            .job-share-icon li a.linked-col {line-height: 20px;}
        </style>
    </oneit:form>
 </oneit:dynIncluded>
