|
@@ -1,5 +1,4 @@
|
|
|
@component('panel.layouts.component', ['title' => 'ویرایش محصول جدید'])
|
|
|
-
|
|
|
@slot('style')
|
|
|
<style>
|
|
|
.card-header {
|
|
@@ -7,12 +6,13 @@
|
|
|
}
|
|
|
|
|
|
.form-control {
|
|
|
-
|
|
|
background-color: hsl(315, 22%, 86%);
|
|
|
}
|
|
|
- .required{
|
|
|
- color:red;
|
|
|
+
|
|
|
+ .required {
|
|
|
+ color: red;
|
|
|
}
|
|
|
+
|
|
|
.py-5 {
|
|
|
padding-top: 0 !important;
|
|
|
}
|
|
@@ -25,187 +25,167 @@
|
|
|
@slot('breadcrumb')
|
|
|
<li class="breadcrumb-item">محصولات</li>
|
|
|
@endslot
|
|
|
-
|
|
|
@slot('content')
|
|
|
<div class="auth-background h-auto py-5">
|
|
|
<div class="container py-5">
|
|
|
@component('product::components.message')
|
|
|
@endcomponent
|
|
|
<div class="row align-items-center">
|
|
|
-
|
|
|
<div class="col-lg-12 col-md-12 mx-auto">
|
|
|
<div class="card">
|
|
|
<div class="card-header"><strong>{{ __('ویرایش محصول جدید') }}</strong></div>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <div class="card-body mx-lg-5 px-lg-3">
|
|
|
- <form method="POST" action="{{ route('products.update',$product->id) }}">
|
|
|
- @csrf
|
|
|
- @if ($product)
|
|
|
- @method('PUT')
|
|
|
- @endif
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label for="title">{{ __('نام محصول جدید') }}</label><i class="required"> *</i>
|
|
|
- <input id="title" type="text"
|
|
|
- class="form-control @error('title') is-invalid @enderror"
|
|
|
- name="title"
|
|
|
- value="{{$product->title}}" autocomplete="title" autofocus>
|
|
|
-
|
|
|
- @error('title')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ <div class="card-body mx-lg-5 px-lg-3">
|
|
|
+ <form method="POST" action="{{ route('products.update',$product->id) }}">
|
|
|
+ @csrf
|
|
|
+ @if ($product)
|
|
|
+ @method('PUT')
|
|
|
+ @endif
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="title">{{ __('product.title') }}</label><i class="required">
|
|
|
+ *</i>
|
|
|
+ <input id="title" type="text"
|
|
|
+ class="form-control @error('title') is-invalid @enderror"
|
|
|
+ name="title"
|
|
|
+ value="{{$product->title}}" autocomplete="title" autofocus>
|
|
|
+ @error('title')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
-
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label for="slug"> {{ __('slug ') }}</label>
|
|
|
- <input id="slug" type="text"
|
|
|
- class="form-control @error('slug') is-invalid @enderror"
|
|
|
- name="slug" value="{{$product->slug}}"
|
|
|
- autocomplete="slug" autofocus>
|
|
|
-
|
|
|
- @error('slug')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="slug"> {{ __('product.slug') }}</label>
|
|
|
+ <input id="slug" type="text"
|
|
|
+ class="form-control @error('slug') is-invalid @enderror"
|
|
|
+ name="slug" value="{{$product->slug}}"
|
|
|
+ autocomplete="slug" autofocus>
|
|
|
+ @error('slug')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
-
|
|
|
- </div>
|
|
|
- <div class="form-group">
|
|
|
- <label for="sku"> {{ __(' sku ') }}</label>
|
|
|
- <input id="sku" type="text"
|
|
|
- class="form-control @error('sku') is-invalid @enderror"
|
|
|
- name="sku" value="{{$product->sku}}"
|
|
|
- autocomplete="sku" autofocus>
|
|
|
-
|
|
|
- @error('sku')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="sku"> {{ __('product.sku') }}</label>
|
|
|
+ <input id="sku" type="text"
|
|
|
+ class="form-control @error('sku') is-invalid @enderror"
|
|
|
+ name="sku" value="{{$product->sku}}"
|
|
|
+ autocomplete="sku" autofocus>
|
|
|
+ @error('sku')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
-
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label for="price"> {{ __('قیمت ') }}</label><i class="required"> *</i>
|
|
|
- <input id="price" type="text"
|
|
|
- class="form-control price @error('price') is-invalid @enderror"
|
|
|
- name="price"
|
|
|
- value="{{$product->price}}" autocomplete="price" autofocus>
|
|
|
-
|
|
|
- @error('price')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="price"> {{ __('product.price') }}</label><i class="required">
|
|
|
+ *</i>
|
|
|
+ <input id="price" type="text"
|
|
|
+ class="form-control price @error('price') is-invalid @enderror"
|
|
|
+ name="price"
|
|
|
+ value="{{$product->price}}" autocomplete="price" autofocus>
|
|
|
+ @error('price')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label for="sale_price">{{ __(' قیمت فروش ویژه') }}</label>
|
|
|
- <input id="sale_price" type="text"
|
|
|
- class="form-control price @error('sale_price') is-invalid @enderror"
|
|
|
- name="sale_price"
|
|
|
- value="{{$product->sale_price}}" autocomplete="sale_price">
|
|
|
-
|
|
|
- @error('sale_price')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="sale_price">{{ __('product.sale_price') }}</label>
|
|
|
+ <input id="sale_price" type="text"
|
|
|
+ class="form-control price @error('sale_price') is-invalid @enderror"
|
|
|
+ name="sale_price"
|
|
|
+ value="{{$product->sale_price}}" autocomplete="sale_price">
|
|
|
+ @error('sale_price')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
- </div>
|
|
|
- <div class="form-group">
|
|
|
- <label for="categories[]">{{ __(' دسته بندی') }}</label><i class="required"> *</i>
|
|
|
- <select id="categories" type="text"
|
|
|
- class="form-control select2 @error('categories[]') is-invalid @enderror" name="categories[]"
|
|
|
- autocomplete="categories[]" multiple>
|
|
|
- @foreach($categories as $cat)
|
|
|
- <option value="{{$cat->id}}" <?php
|
|
|
- if (in_array($cat->id,$product->categories->pluck('id')->toArray()))echo 'selected'
|
|
|
- ?>>{{$cat->title}}</option>
|
|
|
- @endforeach
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- @error('status')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="type">{{ __('product.type') }}</label><i class="required">
|
|
|
+ *</i>
|
|
|
+ <select id="type" type="text"
|
|
|
+ class="form-control @error('type') is-invalid @enderror" name="type"
|
|
|
+ autocomplete="type">
|
|
|
+ <option value="0" @if($product->type==='ساده') selected='selected' @endif>
|
|
|
+ ساده
|
|
|
+ </option>
|
|
|
+ <option value="1" @if($product->type==='متغیر') selected='selected' @endif>
|
|
|
+ متغیر
|
|
|
+ </option>
|
|
|
+ <option value="2" @if($product->type==='باندل') selected='selected' @endif>
|
|
|
+ باندل
|
|
|
+ </option>
|
|
|
+ </select>
|
|
|
+ @error('type')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
- </div>
|
|
|
- <div class="form-group">
|
|
|
- <label for="type">{{ __(' نوع محصول') }}</label><i class="required"> *</i>
|
|
|
- <select id="type" type="text"
|
|
|
- class="form-control @error('type') is-invalid @enderror" name="type"
|
|
|
- autocomplete="type">
|
|
|
- <option value="0" @if($product->type==='ساده') selected='selected' @endif>ساده</option>
|
|
|
- <option value="1" @if($product->type==='متغیر') selected='selected' @endif>متغیر</option>
|
|
|
- <option value="2" @if($product->type==='باندل') selected='selected' @endif>باندل</option>
|
|
|
- </select>
|
|
|
-
|
|
|
- @error('type')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="status">{{ __('product.status') }}</label></label><i
|
|
|
+ class="required"> *</i>
|
|
|
+ <select id="status" type="text"
|
|
|
+ class="form-control @error('status') is-invalid @enderror"
|
|
|
+ name="status"
|
|
|
+ value="{{$product->status}}" required autocomplete="status">
|
|
|
+ <option value="0">ناموجود</option>
|
|
|
+ <option value="1" <?php if ($product->status == 1) echo 'selected'?> >
|
|
|
+ موجود
|
|
|
+ </option>
|
|
|
+ </select>
|
|
|
+ @error('status')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label for="status">{{ __(' وضعیت محصول') }}</label></label><i class="required"> *</i>
|
|
|
- <select id="status" type="text"
|
|
|
- class="form-control @error('status') is-invalid @enderror"
|
|
|
- name="status"
|
|
|
- value="{{$product->status}}" required autocomplete="status">
|
|
|
- <option value="0">ناموجود</option>
|
|
|
- <option value="1" <?php if ($product->status == 1) echo 'selected'?> >
|
|
|
- موجود
|
|
|
- </option>
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
- @error('status')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="discription">{{ __('product.discription') }}</label><i
|
|
|
+ class="required"> *</i>
|
|
|
+ <textarea id="discription" type="text"
|
|
|
+ class="form-control @error('discription') is-invalid @enderror"
|
|
|
+ name="discription"
|
|
|
+ autocomplete="discription">{{$product->discription}}</textarea>
|
|
|
+ @error('discription')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="form-group">
|
|
|
- <label for="discription">{{ __(' توضیحات محصول') }}</label><i class="required"> *</i>
|
|
|
- <textarea id="discription" type="text"
|
|
|
- class="form-control @error('discription') is-invalid @enderror"
|
|
|
- name="discription"
|
|
|
-
|
|
|
- autocomplete="discription">{{$product->discription}}</textarea>
|
|
|
-
|
|
|
- @error('discription')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group">
|
|
|
+ <label for="categories[]">{{ __('product.categories.*') }}</label><i
|
|
|
+ class="required"> *</i>
|
|
|
+ <select id="categories" type="text"
|
|
|
+ class="form-control select2 @error('categories[]') is-invalid @enderror"
|
|
|
+ name="categories[]"
|
|
|
+ autocomplete="categories[]" multiple>
|
|
|
+ @foreach($categories as $cat)
|
|
|
+ <option value="{{$cat->id}}" <?php
|
|
|
+ if (in_array($cat->id, $product->categories->pluck('id')->toArray())) echo 'selected'
|
|
|
+ ?>>{{$cat->title}}</option>
|
|
|
+ @endforeach
|
|
|
+ </select>
|
|
|
+ @error('status')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
- @enderror
|
|
|
+ @enderror
|
|
|
+ </div>
|
|
|
+ <div class="form-group mb-0">
|
|
|
+ <div class="">
|
|
|
+ <button type="submit" class="btn btn-primary">
|
|
|
+ {{ __('ویرایش محصول') }}
|
|
|
+ </button>
|
|
|
+ <a href={{ route('products.index') }} type="button"
|
|
|
+ class="btn btn-warning"> انصراف</a>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <div class="form-group mb-0">
|
|
|
- <div class="">
|
|
|
- <button type="submit" class="btn btn-primary">
|
|
|
- {{ __('ویرایش محصول') }}
|
|
|
- </button>
|
|
|
-
|
|
|
- <a href={{ route('products.index') }} type="button"
|
|
|
- class="btn btn-warning"> انصراف</a>
|
|
|
-
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
-
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
<div class="card-footer">
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -213,9 +193,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
@endslot
|
|
|
-
|
|
|
@slot('script')
|
|
|
-
|
|
|
@endslot
|
|
|
-
|
|
|
@endcomponent
|