@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>
        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;
        }

        .cartContent .head .product_name {
            min-height: auto;
            padding-left: 20px;
        }


        @media only screen and (max-width: 1200px) {
            .cartContent .yard .product_name {
                padding-bottom: 0;
                min-height: 60px;
                width: 60%;
            }
            .cartContent .yard .remove_item {
                clear: right;
            }
            .cartContent .yard .total_price {
                width: auto;
                padding-top: 30px;
                clear: right;
            }
            .cartContent .yard .item .qty {
                float: left;
                text-align: left;
            }
            .cartContent .yard .item.head {
                display: none;
            }

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

            .cartContent .yard .total_price {
                padding-top: 10px;
            }

        }
        @media only screen and (min-width: 992px) {
            .cartContent .yard .total_price {
                padding-top: 30px;
            }
        }
        @media only screen and (min-width: 1200px) {
            .cartContent .yard .total_price {
                padding-top: 10px;
            }
        }

    </style>
    <!-- -->
    <section>
        <div class="container">

            <h1>Warenkorb</h1>

            <!-- EMPTY CART -->
          <!--  <div class="panel panel-default">
                <div class="panel-body">
                    <strong>Shopping cart is empty!</strong><br />
                    You have no items in your shopping cart.<br />
                    Click <a href="index.html">here</a> to continue shopping. <br />
                    <span class="label label-warning">this is just an empty cart example</span>
                </div>
            </div>-->
            <!-- /EMPTY CART -->



            <!-- CART -->
            <div class="row">

                <!-- LEFT -->
                <div class="col-lg-9 col-sm-7">

                    <h3>Du hast {{ Yard::instance('shopping')->count() }} Artikel in Deinem Warenkorb</h3>

                    @if(Yard::instance('shopping')->content()->count())
                    <!-- CART -->
                        {!! Form::open(['url' => url(Util::getPostRoute().'card/update'), 'class' => 'cartContent clearfix', 'id'=>'']) !!}

                        <!-- cart content -->
                            <div id="cartContent">
                                <div class="box-border-shadow">
                                <!-- cart header -->
                                <div class="item head clearfix">
                                    <span class="cart_img"></span>
                                    <span class="product_name size-15 bold">Produkt</span>
                                    <span class="remove_item size-15 bold"></span>
                                    <span class="total_price size-15 bold">Preis</span>
                                    <span class="qty size-15 bold">Anzahl</span>
                                </div>


                                @foreach(Yard::instance('shopping')->content() as $row)

                                    <div class="item yard">
                                        <div class="cart_img pull-left width-100 padding-10 text-left">
                                            @if($row->options->has('image'))
                                                <img src="{{ route('product_image', [$row->options->image]) }}" width="80" alt="">
                                            @else
                                                <img src="{{ asset('/assets/images/1x1.png') }}" width="80" alt="">
                                            @endif
                                        </div>
                                        <a href="{{ url('/produkte/alle-produkte/'.$row->options->slug) }}" class="product_name">
                                            <span>{{ $row->name }}</span>
                                            <small>Lieferzeit: 1-3 Werktage</small>
                                        </a>
                                        <a href="{{ url(Util::getPostRoute().'card/remove', $row->rowId) }}" class="remove_item"><i class="fa fa-times"></i></a>

                                        <div class="total_price"><span>{{  $row->subtotal() }} </span> €</div>
                                        <div class="qty"><input type="number" value="{{ $row->qty }}" name="quantity[{{$row->rowId}}]" maxlength="3" max="999" min="1" /> &times; {{  $row->price() }} € </div>
                                        <div class="clearfix"></div>
                                    </div>

                                 @endforeach
                            </div>
                            <a href="{{url(Util::getPostRoute().'card/delete')}}" class="btn btn-default btn-sm margin-top-20 margin-right-10 pull-left"><i class="glyphicon glyphicon-remove"></i> Warenkorb löschen</a>
                            <button type="submit" class="btn btn-sm btn-default margin-top-20 margin-left-0 pull-right pull-left-xs"><i class="glyphicon glyphicon-refresh"></i> Warenkorb aktualisieren</button>
                            <div class="clearfix"></div>

                        </div>

                        {!! Form::close() !!}
                    <!-- /CART -->
                    @endif

                </div>

                <style>
                    .select2-container{
                        margin-bottom: 0px;
                    }
                    .select2-container .select2-selection--single .select2-selection__rendered
                    {
                        padding: 8px 20px;
                        height: 36px;
                    }
                </style>
                <!-- RIGHT -->
                <div class="col-lg-3 col-sm-5">

                    @if(Yard::instance('shopping')->content()->count())
                    <h3>Warenkorb Summe</h3>


                    <div class="toggle-transparent toggle-bordered-full clearfix">
                        <div class="toggle active">
                            <div class="toggle-content">

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

                                <div class="clearfix mb-2">
                                    <div class=" small">Versandland:</div>
                                    <div class="small">
                                        <form action="{{ url(Util::getPostRoute().'card/show') }}" method="GET" style="margin-bottom: 0;">
                                            <select name="selected_country" class="select2" onchange="this.form.submit()">
                                                {!! HTMLHelper::getCountriesForShipping(Yard::instance('shopping')->getShippingCountryId()) !!}
                                            </select>
                                        </form>
                                    </div>
                                </div>
                                <div class="clearfix mb-2">
                                    <span class="pull-right small">{{  Yard::instance('shopping')->shipping() }} € </span>
                                    <span class="pull-left small">Versandkosten:</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>
                                <hr />
                                <span class="clearfix ">
                                    <span class="pull-right size-20"><strong>{{ Yard::instance('shopping')->totalWithShipping() }} €</strong></span>
                                    <strong class="pull-left">Gesamtsumme:</strong>
                                </span>
                                <a href="{{ url(Util::getPostRoute().'card/checkout/server') }}" class="btn btn-primary btn-lg btn-block mt-4 btn-text-500 faa-parent animated-hover"><i class="fa fa-mail-forward faa-horizontal"></i> zur Kasse</a>
                                <hr>
                                <p class="text-center" style="line-height: 1.2em;"><em class="small text-center"> <i class="fa fa-lock"></i> Sie werden auf unseren checkout Server weitergeletet, die Verbindung ist mit SSL verschlüsselt.</em></p>
                            </div>
                        </div>
                    </div>
                    @endif

                </div>
            </div>
            <br><br>
            <hr>
            <p><em class="small" style="color: #828282">Alle Preise inkl. gesetzl. Mehrwertsteuer zzgl. Versandkosten, wenn nicht anders beschrieben</em></p>
            <!-- /CART -->

        </div>
    </section>

@endsection