<%@ page trimDirectiveWhitespaces="true" %>
<%@ taglib prefix="template" tagdir="/WEB-INF/tags/responsive/template" %>
<%@ taglib prefix="cms" uri="http://hybris.com/tld/cmstags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="ycommerce" uri="http://hybris.com/tld/ycommercetags" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="worldline" tagdir="/WEB-INF/tags/addons/worldlinedirectb2bcheckoutaddon/responsive" %>
<%@ taglib prefix="multi-checkout" tagdir="/WEB-INF/tags/responsive/checkout/multi" %>
<%@ taglib prefix="worldline-multi-checkout" tagdir="/WEB-INF/tags/addons/worldlinedirectb2bcheckoutaddon/responsive/checkout/multi" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<spring:htmlEscape defaultHtmlEscape="true"/>

<spring:url value="/checkout/multi/worldline/summary/placeOrder" var="placeOrderUrl" htmlEscape="false"/>
<spring:url value="/checkout/multi/termsAndConditions" var="getTermsAndConditionsUrl" htmlEscape="false"/>

<template:page pageTitle="${pageTitle}" hideHeaderLinks="true">
    <jsp:body>
        <div class="row">
            <div class="col-sm-6">
                <div class="checkout-headline">
                    <span class="glyphicon glyphicon-lock"></span>
                    <spring:theme code="checkout.multi.secure.checkout"/>
                </div>
                <multi-checkout:checkoutSteps checkoutSteps="${checkoutSteps}" progressBarId="${progressBarId}">
                    <ycommerce:testId code="checkoutStepFour">
                        <div class="checkout-review hidden-xs">
                            <div class="checkout-order-summary">
                                <worldline-multi-checkout:orderTotals cartData="${cartData}" showTaxEstimate="${showTaxEstimate}"
                                                            showTax="${showTax}" subtotalsCssClasses="dark"/>
                            </div>
                        </div>
                        <div class="place-order-form hidden-xs">
                            <form:form action="${placeOrderUrl}" id="placeOrderForm1"
                                       cssClass="js-worldlinePlaceOrderForm"
                                       modelAttribute="worldlinePlaceOrderForm">
                                <form:input type="hidden" path="screenHeight"/>
                                <form:input type="hidden" path="screenWidth"/>
                                <form:input type="hidden" path="navigatorJavaEnabled"/>
                                <form:input type="hidden" path="navigatorJavaScriptEnabled"/>
                                <form:input type="hidden" path="timezoneOffset"/>
                                <form:input type="hidden" path="colorDepth"/>
                                <c:if test="${cartData.quoteData eq null && tokenizePayment eq true}">
                                    <div class="checkbox">
                                        <label> <form:checkbox id="saveCardDetails" path="cardDetailsCheck" />
                                            <spring:theme code="checkout.multi.order.saveCardDetails"/>
                                        </label>
                                    </div>
                                </c:if>
                                <div class="checkbox">
                                    <label> <form:checkbox id="Terms1" path="termsCheck"/>
                                        <spring:theme var="termsAndConditionsHtml"
                                                      code="checkout.summary.placeOrder.readTermsAndConditions"
                                                      arguments="${fn:escapeXml(getTermsAndConditionsUrl)}"
                                                      htmlEscape="false"/>
                                            ${ycommerce:sanitizeHTML(termsAndConditionsHtml)}
                                    </label>
                                </div>

                                <button id="placeOrder" type="submit"
                                        class="btn btn-primary btn-place-order btn-block checkout-next checkoutSummaryButton">
                                    <spring:theme code="checkout.summary.placeOrder" text="Place Order"/>
                                </button>

                            </form:form>
                        </div>
                    </ycommerce:testId>
                </multi-checkout:checkoutSteps>
            </div>

            <div class="col-sm-6">
                <worldline:checkoutOrderSummary cartData="${cartData}" showDeliveryAddress="true" showPaymentInfo="true"
                                                showTaxEstimate="true" showTax="true"/>
            </div>

            <div class="col-sm-12 col-lg-12">
                <br class="hidden-lg">
                <cms:pageSlot position="SideContent" var="feature" element="div" class="checkout-help">
                    <cms:component component="${feature}"/>
                </cms:pageSlot>
            </div>
        </div>

    </jsp:body>
</template:page>
