index.blade.php 9.1 KB

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