@extends('dashboard.base')

@section('content')


<div class="container-fluid">
  <div class="fade-in">
    <div class="row">
      <div class="col-sm-12">
        <div class="card">
          <div class="card-header"><h4>My Bookings</h4></div>
            <div class="card-body overflow-auto">
                <table class="table table-hover datatable">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>Ticket</th>
                            <th>Date</th>
                            <th>Timeslot</th>
                            <th>Seats</th>
                            <th>Status</th>
                            <th>Payment</th>
                            <th>Created at</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach($bookings as $booking)
                            <tr>
                                <td>{{ $loop->iteration }}</td>
                                @if($booking->status == 'reserved')
                                <td>
                                   <a href="{{ route('my_single_record_pdf', $booking->id ) }}" class="btn btn-sm btn-success btn-sm text-white" target="_blank"><i class="cis-eye"></i> Generate Ticket</a>
                                </td>
                                @endif
                                <td>
                                    {{ $booking->booking_date}}
                                </td>
                                <td>
                                    {{ $booking->timeslot}}
                                </td>

                                <td>
                                    {{ $booking->seats}}
                                </td>
                                <td>
                                    {{ $booking->status }}
                                </td>
                                <td>
                                    {{ $booking->payment_status }}
                                </td>
                                <td>
                                    {{ $booking->created_at }}
                                </td>
                            </tr>
                        @endforeach
                    </tbody>
                </table>

            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>

@endsection

@section('javascript')
    <script>
        //data-table work
        $(document).ready( function () {
            $('.datatable').DataTable({
                "order": [[ 0, "desc" ]]
            });
        } );




    </script>
@endsection
