                    <div class="card card-blesta">
                        <div class="card-header">
                            <?php $this->_('Summary.index.box_heading');?>
                        </div>

                        <div class="card-body">
                            <?php
                            if (empty($summary['cart']['display_items'])) {
                            ?>
                            <div class="alert alert-warning mb-2">
                                <i class="fas fa-exclamation-triangle"></i> <?php $this->_('Summary.index.cart_empty');?>
                            </div>
                            <?php
                            } else {
                            ?>
                            <div class="table-responsive cart-summary">
                                <table class="table table-condensed">
                                    <tbody>
                                        <?php
                                        foreach ((isset($summary['cart']['display_items']) ? $summary['cart']['display_items'] : []) as $item) {
                                        ?>
                                            <tr>
                                                <td>
                                                    <?php
                                                    switch ((isset($item['type']) ? $item['type'] : null)) {
                                                        case 'addon':
                                                            // No break, display the item description
                                                        case 'config_fee':
                                                            echo (isset($item['description']) ? $this->Html->safe($item['description']) : null);
                                                            break;
                                                        default:
                                                            ?>
                                                            <strong><?php echo (isset($item['description']) ? $this->Html->safe($item['description']) : null);?></strong>
                                                            <?php
                                                    }
                                                    ?>
                                                    <?php $this->_('Summary.index.price', false, (isset($item['price']) ? $this->Html->safe($item['price']) : null));?>
                                                </td>
                                                <?php
                                                if ((isset($item['type']) ? $item['type'] : null) == 'service' || (isset($item['type']) ? $item['type'] : null) == 'addon') {
                                                ?>
                                                <td>
                                                    <span class="float-right"><a href="<?php echo $this->Html->safe($this->base_uri . 'order/cart/remove/' . (isset($order_form->label) ? $order_form->label : null) . '/?item=' . (isset($item['index']) ? $item['index'] : null));?>"><i class="fas fa-ban fa-fw fa-lg text-danger"></i></a></span>
                                                </td>
                                                <?php
                                                }
                                                ?>
                                            </tr>
                                            <?php
                                        }
                                        ?>
                                    </tbody>
                                </table>
                                <hr>

                                <?php
                                if ((isset($summary['totals']) ? $summary['totals'] : null)) {
                                ?>
                                <table class="table table-condensed totals">
                                    <tbody>
                                        <tr>
                                            <td><span class="float-right"><?php $this->_('Summary.index.totals.subtotal');?></span></td>
                                            <td><span class="float-right currency_value"><?php echo (isset($summary['totals']['subtotal']['amount_formatted']) ? $this->Html->safe($summary['totals']['subtotal']['amount_formatted']) : null);?></span></td>
                                        </tr>
                                        <?php
                                        if ((isset($summary['totals']['discount']['amount']) ? $summary['totals']['discount']['amount'] : null)) {
                                        ?>
                                        <tr>
                                            <td><span class="float-right"><?php $this->_('Summary.index.totals.discount');?></span></td>
                                            <td><span class="float-right currency_value"><?php echo (isset($summary['totals']['discount']['amount_formatted']) ? $this->Html->safe($summary['totals']['discount']['amount_formatted']) : null);?></span></td>
                                        </tr>
                                        <?php
                                        }
                                        if ((isset($summary['totals']['tax']) ? $summary['totals']['tax'] : null)) {
                                            foreach ($summary['totals']['tax'] as $description => $tax) {
                                        ?>
                                            <tr>
                                                <td><span class="float-right"><?php $this->_('Summary.index.totals.tax', false, $description);?></span></td>
                                                <td><span class="float-right currency_value"><?php echo (isset($tax['amount_formatted']) ? $this->Html->safe($tax['amount_formatted']) : null);?></span></td>
                                            </tr>
                                        <?php
                                            }
                                        }
                                        ?>
                                        <tr>
                                            <td><span class="float-right"><?php $this->_('Summary.index.totals.total');?></span></td>
                                            <td><span class="float-right currency_value"><?php echo (isset($summary['totals']['total']['amount_formatted']) ? $this->Html->safe($summary['totals']['total']['amount_formatted']) : null);?></span></td>
                                        </tr>
                                        <?php
                                        // Display recurring totals
                                        if ((isset($summary['totals_recurring']) ? $summary['totals_recurring'] : null)) {
                                        ?>
                                        <tr>
                                            <td><span class="float-right"><?php $this->_('Summary.index.totals.total_recurring');?></span></td>
                                            <td></td>
                                        </tr>
                                            <?php
                                            foreach ($summary['totals_recurring'] as $totals) {
                                                // Determine the period to use
                                                $term = $this->Html->safe($totals['term']);
                                                $period = $this->Html->safe(($term == 1 ? (isset($periods[$totals['period']]) ? $periods[$totals['period']] : null) : (isset($periods[$totals['period'] . '_plural']) ? $periods[$totals['period'] . '_plural'] : null)), true);
                                                $amount = $this->Html->safe($totals['totals']['total']['amount_formatted']);
                                            ?>
                                        <tr>
                                            <td colspan="2"><span class="float-right"><?php $this->_('Summary.index.totals.total_recurring_amount', false, $term, $period, $amount);?></span></td>
                                        </tr>
                                            <?php
                                            }
                                        }
                                        ?>
                                    </tbody>
                                </table>
                                <?php
                                }
                                ?>
                            </div>
                            <?php
                            }
                            ?>
                            <?php
                            if ((isset($order_form->allow_coupons) ? $order_form->allow_coupons : null) == '1') {
                            ?>
                                <p class="mb-2"><a href="#coupon_box" data-toggle="collapse"><i class="fas fa-chevron-down"></i> <?php $this->_('Summary.index.have_coupon');?></a></p>
                                <div id="coupon_box" class="collapse">
                                    <?php
                                    $this->Form->create((isset($this->base_uri) ? $this->base_uri : null) . 'order/cart/applycoupon/' . (isset($order_form->label) ? $order_form->label : null), ['id' => 'applycoupon', 'class' => 'disable-on-submit']);
                                    ?>
                                    <div class="form-group">
                                        <div id="coupon_message"></div>
                                    </div>
                                    <div class="input-group">
                                        <?php
                                        $this->Form->fieldText('coupon', (isset($summary['cart']['coupon']) ? $summary['cart']['coupon'] : (isset($temp_coupon) ? $temp_coupon : null)), ['class' => 'form-control', 'id' => 'coupon', 'placeholder' => $this->_('Summary.index.coupon', true)]);
                                        ?>
                                        <div class="input-group-append">
                                            <button class="btn <?php echo ((isset($summary['cart']['coupon']) ? $summary['cart']['coupon'] : null) ? 'btn-success' : 'btn-secondary');?> m-0" type="submit"><i class="fas fa-sync-alt"></i> <?php $this->_('Summary.index.coupon_btn');?></button>
                                        </div>
                                    </div>
                                    <?php
                                    $this->Form->end();
                                    ?>
                                    <hr />
                                </div>
                            <?php
                            }
                            ?>

                            <div class="row">
                                <div class="col-md-5 col-sm-5 col-xs-5">
                                    <?php
                                    if (count((isset($order_form->currencies) ? $order_form->currencies : [])) > 1) {
                                        $this->Form->setCsrfOptions(['set_on_create' => false]);
                                        $this->Form->create(null, ['method' => 'GET']);
                                    ?>
                                        <div class="form-group currency-selector m-0">
                                            <?php
                                            $this->Form->fieldSelect('currency', $this->Form->collapseObjectArray($order_form->currencies, 'currency', 'currency'), (isset($summary['cart']['currency']) ? $summary['cart']['currency'] : null), ['class' => 'form-control input-sm', 'id' => 'change_currency']);
                                            ?>
                                        </div>
                                    <?php
                                        $this->Form->end();
                                        $this->Form->setCsrfOptions(['set_on_create' => true]);
                                    }
                                    ?>
                                </div>
                                <div class="col-md-7">
                                    <?php
                                    if (!empty($summary['cart']['items'])) {
                                    ?>
                                    <a href="<?php echo $this->Html->safe($this->base_uri . 'order/cart/index/' . (isset($order_form->label) ? $order_form->label : null));?>" class="btn btn-success btn-sm float-right"><?php $this->_('Summary.index.checkout_btn');?> <i class="fas fa-angle-double-right"></i></a>
                                    <?php
                                    }
                                    ?>
                                </div>
                            </div>
                        </div>
                        <?php
                        if (!(isset($client) ? $client : null)) {
                            ?>
                            <div class="card-footer" id="login_section">
                                <?php $this->_('Summary.index.login_customer');?>
                                <a href="#login_box" data-toggle="collapse"><?php $this->_('Summary.index.login_link');?></a>
                                <div id="login_box" class="collapse">
                                    <?php
                                    $this->Form->create($this->base_uri . 'order/login/index/' . (isset($order_form->label) ? $order_form->label : null), ['id' => 'order_login', 'class' => 'disable-on-submit']);
                                    ?>
                                    <div class="form-group">
                                        <div id="login_message"></div>
                                    </div>
                                    <div class="form-group">
                                        <?php
                                        $this->Form->label($this->_('Summary.index.field_username', true));
                                        $this->Form->fieldText('username', null, ['class' => 'form-control']);
                                        ?>
                                    </div>
                                    <div class="form-group">
                                        <?php
                                        $this->Form->label($this->_('Summary.index.field_password', true));
                                        $this->Form->fieldPassword('password', ['class' => 'form-control']);
                                        ?>
                                    </div>
                                    <?php
                                    if ((isset($login_captcha) ? $login_captcha : null)) {
                                        ?>
                                        <div class="form-group">
                                            <?php echo $login_captcha;?>
                                        </div>
                                        <?php
                                    }
                                    ?>

                                    <button class="btn btn-light btn-block" type="submit"><i class="fas fa-lock"></i> <?php $this->_('Summary.index.login_btn');?></button>
                                    <div class="pass-reset">
                                        <a class="float-right" href="<?php echo $this->Html->safe($this->client_uri . "login/reset/");?>" target="_blank"><?php $this->_("Summary.index.link_resetpassword");?></a>
                                    </div>
                                    <div class="clearfix"></div>
                                    <?php
                                    $this->Form->end();
                                    ?>
                                </div>
                            </div>
                            <?php
                        }
                        ?>
                    </div>

