@if(config('app.debug'))


@if(isset($userMargin))
    <div class="row">
        <div class="col-12 text-left">
            <h2 class="mt-3">Provision / DEBUG</h2>

                    <div class="text-left mt-2">
                        <table class="table">
                            <tbody>
                            <tr>
                                <td class="text-left no-border-top">Summe netto:</td>
                                <td class="no-border-top">
                                    {{ Yard::instance('shopping')->subtotal(null, null, null, false) }} €*
                                </td>
                            </tr>
                            @dump($userMargin)
                            @if($userMargin->yard_margin && $userMargin->yard_margin->isMargin())
                                @foreach($userMargin->yard_margin->items as $item)
                                    <tr>
                                        <td class="text-left">Staffelrabatt
                                            <br>ab {{ $item->getFormatted('price_from') }} / {{ $item->getFormatted('trading_margin') }}% :</td>
                                        <td>
                                            - {{ $item->getFormatted('value_margin') }} €*
                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            @if($userMargin->yard_commission && $userMargin->yard_commission->isCommission())
                            <tr>
                                <td class="text-left">Einzelrabatt:</td>
                                <td>
                                    - {{ $userMargin->yard_commission->getFormatted('single_value_commission') }} €*
                                </td>
                            </tr>
                            @endif
                            <tr>
                                <td class="text-left"><strong>Summe (Netto):</strong></td>
                                <td>
                                    <strong>{{ Yard::instance('shopping')->subtotal() }} €*</strong>
                                </td>
                            </tr>
                            
                            @if($userMargin->yard_margin && $userMargin->yard_margin->net_partner_commission > 0)
                                <tr>
                                <td class="text-left"><em>Provision Vertriebspartern:</em></td>
                                <td>
                                    <em>{{ $userMargin->yard_margin->getFormatted('net_partner_commission') }} €*</em>
                                </td>
                            </tr>
                            @endif
                        </table>
        
                    </div>
                </div>
            </div>

            <hr>
            @endif

@endif