@extends('layouts.layout-2')

@section('content')
    {{--
    <style>
        .checkbox.error{
            color:#b92c28 !important;
        }
        div.shop-item {
            margin-bottom:30px;
            border: 1px solid #ddd;
        }
        div.shop-item > .thumbnail, .thumbnail {
            border: none;
        }
        div.shop-item-summary {
            padding: 8px;
        }
        div.shop-item-summary h2 a {
            color: #9aa983;
            font-size: 1.2em;
            margin: 0 0 10px 0;
        }
        div.shop-item-buttons {
            padding: 0 8px 10px 8px;
        }
        div.shop-item-buttons .btn-xs{
            padding: 4px;
        }
        .cartContent a.remove_item {
            background: transparent;
        }
        .cartContent .product_name {
            font-size: 1.15em;
        }
        .cartContent .product_name > small {
            line-height: 20px;
        }
        @media only screen and (max-width: 1200px) {
            .cartContent .product_name {
                padding-bottom: 0;
                min-height: 60px;
                width: 60%;
            }
            .cartContent .remove_item {
                clear: right;
            }
            .cartContent .total_price {
                width: auto;
                padding-top: 30px;
                clear: right;
            }
            .cartContent .item .qty {
                float: left;
                text-align: left;
            }
            .cartContent .item.head {
                display: none;
            }

        }
        @media only screen and (min-width: 768px) {

            .cartContent .total_price {
                padding-top: 10px;
            }
        }
        @media only screen and (min-width: 992px) {
            .cartContent .total_price {
                padding-top: 30px;
            }
        }
        @media only screen and (min-width: 1200px) {
            .cartContent .total_price {
                padding-top: 10px;
            }
        }
        .cc_error {
            border: #bf6464 2px dashed;
        }



        .error .select2-selection, .error select.form-control {
            border: #bf6464 2px dashed;
        }

        fieldset.softhide {
            display: none;
        }

        select.form-control:not([size]):not([multiple]) {
            height: 38px;
            color: #6f6f6f;
            font-weight: 600;
        }

        .info-small {
            font-size: 0.8em;
            font-style: italic;
        }

    </style>
    --}}

    <h4 class="font-weight-bold py-2 mb-2">
        <a href="{{$back}}" class="btn btn-sm btn-default float-right">zurück</a>
        {{ __('Checkout') }}
    </h4>

    @if ($errors->any())
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    Bitte überprüfe das Formular und vervollständigen alle Angaben.
                </div>
            </div>
        </div>
    @endif

    @if (\Session::has('checkout-error'))
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    {{ \Session::get('checkout-error') }}
                </div>
            </div>
        </div>
    @endif

    @if (\Session::has('errormessage'))
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    {{ \Session::get('customermessage') }}
                </div>
            </div>
        </div>
    @endif


    {!! Form::open(['url' => route('user_checkout_store', [$identifier]), 'class' => 'row clearfix', 'id'=>'checkout_card_final']) !!}
    {!! Form::hidden('selected_country', '')  !!}
    {!! Form::hidden('is_for', $shopping_user->is_for)  !!}
    {!! Form::hidden('is_from', $shopping_user->is_from)  !!}

    <div class="row m-checkout">
        <div class="col-lg-8 col-md-7">
            <!-- BILLING -->
                <div class="card">
                    <h4 class="card-header">
                        Rechnungsadresse
                    </h4>
                    <!-- Status -->
                    <div class="card-body">
                        @if($is_from === 'shopping')
                            {{-- <div class="is_from_shopping">
                                <div class="row">
                                    <div class="col-md-12 col-sm-12">
                                        <div class="form-group">
                                            <label class="mt-0 fs-14 fw-400" for="billing_company">Firmenname  (optional)</label>
                                            {!! Form::text('billing_company', $shopping_user->billing_company, ['class' => 'form-control', 'id'=>'billing_company']) !!}
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-12 col-sm-12">
                                        <div class="form-group {{($errors->has('billing_salutation') ? 'error' : '')}}">
                                            <label class="mt-0 fs-14 fw-400" for="billing_salutation">Anrede *</label>
                                            <select id="billing_salutation" name="billing_salutation" class="form-control selectpicker">
                                                {!!  HTMLHelper::getSalutation(($shopping_user->billing_salutation ? $shopping_user->billing_salutation :  old('billing_salutation'))) !!}
                                            </select>
                                            @if ($errors->has('billing_salutation'))
                                                <label for="billing_salutation" class="error text-danger small" style="display: block;">{{ $errors->first('billing_salutation') }}</label>
                                            @endif
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-6 col-sm-6">
                                        <div class="form-group">
                                            <label class="mt-0 fs-14 fw-400" for="billing_firstname">Vorname*</label>
                                            {!! Form::text('billing_firstname', $shopping_user->billing_firstname, ['class' => 'form-control '.($errors->has('billing_firstname') ? 'error' : ''), 'id'=>'billing_firstname']) !!}
                                            @if ($errors->has('billing_firstname'))
                                                <label for="billing_firstname" class="error text-danger small" style="display: block;">{{ $errors->first('billing_firstname') }}</label>
                                            @endif
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-sm-6">
                                        <div class="form-group">
                                            <label class="mt-0 fs-14 fw-400" for="billing_lastname">Nachname*</label>
                                            {!! Form::text('billing_lastname', $shopping_user->billing_lastname, ['class' => 'form-control '.($errors->has('billing_lastname') ? 'error' : ''), 'id'=>'billing_lastname']) !!}
                                            @if ($errors->has('billing_lastname'))
                                                <label for="billing_lastname" class="error text-danger small" style="display: block;">{{ $errors->first('billing_lastname') }}</label>
                                            @endif
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-lg-12">
                                        <div class="form-group">
                                            <label class="mt-0 fs-14 fw-400" for="billing_address">Straße Nr. *</label>
                                            {!! Form::text('billing_address', $shopping_user->billing_address, ['class' => 'form-control '.($errors->has('billing_address') ? 'error' : ''), 'id'=>'billing_address']) !!}
                                            @if ($errors->has('billing_address'))
                                                <label for="billing_address" class="error text-danger small" style="display: block;">{{ $errors->first('billing_address') }}</label>
                                            @endif
                                        </div>
                                    </div>
                                    <div class="col-lg-12">
                                        <div class="form-group">
                                            <label class="mt-0 fs-14 fw-400" for="billing_address_2">Wohnung / Gebäude  (optional)</label>
                                            {!! Form::text('billing_address_2', $shopping_user->billing_address_2, ['class' => 'form-control '.($errors->has('billing_address_2') ? 'error' : ''), 'id'=>'billing_address_2']) !!}
                                            @if ($errors->has('billing_address_2'))
                                                <label for="billing_address_2" class="error text-danger small" style="display: block;">{{ $errors->first('billing_address_2') }}</label>
                                            @endif
                                        </div>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-md-6 col-sm-6">
                                        <label class="mt-0 fs-14 fw-400" for="billing_zipcode">PLZ *</label>
                                        {!! Form::text('billing_zipcode', $shopping_user->billing_zipcode, ['class' => 'form-control '.($errors->has('billing_zipcode') ? 'error' : ''), 'id'=>'billing_zipcode']) !!}
                                        @if ($errors->has('billing_zipcode'))
                                            <label for="billing_zipcode" class="error text-danger small" style="display: block;">{{ $errors->first('billing_zipcode') }}</label>
                                        @endif
                                    </div>
                                    <div class="col-md-6 col-sm-6">
                                        <label class="mt-0 fs-14 fw-400" for="billing_city">Stadt *</label>
                                        {!! Form::text('billing_city', $shopping_user->billing_city, ['class' => 'form-control '.($errors->has('billing_city') ? 'error' : ''), 'id'=>'billing_city']) !!}
                                        @if ($errors->has('billing_city'))
                                            <label for="billing_city" class="error text-danger small" style="display: block;">{{ $errors->first('billing_city') }}</label>
                                        @endif
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-12 col-sm-12">
                                        <label class="mt-0 fs-14 fw-400" for="billing_state">Land *</label>
                                        <select id="billing_state" name="billing_state" class="form-control" required>
                                            {!! HTMLHelper::getCountriesForShipping($shopping_user->billing_state) !!}
                                        </select>
                                        <input type="hidden" name="billing_country_id" value="{{ \App\Services\Shop::getShippingCountryCountryId($shopping_user->billing_state)}}">
                                        <span class="info-small" id="show_shipping_country_info">Bei der Änderung des Lieferlandes werden die Versandkosten neu berechnet.</span>
                                    </div>
                                </div>

                                <div class="row">
                                    <div class="col-md-12 col-sm-12">
                                        <label class="mt-0 fs-14 fw-400" for="billing_phone">Telefon (optional)</label>
                                        {!! Form::text('billing_phone', $shopping_user->billing_phone, ['class' => 'form-control '.($errors->has('billing_phone') ? 'error' : ''), 'id'=>'billing_phone']) !!}
                                        @if ($errors->has('billing_phone'))
                                            <label for="billing_phone" class="error text-danger small" style="display: block;">{{ $errors->first('billing_phone') }}</label>
                                        @endif
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-12 col-sm-12">
                                        <label class="mt-0 fs-14 fw-400" for="billing_email">E-Mail *</label>
                                        {!! Form::email('billing_email', $shopping_user->billing_email, ['class' => 'form-control '.($errors->has('billing_email') ? 'error' : ''), 'id'=>'billing_email']) !!}
                                        @if ($errors->has('billing_email'))
                                            <label for="billing_email" class="error text-danger small" style="display: block;">{{ $errors->first('billing_email') }}</label>
                                        @endif
                                    </div>
                                </div>
                            </div>
                            --}}
                        @else
                            <div class="is_from_user">
                                {!! Form::hidden('billing_company', $shopping_user->billing_company) !!}
                                {!! Form::hidden('billing_salutation', $shopping_user->billing_salutation) !!}
                                {!! Form::hidden('billing_firstname', $shopping_user->billing_firstname) !!}
                                {!! Form::hidden('billing_lastname', $shopping_user->billing_lastname) !!}
                                {!! Form::hidden('billing_address', $shopping_user->billing_address) !!}
                                {!! Form::hidden('billing_address_2', $shopping_user->billing_address_2) !!}
                                {!! Form::hidden('billing_zipcode', $shopping_user->billing_zipcode) !!}
                                {!! Form::hidden('billing_city', $shopping_user->billing_city) !!}
                                {!! Form::hidden('billing_phone', $shopping_user->billing_phone) !!}
                                {!! Form::hidden('billing_email', $shopping_user->billing_email) !!}
                                {!! Form::hidden('billing_state', $shopping_user->billing_state) !!}
                                {!! Form::hidden('billing_country_id', \App\Services\Shop::getShippingCountryCountryId($shopping_user->billing_state)) !!}
                                <div class="row">
                                    @if($shopping_user->billing_company)
                                        <div class="col-md-12 mb-3">
                                            <div class="text-muted small">Firma</div>
                                            {{ $shopping_user->billing_company }}
                                        </div>
                                    @endif

                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">Anrede</div>
                                        {{ \App\Services\HTMLHelper::getSalutationLang($shopping_user->billing_salutation) }}
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">Vorname</div>
                                        {{ $shopping_user->billing_firstname }}
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">Nachname</div>
                                        {{ $shopping_user->billing_lastname }}
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">Straße</div>
                                        {{ $shopping_user->billing_address }}
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">Zusatz</div>
                                        {{ $shopping_user->billing_address_2 }}
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">PLZ</div>
                                        {{ $shopping_user->billing_zipcode }}
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">Stadt</div>
                                        {{ $shopping_user->billing_city }}
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">E-Mail</div>
                                        {{ $shopping_user->billing_email }}
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">Telefon</div>
                                        {{ $shopping_user->billing_phone }}
                                    </div>
                                    <div class="col-md-3 mb-3">
                                        <div class="text-muted small">Land</div>
                                        {{ $shopping_user->billing_country->getLocated() }}
                                    </div>
                                </div>
                                <hr class="mb-3 mt-1">
                                <p class="text-muted small mb-0"><i>Deine Rechnungsadresse kann nur im Salescenter geändert werden.</i></p>
                                <hr>
                            </div>
                        @endif


                        <div class="form-group">
                            <label class="custom-control custom-checkbox">
                                {!! Form::checkbox('same_as_billing', 1, $shopping_user->same_as_billing, ['id'=>'shipswitch', 'class'=>'custom-control-input']) !!}
                                <span class="custom-control-label pt-1">Abweichende Lieferadresse</span>
                            </label>
                        </div>
                    </div>
                </div>

            <!-- /BILLING -->

            <!-- SHIPPING -->
            <div class="card mt-3" id="shipping">
                    <h4 class="card-header">
                        @if($shopping_user->is_from === 'user_order')
                            @if($shopping_user->is_for === 'me')
                                Meine Lieferadresse
                            @else
                                Lieferadresse des Kunden
                            @endif
                        @else
                            Lieferadresse
                        @endif
                    </h4>
                    <div class="card-body">

                        <div>
                            <div class="form-row">
                                <div class="form-group col-md-12">
                                    <label for="shipping_company" class="form-label">{{ __('Company name') }} (optional)</label>
                                    {{ Form::text('shipping_company', $shopping_user->shipping_company,  array('placeholder'=>__('Company name'), 'class'=>'form-control')) }}
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-6 {{ $errors->has('shipping_salutation') ? 'has-error' : '' }}">
                                    <label class="form-label">{{ __('Salutation') }}*</label>
                                    <select class="selectpicker" data-style="btn-light" name="shipping_salutation">
                                        {!!  HTMLHelper::getSalutation($shopping_user->shipping_salutation) !!}
                                    </select>
                                    @if ($errors->has('shipping_salutation'))
                                        <span class="help-block">
                                <strong>{{ $errors->first('shipping_salutation') }}</strong>
                            </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-6  {{ $errors->has('shipping_firstname') ? 'has-error' : '' }}">
                                    <label class="form-label" for="shipping_firstname">{{ __('First name') }}*</label>
                                    {{ Form::text('shipping_firstname', $shopping_user->shipping_firstname,  array('placeholder'=>__('First name'), 'class'=>'form-control')) }}
                                    @if ($errors->has('shipping_firstname'))
                                        <span class="help-block">
                                <strong>{{ $errors->first('shipping_firstname') }}</strong>
                            </span>
                                    @endif
                                </div>
                                <div class="form-group col-md-6  {{ $errors->has('shipping_lastname') ? 'has-error' : '' }}">
                                    <label class="form-label" for="shipping_lastname">{{ __('Last name') }}*</label>
                                    {{ Form::text('shipping_lastname', $shopping_user->shipping_lastname,  array('placeholder'=>__('Last name'), 'class'=>'form-control')) }}
                                    @if ($errors->has('shipping_lastname'))
                                        <span class="help-block">
                                <strong>{{ $errors->first('shipping_lastname') }}</strong>
                            </span>
                                    @endif

                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-12  {{ $errors->has('shipping_address') ? 'has-error' : '' }}">
                                    <label class="form-label" for="shipping_address">{{ __('Street') }} / {{ __('House number') }}*</label>
                                    {{ Form::text('shipping_address', $shopping_user->shipping_address,  array('placeholder'=>__('Street'), 'class'=>'form-control')) }}
                                    @if ($errors->has('shipping_address'))
                                        <span class="help-block">
                                    <strong>{{ $errors->first('shipping_address') }}</strong>
                                </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-12 {{ $errors->has('shipping_address_2') ? 'has-error' : '' }}">
                                    <label class="form-label" for="shipping_address_2">{{ __('Wohnung / Gebäude  (optional)') }}</label>
                                    {{ Form::text('shipping_address_2', $shopping_user->shipping_address_2,  array('placeholder'=>__('Wohnung / Gebäude  (optional)'), 'class'=>'form-control')) }}
                                    @if ($errors->has('shipping_address_2'))
                                        <span class="help-block">
                                    <strong>{{ $errors->first('shipping_address_2') }}</strong>
                                </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-6  {{ $errors->has('shipping_zipcode') ? 'has-error' : '' }}">
                                    <label class="form-label" for="shipping_zipcode">{{ __('Postcode') }}*</label>
                                    {{ Form::text('shipping_zipcode', $shopping_user->shipping_zipcode,  array('placeholder'=>__('Postcode'), 'class'=>'form-control')) }}
                                    @if ($errors->has('shipping_zipcode'))
                                        <span class="help-block">
                                    <strong>{{ $errors->first('shipping_zipcode') }}</strong>
                                </span>
                                    @endif

                                </div>
                                <div class="form-group col-md-6  {{ $errors->has('shipping_city') ? 'has-error' : '' }}">
                                    <label class="form-label" for="shipping_city">{{ __('City') }}*</label>
                                    {{ Form::text('shipping_city', $shopping_user->shipping_city,  array('placeholder'=>__('City'), 'class'=>'form-control')) }}
                                    @if ($errors->has('shipping_city'))
                                        <span class="help-block">
                                    <strong>{{ $errors->first('shipping_city') }}</strong>
                                </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-12  {{ $errors->has('shipping_country_id') ? 'has-error' : '' }}">
                                    <label class="form-label">{{ __('Lieferland') }}*</label>
                                    <select class="selectpicker" name="shipping_country_id" id="shipping_country_id"  data-style="btn-light" data-live-search="false" tabindex="24">
                                        {!! HTMLHelper::getCountriesForShipping($shopping_user->shipping_state) !!}
                                    </select>
                                    @if ($errors->has('shipping_country_id'))
                                        <span class="help-block">
                                    <strong>{{ $errors->first('shipping_country_id') }}</strong>
                                </span>
                                    @endif
                                </div>
                            </div>
                            <div class="form-row">
                                <div class="form-group col-md-12">
                                    <label class="form-label" for="shipping_phone">{{ __('Phone') }} (optional)</label>
                                    {{ Form::text('shipping_phone', $shopping_user->shipping_phone,  array('placeholder'=>__('Phone'), 'class'=>'form-control', 'id'=>'shipping_phone')) }}
                                </div>
                            </div>
                        </div>

                            {{-- <div class="row">
                                <div class="col-md-12 col-sm-12">
                                    <input type="hidden" name="shipping_country_id" value="{{ \App\Services\Shop::getShippingCountryCountryId($shopping_user->shipping_state) }}">
                                    <label class="mt-0 fs-14 fw-400" for="shipping_state">Lieferland *</label>
                                    <select id="shipping_state" name="shipping_state" class="form-control" required @if($is_from === 'user_order' && $is_for === 'me') disabled style="background-color: #d4d4d4;" @endif>
                                        {!! HTMLHelper::getCountriesForShipping($shopping_user->shipping_state) !!}
                                    </select>
                                    @if($is_from === 'user_order' && $is_for === 'me')
                                        <span class="info-small">Das Lieferland kann nur bei der Bestellübersicht geändert werden.</span>
                                    @else
                                        <span class="info-small">Bei der Änderung des Landes werden die Versandkosten neu berechnet.</span>
                                    @endif
                                </div>
                            </div>
                            --}}


                        </div>
                    <!-- /Body -->
                    </div>
            <!-- /card -->
            <div class="mt-2">
                <a href="{{$back}}" class="btn btn-sm btn-default">zurück</a>
            </div>
        </div>

        <div class="col-lg-4 col-md-5">
            @if($shopping_mode === 'test')
                <strong>#### TEST MODE #### TEST MODE ####</strong>
        @endif
        <!-- PAYMENT METHOD -->
            <div class="card mb-3">
                <h4 class="card-header">
                    Zahlungsart
                </h4>
                <div class="card-body">
                   {{-- @if(($shopping_user->abo_options === 1) && (Util::getUserPaymentFor() >= 3))

                        @if(array_key_exists('SEPA', $payment_methods_active) && in_array($payment_methods_active['SEPA'], $payment_methods))
                            <div class="col-lg-12 nomargin clearfix">
                                <label class="mt-4 fs-14 fw-400 radio pull-left" style="width: 100%">
                                    {!! Form::radio('payment_method', 'elv', '1') !!}
                                    <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> SEPA Lastschrift</span>
                                    <img class="float-right" width="90" src="{{asset('images/payments-assets/sepa.png')}}" alt="SEPA Lastschrift">
                                </label>
                            </div>
                        @else
                            <p>Zahlungsmethode nicht freigeschaltet, bitte wende dich an {{ config('app.default_mail') }}</p>
                        @endif
                    @else
                     --}}

                    <style>
                        .table tr:first-child td {
                            border-top: none;
                        }
                    </style>
                    <div class="table-responsive">
                        <table class="table table- m-0" id="membership_package_payment">
                            <tbody class="switchers-stacked">
                            @if(\App\Models\PaymentMethod::isShowPaymentMethod('PP', $user_payment_methods, Yard::instance('shopping')->totalWithShipping(2, '.', '')))
                                <tr>
                                    <td class="text-center align-middle px-0 ui-w-20">
                                        <label class="switcher switcher-secondary">
                                            {!! Form::radio('payment_method', 'pp', '', ['class'=>'switcher-input', 'required'=>true]) !!}
                                            <span class="switcher-indicator">
                                                    <span class="switcher-yes"></span>
                                                    <span class="switcher-no"></span>
                                                </span>
                                            <span class="switcher-label"></span>
                                        </label>
                                    </td>
                                    <td class="px-2 py-3 text-left font-weight-bold">
                                        <div class="mt-1"> PayPal </div>
                                    </td>
                                    <td class="text-right align-middle px-0 py-3">
                                        <img class="float-right" width="90" src="{{asset('images/payments-assets/paypal.png')}}" alt="PayPal">
                                    </td>
                                </tr>
                            @endif

                            @if(\App\Models\PaymentMethod::isShowPaymentMethod('SB', $user_payment_methods, Yard::instance('shopping')->totalWithShipping(2, '.', '')))
                                <tr>
                                    <td class="text-center align-middle px-0 ui-w-20">
                                        <label class="switcher switcher-secondary">
                                            {!! Form::radio('payment_method', 'SB', '', ['class'=>'switcher-input', 'required'=>true]) !!}
                                            <span class="switcher-indicator">
                                                    <span class="switcher-yes"></span>
                                                    <span class="switcher-no"></span>
                                                </span>
                                            <span class="switcher-label"></span>
                                        </label>
                                    </td>
                                    <td class="px-2 py-3 text-left font-weight-bold">
                                        <div class="mt-1"> Sofort -Überweisung </div>
                                    </td>
                                    <td class="text-right align-middle px-0 py-3">
                                        <img class="float-right" width="90" src="{{asset('images/payments-assets/sofort.png')}}" alt="Sofort">
                                    </td>
                                </tr>
                            @endif
                            @if(\App\Models\PaymentMethod::isShowPaymentMethod('CC', $user_payment_methods, Yard::instance('shopping')->totalWithShipping(2, '.', '')))
                                    <tr>
                                        <td class="text-center align-middle px-0 ui-w-20">
                                            <label class="switcher switcher-secondary">
                                                {!! Form::radio('payment_method', 'vor', '', ['class'=>'switcher-input', 'required'=>true]) !!}
                                                <span class="switcher-indicator">
                                                    <span class="switcher-yes"></span>
                                                    <span class="switcher-no"></span>
                                                </span>
                                                <span class="switcher-label"></span>
                                            </label>
                                        </td>
                                        <td class="px-2 py-3 text-left font-weight-bold">
                                            <div class="mt-1"> Kreditkarte </div>
                                        </td>
                                        <td class="text-right align-middle px-0 py-3">
                                            <img class="float-right" width="90" src="{{asset('images/payments-assets/creditcard.png')}}" alt="Mastercard + Visa">
                                        </td>
                                    </tr>
                                @endif
                            @if(\App\Models\PaymentMethod::isShowPaymentMethod('SEPA', $user_payment_methods, Yard::instance('shopping')->totalWithShipping(2, '.', '')))
                                <tr>
                                    <td class="text-center align-middle px-0 ui-w-20">
                                        <label class="switcher switcher-secondary">
                                            {!! Form::radio('payment_method', 'SEPA', '', ['class'=>'switcher-input', 'required'=>true]) !!}
                                            <span class="switcher-indicator">
                                                <span class="switcher-yes"></span>
                                                <span class="switcher-no"></span>
                                            </span>
                                            <span class="switcher-label"></span>
                                        </label>
                                    </td>
                                    <td class="px-2 py-3 text-left font-weight-bold">
                                        <div class="mt-1"> SEPA </div>
                                    </td>
                                    <td class="text-right align-middle px-0 py-3">
                                        <img class="float-right" width="90" src="{{asset('images/payments-assets/sepa.png')}}" alt="SEPA Lastschrift">
                                    </td>
                                </tr>
                            @endif
                            @if(\App\Models\PaymentMethod::isShowPaymentMethod('VOR', $user_payment_methods, Yard::instance('shopping')->totalWithShipping(2, '.', '')))
                                <tr>
                                    <td class="text-center align-middle px-0 ui-w-20">
                                        <label class="switcher switcher-secondary">
                                            {!! Form::radio('payment_method', 'vor', '', ['class'=>'switcher-input', 'required'=>true]) !!}
                                            <span class="switcher-indicator">
                                                    <span class="switcher-yes"></span>
                                                    <span class="switcher-no"></span>
                                                </span>
                                            <span class="switcher-label"></span>
                                        </label>
                                    </td>
                                    <td class="px-2 py-3 text-left font-weight-bold">
                                        <div class="mt-1"> Vorkasse</div>
                                    </td>
                                    <td class="text-right align-middle px-0 py-3">
                                        <img class="float-right" width="90" src="{{asset('images/payments-assets/vor.png')}}" alt="Vorkasse">
                                    </td>
                                </tr>
                            @endif
                            @if(\App\Models\PaymentMethod::isShowPaymentMethod('FNC', $user_payment_methods, Yard::instance('shopping')->totalWithShipping(2, '.', '')))
                                    <tr>
                                        <td class="text-center align-middle px-0 ui-w-20">
                                            <label class="switcher switcher-secondary">
                                                {!! Form::radio('payment_method', 'fnc', '', ['class'=>'switcher-input', 'required'=>true]) !!}
                                                <span class="switcher-indicator">
                                                    <span class="switcher-yes"></span>
                                                    <span class="switcher-no"></span>
                                                </span>
                                                <span class="switcher-label"></span>
                                            </label>
                                        </td>
                                        <td class="px-2 py-3 text-left font-weight-bold">
                                            <div class="mt-1"> Rechnungskauf </div>
                                        </td>
                                        <td class="text-right align-middle px-0 py-3">
                                            <img class="float-right" width="90" src="{{asset('images/payments-assets/fnc.png')}}" alt="Rechnungskauf">
                                        </td>
                                    </tr>
                                @endif

                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
            <!-- /PAYMENT METHOD -->

            <!-- PAYMENT METHOD SEPA-->
           {{--  <fieldset class="box-border-shadow p-20 @if (\Session::has('elv-error')) cc_error @endif" id="sepa-box-holder">
                <style>
                    #elv_content_check .form-group {
                        margin-bottom: 5px;
                    }
                    #elv_content_check input.form-control {
                        padding: 14px 20px;
                    }
                </style>
                <h4>SEPA Lastschrift</h4>
                <hr>
                <div class="toggle-transparent toggle-bordered-full clearfix">
                    <div class="toggle active">
                        <div class="toggle-content" id="elv_content_check">
                            <div class="row">
                                <div class="col-md-12">
                                    <label class="mt-0 fs-14 fw-400">Inhaber*</label>
                                </div>
                                <div class="form-group col-md-12">
                                    {!! Form::text('elv_bankaccountholder', (isset($payment_data['bankaccountholder']) ? $payment_data['bankaccountholder'] : ''), ['class' => 'form-control', 'id'=>'elv_bankaccountholder', 'placeholder'=>'Vorname Nachname']) !!}
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="mt-0 fs-14 fw-400">IBAN*</label>
                                {!! Form::text('elv_iban', (isset($payment_data['iban']) ? $payment_data['iban'] : ''), ['class' => 'form-control', 'id'=>'elv_iban', 'placeholder'=>'Beisp.: DE02120300000000202051']) !!}
                            </div>

                            <div class="form-group">
                                <label class="mt-0 fs-14 fw-400">BIC*</label>
                                {!! Form::text('elv_bic', (isset($payment_data['bic']) ? $payment_data['bic'] : ''), ['class' => 'form-control', 'id'=>'elv_bic', 'placeholder'=>'Beisp.: PBNKDEFF']) !!}
                            </div>
                            @if($shopping_user->abo_options)
                                <p>Automatische Verlängerung wurde ausgewählt. Dein SEPA-Mandart wird gespeichert und die jährliche Zahlung automatisch ausgeführt.</p>
                            @endif
                        </div>
                    </div>
                </div>
            </fieldset>--}}
            <!-- TOTAL / PLACE ORDER -->

            <!-- PAYMENT METHOD CC -->
            <fieldset class="box-border-shadow p-20  @if (\Session::has('cc-error')) cc_error @endif" id="creditcard-box-holder">
                <style>
                    #cc_content_check .form-group {
                        margin-bottom: 5px;
                    }
                    #cc_content_check input.form-control {
                        padding: 14px 20px;
                    }
                </style>
                <h4>Kreditkarte</h4>
                <hr>
                <div class="toggle-transparent toggle-bordered-full clearfix">
                    <div class="toggle active">
                        <div class="toggle-content" id="cc_content_check">
                            <input type="hidden" name="pseudocardpan" id="pseudocardpan">
                            <input type="hidden" name="truncatedcardpan" id="truncatedcardpan">

                            <div class="form-group">
                                <label class="mt-0 fs-14 fw-400" for="cc_cardtype">Kreditkarte *</label>
                                <select id="cc_cardtype" name="cc_cardtype" class="form-control selectpicker">
                                    <option value="V" @if(old('cc_cardtype') && old('cc_cardtype') == 'V') selected="selected" @endif>VISA</option>
                                    <option value="M" @if(old('cc_cardtype') && old('cc_cardtype') == 'M') selected="selected" @endif>Mastercard</option>
                                    <!--  <option value="A">Amex</option> -->
                                </select>
                            </div>

                            <div class="row">
                                <div class="col-md-12">
                                    <label class="mt-0 fs-14 fw-400">Inhaber*</label>
                                </div>
                                <div class="form-group col-md-6">
                                    {!! Form::text('cc_cardholder_first', '', ['class' => 'form-control', 'id'=>'cc_cardholder_first', 'placeholder'=>'Vorname']) !!}
                                </div>
                                <div class="form-group col-md-6">
                                    {!! Form::text('cc_cardholder_last', '', ['class' => 'form-control', 'id'=>'cc_cardholder_last', 'placeholder'=>'Nachname']) !!}
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="mt-0 fs-14 fw-400">Kreditkartennummer*</label>

                                {!! Form::text('cc_cardpan', '', ['class' => 'form-control', 'id'=>'cc_cardpan', 'placeholder'=>'Kreditkartennummer']) !!}
                            </div>
                            <div class="row">
                                <div class="form-group col-sm-12 col-md-8">
                                    <label class="mt-0 fs-14 fw-400">Gültis bis*</label>
                                    <div style="width: 40%" class="float-left">
                                        <select id="cc_cardexpiremonth" name="cc_cardexpiremonth" class="form-control selectpicker">
                                            @php( $months = range(1, 12))
                                            @foreach($months as $month)
                                                @php( $month = sprintf('%02d', $month) )
                                                <option value="{{$month}}" @if(old('cc_cardexpiremonth') && old('cc_cardexpiremonth') == $month) selected="selected" @endif>{{$month}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                    <div style="width: 60%;" class="float-right">
                                        <select id="cc_cardexpireyear" name="cc_cardexpireyear" class="form-control selectpicker">
                                            @php( $years = range(date("Y"), date('Y', strtotime('+6 years'))) )
                                            @foreach($years as $year)
                                                <option value="{{$year}}"  @if(old('cc_cardexpireyear') && old('cc_cardexpireyear') == $year) selected="selected" @endif>{{$year}}</option>
                                            @endforeach
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group col-sm-12 col-md-4">
                                    <label class="mt-0 fs-14 fw-400">Prüfnr.*</label>
                                    {!! Form::text('cc_cardcvc2', '', ['class' => 'form-control', 'id'=>'cc_cardcvc2', 'placeholder'=>'CVC*']) !!}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>
            <!-- TOTAL / PLACE ORDER -->
                <!-- BILLING -->
                <div class="card">

                    <h4 class="card-header">
                        Warenkorb
                    </h4>

                    <div class="card-body">

                    @if($is_from ===  'user_order')
                            <div class="clearfix mb-2">
                                <span class="pull-right">{{ Yard::instance('shopping')->subtotal() }} €</span>
                                <strong class="pull-left">Zwischensumme:</strong>
                            </div>

                            <hr>

                            <div class="clearfix mb-2">
                                <span class="pull-right">{{  Yard::instance('shopping')->shippingNet() }} € </span>
                                <span class="pull-left">Versandkosten:</span>
                            </div>
                        @else
                            <div class="clearfix mb-2">
                                <span class="pull-right">{{ Yard::instance('shopping')->total() }} €</span>
                                <strong class="pull-left">Zwischensumme:</strong>
                            </div>

                        @endif

                            <div class="clearfix mb-2">
                                <span class="pull-right">{{  Yard::instance('shopping')->getShippingCountryName() }}</span>
                                <span class="pull-left">Lieferland:</span>
                            </div>

                            <hr>

                            <div class="clearfix mb-2" style="font-size: 90%">
                                <span class="pull-right">{{  Yard::instance('shopping')->subtotalWithShipping() }} €</span>
                                <span class="pull-left">Summe ohne MwSt:</span>
                            </div>

                            <div class="clearfix mb-2" style="font-size: 90%">
                                <span class="pull-right">{{  Yard::instance('shopping')->taxWithShipping() }} €</span>
                                <span class="pull-left"> zzgl. {{-- Yard::getTaxRate() --}} MwSt:</span>
                            </div>

                        <hr />
                        @if(Yard::instance('shopping')->getPaymentCredit())
                            <div class="clearfix mb-2">
                                <span class="pull-right">{{ Yard::instance('shopping')->totalWithShippingWithoutCredit() }} €</span>
                                <span class="pull-left">Summe:</span>
                            </div>

                            <div class="clearfix mb-2">
                                <span class="pull-right"> - {{ Yard::instance('shopping')->totalfromCredit() }} €</span>
                                <span class="pull-left">aus Guthaben:</span>
                            </div>
                        @endif
                            <div class="clearfix">
                                <span class="pull-right size-20"><strong>{{ Yard::instance('shopping')->totalWithShipping() }} €</strong></span>
                                <strong class="pull-left">Gesamtsumme:</strong>
                            </div>
                            <hr />

                            <div class="form-group">
                                <label class="custom-control custom-checkbox m-0">
                                    <input type="checkbox" class="custom-control-input  {{ ($errors->has('accepted_data_checkbox') ? 'has-error' : '') }}" name="accepted_data_checkbox" id="accepted_data_checkbox" required>
                                    <span class="custom-control-label small">Mit Klick auf "Jetzt kaufen" akzeptiere ich die Allgemeinen Geschäftsbedingungen und die Datenschutzbelehrung, damit für die Bestellung meine Daten verarbeitet werden können.*</span>
                                </label>
                            </div>
                            <button type="submit" class="btn btn-primary btn-lg btn-block size-18 btn-text-500 mt-4 faa-parent animated-hover"><i class="fa fa-mail-forward faa-horizontal"></i> Jetzt kaufen</button>
                            <hr>
                            <p class="text-center" style="line-height: 1.2em;"><em class="small text-center"> <i class="fa fa-lock"></i> Sind alle Deine Angaben vollsätndig ausgefüllt, klicke auf "Jetzt kaufen" und Du wist zu unserem Zahlungsanbieter weitergeleitet, die Verbindung wird ist SSL verschlüsselt.</em></p>

                    </div>
                </div>

        </div>
        <!-- /COL -->

    </div>
    <!-- /RAW -->



    {!! Form::close() !!}



@endsection

@section('scripts')

    <script>
        /** CHECKOUT
         ** *********************** **/
        // New Account show|hide
        jQuery("#accountswitch").bind("click", function() {
            jQuery('#newaccount').slideToggle(200);
        });


        $('#billing_state').on('change', function (){
            $('input[name="selected_country"]').val('change');
            $('form#checkout_card_final').submit();
        });
        $('#shipping_state').on('change', function (){
            $('input[name="selected_country"]').val('change');
            $('form#checkout_card_final').submit();
        });
        function showShippingCountryFor($for){
            if($for === 'billing'){
                $('#show_shipping_country_info').show();
            }
            if($for === 'shipping'){
                $('#show_shipping_country_info').hide();
            }
        }
        // Shipping Address show|hide
        jQuery("#shipswitch").bind("click", function() {
            jQuery('#shipping').slideToggle(200, function() {
                // scroll down to shipping area.
                if($('#billing_state').val() !== $('#shipping_state').val()){
                    $('input[name="selected_country"]').val('change');
                }
                if(jQuery('#shipping').is(":visible")) {
                    _scrollTo('#shipping', 150);
                    showShippingCountryFor('billing');
                }else{
                    showShippingCountryFor('shipping');
                }
            });
        });

        if(!jQuery('#shipswitch').is(':checked')){
            jQuery('#shipping').hide();
            showShippingCountryFor('billing');
        }else{
            jQuery('#shipping').show();
            showShippingCountryFor('shipping');
        }

        jQuery('.quick-cart-box-close').on('click', function () {
            jQuery('.quick-cart-box').css('display', 'none');
        });


        function showCreditCardPayment(val){
            if(val === 'cc'){
                $('#creditcard-box-holder').show('slow');
            }else{
                $('#creditcard-box-holder').hide('slow');
            }

        }
        showCreditCardPayment(jQuery('input[name="payment_method"]:checked').val());
        jQuery('input[name="payment_method"]').on('change', function () {
            showCreditCardPayment($(this).val());
        });

        function showSEPAPayment(val){
            if(val === 'elv'){
                $('#sepa-box-holder').show('slow');
            }else{
                $('#sepa-box-holder').hide('slow');
            }

        }
        showSEPAPayment(jQuery('input[name="payment_method"]:checked').val());
        jQuery('input[name="payment_method"]').on('change', function () {
            showSEPAPayment($(this).val());
        });
    </script>




@endsection