@section('title') {{trans('website.labels.payment-and-shipment')}} - {{Config::get('website.title')}} @stop @section('container')

{{trans('website.labels.payment-and-shipment')}}

@if ($errors->order->count()) @foreach($errors->order->all() as $error) {{Alert::warning($error)->close()}} @endforeach @endif {{Form::open(['id' => 'payment_shipment', 'route' => 'payment-shipment', 'secure' => true])}}

1. {{trans('website.messages.choose-shipment-method')}}

    @forelse($shipment_options as $shipment) @if (isset($shipment_payment_options['shipment'][$shipment->id]))
  • {{Form::radio('shipment', $shipment->id, (Session::get('order.order_shipment_id')==$shipment->id) ? true : false, isShipmentDisabled($shipment_payment_options, $shipment->id) ? ['disabled'] : null)}} @if (!is_null($shipment->description($language->id)) && !empty($shipment->description($language->id))) {{$shipment->title($language->id)}} @else {{$shipment->title($language->id)}} @endif @if (!$shipment_price_options[$shipment->id]) {{trans('website.labels.shipment-free')}} @else {{number_format($shipment_price_options[$shipment->id], 2, ',', ' ')}} € @endif
  • @endif @empty @endforelse

2. {{trans('website.messages.choose-payment-method')}}

    @forelse($payment_options as $payment) @if (isset($shipment_payment_options['payment'][$payment->id]))
  • {{Form::radio('payment', $payment->id, (Session::get('order.order_payment_id')==$payment->id) ? true : false, isPaymentDisabled($shipment_payment_options, $payment->id) ? ['disabled'] : null)}} {{$payment->title($language->id)}} @if ($payment->price > 0) + {{number_format($payment->price, 2, ',', ' ')}} € @endif
  • @endif @empty @endforelse
{{HTML::linkRoute('cart.show', trans('website.labels.back'))}}
{{trans('website.labels.total-goods')}}
{{number_format($price_goods, 2, ',', ' ')}} €
{{trans('website.labels.total-shipment')}}
{{number_format($price_shipment + $price_payment, 2, ',', ' ')}} €
{{trans('website.labels.total-with-vat')}}
{{number_format($price_goods + $price_shipment + $price_payment, 2, ',', ' ')}} €
{{Button::accept(trans('website.buttons.proceed-to-checkout'))->appendIcon(Icon::triangle_right())->block()->submit()->withAttributes(['class' => 'top-margin'])}}
{{Form::close()}}
@stop @section('modals') @parent @stop @section('scripts') @parent var price = {{$price_goods}}; var shipment_options = {{json_encode($shipment_payment_options['shipment'])}}; var payment_options = {{json_encode($shipment_payment_options['payment'])}}; var shipments = {{json_encode($shipment_price_options)}}; var payments = {{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, ',', ' ') + ' €'); $('.total .price').html(number_format(parseFloat(price) + parseFloat(shipments[shipment]) + parseFloat(payments[payment]), 2, ',', ' ') + ' €'); }); $('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, ',', ' ') + ' €'); $('.total .price').html(number_format(parseFloat(price) + parseFloat(shipments[shipment]) + parseFloat(payments[payment]), 2, ',', ' ') + ' €'); }); $('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); } @stop