Current File : //home/tradevaly/public_html/resources/views/backend/pages/users/buy_offer.blade.php
@extends('backend.ayaan.master')

@push('title')Buy Offers @endpush
@section('css')
<style>
    nav.flex.items-center.justify-between {
    display: none;
    }
    </style>
    <!-- DataTables -->
    <link href="{{ asset('/assets/libs/datatables/datatables.min.css') }}" rel="stylesheet" type="text/css" />
@endsection
@section('content')

    @component('components.breadcrumb')
        @slot('li_1') Dashboards @endslot
        @slot('title') Buy Offers @endslot
    @endcomponent
    
    
    
    <div class="row">
        <div class="col-12">
            <form action="{{route('admin.product.inquery')}}" method='post'>
                @csrf
            <div class="card">
                <div class="card-body">
                    <div class="row mb-2">
                        <div class="col-sm-4"></div>
                        <div class="col-sm-8"></div><!-- end col-->
                    </div>

                    <div class="table-responsive">
            <table class="table" id="datatable-buttons">
              <thead>
                <tr>
                  <th class="text-center">#</th>
                  <!--1.title, 2. Product title with link, 3. Sender 4. Receiver 5. Time 6. Button, approved, delet details.-->
                  <th>{{translate("inquery Title")}}</th>
                  <th>{{translate("Product Title")}}</th>
                  <th>{{translate("Sender")}}</th>
                  <th>{{translate("Sender Company")}}</th>
                  <th>{{translate("Sender Country")}}</th>
                  <th>{{translate("Receiver")}}</th>
                  <th>{{translate("Receiver Company")}}</th>
                  <th>{{translate("Time")}}</th>
                  <th>Action</th>
                  <th>Check Box</th>
                </tr>
              </thead>
              <form></form>
              <tbody>
                @php
                   $i = 0;
                @endphp
                @foreach ($offers as $offer)
                @if($offer->buyer)
                <tr>
                  <?php $i++; ?>
                  <td class="text-center">{{$i}}</td>
                  <td><a href="{{route('buy.view', $offer->slug)}}">{{$offer['title']}}</a></td>
                  <td>
                      @if($offer->product)
                      <a href="{{route('product.view',$offer->product->slug)}}">{{$offer->product->title}}</a>
                      @endif
                  </td>
                  <td>
                      @if($offer->buyer->user)
                      {{$offer->buyer->user->name}}
                      @endif
                  </td>
                  <td>
                      @if($offer->buyer)
                        {{$offer->buyer->name}}
                      @endif
                  </td>
                  <td>
                     @if($offer->buyer->user->country)
                      {{$offer->buyer->user->country->name}}
                      @endif
                  </td>
                  <td>
                      @if($offer->sellerUser)
                        {{$offer->sellerUser->name}}
                      @endif
                  </td>
                  <td>
                      @if($offer->seller)
                      {{$offer->seller->name}}
                      @endif
                  </td>
                  
                  <td>
                      {{$offer->created_at->diffForHumans()}}
                  </td>
                  <td>
                      
                    <a href="{{ route('admin.buy_offer.view',$offer->id) }}"class="btn btn-success" title="View" style="color: #fff">
                      <i class="fas fa-eye"></i>
                    </a>
                    @if($offer->status == 0)
                      <a onclick="return confirm(\'Are you sure?\')" href="{{ route('admin.buy_offer.approve',$offer->id) }}"  class="btn btn-warning" title="Edit" style="color: #fff">
                      <i class="fas fa-check"></i></a>
                    @endif
                    <a onclick="return confirm(\'Are you sure?\')" href="{{ route('admin.buy_offer.reject',$offer->id) }}" name="category" class="btn btn-danger confirmDelete" title="Delete" style="color: #fff">
                      <i class="fas fa-times"></i>
                    </a>
                    </td>
                    <td>
                        @if($offer->buyer->user->country)
                        <div class="form-check">
                          <input class="form-check-input" type="checkbox" name=user_ids[] value="{{$offer->buyer->id}}" id="">
                        </div>
                        @endif
                  </td>
                </tr>
                @endif
                @endforeach
              </tbody>
              {{ $offers->links() }}
            </table>
           </div>
                    
                </div>
                <div class="card-footer text-end">
                    <button type="submit" class="btn btn-success">Submit</button>
                </div>
            </div>
            </form>
        </div>
    </div>
    <!-- end row -->
    
    
@endsection
@section('script')
    <!-- Required datatable js -->
    <script src="{{ asset('/assets/libs/datatables/datatables.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/jszip/jszip.min.js') }}"></script>
    <script src="{{ asset('/assets/libs/pdfmake/pdfmake.min.js') }}"></script>
    <!-- Datatable init js -->
     
    <script type="text/javascript">
  $(function () {
    $(document).ready(function () {
 
  var table = $('#datatable-buttons').DataTable({
    lengthChange: false,
    processing: true,
    dom: 'Bfrtip',
        serverSide: false,
    buttons: ['copy', 'excel', 'pdf', 'colvis']
  });
  table.buttons().container().appendTo('#datatable-buttons_wrapper .col-md-6:eq(0)');
  $(".dataTables_length select").addClass('form-select form-select-sm');
});
});
</script>
@endsection