<%@ 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>
<%
    SecUser     loggedInUser    =   SecUser.getTXUser(transaction);
    CompanyUser companyUser     =   loggedInUser.getExtension(CompanyUser.REFERENCE_CompanyUser);
    Company     company         =   companyUser.getCompany();
    String      nextPage        =   WebUtils.getSamePageInRenderMode(request, WebUtils.CREATED_JOB) + "&fromJob=true";
    Job         job             =   (Job) process.getAttribute("Job");
    Boolean     ppj             =   (Boolean) process.getAttribute("PPJ");
    String      jobsPage        =   WebUtils.getSamePageInRenderMode(request, "Page");
%>
    <oneit:form name="makePayment"  method="post"   enctype="multipart/form-data">

    <script type="text/javascript">
        $(document).ready(function()
        {
            recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
        });
    </script> 
    
        <div class="main-created-job card-payment">
            <h1 class="page-title select-payment-optio">
                Enter Payment Details
            </h1>
            <div class="form-page-area billing-content-area">
                
                <oneit:dynInclude   page="/extensions/adminportal/inc/payment_plan.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"  
                                    Company="<%= company %>"    Job="<%= job %>"/>
                
                <div class="form-group row">
                    <div class="col-md-12 col-sm-12 col-xs-12 text-left">
                        <label class="label-20 pay-subsc-txt">Payment</label><br/>               
                        <span id="card-errors" style="color: #eb1c26; font-size: 15px;"></span>
                    </div>
                </div>
        <%
            if(company.getCardID() != null)
            {
        %>
                <oneit:dynInclude   page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"  
                                    Company="<%= company %>"    IsEdit="<%= false %>"   IsReplace="<%= false %>"/>

        <%
            }
            else
            {
        %>
                <div class="form-group row">
                    <div class="col-md-12 col-sm-12 col-xs-12 text-left">
                        <label class="label-14">Your card details will be saved for future billing</label>            
                    </div>
                </div>   
                <div class="grey-area">
                    <oneit:dynInclude   page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"
                                        Company="<%= company %>"    IsEdit="<%= false %>"   IsReplace="<%= true %>"/>
                </div>
        <%
            }
        %>
                <div class="form-group row" style="padding-top: 30px;">
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 btn-footer">
                        <oneit:button   value="Cancel and go back to Jobs"   name="gotoPage"  skin="link" cssClass="cancel-and-go-back"
                                        requestAttribs="<%= CollectionUtils.mapEntry("nextPage", jobsPage)
                                                                            .toMap() %>" />
                    </div>
                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 btn-right">
                        <oneit:button   value="Pay and Open Job"   name="savePayment"   cssClass="btn btn-primary large-btn btn-green"
                                        requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
                                                                            .mapEntry("Company", company)
                                                                            .mapEntry("PPJ", ppj)
                                                                            .toMap() %>'/>
                    </div>
                </div>
            </div>
        </div>
    </oneit:form>

</oneit:dynIncluded>