<%@ 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>
<%
    HiringTeam  hiringTeam      =   (HiringTeam) process.getAttribute("HiringTeam");

    Debug.assertion(hiringTeam != null , "Invalid hiring team in admin portal my company");

    String      hiringTeamList  =   WebUtils.getSamePageInRenderMode(request, "Page");
    String      nextPage        =   WebUtils.getSamePageInRenderMode(request, "Billing");
%>
    <script type="text/javascript">
        $(document).ready(function()
        {
            recalcFunction = setupRecalc ($("form#makePayment"), {'recalcOnError':true});
        });
    </script>    
    
    <oneit:form name="hiringTeamTilte"  method="post"    enctype="multipart/form-data">
        <h1 class="page-title page-title-with-arrow">
            <oneit:button   cssClass="arrow-btn-blue"  name="gotoPage" value=" " skin="link"
                            requestAttribs="<%= CollectionUtils.mapEntry("nextPage", hiringTeamList)
                                                                .mapEntry("cancelProcess", true)
                                                                .toMap() %>" >
                <img src="images/arrow-left-prev_blue.svg" />
            </oneit:button>
            <%= hiringTeam.getHiringTeamName() %>
        </h1>
    </oneit:form>
    <div class="my-company-area">
        <oneit:form name="editCompany"  method="post"   enctype="multipart/form-data">
            <div style="padding-left: 15px; padding-right: 15px;">
                <oneit:dynInclude   page="/extensions/applicantportal/inc/multifieldtext.jsp"   data="<%= CollectionUtils.EMPTY_MAP%>"/>
            </div>
            <div class="row">
                <div class="col-lg-4 col-md-4 col-sm-6">
                    <div class="form-group hide">
                        <input type="hidden" name="expiry-date" />
                    </div>
                    <div class="form-group hide">
                        <input type="hidden" name="holder-name" />
                    </div>
                    <div class="form-group hide">
                        <input type="hidden" name="address-zip" />
                    </div>
                </div>
            </div>
            <oneit:button   value="Pay" name="updateCard" cssClass="hide"  id="payNow" 
                                                            requestAttribs='<%= CollectionUtils.mapEntry("nextPage", nextPage)
                                                                                            .mapEntry ("restartProcess", Boolean.TRUE)
                                                                                            .mapEntry("procParams", CollectionUtils.mapEntry("HiringTeam", hiringTeam).toMap())
                                                                                            .mapEntry ("attribNamesToRestore", Collections.singleton("HiringTeam"))
                                                                                            .toMap() %>'/>
        </oneit:form>
        <oneit:form name="makePayment"  method="post"    enctype="multipart/form-data">

            <oneit:dynInclude   page="/extensions/adminportal/inc/my_company_tabs.jsp"    TabNumber="3"    data="<%= CollectionUtils.EMPTY_MAP%>"/>

            <div class="company-content-area">
                <!-- Tab panes -->
                <div class="tab-content">
                    <div class="tab-pane active" id="company-detail">
                        <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">Billing</label><br/>               
                                <span id="card-errors" style="color: #eb1c26; font-size: 15px;"></span>
                            </div>
                        </div>
                    <%
                        if(hiringTeam.getCardID() != null)
                        {
                    %>
                            <oneit:dynInclude   page="/extensions/adminportal/inc/existing_card.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"  
                                                HiringTeam="<%= hiringTeam %>"    IsEdit="<%= true %>"   IsReplace="<%= false %>"/>

                    <%
                        }
                    %>
                    </div>
                    <div>
                        <div class="form-group row">
                            <div class="col-md-12 col-sm-12 col-xs-12 text-left">
                                <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>
                        <div class="grey-area">
                            <oneit:dynInclude   page="/extensions/adminportal/inc/card_details.jsp" data="<%= CollectionUtils.EMPTY_MAP%>"  
                                                HiringTeam="<%= hiringTeam %>"    IsEdit="<%= true %>"   IsReplace="<%= false %>"/>
                            <div class="form-group">
                                <oneit:button   value="Save Card"   name="updateCard"  cssClass="btn btn-primary btn-green large-btn"
                                                requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
                                                                                    .toMap() %>" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </oneit:form>
        <script src="https://js.stripe.com/v2/"></script>
        <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/updateCardStripe.js"/>
        </oneit:script>
    </div>
</oneit:dynIncluded>
