|
@@ -1,10 +1,15 @@
|
|
|
@component('panel.layouts.component', ['title' => 'محصولات'])
|
|
|
|
|
|
@slot('style')
|
|
|
+ <style>
|
|
|
+ .btnSearch {
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
@endslot
|
|
|
|
|
|
@slot('subject')
|
|
|
- <h1><i class="fa fa-users"></i> محصولات </h1>
|
|
|
+ <h1><i class="fa fa-users"></i>لیست محصولات </h1>
|
|
|
<p>لیست محصولاتی تعریف شده برای مدیریت سطوح دسترسی.</p>
|
|
|
@endslot
|
|
|
|
|
@@ -17,105 +22,124 @@
|
|
|
<div class="col-md-12">
|
|
|
@component('product::components.message')
|
|
|
@endcomponent
|
|
|
- @component('components.collapse-card' , ['title' => 'لیست محصولات'])
|
|
|
+ @component('components.collapse-card' , ['title' => 'جست جو محصولات'])
|
|
|
@slot('body')
|
|
|
- @component('components.collapse-search')
|
|
|
- @slot('form')
|
|
|
- <form class="clearfix" method="GET" action="">
|
|
|
- <div class="form-group col-3">
|
|
|
- <label for="categories">{{ __(' نام محصول') }}</label>
|
|
|
- <input type="text" class="form-control"
|
|
|
- id="query" name="productName"
|
|
|
- value="{{ request()->query('productName') }}"
|
|
|
- placeholder=" جستجو بر اساس نام محصول ...">
|
|
|
- <label for="categories">{{ __('دسته بندبی محصول') }}</label>
|
|
|
- <input type="text" class="form-control "
|
|
|
- id="query" name="productSlug"
|
|
|
- value="{{ request()->query('productSlug') }}"
|
|
|
- placeholder=" جستجو بر اساس نام محصول ...">
|
|
|
- <label for="categories">{{ __(' دسته بندی') }}</label>
|
|
|
- <input type="text" class="form-control"
|
|
|
- id="query" name="productCategory"
|
|
|
- value="{{ request()->query('productCategory') }}"
|
|
|
- placeholder=" جستجو بر اساس نام محصول ، slug ، وضعیت محصول ...">
|
|
|
+
|
|
|
+ <form action="">
|
|
|
+
|
|
|
+
|
|
|
+ <form method="GET" action="">
|
|
|
+ <div class="form-row">
|
|
|
+ <div class="col">
|
|
|
+ <label for="categories">{{ __(' نام محصول:') }}</label>
|
|
|
+ <input type="text" class="form-control" placeholder="محصول..."
|
|
|
+ name="productName" value="{{ request()->query('productName') }}">
|
|
|
</div>
|
|
|
- <button type="submit" class="btn btn-primary float-left">جستجو</button>
|
|
|
- </form>
|
|
|
- {{-- <p>{{$products->count()}}{{$request()->input('query')}} برای مورد یافت شد'</p>--}}
|
|
|
- @endslot
|
|
|
- @endcomponent
|
|
|
-
|
|
|
- <div class="mt-4">
|
|
|
- <a href="{{ route('products.create') }}" type="button" class="btn btn-primary"><i
|
|
|
- class="fa fa-plus"></i> ایجاد محصول</a>
|
|
|
- </div>
|
|
|
-
|
|
|
- @component('components.table')
|
|
|
- @slot('thead')
|
|
|
- <tr>
|
|
|
- <th>شماره</th>
|
|
|
- <th>نام</th>
|
|
|
- <th>slug</th>
|
|
|
- <th> sku</th>
|
|
|
- <th>قیمت</th>
|
|
|
- <th> قیمت فروش ویژه</th>
|
|
|
- <th> نویسنده</th>
|
|
|
- <th>وضعیت</th>
|
|
|
- <th>نوع</th>
|
|
|
-
|
|
|
- <th>توضیحات</th>
|
|
|
- <th>دسته بندی</th>
|
|
|
- <th> مدیریت</th>
|
|
|
- </tr>
|
|
|
- @endslot
|
|
|
- @slot('tbody')
|
|
|
- @forelse ($products as $product)
|
|
|
+ <div class="col">
|
|
|
+ <label for="categories">{{ __(' نام دسته بندی:') }}</label>
|
|
|
+ <select type="text" class="form-control" placeholder="دسته بندی..."
|
|
|
+ name="productCategory"
|
|
|
+ value="{{ request()->query('productCategory') }}">
|
|
|
+ <option value="">همه</option>
|
|
|
|
|
|
- <tr>
|
|
|
- <td>{{$product->id}}</td>
|
|
|
- <td>{{$product->title}}</td>
|
|
|
- <td>{{$product->slug}}</td>
|
|
|
- <td>{{$product->sku}}</td>
|
|
|
- <td>{{$product->price}}</td>
|
|
|
- <td>{{$product->sale_price}}</td>
|
|
|
- <td>{{$product->user->name}}</td>
|
|
|
- <td>{{$product->status}}</td>
|
|
|
- <td>{{$product->type}}</td>
|
|
|
-
|
|
|
- <td><?php echo mb_substr($product->discription, 0, 15, 'UTF8') . '...'?></td>
|
|
|
- <td>
|
|
|
- @foreach($product->categories->pluck('title') as $category)
|
|
|
- <span>{{$category}}</span>
|
|
|
+ @foreach($categories as $cat)
|
|
|
+
|
|
|
+ <option value={{$cat->id}} {{(request()->has('productStatus') && request()->query('productStatus') == "$cat->id") ? 'selected'
|
|
|
+ : ''}}>{{$cat->title}}</option>
|
|
|
@endforeach
|
|
|
- </td>
|
|
|
- <td class="d-flex">
|
|
|
- <a href="{{route('products.edit', $product->id)}}"
|
|
|
- class="btn btn-sm btn-primary mr-2">ویرایش</a>
|
|
|
- <form
|
|
|
- action="{{route('products.destroy', $product->id)}}"
|
|
|
- method="POST"
|
|
|
- onsubmit="return confirm('آیا مطمئن هستید؟');"
|
|
|
- >
|
|
|
- @csrf
|
|
|
- @method('DELETE')
|
|
|
- <button type="submit" class="btn btn-sm btn-danger">حذف</button>
|
|
|
- </form>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
- @empty
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <div class="col">
|
|
|
+ <label for="categories">{{ __(' وضعیت:') }}</label>
|
|
|
+ <select type="text" class="form-control" placeholder="وضعیت..."
|
|
|
+ name="productStatus" value="{{ request()->query('productStatus') }}">
|
|
|
+ <option value="">همه</option>
|
|
|
+ <option value=1 {{(request()->has('productStatus') && request()->query('productStatus') == "1") ? 'selected'
|
|
|
+ : ''}}>موجود
|
|
|
+ </option>
|
|
|
+ <option value=0 {{(request()->has('productStatus') && request()->query('productStatus') ==" 0") ?
|
|
|
+ 'selected': ''}}>ناموجود
|
|
|
+ </option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <button type="submit" class="btn btn-primary float-left btnSearch" id="show">جستجو
|
|
|
+ </button>
|
|
|
+ <p class="searchNaum">{{$products->count()}}{{ __(' :مورد یافت شد.') }}</p>
|
|
|
+ </form>
|
|
|
+
|
|
|
+ <div class="mt-4">
|
|
|
+ <a href="{{ route('products.create') }}" type="button" class="btn btn-primary"><i
|
|
|
+ class="fa fa-plus"></i> ایجاد محصول</a>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ @component('components.table')
|
|
|
+ @slot('thead')
|
|
|
<tr>
|
|
|
- <td colspan="5" class="text-center">موردی برای نمایش وجود ندارد.</td>
|
|
|
+ <th>شماره</th>
|
|
|
+ <th>نام</th>
|
|
|
+ <th>slug</th>
|
|
|
+ <th> sku</th>
|
|
|
+ <th>قیمت</th>
|
|
|
+ <th> قیمت فروش ویژه</th>
|
|
|
+ <th> نویسنده</th>
|
|
|
+ <th>وضعیت</th>
|
|
|
+ <th>نوع</th>
|
|
|
+
|
|
|
+ <th>توضیحات</th>
|
|
|
+ <th>دسته بندی</th>
|
|
|
+ <th> مدیریت</th>
|
|
|
</tr>
|
|
|
- @endforelse
|
|
|
- @endslot
|
|
|
+ @endslot
|
|
|
+ @slot('tbody')
|
|
|
+ @forelse ($products as $product)
|
|
|
+
|
|
|
+ <tr>
|
|
|
+ <td>{{$product->id}}</td>
|
|
|
+ <td>{{$product->title}}</td>
|
|
|
+ <td>{{$product->slug}}</td>
|
|
|
+ <td>{{$product->sku}}</td>
|
|
|
+ <td>{{$product->price}}</td>
|
|
|
+ <td>{{$product->sale_price}}</td>
|
|
|
+ <td>{{$product->user->name}}</td>
|
|
|
+ <td>{{$product->status}}</td>
|
|
|
+ <td>{{$product->type}}</td>
|
|
|
+
|
|
|
+ <td><?php echo mb_substr($product->discription, 0, 15, 'UTF8') . '...'?></td>
|
|
|
+ <td>
|
|
|
+ @foreach($product->categories->pluck('title') as $category)
|
|
|
+ <span>{{$category}}{{'،'}}</span>
|
|
|
+ @endforeach
|
|
|
+ </td>
|
|
|
+ <td class="d-flex">
|
|
|
+ <a href="{{route('products.edit', $product->id)}}"
|
|
|
+ class="btn btn-sm btn-primary mr-2">ویرایش</a>
|
|
|
+ <form
|
|
|
+ action="{{route('products.destroy', $product->id)}}"
|
|
|
+ method="POST"
|
|
|
+ onsubmit="return confirm('آیا مطمئن هستید؟');"
|
|
|
+ >
|
|
|
+ @csrf
|
|
|
+ @method('DELETE')
|
|
|
+ <button type="submit" class="btn btn-sm btn-danger">حذف</button>
|
|
|
+ </form>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ @empty
|
|
|
+ <tr>
|
|
|
+ <td colspan="5" class="text-center">موردی برای نمایش وجود ندارد.</td>
|
|
|
+ </tr>
|
|
|
+ @endforelse
|
|
|
+ @endslot
|
|
|
|
|
|
- @endcomponent
|
|
|
+ @endcomponent
|
|
|
|
|
|
- {{--Paginate section--}}
|
|
|
+ {{--Paginate section--}}
|
|
|
|
|
|
- {{ $products->withQueryString()->links() }}
|
|
|
+ {{ $products->withQueryString()->links() }}
|
|
|
|
|
|
- @endslot
|
|
|
+ @endslot
|
|
|
@endcomponent
|
|
|
</div>
|
|
|
</div>
|
|
@@ -124,6 +148,17 @@
|
|
|
@endslot
|
|
|
|
|
|
@slot('script')
|
|
|
+ <script>
|
|
|
+
|
|
|
+
|
|
|
+ $(document).ready(function(){
|
|
|
+ $("#show").click(function(){
|
|
|
+ $("#searchNaum").toggle();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ </script>
|
|
|
+
|
|
|
@endslot
|
|
|
|
|
|
@endcomponent
|