<%@ 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, "CardPayment");
%>
    <oneit:form name="makePayment"  method="post"    enctype="multipart/form-data">
        <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">
                <div class="tabpage-title">
                    <label class="label-20">Payment</label><br/>               
                    <span id="card-errors" style="color: #eb1c26; font-size: 15px;"></span>
                </div>
                <%
                    if(company.getCardID() != null)
                    {
                %>
                        <oneit:dynInclude   page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"  
                                            Company="<%= company %>"    IsEdit="<%= true %>"   IsReplace="<%= false %>"/>

                <%
                    }
                %>
                <div>
                    <div>
                        <label class="label-14 bold">Edit Card</label><br/>           
                        <label class="label-14">Your card details will be saved for future billing</label>            
                    </div>
                    <div class="grey-area">
                        <oneit:dynInclude   page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"  
                                            Company="<%= company %>"    IsEdit="<%= true %>"   IsReplace="<%= false %>"/>
                    </div>
                </div>
            </div>
        </div>                
    </oneit:form>    
    <oneit:form name="editJob"  method="post"   enctype="multipart/form-data">
        <div class="row">
            <div class="col-lg-4 col-md-4 col-sm-6">
                <div class="form-group hide">
                    <input type="hidden" name="stripe-token-id" />
                </div>
            </div>
        </div>
        <oneit:button   value="Pay" name="savePayment" cssClass="hide"  id="payNow" 
                                                        requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
                                                                                        .toMap() %>'/>
    </oneit:form>
    <script src="https://js.stripe.com/v3/"></script>
    <script>
        var stripePubKey = '<%= MakePaymentFP.STRIPE_PUB_KEY %>';
    </script>
    <oneit:script>
        <!-- MUST be included after initializing stripePubKey -->
        <oneit:script src="/scripts/performaStripe.js"/>
    </oneit:script>
</oneit:dynIncluded>