@extends('layouts.app')

@section('content')
<div class="container">
  <div class="row">
    <div class="col-md-10 col-md-offset-1">
      <div class="panel panel-default">
        <div class="panel-heading">Winnings for Bidder #{{ $bidder->bidder_assigned_number }} - {{ $bidder->bidder_fname }} {{ $bidder->bidder_lname }}</div>

        <div class="panel-body">
          @if($winnings->count() > 0)
            <table class="table table-striped">
              <thead>
                <tr>
                  <th>Item #</th>
                  <th>Description</th>
                  <th>Amount</th>
                </tr>
              </thead>
              <tbody>
                @foreach($winnings as $winning)
                  <tr>
                    <td>{{ $winning->items->item_assigned_num }}</td>
                    <td>{{ $winning->items->item_desc }}</td>
                    <td>${{ number_format($winning->winning_cost, 2) }}</td>
                  </tr>
                @endforeach
              </tbody>
              <tfoot>
                <tr>
                  <th colspan="2" class="text-right">Total:</th>
                  <th>${{ number_format($total_cost, 2) }}</th>
                </tr>
              </tfoot>
            </table>
          @else
            <p>No winning bids found for this bidder number.</p>
          @endif

          <hr>
          <div class="text-center">
            <a href="/mywinnings" class="btn btn-default">Back to Search</a>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
@endsection
