index.blade.php 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. @component('panel.layouts.component', ['title' => 'محصولات'])
  2. @slot('style')
  3. <style>
  4. .btnSearch {
  5. margin-top: 10px;
  6. }
  7. .searchNaum{
  8. display: none;
  9. margin: 20px;
  10. }
  11. </style>
  12. @endslot
  13. @slot('subject')
  14. <h1><i class="fa fa-users"></i>لیست محصولات </h1>
  15. <p>لیست محصولاتی تعریف شده برای مدیریت سطوح دسترسی.</p>
  16. @endslot
  17. @slot('breadcrumb')
  18. <li class="breadcrumb-item">محصولات</li>
  19. @endslot
  20. @slot('content')
  21. <div class="row">
  22. <div class="col-md-12">
  23. @component('product::components.message')
  24. @endcomponent
  25. @component('components.collapse-card' , ['title' => 'جست جو محصولات'])
  26. @slot('body')
  27. <form method="GET" action="">
  28. <div class="form-row">
  29. <div class="col">
  30. <label for="categories">{{ __(' نام محصول:') }}</label>
  31. <input type="text" class="form-control" placeholder="محصول..."
  32. name="productName" value="{{ request()->query('productName') }}">
  33. </div>
  34. <div class="col">
  35. <label for="categories">{{ __(' نام دسته بندی:') }}</label>
  36. <select type="text" class="form-control" placeholder="دسته بندی..."
  37. name="productCategory"
  38. value="{{ request()->query('productCategory') }}">
  39. <option value="">همه</option>
  40. @foreach($categories as $cat)
  41. <option value={{$cat->id}} {{(request()->has('productStatus') && request()->query('productStatus') == "$cat->id") ? 'selected'
  42. : ''}}>{{$cat->title}}</option>
  43. @endforeach
  44. </select>
  45. </div>
  46. <div class="col">
  47. <label for="categories">{{ __(' وضعیت:') }}</label>
  48. <select type="text" class="form-control" placeholder="وضعیت..."
  49. name="productStatus" value="{{ request()->query('productStatus') }}">
  50. <option value="">همه</option>
  51. <option value=1 {{(request()->has('productStatus') && request()->query('productStatus') == "1") ? 'selected'
  52. : ''}}>موجود
  53. </option>
  54. <option value=0 {{(request()->has('productStatus') && request()->query('productStatus') ==" 0") ?
  55. 'selected': ''}}>ناموجود
  56. </option>
  57. </select>
  58. </div>
  59. </div>
  60. <button type="submit" class="btn btn-primary float-left btnSearch" id="showProduct">جستجو
  61. </button>
  62. <p class="searchNaum">{{$products->total()}}{{ __(' :مورد یافت شد.') }}</p>
  63. </form>
  64. <div class="mt-4">
  65. <a href="{{ route('products.create') }}" type="button" class="btn btn-primary"><i
  66. class="fa fa-plus"></i> ایجاد محصول</a>
  67. </div>
  68. @component('components.table')
  69. @slot('thead')
  70. <tr>
  71. <th>شماره</th>
  72. <th>نام</th>
  73. <th>slug</th>
  74. <th> sku</th>
  75. <th>قیمت</th>
  76. <th> قیمت فروش ویژه</th>
  77. <th> نویسنده</th>
  78. <th>وضعیت</th>
  79. <th>نوع</th>
  80. <th>توضیحات</th>
  81. <th>دسته بندی</th>
  82. <th> مدیریت</th>
  83. </tr>
  84. @endslot
  85. @slot('tbody')
  86. @forelse ($products as $product)
  87. <tr>
  88. <td>{{$product->id}}</td>
  89. <td>{{$product->title}}</td>
  90. <td>{{$product->slug}}</td>
  91. <td>{{$product->sku}}</td>
  92. <td>{{$product->price}}</td>
  93. <td>{{$product->sale_price}}</td>
  94. <td>{{$product->user->name}}</td>
  95. <td>{{$product->status}}</td>
  96. <td>{{$product->type}}</td>
  97. <td><?php echo mb_substr($product->discription, 0, 15, 'UTF8') . '...'?></td>
  98. <td>
  99. @foreach($product->categories->pluck('title') as $category)
  100. <span>{{$category}}{{'،'}}</span>
  101. @endforeach
  102. </td>
  103. <td class="d-flex">
  104. <a href="{{route('products.edit', $product->id)}}"
  105. class="btn btn-sm btn-primary mr-2">ویرایش</a>
  106. <form
  107. action="{{route('products.destroy', $product->id)}}"
  108. method="POST"
  109. onsubmit="return confirm('آیا مطمئن هستید؟');">
  110. @csrf
  111. @method('DELETE')
  112. <button type="submit" class="btn btn-sm btn-danger">حذف</button>
  113. </form>
  114. </td>
  115. </tr>
  116. @empty
  117. <tr>
  118. <td colspan="5" class="text-center">موردی برای نمایش وجود ندارد.</td>
  119. </tr>
  120. @endforelse
  121. @endslot
  122. @endcomponent
  123. {{--Paginate section--}}
  124. {{ $products->withQueryString()->links() }}
  125. @endslot
  126. @endcomponent
  127. </div>
  128. </div>
  129. @endslot
  130. @slot('script')
  131. <script>
  132. $("#showProduct").click(function(e){
  133. e.preventDefault();
  134. $(".searchNaum").show();
  135. });
  136. </script>
  137. @endslot
  138. @endcomponent