|
@@ -17,183 +17,131 @@
|
|
|
<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-header">
|
|
|
+ <strong>{{ __('ثبت محصول جدید') }}</strong>
|
|
|
+ </div>
|
|
|
@component('product::components.message')
|
|
|
@endcomponent
|
|
|
<div class="card-body mx-lg-5 px-lg-3">
|
|
|
- <form method="POST" action="{{ route('products.store') }}"
|
|
|
- enctype="multipart/form-data">
|
|
|
+ <form method="POST" action="{{ route('products.store') }}" enctype="multipart/form-data" id="DraftProduct">
|
|
|
@csrf
|
|
|
-
|
|
|
<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="{{ old('title') }}" autocomplete="title" autofocus>
|
|
|
-
|
|
|
- @error('title')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <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="{{ old('title') }}" autocomplete="title" autofocus>
|
|
|
+ @error('title')
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-row">
|
|
|
<div class="form-group col-lg-4">
|
|
|
<label for="slug">{{ __('product.slug') }}</label>
|
|
|
- <input type="text" name="slug"
|
|
|
- class="form-control @error('slug') is-invalid @enderror"
|
|
|
- value="{{old('slug')}}" autocomplete="slug" autofocus>
|
|
|
+ <input type="text" name="slug" class="form-control @error('slug') is-invalid @enderror" value="{{old('slug')}}" autocomplete="slug" autofocus>
|
|
|
@error('slug')
|
|
|
- <div class="alert alert-danger">{{$message}}</div>
|
|
|
+ <div class="alert alert-danger">{{$message}}</div>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-group col-lg-4">
|
|
|
<label for="sku">{{ __('product.sku') }}</label>
|
|
|
- <input id="sku" type="text"
|
|
|
- class="form-control @error('sku') is-invalid @enderror" name="sku"
|
|
|
+ <input id="sku" type="text" class="form-control @error('sku') is-invalid @enderror" name="sku"
|
|
|
autocomplete="sku" value="{{ old('sku') }}" autofocus>
|
|
|
-
|
|
|
@error('sku')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-group col-lg-4">
|
|
|
- <label for="type">{{ __('product.type') }}</label></label><i
|
|
|
- class="required">
|
|
|
- *</i>
|
|
|
- <select id="type" type="text"
|
|
|
- class="form-control @error('type') is-invalid @enderror" name="type"
|
|
|
- value="{{ old('type') }}" autocomplete="type">
|
|
|
+ <label for="type">{{ __('product.type') }}</label></label><i class="required"> *</i>
|
|
|
+ <select id="type" type="text" class="form-control @error('type') is-invalid @enderror" name="type" value="{{ old('type') }}" autocomplete="type">
|
|
|
<option value="">انتخاب کنید</option>
|
|
|
- <option value="0" {{ (old('type') == '0') ? 'selected' : '' }}>ساده
|
|
|
- </option>
|
|
|
- <option value="1" {{ (old('type') == '1') ? 'selected' : '' }}>متغیر
|
|
|
- </option>
|
|
|
- <option value="2" {{ (old('type') == '2') ? 'selected' : '' }}>باندل
|
|
|
- </option>
|
|
|
-
|
|
|
+ <option value="0" {{ (old('type') == '0') ? 'selected' : '' }}>ساده</option>
|
|
|
+ <option value="1" {{ (old('type') == '1') ? 'selected' : '' }}>متغیر</option>
|
|
|
+ <option value="2" {{ (old('type') == '2') ? 'selected' : '' }}>باندل</option>
|
|
|
</select>
|
|
|
-
|
|
|
@error('type')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="form-row ">
|
|
|
<div class="form-group col-lg-4">
|
|
|
- <label for="title">{{ __('product.price') }}</label><i class="required">
|
|
|
- *</i>
|
|
|
- <input id="input.price" type="text"
|
|
|
- class="form-control price @error('price') is-invalid @enderror"
|
|
|
- name="price"
|
|
|
- value="{{ old('price') }}" autocomplete="price" autofocus>
|
|
|
-
|
|
|
+ <label for="title">{{ __('product.price') }}</label><i class="required"> *</i>
|
|
|
+ <input id="input.price" type="text" class="form-control price @error('price') is-invalid @enderror" name="price" value="{{ old('price') }}" autocomplete="price" autofocus>
|
|
|
@error('price')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-group col-lg-4">
|
|
|
<label for="sale_price">@lang('product.sale_price')</label>
|
|
|
- <input id="sale_price" type="text"
|
|
|
- class="form-control price @error('sale_price') is-invalid @enderror"
|
|
|
- name="sale_price"
|
|
|
- value="{{ old('sale_price') }}" autocomplete="sale_price" autofocus>
|
|
|
-
|
|
|
+ <input id="sale_price" type="text" class="form-control price @error('sale_price') is-invalid @enderror" name="sale_price" value="{{ old('sale_price') }}" autocomplete="sale_price" autofocus>
|
|
|
@error('sale_price')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-group col-lg-4">
|
|
|
- <label for="status">{{ __('product.status') }}</label><i class="required">
|
|
|
- *</i>
|
|
|
- <select id="status" type="text"
|
|
|
- class="form-control @error('status') is-invalid @enderror"
|
|
|
- name="status"
|
|
|
- autocomplete="status">
|
|
|
+ <label for="status">{{ __('product.status') }}</label><i class="required"> *</i>
|
|
|
+ <select id="status" type="text" class="form-control @error('status') is-invalid @enderror" name="status" autocomplete="status">
|
|
|
<option value="">انتخاب کنید</option>
|
|
|
- <option value="1" {{ (old('status') == '1') ? 'selected' : '' }}>موجود
|
|
|
- </option>
|
|
|
- <option value="0" {{ (old('status') == '0') ? 'selected' : '' }}>
|
|
|
- ناموجود
|
|
|
- </option>
|
|
|
+ <option value="1" {{ (old('status') == '1') ? 'selected' : '' }}>موجود</option>
|
|
|
+ <option value="0" {{ (old('status') == '0') ? 'selected' : '' }}>ناموجود</option>
|
|
|
</select>
|
|
|
@error('status')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-group col-lg-4">
|
|
|
- <label for="status">{{ __('product.ReleaseStatus') }}</label><i class="required">
|
|
|
- *</i>
|
|
|
- <select id="ReleaseStatus" type="text"
|
|
|
- class="form-control @error('ReleaseStatus') is-invalid @enderror" name="ReleaseStatus"
|
|
|
- value="{{ old('ReleaseStatus') }}" autocomplete="ReleaseStatus">
|
|
|
+ <label for="status">{{ __('product.ReleaseStatus') }}</label><i class="required"> *</i>
|
|
|
+ <select id="ReleaseStatus" type="text" class="form-control @error('ReleaseStatus') is-invalid @enderror" name="ReleaseStatus" value="{{ old('ReleaseStatus') }}" autocomplete="ReleaseStatus">
|
|
|
<option value="">انتخاب کنید</option>
|
|
|
- <option value="draft" {{ (old('ReleaseStatus') == 'draft') ? 'selected' : '' }}>پیشنویس
|
|
|
- </option>
|
|
|
- <option value="pending" {{ (old('ReleaseStatus') == 'pending') ? 'selected' : '' }}>در حال انتظار
|
|
|
- </option>
|
|
|
- <option value="published" {{ (old('ReleaseStatus') == 'published') ? 'selected' : '' }}>منتشر شده
|
|
|
- </option>
|
|
|
-
|
|
|
+ <option value="draft" {{ (old('ReleaseStatus') == 'draft') ? 'selected' : '' }}>پیشنویس</option>
|
|
|
+ <option value="pending" {{ (old('ReleaseStatus') == 'pending') ? 'selected' : '' }}>در حال انتظار</option>
|
|
|
+ <option value="published" {{ (old('ReleaseStatus') == 'published') ? 'selected' : '' }}>منتشر شده</option>
|
|
|
</select>
|
|
|
@error('ReleaseStatus')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
- <label for="discription">{{ __('product.discription') }}</label></label><i
|
|
|
- class="required"> *</i>
|
|
|
- <textarea id="discription" type="text"
|
|
|
- class="form-control editor @error('discription') is-invalid @enderror"
|
|
|
- name="discription"
|
|
|
-
|
|
|
- autocomplete="discription"
|
|
|
- autofocus>{{ old('discription') }}</textarea>
|
|
|
+ <label for="discription">{{ __('product.discription') }}</label></label><i class="required"> *</i>
|
|
|
+ <textarea id="discription" type="text"class="form-control editor @error('discription') is-invalid @enderror" name="discription" autocomplete="discription" autofocus>
|
|
|
+ {{ old('discription') }}
|
|
|
+ </textarea>
|
|
|
|
|
|
@error('discription')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
- <label for="categories">{{ __('product.categories') }}</label><i
|
|
|
- class="required"> *</i>
|
|
|
- <select name="categories[]"
|
|
|
- class="form-control select2 @error('categories[]') is-invalid @enderror" multiple>
|
|
|
+ <label for="categories">{{ __('product.categories') }}</label><i class="required"> *</i>
|
|
|
+ <select name="categories[]" class="form-control select2 @error('categories[]') is-invalid @enderror" multiple>
|
|
|
<option value="0">--</option>
|
|
|
-
|
|
|
{!! category_select_options( $categories, old( 'categories[]' ) ) !!}
|
|
|
</select>
|
|
|
@error('categories')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
- <strong>{{ $message }}</strong>
|
|
|
- </span>
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
+ <strong>{{ $message }}</strong>
|
|
|
+ </span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-group col-md-8">
|
|
|
- <label for="title">
|
|
|
- {{ __('product.featured_image') }}
|
|
|
- </label> <i class="required"> *</i>
|
|
|
-
|
|
|
<span class="btn btn-primary btn-file">
|
|
|
- <input type="file" id="uploadImages" name="featured_image" accept="image/*"
|
|
|
- class="form-control photo browse @error('featured_image') is-invalid @enderror"
|
|
|
- value="{{old('featured_image')}}" autocomplete="featured_image" autofocus>تصویر شاخص
|
|
|
+ <input type="file" id="uploadImages" name="featured_image" accept="image/*" class="form-control photo browse @error('featured_image') is-invalid @enderror" value="{{old('featured_image')}}" autocomplete="featured_image" autofocus>
|
|
|
+ <label for="title">{{ __('product.featured_image') }}</label> <i class="required"> *</i>
|
|
|
</span>
|
|
|
<div class="hide-element" id="previewImages">
|
|
|
<div class="media">
|
|
@@ -201,12 +149,8 @@
|
|
|
<a href="" role="button" class="btn btn-danger pull-right" id="delete">
|
|
|
<i class="icon fa fa-close"></i>
|
|
|
</a>
|
|
|
- <img class="media-object img-thumbnail" src=""
|
|
|
- alt="" id="0" title="" data-toggle="modal"
|
|
|
- data-target="#individualImagePreview"
|
|
|
- style="width: 250px; height: 150px;" >
|
|
|
+ <img class="media-object img-thumbnail" src="" alt="" id="0" title="" data-toggle="modal" data-target="#individualImagePreview" style="width: 250px; height: 150px;" >
|
|
|
</div>
|
|
|
-
|
|
|
<div class="media-body">
|
|
|
<p>
|
|
|
<label for="featureDescription">توضیحات: </label>
|
|
@@ -216,26 +160,23 @@
|
|
|
<label for="featureCaption">عنوان: </label>
|
|
|
<input type="text" class="form-control" value="" name="featureCaption">
|
|
|
</p>
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@error('featured_image')
|
|
|
- <span class="invalid-feedback" role="alert">
|
|
|
+ <span class="invalid-feedback" role="alert">
|
|
|
<strong>{{ $message }}</strong>
|
|
|
</span>
|
|
|
@enderror
|
|
|
</div>
|
|
|
<div class="form-row ">
|
|
|
<div class="upload-widget test ">
|
|
|
-
|
|
|
<div class="select">
|
|
|
- <label for="title">
|
|
|
- {{ __('product.gallery_image') }}
|
|
|
- </label>
|
|
|
<span class="btn btn-primary btn-file">
|
|
|
- <input class="files" type="file" name="gallery_image[]" value="{{old('gallery_image[]')}}" multiple>
|
|
|
- {{ __('product.gallery_images') }}
|
|
|
+ <input class="files" type="file" name="gallery_image[]" value="{{old('gallery_image[]')}}" multiple>
|
|
|
+ <label for="title">
|
|
|
+ {{ __('product.gallery_image') }}
|
|
|
+ </label>
|
|
|
</span>
|
|
|
<output class="list row " >
|
|
|
</output>
|
|
@@ -249,9 +190,8 @@
|
|
|
<button type="submit" class="btn btn-primary">
|
|
|
{{ __('ثبت محصول') }}
|
|
|
</button>
|
|
|
-
|
|
|
- <a href={{ route('products.index') }} type="button" class="btn btn-warning">
|
|
|
- انصراف</a>
|
|
|
+ <a href="{{ route('products.index') }}" type="button" class="btn btn-warning" > انصراف</a>
|
|
|
+ <button type="submit" class="btn btn-warning" id="DraftProduct"> انصراف</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</form>
|
|
@@ -266,7 +206,60 @@
|
|
|
@endslot
|
|
|
|
|
|
@slot('script')
|
|
|
-
|
|
|
+ <script>
|
|
|
+ // $(document).ready(function() {
|
|
|
+ // $("#DraftProduct").on('click', function(e) {
|
|
|
+ // var getUrl = window.location;
|
|
|
+ // var base_url = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
|
|
+ // e.preventDefault();
|
|
|
+ // var message = $('.message').val();
|
|
|
+ // if (message === '') {
|
|
|
+ // alert("لطفا پارامتر ارسالی را وارد کنید");
|
|
|
+ // }else{
|
|
|
+ // $.ajax({
|
|
|
+ // type: "POST",
|
|
|
+ // url: base_url + "/product/store",
|
|
|
+ // data: '{message: "' + $('.message').val() + '" }',
|
|
|
+ // contentType: "application/json; charset=utf-8",
|
|
|
+ // dataType: "json",
|
|
|
+ // success: function(response) {
|
|
|
+ // if (response.Ajax) {
|
|
|
+ // alert(response.msg);
|
|
|
+ // } else {
|
|
|
+ // alert("این متن برای تست می باشد");
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // error: function(response) {
|
|
|
+ // alert("مشکلی در اجرای برنامه به وجود آمده ");
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ $(document).ready(function(){
|
|
|
+ $("#DraftProduct").click(function(e){
|
|
|
+ var getUrl = window.location;
|
|
|
+ var base_url = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
|
|
|
+ e.preventDefault();
|
|
|
+ title = $("#title").val();
|
|
|
+ price = $("#price").val();
|
|
|
+ slug = $("#slug").val();
|
|
|
+ type = $("#type").val();
|
|
|
+ status = $("#status").val();
|
|
|
+ discription = $("#discription").val();
|
|
|
+ categories = $("#categories").val();
|
|
|
+ featured_image = $("#featured_image").val();
|
|
|
+ $.ajax({
|
|
|
+ type:"POST",
|
|
|
+ data:{"title":title,"price":price,"slug":slug,"type":type,"status":status,"discription":discription,"categories":categories,"featured_image":featured_image},
|
|
|
+ url:base_url +"/product/SaveFormProductByAjax",
|
|
|
+ success:function(data){
|
|
|
+ $("#success").html(data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
@endslot
|
|
|
|
|
|
@endcomponent
|