Current File : //home/tradevaly/new.tradevaly.com.bd/resources/views/user/pages/featuredlist.blade.php
@extends('user.ayaan.master')

@push('style')
<link href="{{ asset('/assets/libs/select2/select2.min.css') }}" rel="stylesheet" type="text/css" />
@endpush

@section('content')
<div class="container-fluid">
  <div class="row">
      <div class="col-md-12">
          <div class="card">
              <div class="card-header card-header-info card-header-icon">
                  <h4 class="card-title">{{translate("Feature Product Request Sent")}}</h4>
                </div>
              <div class="card-body">
                  <form action="{{ url('user/featured/product/create') }}" method="POST" class="outer-repeater">
              @csrf
                                             
            <div class="row">
                <div class="col-md-4 mb-3">
                    <div class="form-group">
                         <label class="bmd-label-floating">Select A Product</label>
                            <select class="form-control select2" name="product_id">
                                <option disabled selected>Select Product</option>
                                @foreach (\App\Models\Product::where('supplier_id',Auth::id())->latest()->get() as $product)
                                @php
                                $feature_exitst = \App\Models\FeaturedRequest::where('product_id',$product->id)->first();
                                $feature_product_exitst = \App\Models\FeaturedProduct::where('product_id',$product->id)->first();
                                @endphp
                                @if(! $feature_exitst )
                                @if(! $feature_product_exitst )
                                <option value="{{$product->id}}">{{$product->title}}</option>
                                @endif
                                @endif
                                @endforeach
                            </select>
                    </div>
                </div>
            
            
            
                <div class="col-md-4 mb-5" style="display:flex;align-content:center">
            <button type="submit" class="btn btn-info pull-right mt-3">Request Send</button>
            <div class="clearfix"></div>
                    
                </div>
            
            
                </div>
          </form>
              </div>
          </div>
      </div>
    <div class="col-md-12">
      <div class="card">
        <div class="card-header card-header-info card-header-icon">
          <h4 class="card-title">{{translate("Features Products")}}</h4>
        </div>
        <div class="card-body">
        </div>
        <div class="card-body">
          <div class="table-responsive">
            <table class="table">
              <thead>
                <tr>
                  <th class="text-center">#</th>
                  <th>Image</th>
                  <th>{{translate("Product Name")}}</th>
                  <th>Category</th>
                  <th>Status</th>
                  <th class="text-right">{{translate("Actions")}}</th>
                </tr>
              </thead>
              <tbody>
                
                @foreach ($products as $product)
                @if($product->product)
                <tr>
                   <td class="text-center">{{$loop->iteration}}</td>
                  <td><img style="width:50px; border-radius:10%;" src="{{asset('storage/images/admin/product/'.$product->product->image)}}" alt=""></td>
                 
                  <td>@isset($product->product->title) {{$product->product->title}} @endif</td>
                    <td>
                  {{$product->product->category->name}}
                  </td>
                  <td>
                   @if($product->status == 0)
                   <span class="badge bg-warning">Pending</span>
                   @elseif($product->status == 1)
                   <span class="badge bg-success">Approved</span>
                   @else
                   <span class="badge bg-danger">Rejeceted</span>
                   @endif
                  </td>
                 
                  <td class="td-actions text-right">
                      @if($product->status == 0)
                    
                    <a href="{{url('b2b/feature_product/requestdelete',$product->id)}}" name="about" class="btn btn-danger confirmDelete" title="Delete" style="color: #fff">
                      Delete
                    </a>
                    @elseif($product->status == 1)
                    
                    
                    <a href="{{url('b2b/feature_product/delete',$product->id)}}" name="about" class="btn btn-danger confirmDelete" title="Delete" style="color: #fff">
                      Delete
                    </a>
                    @endif
                  </td>
                </tr>
                @endif
                @endforeach
              </tbody>
            </table>
          </div>
        </div>
      </div>
  </div>
</div>
@stop

@push('script')
   <script src="{{ asset('/assets/libs/select2/select2.min.js') }}"></script>
   <script>
               $(function() {
                    $('#example').select2({
                             multiple: true,
                             maximumSelectionSize: 1,
                             tags: true
                        });
                    });
   </script>
@endpush