@if($homeparty_guest && $homeparty_guest->homeparty_user_order_items->count() || $homeparty_guest->is_host)
    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
            <tr>
                <th>{{__('Bild')}}</th>
                <th>{{__('Produkt')}}</th>
                <th>{{__('Anzahl')}}</th>
                <th>{{__('Marge')}}</th>
                <th class="text-right">{{__('EK-Preis')}}</th>
                <th class="text-right">{{__('Points')}}</th>
                <th class="text-right">{{__('Verdienst')}}</th>
                <th class="text-right">{{__('VK-Preis')}}</th>
            </tr>
            </thead>
            <tbody>
            @foreach($homeparty_guest->homeparty_user_order_items as $value)
                <tr>
                    <td>
                        @if(count($value->product->images))
                            <img class="img-fluid img-extra" alt="" src="{{ route('product_image', [$value->product->images->first()->slug]) }}">
                        @endif
                    </td>
                    <td class="min-width-80">
                        <strong>{{ $value->product->name }}</strong>
                        <div class="text-body">
                            <div>Inhalt: {{ $value->product->contents }}</div>
                            <div>Art.-Nr.: {{ $value->product->number }}</div>
                        </div>
                    </td>
                    <td>
                        {{$value->qty}}
                    </td>
                    <td>
                        {{ $value->margin }}%
                    </td>
                    <td class="text-right">
                        {{ $value->getFormattedTotalEKPrice() }} &euro;
                    </td>
                    <td class="text-right">
                        {{ $value->getFormattedTotalPoints() }}
                    </td>
                    <td class="text-right">
                        {{ $value->getFormattedTotalIncomePrice() }} &euro;
                    </td>
                    <td class="text-right">
                        {{ $value->getFormattedTotalPrice() }} &euro;
                    </td>
                </tr>
            @endforeach

            </tbody>
            <tfoot id="insert_show_bonus_host">
            @php($user_cart = $homeparty->order['user_carts'][$homeparty_guest->id])
            @php($hp_order = $homeparty->order)

            @if(!$homeparty_guest->is_host)
                <tr class="foot-small">
                    <td colspan="8" class="text-left">
                    @if($homeparty_guest->getDelivery() === 'host')
                        Lieferung an Gastgeber
                    @endif
                    @if($homeparty_guest->getDelivery() === 'direct')
                            Lieferung direkt an den Gast
                    @endif
                    </td>
                </tr>
                @if($homeparty_guest->getDelivery() === 'direct')
                    <tr>
                        <td colspan="5" class="text-left">Versandkosten</td>
                        <td>&nbsp;</td>
                        <td class="text-right">&nbsp;</td>
                        <td class="text-right">{{ Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
                    </tr>
                @endif

                <tr>
                    <td colspan="4" class="border-top"><strong>Gesamt:</strong></td>
                    <td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['ek_price'])}} &euro;</strong></td>
                    <td class="border-top text-right"><strong>{{$user_cart['points']}}</strong></td>
                    <td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['income_price'])}} &euro;</strong></td>
                    <td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['price'])}} &euro;</strong></td>
                </tr>
            @else
                @if($hp_order['is_bonus'])
                    <tr class="foot-small">
                        <td colspan="5" class="text-left">Gutschrift Homeparty Gutschein</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td class="text-right">- {{ Util::formatNumber($hp_order['bonus_value']) }} &euro;</td>
                    </tr>
                @endif
                @if($hp_order['is_bonus_coupon'])
                    <tr class="foot-small">
                        <td colspan="5" class="text-left">Gutschrift Bonus</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td class="text-right">- {{ Util::formatNumber($hp_order['bonus_coupon']) }} &euro;</td>
                    </tr>
                @endif
                @if($hp_order['is_bonus'])
                    <tr class="foot-small">
                        <td colspan="5" class="text-left">Abzug Points durch Gutschein</td>
                        <td class="text-right">- {{ $hp_order['bonus_points_diff'] }} </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                @endif
                <tr class="foot-small">
                    <td colspan="5" class="text-left">Versandkosten:</td>
                    <td>&nbsp;</td>
                    <td  class="text-right">&nbsp;</td>
                    <td class="text-right">{{Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
                </tr>
                <tr>
                    <td colspan="4" class="border-top"><strong>Summen:</strong></td>
                    <td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['ek_price'])}} &euro;</strong></td>
                    <td class="border-top text-right"><strong>{{$user_cart['points']}}</strong></td>
                    <td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['income_price'])}} &euro;</strong></td>
                    <td class="border-top text-right"><strong>{{Util::formatNumber($user_cart['price'])}} &euro;</strong></td>
                </tr>

            @endif
            </tfoot>
        </table>
    </div>

    @if($homeparty_guest->is_host || $homeparty_guest->getDelivery() === 'direct')

    <hr class="m-0">

    <div class="card-body" style="background-color: #E5E9EF">
        <h6 class="small font-weight-semibold">
            Lieferadresse
        </h6>
        @if($homeparty_guest->same_as_billing)
            <div class="row">
                @if($homeparty_guest->billing_company)
                    <div class="col-md-12 mb-3">
                        <div class="text-muted small">Firma</div>
                        {{ $homeparty_guest->billing_company }}
                    </div>
                @endif

                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Anrede</div>
                    {{ \App\Services\HTMLHelper::getSalutationLang($homeparty_guest->billing_salutation) }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Vorname</div>
                    {{ $homeparty_guest->billing_firstname }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Nachname</div>
                    {{ $homeparty_guest->billing_lastname }}
                </div>
            </div>
            <div class="row">
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Straße</div>
                    {{ $homeparty_guest->billing_address }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Zusatz</div>
                    {{ $homeparty_guest->billing_address_2 }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">PLZ</div>
                    {{ $homeparty_guest->billing_zipcode }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Stadt</div>
                    {{ $homeparty_guest->billing_city }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">E-Mail</div>
                    {{ $homeparty_guest->billing_email }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Telefon</div>
                    {{ $homeparty_guest->billing_phone }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Land</div>
                    {{ $homeparty_guest->billing_country->getLocated() }}
                </div>
            </div>
        @else
            <div class="row">
                @if($homeparty_guest->shipping_company)
                    <div class="col-md-12 mb-3">
                        <div class="text-muted small">Firma</div>
                        {{ $homeparty_guest->shipping_company }}
                    </div>
                @endif

                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Anrede</div>
                    {{ \App\Services\HTMLHelper::getSalutationLang($homeparty_guest->shipping_salutation) }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Vorname</div>
                    {{ $homeparty_guest->shipping_firstname }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Nachname</div>
                    {{ $homeparty_guest->shipping_lastname }}
                </div>
            </div>
            <div class="row">
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Straße</div>
                    {{ $homeparty_guest->shipping_address }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Zusatz</div>
                    {{ $homeparty_guest->shipping_address_2 }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">PLZ</div>
                    {{ $homeparty_guest->shipping_zipcode }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Stadt</div>
                    {{ $homeparty_guest->shipping_city }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">E-Mail</div>
                    {{ $homeparty_guest->shipping_email }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Telefon</div>
                    {{ $homeparty_guest->shipping_phone }}
                </div>
                <div class="col-md-3 mb-3">
                    <div class="text-muted small">Land</div>
                    {{ $homeparty_guest->shipping_country->getLocated() }}
                </div>
            </div>
        @endif
    </div>
    @endif

@else
    <p>Keine Bestellung</p>
@endif