@if($homeparty_guest && $homeparty_guest->homeparty_user_order_items->count() || $homeparty_guest->is_host)

    <table style="padding: 20px; border:1px solid #eee; background-color: #f6fdf5;line-height:1.6em;" cellpadding="2" cellspacing="0" width="100%">

        <tr>
            <th>{{__('Produkt')}}</th>
            <th style="color:#37302d; text-align: right;">{{__('Anzahl')}}</th>
            <th style="color:#37302d; text-align: right;">{{__('VK-Preis')}}</th>
            <th style="color:#37302d; text-align: right;">{{__('EK-Preis')}}</th>
        </tr>

        @foreach($homeparty_guest->homeparty_user_order_items as $value)
            <tr>

                <td style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
                    <strong>{{ $value->product->name }}</strong><br>
                    Art.-Nr.: {{ $value->product->number }}
                </td>
                <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
                    {{$value->qty}}
                </td>
                <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
                    {{ $value->getFormattedTotalPrice() }} &euro;
                </td>
                <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">
                    {{ $value->getFormattedTotalEKPrice() }} &euro;
                </td>
            </tr>
        @endforeach

        @php($user_cart = $homeparty->order['user_carts'][$homeparty_guest->id])
        @php($hp_order = $homeparty->order)

        @if(!$homeparty_guest->is_host)
            <tr>
                <td colspan="3" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">
                @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="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">Versandkosten</td>
                    <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">{{ Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
                    <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">{{ Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
                </tr>
            @endif

            <tr>
                <td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;"><strong>Gesamt:</strong></td>
                <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;"><strong>{{Util::formatNumber($user_cart['price'])}} &euro;</strong></td>
                <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;"><strong>{{Util::formatNumber($user_cart['ek_price'])}} &euro;</strong></td>
            </tr>
        @else
            @if($hp_order['is_bonus'])
                <tr>
                    <td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">Gutschrift Homeparty Gutschein</td>
                    <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">- {{ Util::formatNumber($hp_order['bonus_value']) }} &euro;</td>    
                    <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">- {{ Util::formatNumber($hp_order['bonus_value']) }} &euro;</td>
                </tr>
            @endif
            @if($hp_order['is_bonus_coupon'])
                <tr>
                    <td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">Gutschrift Bonus</td>
                    <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">- {{ Util::formatNumber($hp_order['bonus_coupon']) }} &euro;</td>
                    <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">- {{ Util::formatNumber($hp_order['bonus_coupon']) }} &euro;</td>
                </tr>
            @endif
            @if($hp_order['is_bonus'])

            @endif
            <tr>
                <td colspan="3" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;">Versandkosten:</td>
                <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;">{{Util::formatNumber($user_cart['shipping_price'])}} &euro;</td>
            </tr>
            <tr>
                <td colspan="2" style="color:#37302d; text-align: left; vertical-align: top;line-height:1.6em;"><strong>Summen:</strong></td>
                <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;"><strong>{{Util::formatNumber($user_cart['price'])}} &euro;</strong></td>
                <td style="color:#37302d; text-align: right; vertical-align: top;line-height:1.6em;"><strong>{{Util::formatNumber($user_cart['ek_price'])}} &euro;</strong></td>
            </tr>
            @endif
    </table>

    @if($homeparty_guest->is_host || $homeparty_guest->getDelivery() === 'direct')
    <table style="padding: 0px; border:1px solid #eee; background-color: #f6fdf5;line-height:1.6em;" cellpadding="2" cellspacing="0" width="100%">

    <tr>
        <td style="color:#37302d; ">
            <table style="padding: 20px; border:1px solid #eee; background-color: #f6fdf5" cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td style="color:#37302d;line-height:1.6em;">
                        @if($homeparty_guest->same_as_billing)
                            @if($homeparty_guest->billing_company)
                                {{ $homeparty_guest->billing_company }}<br>
                            @endif

                            {{ $homeparty_guest->billing_firstname }}
                            {{ $homeparty_guest->billing_lastname }}  <br>
                            <br>

                            {{ $homeparty_guest->billing_address }} <br>
                            @if($homeparty_guest->billing_address_2)
                                {{ $homeparty_guest->billing_address_2 }}<br>
                            @endif

                            {{ $homeparty_guest->billing_zipcode }}
                            {{ $homeparty_guest->billing_city }}  <br>
                            {{ $homeparty_guest->billing_country->getLocated() }}  <br>

                            @if($homeparty_guest->billing_phone)
                                <br><br>  {{ $homeparty_guest->billing_phone }}<br>
                            @endif
                       @else
                            @if($homeparty_guest->shipping_company)
                                {{ $homeparty_guest->shipping_company }}<br>
                            @endif

                            {{ $homeparty_guest->shipping_firstname }}
                            {{ $homeparty_guest->shipping_lastname }}  <br>
                            <br>

                            {{ $homeparty_guest->shipping_address }} <br>
                            @if($homeparty_guest->shipping_address_2)
                                {{ $homeparty_guest->shipping_address_2 }}<br>
                            @endif

                            {{ $homeparty_guest->shipping_zipcode }}
                            {{ $homeparty_guest->shipping_city }}  <br>
                            {{ $homeparty_guest->shipping_country->getLocated() }}  <br>

                            @if($homeparty_guest->shipping_phone)
                                <br><br>  {{ $homeparty_guest->shipping_phone }}<br>
                            @endif
                       @endif
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    </table>
        @endif
@endif
