<div class="card">


        <!-- Info -->
        <div class="card-body pb-1">
            @if($isAdmin)
            <div class="row">
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">E-Mail</div>
                    @if($shopping_user->faker_mail)
                        -
                    @else
                        {{ $shopping_user->billing_email }}
                    @endif
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Kundennummer</div>
                    {{$shopping_user->number}}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Datum</div>
                    {{$shopping_user->created_at->format("d.m.Y H:i")}}
                </div>
                <div class="col-md-3 mb-3">
                    <a class="btn btn-sm btn-secondary mt-2" href="{{route('admin_customer_edit', [$shopping_user->id])}}">Kundendaten bearbeiten</a>
                </div>
            </div>
            @else
                <div class="row">
                    <div class="col-md-3 mb-3">
                        <div class="text-muted small">E-Mail</div>
                        @if($shopping_user->faker_mail)
                            -
                        @else
                            {{ $shopping_user->billing_email }}
                        @endif
                    </div>
                    <div class="col-md-3 mb-3">
                        <div class="text-muted small">Kundennummer</div>
                        {{$shopping_user->number}}
                    </div>
                    <div class="col-md-3 mb-3">
                        <div class="text-muted small">Erstellt</div>
                        {{$shopping_user->firstEntryByNumber()->created_at->format("d.m.Y H:i")}}
                    </div>
                    <div class="col-md-3 mb-3">

                    @if(!$shopping_user->is_like)
                        <a class="btn btn-sm btn-secondary mt-2" href="{{route('user_customer_edit', [$shopping_user->id])}}">Kundendaten bearbeiten</a>
                    @endif
                    </div>
                </div>
            @endif
        </div>
        <hr class="m-0">
        <!-- / Info -->
        <!-- Member -->
         <div class="card-body pb-1">
             <div class="row">
                @if($isAdmin)
                    <div class="col-md-6 mb-3">
                        @if(isset($change_member_error) && $change_member_error)
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="alert alert-danger p-2">
                                        <ul>
                                            <li>{{ $change_member_error }}</li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        @endif
                        <div class="text-muted small">Zugewiesener Vertriebspartner</div>
                        @if($shopping_user->is_like)
                            <button type="button" class="btn btn-xs btn-outline-info" data-toggle="modal" data-target="#modals-load-content"
                                    data-id="{{$shopping_user->id}}"
                                    data-action="shopping-user-is-like-member"
                                    data-back="{{route('admin_customer_detail', [$shopping_user->id])}}"
                                    data-modal="modal-xl"
                                    data-route="{{route('modal_load')}}"><span class="fa fa-edit"></span> Vertriebspartner zuordnen</button>
                        @else
                            @if($shopping_user->member)
                                <a class="btn btn-xs btn-outline-primary" href="{{route('admin_lead_edit', [$shopping_user->member->id])}}"><i class="ion ion-ios-contacts"></i></a>
                                {{$shopping_user->member->getFullName()}} <span class="text-muted">#{{$shopping_user->member->number}}</span>
                            @endif
                            <button type="button" class="btn btn-xs btn-outline-secondary" data-toggle="modal" data-target="#modals-load-content"
                                    data-id="{{ $shopping_user->id }}"
                                    data-action="shopping-user-change-member"
                                    data-view="customer"
                                    data-route="{{ route('modal_load') }}"><span class="fa fa-edit"></span></button>
                        @endif
                    </div>
                    <div class="col-md-3 mb-3">
                        <div class="text-muted small">Über Shop</div>
                        @if($shopping_user->shopping_order)
                            @if($shopping_user->shopping_order->user_shop->user->isActive() && $shopping_user->shopping_order->user_shop->user->isActiveShop())
                                <a href="{{$shopping_user->shopping_order->user_shop->getSubdomain(false)}}" class="badge badge-success" target="_blank">{{$shopping_user->shopping_order->user_shop->getSubdomain(false)}}</a>
                            @else
                                <span class="badge badge-danger" target="_blank">{{$shopping_user->shopping_order->user_shop->getSubdomain(false)}}</span>
                            @endif
                        @endif
                    </div>
                    <div class="col-md-3 mb-3">
                        <div class="text-muted small">ist Vertriebspartner</div>
                        @if($shopping_user->auth_user)
                            <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span>
                            <a class="btn btn-xs btn-outline-primary" href="{{route('admin_lead_edit', [$shopping_user->auth_user->id])}}"><i class="ion ion-ios-contacts"></i></a>
                            {{$shopping_user->auth_user->getFullName()}} <span class="text-muted">#{{$shopping_user->auth_user->number}}</span>
                        @else
                            <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span>
                        @endif
                    </div>
                @else
                    <div class="col-md-6 mb-3">
                        {{--
                        @if(!$shopping_user->is_like)
                            <a href="{{ route('user_order_my_delivery', ['ot', $shopping_user->id]) }}" class="btn btn-sm btn-secondary mt-2">
                                <span class="fa fa-shopping-cart"></span> Bestellung für diesen Kunden aufgeben
                            </a>
                        @endif
                        --}}
                    </div>
                    <div class="col-md-6 mb-3">
                        <div class="text-muted small">Kundenhoheit</div>
                        @if($shopping_user->is_like)
                            <span class="badge badge-pill badge-warning"><i class="fa fa-clock"></i> in Prüfung</span>
                        @else
                            <span class="badge badge-pill badge-success"><i class="fa fa-check-circle"></i> zugewiesen</span>
                        @endif

                    </div>
                @endif
                </div>
            </div>
        <hr class="m-0">
        <!-- / Member -->

        <!-- Billing -->
        @include('admin.customer._customer_detail')

        <hr class="m-0">
        <div class="card-body">
            <h6 class="small font-weight-semibold">
                Kunde
            </h6>
            <div class="row">
            <div class="col-md-12 mb-3">
                @if($shopping_user->has_buyed)
                   <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span> Kunde hat schon gekauft.
                @else
                    <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span> Kunde hat noch nicht gekauft.
                @endif
            </div>
            <div class="col-md-12 mb-3">
                @if($shopping_user->subscribed)
                    <span class="badge badge-pill badge-success"><i class="fa fa-check"></i></span> Kunde ist für Newsletter abonniert.
                @else
                    <span class="badge badge-pill badge-danger"><i class="fa fa-times"></i></span> Kunde ist nicht für Newsletter abonniert.
                @endif
            </div>
            </div>
        </div>
        <hr class="m-0">
        <!-- / Shipping -->
        @if($isAdmin)
       <!-- Order -->
        <div class="card-body">
            <h6 class="small font-weight-semibold">
                Bestellung
            </h6>
            <div class="table-responsive">
                <table class="table table-bordered m-0" style="min-width:550px;">
                    <tbody>
                    <tr>
                        <th>Produkt</th>
                        <th>Anzahl</th>
                        <th>Preis</th>
                    </tr>
                    @if($shopping_user->shopping_order)
                    @foreach($shopping_user->shopping_order->shopping_order_items as $shopping_order_item)
                        <tr>
                            <td class="px-3 py-2">
                                <div class="media align-items-center">
                                    @if($shopping_order_item->product->images)
                                        @if($image = $shopping_order_item->product->images->first())
                                            <img src="{{ route('product_image', [$image->slug]) }}" class="d-block ui-w-80 mr-4" alt>
                                        @endif
                                    @endif

                                    <div class="media-body">
                                        <a href="{{route('admin_product_edit', [$shopping_order_item->product->id])}}" class="d-block">{{ $shopping_order_item->product->name }}
                                            <span class="text-muted">#{{ $shopping_order_item->product->number }}</span></a>
                                        <small>
                                            <span class="text-muted">Inhalt: </span> {{ $shopping_order_item->product->contents }}<br>
                                            <span class="text-muted">Gewicht: </span> {{ $shopping_order_item->product->weight }} g<br>
                                            <span class="text-muted">Points: </span> {{ $shopping_order_item->product->points }}
                                        </small>
                                    </div>
                                </div>
                            </td>
                            <!-- Set column width -->
                            <td class="align-middle px-3 py-2" style="width: 66px;">
                                {{ $shopping_order_item->qty }}
                            </td>
                            <!-- Set column width -->
                            <td class="text-right font-weight-semibold align-middle px-3 py-2" style="width: 100px;">
                                {{ $shopping_order_item->getFormattedPrice() }} &euro;
                            </td>
                        </tr>
                    @endforeach
                    @endif
                    </tbody>
                </table>
            </div>
        </div>
        <hr class="m-0">

        <!-- / Payment -->
        <div class="card-body">
            <h6 class="small font-weight-semibold">
                Zahlung
            </h6>
            <div class="table-responsive">

                <table class="table table-bordered table-striped">
                    <thead>
                    <tr>
                        <th style="min-width: 60px">#</th>
                        <th>Zahlungsart</th>
                        @if($isAdmin)<th>Referenznummer</th>@endif
                        <th>Gesamt</th>
                        <th>Status</th>
                        <th>Datum</th>
                    </tr>
                    </thead>
                    <tbody>
                    @php($count=0)
                    @if($shopping_user->shopping_order)
                    @foreach($shopping_user->shopping_order->shopping_payments as $shopping_payment)
                        <tr>
                            <th scope="row">{{++$count}}</th>
                            <td>{{$shopping_payment->getPaymentType()}}</td>
                            @if($isAdmin)<td>{{$shopping_payment->reference}}</td>@endif
                            <td>{{$shopping_payment->getPaymentAmount()}}</td>
                            <td>{!! \App\Services\Payment::getShoppingPaymentBadge($shopping_payment) !!}</td>
                            <td>{{$shopping_payment->created_at->format("d.m.Y H:i")}}</td>
                        </tr>
                        @if($isAdmin && $shopping_payment->payment_transactions)
                            @php($ccount=0)
                            <tr>
                                <th scope="row" class="m-0">{{$count}}.{{++$ccount}}</th>
                                <td colspan="5" class="m-0 p-0">
                                    <table class="table table-info table-borderless mb-0 small">
                                        <thead>
                                        <tr>
                                            <th style="min-width: 80px">Request</th>
                                            <th style="min-width: 80px">Status</th>
                                            <th style="min-width: 200px">TX-Action</th>
                                            <th style="min-width: 120px">Datum</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        @foreach($shopping_payment->payment_transactions as $payment_transaction)
                                            <tr>
                                                <td>{{$payment_transaction->request}}</td>
                                                <td>{{$payment_transaction->status}}</td>
                                                <td>{{$payment_transaction->txaction}} {{$payment_transaction->errormessage}}</td>
                                                <td>{{$payment_transaction->created_at->format("d.m.Y H:i")}}</td>
                                            </tr>
                                        @endforeach
                                        </tbody>
                                    </table>
                                </td>
                            </tr>
                        @endif
                    @endforeach
                        @endif
                    </tbody>
                </table>
            </div>
        </div>
        @endif
    </div>