@extends($user_shop ?'web.user.layouts.layout' : 'web.layouts.layout')

@section('content')

    <section class="page-header page-header-xlg parallax parallax-3"
             style="background-image:url('/assets/images/vision-min.jpg')">
        <div class="overlay dark-1"><!-- dark overlay [1 to 9 opacity] --></div>

        <div class="container">
        </div>
    </section>
    <!-- /PAGE HEADER -->

    <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>

    <section>
        <div class="container">
             @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



        <div class="m-checkout">

        {!! Form::open(['url' => route('checkout.checkout_card_final'), '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)  !!}
            {!! Form::hidden('homeparty_id', $shopping_user->homeparty_id)  !!}


        @if (\Session::has('elv-managemandate'))

                <div class="col-sm-12">
                    <fieldset class="mb-20 box-border-shadow p-20">

                        <button type="submit" class="btn btn-warning btn-lg btn-block size-18 btn-text-500 mt-4 faa-parent animated-hover" style="white-space: normal"><i class="fa fa-mail-forward faa-horizontal"></i> SEPA-Lastschriftmandat zustimmen und kauf abschließen</button>
                        <hr>
                        <div class="alert alert-success">
                            {!! urldecode(\Session::get('elv-mandate_text')) !!}
                        </div>
                        <hr>
                        <button type="submit" class="btn btn-warning btn-lg btn-block size-18 btn-text-500 mt-4 faa-parent animated-hover" style="white-space: normal"><i class="fa fa-mail-forward faa-horizontal"></i> SEPA-Lastschriftmandat zustimmen und kauf abschließen</button>

                    </fieldset>
                    <input type="hidden" name="mandate_identification" id="mandate_identification" value="{{ \Session::get('elv-mandate_identification') }}">
                    <input type="hidden" name="creditor_identifier" id="creditor_identifier" value="{{ \Session::get('elv-creditor_identifier') }}">
                </div>
            @endif


            <div class="col-lg-7 col-sm-7">
                <!-- BILLING -->
                <fieldset class="mb-0 box-border-shadow p-20">
                    <h4>Rechnungsadresse</h4>

                    <hr />
                    @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">
                            <style>
                                .ex-small {
                                    color: #868686 !important;
                                    font-size: 12px;
                                    font-weight: bold;
                                }
                                .text-normal {
                                    color: #404040 !important;
                                    font-size: 14px;
                                    font-weight: normal;
                                    margin-bottom: 6px;
                                }
                            </style>
                            @if($shopping_user->billing_company)
                                <div class="col-md-12 mb-3">
                                    <div class="ex-small">Firma</div>
                                    <div class="text-normal">{{ $shopping_user->billing_company }}</div>
                                </div>
                            @endif
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">Anrede</div>
                                <div class="text-normal">{{ \App\Services\HTMLHelper::getSalutationLang($shopping_user->billing_salutation) }}</div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">Vorname</div>
                                <div class="text-normal">{{ $shopping_user->billing_firstname }}</div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">Nachname</div>
                                <div class="text-normal">{{ $shopping_user->billing_lastname }}</div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">Straße</div>
                                <div class="text-normal">{{ $shopping_user->billing_address }}</div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">Zusatz</div>
                                <div class="text-normal">{{ $shopping_user->billing_address_2 }}</div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">PLZ</div>
                                <div class="text-normal">{{ $shopping_user->billing_zipcode }}</div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">Stadt</div>
                                <div class="text-normal">{{ $shopping_user->billing_city }}</div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">Land</div>
                                <div class="text-normal">{{ $shopping_user->billing_country->getLocated() }}</div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">Telefon</div>
                                <div class="text-normal">{{ $shopping_user->billing_phone }}</div>
                            </div>
                            <div class="col-md-3 mb-3">
                                <div class="ex-small">E-Mail</div>
                                <div class="text-normal">{{ $shopping_user->billing_email }}</div>
                            </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>
                    </div>
                    @endif

                    <div class="row">
                        <div class="col-md-12 col-sm-12">
                            <hr>
                            <label class="checkbox {{ ($errors->has('accepted_data_checkbox') ? 'error' : '') }}" for="accepted_data_checkbox" style="font-size: 14px;line-height: 22px; font-weight: 400">
                                {!! Form::checkbox('accepted_data_checkbox', 1, $shopping_user->accepted_data_checkbox, ['id'=>'accepted_data_checkbox', 'class' => 'form-control '.($errors->has('accepted_data_checkbox') ? 'error' : '')]) !!}

                                @if($shopping_user->auth_user_id)
                                    <i></i> 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.
                                @else
                                    <i></i> Mit Klick auf "Jetzt kaufen" akzeptiere ich die <a href="{{ url('/agb') }}">Allgemeinen Geschäftsbedingungen</a>, die <a target="_blank" href="{{ asset('download/mivita_widerruf_formular.pdf') }}">Widerrufsbelehrung</a> und die <a href="{{ url('/datenschutz') }}">Datenschutzerklärung</a>, damit für die Bestellung meine Daten verarbeitet werden können.
                                @endif
                            </label>
                            @if ($errors->has('accepted_data_checkbox'))
                                <label for="accepted_data_checkbox" class="error text-danger small" style="display: block;">{{ $errors->first('accepted_data_checkbox') }}</label>
                            @endif
                        </div>
                    </div>
                        <div class="row" @if($is_from === 'user_order') style="display: none"  @endif>
                            <div class="col-lg-12 nomargin clearfix">
                                <hr>
                                <label class="mt-0 fs-14 fw-500 checkbox pull-left">
                                    {!! Form::checkbox('same_as_billing', 1, $shopping_user->same_as_billing, ['id'=>'shipswitch']) !!}
                                    <i></i> <span class="weight-400">Abweichende Lieferadresse</span>
                                </label>
                            </div>
                        </div>
                </fieldset>
                <!-- /BILLING -->


                <!-- SHIPPING -->
                <fieldset id="shipping" class="softhide mt-40">
                    <div class="box-border-shadow p-20">

                        @if($shopping_user->is_from === 'user_order')
                            @if($shopping_user->is_for === 'me')
                                <h4>Meine Lieferadresse</h4>
                            @else
                                <h4>Lieferadresse des Kunden</h4>
                            @endif
                        @else
                            <h4>Lieferadresse</h4>
                        @endif

                        <hr />

                        <div class="row">

                            <div class="col-md-12 col-sm-12">
                                <label class="mt-0 fs-14 fw-400" for="shipping_company">Firmenname  (optional)</label>
                                {!! Form::text('shipping_company', $shopping_user->shipping_company, ['class' => 'form-control', 'id'=>'shipping_company']) !!}
                            </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="shipping_salutation">Anrede *</label>
                                <select id="shipping_salutation" name="shipping_salutation" class="form-control selectpicker">
                                    {!!  HTMLHelper::getSalutation(($shopping_user->shipping_salutation ? $shopping_user->shipping_salutation :  old('shipping_salutation'))) !!}
                                </select>
                                @if ($errors->has('shipping_salutation'))
                                    <label for="shipping_salutation" class="error text-danger small" style="display: block;">{{ $errors->first('shipping_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="shipping_firstname">Vorname*</label>
                                    {!! Form::text('shipping_firstname', $shopping_user->shipping_firstname, ['class' => 'form-control '.($errors->has('shipping_firstname') ? 'error' : ''), 'id'=>'shipping_firstname']) !!}
                                    @if ($errors->has('shipping_firstname'))
                                        <label for="shipping_firstname" class="error text-danger small" style="display: block;">{{ $errors->first('shipping_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="shipping_lastname">Nachname*</label>
                                    {!! Form::text('shipping_lastname', $shopping_user->shipping_lastname, ['class' => 'form-control '.($errors->has('shipping_lastname') ? 'error' : ''), 'id'=>'shipping_lastname']) !!}
                                    @if ($errors->has('shipping_lastname'))
                                        <label for="shipping_lastname" class="error text-danger small" style="display: block;">{{ $errors->first('shipping_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="shipping_address">Straße Nr. *</label>
                                    {!! Form::text('shipping_address', $shopping_user->shipping_address, ['class' => 'form-control '.($errors->has('shipping_address') ? 'error' : ''), 'id'=>'shipping_address']) !!}
                                    @if ($errors->has('shipping_address'))
                                        <label for="shipping_address" class="error text-danger small" style="display: block;">{{ $errors->first('shipping_address') }}</label>
                                    @endif
                                </div>
                            </div>
                            <div class="col-lg-12">
                                <div class="form-group">
                                    <label class="mt-0 fs-14 fw-400" for="shipping_address_2">Wohnung / Gebäude  (optional)</label>
                                    {!! Form::text('shipping_address_2', $shopping_user->shipping_address_2, ['class' => 'form-control '.($errors->has('shipping_address_2') ? 'error' : ''), 'id'=>'shipping_address_2']) !!}
                                    @if ($errors->has('shipping_address_2'))
                                        <label for="shipping_address_2" class="error text-danger small" style="display: block;">{{ $errors->first('shipping_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="shipping_zipcode">PLZ *</label>
                                {!! Form::text('shipping_zipcode', $shopping_user->shipping_zipcode, ['class' => 'form-control '.($errors->has('shipping_zipcode') ? 'error' : ''), 'id'=>'shipping_zipcode']) !!}
                                @if ($errors->has('shipping_zipcode'))
                                    <label for="shipping_zipcode" class="error text-danger small" style="display: block;">{{ $errors->first('shipping_zipcode') }}</label>
                                @endif
                            </div>
                            <div class="col-md-6 col-sm-6">
                                <label class="mt-0 fs-14 fw-400" for="shipping_city">Stadt *</label>
                                {!! Form::text('shipping_city', $shopping_user->shipping_city, ['class' => 'form-control '.($errors->has('shipping_city') ? 'error' : ''), 'id'=>'shipping_city']) !!}
                                @if ($errors->has('shipping_city'))
                                    <label for="shipping_city" class="error text-danger small" style="display: block;">{{ $errors->first('shipping_city') }}</label>
                                @endif
                            </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 class="row">
                            <div class="col-md-12 col-sm-12">
                                <label class="mt-0 fs-14 fw-400" for="shipping_phone">Telefon (optional)</label>
                                {!! Form::text('shipping_phone', $shopping_user->shipping_phone, ['class' => 'form-control '.($errors->has('shipping_phone') ? 'error' : ''), 'id'=>'shipping_phone']) !!}
                                @if ($errors->has('shipping_phone'))
                                    <label for="shipping_phone" class="error text-danger small" style="display: block;">{{ $errors->first('shipping_phone') }}</label>
                                @endif
                            </div>
                        </div>
                    </div>
                </fieldset>
                <!-- /SHIPPING -->

                @if(isset($order_reference))
                    <a href="{{ Util::getUserShopBackUrl($order_reference) }}" class="btn btn-default btn-sm btn- size-15 mt-4 mb-4">
                        <i class="fa fa-chevron-left"></i> zurück zum Shop
                    </a>
                @else
                    <a href="{{ Util::getUserCardBackUrl('/card/show') }}" class="btn btn-default btn-sm btn- size-15 mt-4 mb-4">
                        @if(Util::getUserPaymentFor() > 1)
                            <i class="fa fa-chevron-left"></i> zurück {{ Util::getMyMivitaUrl(false) }}
                        @else
                            <i class="fa fa-chevron-left"></i> zurück zum Warenkorb
                        @endif
                    </a>
                @endif
            </div>

            <div class="col-lg-5 col-sm-5">
                @if($shopping_mode === 'test')
                    <strong>#### TEST MODE #### TEST MODE ####</strong>
                @endif
                <!-- PAYMENT METHOD -->
                <fieldset class="box-border-shadow p-20">
                    <h4>Zahlungsart</h4>
                    <hr>
                    <div class="toggle-transparent toggle-bordered-full clearfix">
                        <div class="toggle active">
                            <div class="toggle-content">
                                <div class="row nomargin-bottom">


                                     @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
                                    @if(array_key_exists('PP', $payment_methods_active) && in_array($payment_methods_active['PP'], $payment_methods))
                                        <div class="col-lg-12 nomargin clearfix">
                                            <label class="mt-0 fs-14 fw-400 radio pull-left nomargin-top" style="width: 100%">
                                                {!! Form::radio('payment_method', 'wlt#PPE', (!old('payment_method') ? '1' : '')) !!}
                                                <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> PayPal</span>
                                                <img class="float-right" width="90" src="{{asset('images/payments-assets/paypal.png')}}" alt="PayPal">
                                            </label>
                                        </div>
                                        @endif

                                        @if(array_key_exists('CC', $payment_methods_active) && in_array($payment_methods_active['CC'], $payment_methods))
                                        <div class="col-lg-12 nomargin clearfix">
                                            <label class="mt-4 fs-14 fw-400 radio pull-left nomargin-top" style="width: 100%">
                                                {!! Form::radio('payment_method', 'cc', '') !!}
                                                <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> Kreditkarte</span>
                                                <img class="float-right" width="90" src="{{asset('images/payments-assets/creditcard.png')}}" alt="Mastercard + Visa">
                                            </label>
                                        </div>
                                        @endif
                                        @if(array_key_exists('SB', $payment_methods_active) && in_array($payment_methods_active['SB'], $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', 'sb#PNT', '') !!}
                                                <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> Sofort -Überweisung</span>
                                                <img class="float-right" width="90" src="{{asset('images/payments-assets/sofort.png')}}" alt="Sofort">
                                            </label>
                                        </div>
                                        @endif
                                        @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', '') !!}
                                                <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>
                                        @endif
                                        @if(array_key_exists('VOR', $payment_methods_active) && in_array($payment_methods_active['VOR'], $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', 'vor', '') !!}
                                                <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> Vorkasse</span>
                                                <img class="float-right" width="90" src="{{asset('images/payments-assets/vor.png')}}" alt="Vorkasse">
                                            </label>
                                        </div>
                                        @endif
                                        @if(array_key_exists('FNC', $payment_methods_active) && in_array($payment_methods_active['FNC'], $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', 'fnc#MIV', '') !!}
                                                <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> Rechnungskauf</span>
                                                <img class="float-right" width="90" src="{{asset('images/payments-assets/fnc.png')}}" alt="Rechnungskauf">
                                            </label>
                                        </div>
                                        @endif
                                     @endif

                                {{--
                                <div class="col-lg-12 nomargin clearfix">
                                       <label class="mt-0 fs-14 fw-400 radio pull-left" style="width: 100%">
                                           <input name="payment_method" type="radio" value="sb#GPY" />
                                           <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> giropay - Online-Überweisung</span>
                                       </label>
                                   </div>

                                    <div class="col-lg-12 nomargin clearfix">
                                        <label class="mt-0 fs-14 fw-400 radio pull-left" style="width: 100%">
                                            <input name="payment_method" type="radio" value="wlt#PDT" />
                                            <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> paydirekt </span>
                                        </label>
                                    </div>
                                   <div class="col-lg-12 nomargin clearfix">
                                        <label class="mt-0 fs-14 fw-400 radio pull-left" style="width: 100%">
                                            <input name="payment_method" type="radio" value="fnc#PYS" />
                                            <i></i> <span class="weight-400"><span class="fa fa-check text-primary"></span> Rechnungskauf</span>
                                        </label>
                                    </div>
                                    --}}
                                </div>
                            </div>
                        </div>
                    </div>
                </fieldset>
                <!-- /PAYMENT METHOD -->

                <!-- PAYMENT METHOD SEPA-->
                <fieldset class="box-border-shadow p-20 softhide @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 softhide  @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 -->
                <div class="toggle-transparent toggle-bordered-full clearfix">
                    <div class="toggle active">
                        <div class="toggle-content">
                            @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 class="mt-4 mb-4">

                            <div class="clearfix mb-2">
                                <span class="pull-right small">{{  Yard::instance('shopping')->shippingNet() }} € </span>
                                <span class="pull-left small">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>

                                @if($shopping_user->is_from !== 'homeparty')

                                <hr class="mt-4 mb-4">

                                <div class="clearfix mb-2">
                                    <span class="pull-right small">{{  Yard::instance('shopping')->shipping() }} € </span>
                                    <span class="pull-left small">Versandkosten:</span>
                                </div>
                                @endif
                            @endif

                            @if($shopping_user->is_from !== 'homeparty')
                            <div class="clearfix mb-2">
                                    <span class="pull-right small">{{  Yard::instance('shopping')->getShippingCountryName() }}</span>
                                    <span class="pull-left small">Lieferland:</span>
                                </div>


                                <hr class="mt-4 mb-4">

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

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

                                <div class="clearfix mb-2" style="font-size: 90%">
                                    <span class="pull-right small">{!! $shopping_data['shop_price_net'] !!}  €</span>
                                    <span class="pull-left small">Summe ohne MwSt:</span>
                                </div>

                                <div class="clearfix mb-2" style="font-size: 90%">
                                    <span class="pull-right small">{!! $shopping_data['shop_price_tax'] !!} €</span>
                                    <span class="pull-left small"> zzgl. {{-- Yard::getTaxRate() --}} MwSt:</span>
                                </div>
                            @endif
                            <hr />

                            <div class="clearfix">
                                <span class="pull-right size-20"><strong>{{ Yard::instance('shopping')->totalWithShipping() }} €</strong></span>
                                <strong class="pull-left">Gesamtsumme:</strong>
                            </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>
            </div>
            <!-- /CHECKOUT -->
        {!! Form::close() !!}
        </div>
        </div>
    </section>
    <!-- /CHECKOUT -->
    <!-- /CART -->


@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');
                    $('form#checkout_card_final').submit();
                }
                if(jQuery('#shipping').is(":visible")) {
                    _scrollTo('#shipping', 150);
                    showShippingCountryFor('billing');
                }else{
                    showShippingCountryFor('shipping');
                }
            });
        });

        if(!jQuery('#shipswitch').is(':checked')){
            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