<?php $__env->startSection('title'); ?> <?php echo trans('website.labels.payment-and-shipment'); ?> - <?php echo Config::get('website.title'); ?> <?php $__env->stopSection(); ?> <?php $__env->startSection('container'); ?> <div class="row"> <div class="col-xs-12 order"> <h1><?php echo trans('website.labels.payment-and-shipment'); ?></h1> <ul class="steps clearfix"> <li class="col-xs-3 first"> <a href="<?php echo route('cart.show'); ?>">1. <?php echo trans('website.labels.shopping-cart'); ?></a> <i class="glyphicon glyphicon-triangle-right"></i> </li> <li class="col-xs-3 active"> <a>2. <?php echo trans('website.labels.payment-and-shipment'); ?></a> <i class="glyphicon glyphicon-triangle-right"></i> </li> <li class="col-xs-3"> <a>3. <?php echo trans('website.labels.billing-information'); ?></a> <i class="glyphicon glyphicon-triangle-right"></i> </li> <li class="col-xs-3 last"> <a>4. <?php echo trans('website.labels.order-confirmation'); ?></a> </li> </ul> <?php if($errors->order->count()): ?> <?php foreach($errors->order->all() as $error): ?> <?php echo Alert::warning($error)->close(); ?> <?php endforeach; ?> <?php endif; ?> <?php echo Form::open(['id' => 'payment_shipment', 'route' => 'payment-shipment', 'secure' => true]); ?> <div class="row"> <div class="col-xs-6"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">1. <?php echo trans('website.messages.choose-shipment-method'); ?></h3> </div> <div class="panel-body"> <ul class="shipments"> <?php $__empty_1 = true; foreach($shipment_options as $shipment): $__empty_1 = false; ?> <?php if(isset($shipment_payment_options['shipment'][$shipment->id])): ?> <li> <?php echo Form::radio('shipment', $shipment->id, (Session::get('order.order_shipment_id')==$shipment->id) ? true : false, isShipmentDisabled($shipment_payment_options, $shipment->id) ? ['disabled'] : null); ?> <?php if(!is_null($shipment->description($language->id)) && !empty($shipment->description($language->id))): ?> <span class="title <?php echo isShipmentDisabled($shipment_payment_options, $shipment->id) ? 'disabled' : ''; ?>"><?php echo $shipment->title($language->id); ?></span> <a tabindex="0" data-toggle="popover" data-trigger="focus" title="<?php echo $shipment->title($language->id); ?>" data-content="<?php echo $shipment->description($language->id); ?>" class="info"></a> <?php else: ?> <span class="title <?php echo isShipmentDisabled($shipment_payment_options, $shipment->id) ? 'disabled' : ''; ?>"><?php echo $shipment->title($language->id); ?></span> <?php endif; ?> <span class="price <?php echo isShipmentDisabled($shipment_payment_options, $shipment->id) ? 'disabled' : ''; ?> pull-right"> <?php if(!$shipment_price_options[$shipment->id]): ?> <?php echo trans('website.labels.shipment-free'); ?> <?php else: ?> <?php echo number_format($shipment_price_options[$shipment->id], 2, ',', ' '); ?> &euro; <?php endif; ?> </span> </li> <?php endif; ?> <?php endforeach; if ($__empty_1): ?> <?php endif; ?> </ul> </div> </div> </div> <div class="col-xs-6"> <div class="panel panel-default"> <div class="panel-heading"> <h3 class="panel-title">2. <?php echo trans('website.messages.choose-payment-method'); ?></h3> </div> <div class="panel-body"> <ul class="payments"> <?php $__empty_1 = true; foreach($payment_options as $payment): $__empty_1 = false; ?> <?php if(isset($shipment_payment_options['payment'][$payment->id])): ?> <li> <?php echo Form::radio('payment', $payment->id, (Session::get('order.order_payment_id')==$payment->id) ? true : false, isPaymentDisabled($shipment_payment_options, $payment->id) ? ['disabled'] : null); ?> <span class="title <?php echo isPaymentDisabled($shipment_payment_options, $payment->id) ? 'disabled' : ''; ?>"><?php echo $payment->title($language->id); ?></span> <?php if($payment->price > 0): ?> <span class="price <?php echo isPaymentDisabled($shipment_payment_options, $payment->id) ? 'disabled' : ''; ?> pull-right"> + <?php echo number_format($payment->price, 2, ',', ' '); ?> &euro; </span> <?php endif; ?> </li> <?php endif; ?> <?php endforeach; if ($__empty_1): ?> <?php endif; ?> </ul> </div> </div> </div> </div> <div class="row"> <div class="col-xs-6 back"> <i class="glyphicon glyphicon-chevron-left"></i> <?php echo HTML::linkRoute('cart.show', trans('website.labels.back')); ?> </div> <div class="col-xs-6"> <div class="well pull-right total"> <div class="row clearfix"> <div class="col-xs-8 pull-left"> <?php echo trans('website.labels.total-goods'); ?> </div> <div class="col-xs-4 pull-right text-right"> <strong><?php echo number_format($price_goods, 2, ',', ' '); ?> &euro;</strong> </div> </div> <div class="row clearfix"> <div class="col-xs-8 pull-left"> <?php echo trans('website.labels.total-shipment'); ?> </div> <div class="col-xs-4 pull-right text-right"> <strong class="shipment"><?php echo number_format($price_shipment + $price_payment, 2, ',', ' '); ?> &euro;</strong> </div> </div> <div class="row top-margin clearfix"> <div class="col-xs-8 pull-left"> <?php echo trans('website.labels.total-with-vat'); ?> </div> <div class="col-xs-4 pull-right text-right"> <strong class="price"><?php echo number_format($price_goods + $price_shipment + $price_payment, 2, ',', ' '); ?> &euro;</strong> </div> </div> <?php echo Button::accept(trans('website.buttons.proceed-to-checkout'))->appendIcon(Icon::triangle_right())->block()->submit()->withAttributes(['class' => 'top-margin']); ?> </div> </div> </div> <?php echo Form::close(); ?> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startSection('modals'); ?> @parent <div id="selectPaymentShipment" class="modal fade" role="dialog" aria-labelledby="" aria-hidden="true"> <div class="modal-dialog modal-md"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title"><?php echo trans('website.labels.payment-or-shipment-method-not-selected'); ?></h4> </div> <div class="modal-body"> <?php echo trans('website.messages.please-select-payment-and-shipment-method'); ?> </div> <div class="modal-footer"> <?php echo Button::normal(trans('admin.buttons.close'))->withAttributes(['data-dismiss' => 'modal']); ?> </div> </div> </div> </div> <?php $__env->stopSection(); ?> <?php $__env->startSection('scripts'); ?> @parent var price = <?php echo $price_goods; ?>; var shipment_options = <?php echo json_encode($shipment_payment_options['shipment']); ?>; var payment_options = <?php echo json_encode($shipment_payment_options['payment']); ?>; var shipments = <?php echo json_encode($shipment_price_options); ?>; var payments = <?php echo json_encode($payment_prices); ?>; var indexOf = function(needle) { if(typeof Array.prototype.indexOf === 'function') { indexOf = Array.prototype.indexOf; } else { indexOf = function(needle) { var i = -1, index = -1; for(i = 0; i < this.length; i++) { if(this[i] === needle) { index = i; break; } } return index; }; } return indexOf.call(this, needle); }; $('[data-toggle="popover"]').popover(); $('form input[name=shipment]').on('change', function(event) { var shipment = $(this).val(); var payment = $('form input[name=payment]:checked').val(); $('form input[name=payment]').each(function(index) { var index = indexOf.call(shipment_options[shipment], parseInt($(this).val())); if (index==-1) { $(this).prop('disabled', true); $(this).prop('checked', false); $(this).parents('li').find('.title').addClass('disabled'); } else { $(this).prop('disabled', false); $(this).parents('li').find('.title').removeClass('disabled'); } }); $('.total .shipment').html(number_format(parseFloat(shipments[shipment]) + parseFloat(payments[payment]), 2, ',', ' ') + ' &euro;'); $('.total .price').html(number_format(parseFloat(price) + parseFloat(shipments[shipment]) + parseFloat(payments[payment]), 2, ',', ' ') + ' &euro;'); }); $('form input[name=payment]').on('change', function(event) { var payment = $(this).val(); var shipment = $('form input[name=shipment]:checked').val(); $('form input[name=shipment]').each(function(index) { var index = indexOf.call(payment_options[payment], parseInt($(this).val())); if (index==-1) { $(this).prop('disabled', true); $(this).prop('checked', false); $(this).parents('li').find('.title').addClass('disabled'); $(this).parents('li').find('.price').addClass('disabled'); } else { $(this).prop('disabled', false); $(this).parents('li').find('.title').removeClass('disabled'); $(this).parents('li').find('.price').removeClass('disabled'); } }); $('.total .shipment').html(number_format(parseFloat(shipments[shipment]) + parseFloat(payments[payment]), 2, ',', ' ') + ' &euro;'); $('.total .price').html(number_format(parseFloat(price) + parseFloat(shipments[shipment]) + parseFloat(payments[payment]), 2, ',', ' ') + ' &euro;'); }); $('form#payment_shipment').on('submit', function(event) { var shipment = $(this).find('input[name=shipment]:checked').val(); var payment = $(this).find('input[name=payment]:checked').val(); if (!shipment || !payment) { $('#selectPaymentShipment').modal('show'); return false; } }); function number_format(number, decimals, dec_point, thousands_sep) { number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); var n = !isFinite(+number) ? 0 : +number, prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, dec = (typeof dec_point === 'undefined') ? '.' : dec_point, s = '', toFixedFix = function (n, prec) { var k = Math.pow(10, prec); return '' + Math.round(n * k) / k; }; s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); if (s[0].length > 3) { s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); } if ((s[1] || '').length < prec) { s[1] = s[1] || ''; s[1] += new Array(prec - s[1].length + 1).join('0'); } return s.join(dec); } <?php $__env->stopSection(); ?>