<script type="text/javascript">
$(document).ready(function() {
    // Process change currency request
    $("#change_currency").change(function() {
        $(this).closest("form").attr('action', window.location.href);
        $(this).closest("form").submit();
    });

    // Process login request
    $("#order_login").submit(function(event) {
        $(this).blestaRequest('POST', $(this).attr('action'), $(this).serialize(),
            function(data) {
                if (data.error) {
                    $("#login_message").html(data.error);

                    // Re-enable the submit buttons
                    $(document).blestaEnableFormSubmission($('#order_login'));
                } else if (data.requires_otp) {
                    $(this).blestaRequest('GET', '<?php echo $this->Html->safe($this->base_uri . 'order/signup/otp/' . ($order_form->label ?? null));?>', null,
                        function(data) {
                            $("#login_section").html(data);
                        }
                    );
                } else {
                    $("#login_section").hide();
                }
            },
            null,
            {dataType: 'json'}
        );

        event.preventDefault();
    });

    $("#applycoupon").on('submit', function(event) {
        $(this).blestaRequest('POST', $(this).attr('action'), $(this).serialize(),
            function(data) {
                if (data.error)
                    $("#coupon_message").html(data.error);
                else {
                    var success_message = (data.success ? data.success : "");

                    $(this).blestaRequest('GET', '<?php echo $this->Html->safe($this->base_uri . 'order/summary/index/' . (isset($order_form->label) ? $order_form->label : null));?>', null,
                        function(data) {
                            $("#summary_section").html(data);

                            if (success_message.length > 0) {
                                $("#coupon_message").html(success_message);
                                $("#coupon_box").toggle();
                            }
                        }
                    );
                }
            },
            null,
            {dataType: 'json', complete: function() { $("#applycoupon").blestaEnableFormSubmission($("#applycoupon")); }}
        );

        event.preventDefault();
    });

    <?php
    // Attempt to auto-apply a temp coupon by submitting the coupon form
    if (!empty($temp_coupon) && empty($summary['cart']['coupon'])) {
    ?>
    $("#applycoupon").trigger("submit");
    <?php
    }
    ?>
});
</script>