Azam Rezayi преди 4 години
родител
ревизия
519a235e50
променени са 31 файла, в които са добавени 1054 реда и са изтрити 651 реда
  1. 2 6
      app/Http/Controllers/Panel/Categories/CategoryController.php
  2. 0 0
      azam/createggg.blade.php
  3. 23 10
      packages/product/src/Http/Controllers/AttributeController.php
  4. 22 5
      packages/product/src/Http/Controllers/ProductController.php
  5. 1 1
      packages/product/src/Http/Requests/AttributeRequest.php
  6. 0 1
      packages/product/src/Http/Requests/ProductRequest.php
  7. 18 0
      packages/product/src/Models/Attribute.php
  8. 9 5
      packages/product/src/Models/Product.php
  9. 34 0
      packages/product/src/database/migrations/2020_08_12_070412_create_attributable_table.php
  10. 417 0
      packages/product/src/js/d.js
  11. 14 408
      packages/product/src/js/product.js
  12. 32 1
      packages/product/src/sass/product.scss
  13. 5 3
      packages/product/src/views/attributes/create.blade.php
  14. 88 0
      packages/product/src/views/attributes/edit.blade.php
  15. 64 6
      packages/product/src/views/attributes/index.blade.php
  16. 4 8
      packages/product/src/views/index.blade.php
  17. 5 5
      packages/product/src/views/product/create.blade.php
  18. 7 4
      packages/product/src/views/product/edit.blade.php
  19. 58 0
      packages/product/src/views/product/include/simpleProduct.blade.php
  20. 39 32
      packages/product/src/views/product/include/variableAttribute.blade.php
  21. 54 0
      packages/product/src/views/product/include/variableAttribute.php
  22. 114 0
      packages/product/src/views/product/simpleEditProduct.blade.php
  23. 0 96
      packages/product/src/views/product/simpleProduct.blade.php
  24. 26 24
      packages/product/src/views/product/variableProduct.blade.php
  25. 5 2
      resources/js/panel/panel.js
  26. 1 1
      resources/lang/fa/category.php
  27. 1 1
      resources/lang/fa/product.php
  28. 1 1
      resources/views/components/collapse-card.blade.php
  29. 2 2
      resources/views/panel/categories/create.blade.php
  30. 5 25
      resources/views/panel/categories/edit.blade.php
  31. 3 4
      resources/views/panel/categories/index.blade.php

+ 2 - 6
app/Http/Controllers/Panel/Categories/CategoryController.php

@@ -90,12 +90,8 @@ class CategoryController extends Controller
      */
     public function edit( $id)
     {
-        $category = Category::findOrFail( $id );
-
-
-            $categories  = Category::orderBy('parent_id')->where('parent_id', 0)->get();
-
-
+        $category = Category::findOrFail($id);
+        $categories = Category::orderBy('parent_id')->where('parent_id', 0)->get();
         return view('panel.categories.edit', compact('category', 'categories'));
 
     }

+ 0 - 0
packages/product/src/views/attributes/createggg.blade.php → azam/createggg.blade.php


+ 23 - 10
packages/product/src/Http/Controllers/AttributeController.php

@@ -15,7 +15,7 @@ class AttributeController extends Controller
      */
     public function index()
     {
-        $attributes = Attribute::orderBy('id','DESC');
+        $attributes = Attribute::orderBy('id','DESC')->get();
         return view('product::attributes.index', compact('attributes'));
     }
 
@@ -42,12 +42,10 @@ class AttributeController extends Controller
             'title' => $request->title,
             'key' => $request->key,
             'use_in_veriation' => $request->use_in_veriation,
-
         ];
-
         $attribute = Attribute::create($data);
         $msg = 'ذخیره ویژگی با موفقیت انجام شد ';
-        return redirect(route('categories.index', $attribute->id))->with('success', $msg);
+        return redirect(route('attributes.index', $attribute->id))->with('success', $msg);
     }
 
     /**
@@ -67,9 +65,13 @@ class AttributeController extends Controller
      * @param  \App\Attribute  $attribute
      * @return \Illuminate\Http\Response
      */
-    public function edit(Attribute $attribute)
+    public function edit($id)
     {
-        //
+        $attribute = Attribute::findOrFail( $id );
+        $attributes  = Attribute::orderBy('id')->get();
+        $msg = 'ذخیره ویژگی با موفقیت انجام شد ';
+        return view('product::attributes.edit', compact('attribute', 'attributes'))->with('success', $msg);
+
     }
 
     /**
@@ -79,11 +81,19 @@ class AttributeController extends Controller
      * @param  \App\Attribute  $attribute
      * @return \Illuminate\Http\Response
      */
-    public function update(Request $request, Attribute $attribute)
+    public function update(AttributeRequest $request, Attribute $attribute)
     {
-        //
-    }
+        $data = [
+            'title' => $request->title,
+            'key' => $request->key,
+            'use_in_veriation' => $request->use_in_veriation,
+        ];
+        $attribute->update($data);
+//        dd($attribute);
+        $msg = 'ویرایش ویژگی با موفقیت انجام شد ';
+        return redirect(route('attributes.index', $attribute->id))->with('success', $msg);
 
+    }
     /**
      * Remove the specified resource from storage.
      *
@@ -92,6 +102,9 @@ class AttributeController extends Controller
      */
     public function destroy(Attribute $attribute)
     {
-        //
+        $attribute->delete();
+        {
+            return back();
+        }
     }
 }

+ 22 - 5
packages/product/src/Http/Controllers/ProductController.php

@@ -10,6 +10,7 @@ use Illuminate\Support\Facades\Facade;
 use Illuminate\Support\Facades\File;
 use Illuminate\Support\Facades\Storage;
 use Illuminate\Support\Str;
+use Packages\Product\Models\Attribute;
 use Packages\Product\Models\Draft;
 use Packages\Product\Http\Requests\ProductRequest;
 use Packages\Product\Http\Requests\ProductRequestEdit;
@@ -69,29 +70,33 @@ class ProductController extends Controller
         if ($product->type === 'ساده'){
             $view = 'saveProductStepTwo';
         }elseif ($product->type ==='متغیر'){
+
             $view = 'productStepVariable';
         }elseif ($product->type === 'باندل'){
             $view = 'productStepVariable';
         }
-        return redirect()->route($view, $product->id);
+        $msg = 'ذخیره محصول با موفقیت انجام شد ';
+        return redirect()->route($view, $product->id)->with('success', $msg);
     }
     public function productStepTwo($id)
     {
         $product = $this->productChecker($id);
         if ($product != false){
             $msg = 'ذخیره محصول با موفقیت انجام شد ';
-            return view('product::product.simpleProduct', compact('product'))->with('success', $msg);
+            return view('product::product.simpleEditProduct', compact('product'))->with('success', $msg);
         }else{
             return abort(419);
         }
     }
 
-    public function productStepVariable($id)
+    public function productStepVariable(Request $request, $id)
     {
+        $attributes = Attribute::orderBy('id')->where('use_in_veriation', 1)->get();
+//        $attributes = Attribute::query()->where('id', $request->id)->where('use_in_veriation', 1)->first();
         $product = $this->productChecker($id);
         if ($product != false){
             $msg = 'ذخیره محصول با موفقیت انجام شد ';
-            return view('product::product.variableProduct', compact('product'))->with('success', $msg);
+            return view('product::product.variableProduct', compact('product', 'attributes'))->with('success', $msg);
         }else{
             return abort(419);
         }
@@ -103,22 +108,32 @@ class ProductController extends Controller
         $product = $this->productChecker($request->product_id);
         if ($product != false){
             $request->validate([
+                'title' => 'required',
+                'slug' => 'required',
+                'ReleaseStatus' => 'required',
+                'discription' => 'required',
                 'sku' => 'required',
                 'status' => 'required',
                 'price' => 'required',
                 'sale_price' => 'required',
+
             ]);
             /**
              * update product
              */
             $data = [
+                'title' => $request->title,
+                'slug' => $request->slug,
+                'ReleaseStatus' => $request->ReleaseStatus,
+                'discription' => $request->discription,
+                'creator_id' => auth()->user()->id,
                 'sku' => $request->sku,
                 'status' => $request->status,
                 'price' => $request->price,
                 'sale_price' => $request->sale_price,
             ];
             $product->update($data);
-            $msg = 'ذخیره محصول با موفقیت انجام شد ';
+            $msg = 'ویرایش محصول با موفقیت انجام شد ';
             return redirect(route('products.index'))->with('success', $msg);
         }else{
             return abort(419);
@@ -136,7 +151,9 @@ class ProductController extends Controller
     }
     // ******************************************************edit page product*********************************************
     public function edit(Product $product)
+
     {
+        $categories = Category::orderBy('id', 'DESC')->get();
         return view('product::product.edit', compact('product', 'categories'));
     }
 

+ 1 - 1
packages/product/src/Http/Requests/AttributeRequest.php

@@ -26,7 +26,7 @@ class AttributeRequest extends FormRequest
 //       dd(request()->all());
         return [
             'title' => ['required','max:100'],
-            'key' => ['unique:attributes'],
+            'key' => ['required'],
             'use_in_veriation' => ['required'],
         ];
 

+ 0 - 1
packages/product/src/Http/Requests/ProductRequest.php

@@ -29,7 +29,6 @@ class ProductRequest extends FormRequest
             'slug' => ['unique:products'],
             'type' => ['required'],
             'discription' => ['required'],
-
             'sale_price' => ['nullable'],
             'sku' => ['nullable'],
             'status' => ['nullable'],

+ 18 - 0
packages/product/src/Models/Attribute.php

@@ -8,4 +8,22 @@ class Attribute extends Model
 {
     use SoftDeletes;
     protected $fillable=['title', 'key', 'use_in_veriation'];
+    public function products()
+    {
+        return $this->morphedByMany(Product::class, 'attributable');
+    }
+    public function getUseInVeriationAttribute($value)
+    {
+        switch ($value) {
+            case 0:
+                $UseInVeriation = 'خیر';
+                break;
+            case 1:
+                $UseInVeriation = 'بله';
+                break;
+            default:
+                $UseInVeriation = '';
+        }
+        return $UseInVeriation ;
+}
 }

+ 9 - 5
packages/product/src/Models/Product.php

@@ -13,7 +13,7 @@ class Product extends Model
     use Sluggable;
     use SoftDeletes;
   protected $fillable = ['title', 'discription', 'price', 'creator_id', 'type', 'status', 'sale_price', 'sku', 'ReleaseStatus'];
-//    protected $guarded = [];
+
     public function user()
     {
         return $this->belongsTo(User::class, 'creator_id', 'id');
@@ -22,6 +22,10 @@ class Product extends Model
     {
         return $this->morphToMany(Category::class, 'categorizable');
     }
+    public function attributes()
+    {
+        return $this->morphToMany(Attribute::class, 'attributable');
+    }
     public function uploads()
     {
         return $this->morphMany(Upload::class, 'uploadable');
@@ -54,15 +58,15 @@ class Product extends Model
     {
         switch ($value) {
             case 0:
-                $type = 'ناموجود';
+                $status = 'ناموجود';
                 break;
             case 1:
-                $type = 'موجود';
+                $status = 'موجود';
                 break;
             default:
-                $type = '';
+                $status = '';
         }
-        return $type;
+        return $status;
     }
     public function getReleaseStatusAttribute($value)
     {

+ 34 - 0
packages/product/src/database/migrations/2020_08_12_070412_create_attributable_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateAttributableTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('attributable', function (Blueprint $table) {
+            $table->id();
+            $table->integer('attribute_id');
+            $table->integer('attributable_id');
+            $table->string('attributable_type');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('attributable');
+    }
+}

+ 417 - 0
packages/product/src/js/d.js

@@ -0,0 +1,417 @@
+
+//**************************show images gallery**********************************************
+// $(document).ready(function(){
+//     $('.upload-widget').on('click', '.deleteGallary', function(e){
+//         e.preventDefault();
+//         $(this).closest(".DeleteImages").remove();
+//     });
+// });
+var FileUploader = (function() {
+    function FileUploader(options) {
+        options = options || {};
+
+        this.widget = document.querySelector(options.className);
+        this.dropZone = this.widget.querySelector('.dropZone');
+        this.input = this.widget.querySelector('.files');
+        this.output = this.widget.querySelector('.list');
+    };
+    FileUploader.prototype.init = function() {
+        var self = this;
+
+        self.dropZone.addEventListener('drop', function(e) {self.handleFile(e, self);}, false);
+        self.input.addEventListener('change', function(e) {self.handleFile(e, self);}, false);
+        self.dropZone.addEventListener('dragover', self.handleDragOver, false);
+    };
+    FileUploader.prototype.handleFile = function(evt, that) {
+        var self = that;
+        var files;
+
+        evt.stopPropagation();
+        evt.preventDefault();
+
+        if (evt.type === 'change') {
+            files = evt.target.files;
+        } else if (evt.type === 'drop') {
+            files = evt.dataTransfer.files;
+        }
+
+        self.selectLogic(files, self);
+    };
+    FileUploader.prototype.handleDragOver = function(evt) {
+        evt.stopPropagation();
+        evt.preventDefault();
+        evt.dataTransfer.dropEffect = 'link';
+    };
+    FileUploader.prototype.selectLogic = function(files, that) {
+        var self = that;
+        var reader;
+        for (var i = 0, file; file = files[i]; i++) {
+
+            reader = new FileReader();
+            reader.onload = (function(theFile) {
+                return function(e) {
+                    var
+                        div = document.createElement('div'),
+                        canvas = document.createElement('canvas'),
+                        ctx = canvas.getContext('2d'),
+                        image = new Image(),
+                        ratio,
+                        thumb;
+                    div.className = 'b';
+                    image.src = e.target.result;
+                    //size image
+                    image.onload = function() {
+                        ratio = 150/image.width;
+                        ratio = 150/image.height;
+
+
+                        canvas.width = image.width * ratio;
+                        canvas.height = image.height * ratio;
+                        ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
+
+                        // Gallery Description Input Fields
+                        thumb = canvas.toDataURL(theFile.type);
+
+                        div.innerHTML = '<div class="DeleteImages">' +
+                            '<a href="" class="deleteGallary btn btn-danger pull-right position-absolute"> ' +
+                            '<i class="icon fa fa-close"></i>' +
+                            '</a>' +
+                            '<img class="thumb img-thumbnail" style="width: 200px; height: 150px;" src="' + thumb + '" title="' + escape(theFile.name) + '">' +
+                            '<span class="form-input py-3 md-form" style="display: block;"> ' +
+                            '<label for="description">توضیحات: </label>' +
+                            '<input type="text" class="form-control" name="descriptionGallery[]">\n' +
+                            '<label for="caption">عنوان: </label>' +
+                            '<input type="text" class="form-control" name="captionGallery[]">' +
+                            '</span>' +
+                            '</div>';
+                    }
+                    self.output.insertBefore(div, null);
+                }
+            })(file)
+            reader.readAsDataURL(file);
+        }
+    }
+    return FileUploader;
+})();
+if( $('.GalleryImageChoice').length > 0 ){
+    var GalleryImageChoice = new FileUploader({className: '.GalleryImageChoice'});
+    GalleryImageChoice.init();
+}
+//***************FEATURE IMAGES***************************************
+$(document).ready(function () {
+    $('[data-toggle="tooltip"]').tooltip({
+        html: true
+    });
+    $('.media').addClass('hide-element');
+    $('#imagesUploadForm').submit(function (evt) {
+        evt.preventDefault();
+    });
+    $('#edit').click(function () {
+        console.log('click detected inside circl-o of edit');
+        $('#edit').toggleClass('fa-circle-o').toggleClass('fa-check-circle');
+        if ($('#edit').hasClass('fa-check-circle')) {
+            $('#captionForImage').toggleClass('hide-element');
+        } else {
+            $('#captionForImage').toggleClass('hide-element');
+        }
+    });
+    //Delete features Image
+    // $(document).ready(function(){
+    //     $('#previewImages').on('click', '#delete', function(e){
+    //         e.preventDefault();
+    //         $(this).closest(".media").remove();
+    //     });
+    // });
+    //namespace variable to determine whether to continue or not
+    var proceed = false;
+    //Ensure that FILE API is supported by the browser to proceed
+    if (window.File && window.FileReader && window.FileList && window.Blob) {
+        if (window.webkitURL || window.URL) {
+            $('#errorMessaage').removeClass('hide-element').addClass(
+                '').html('');
+            proceed = true;
+        } else {
+            $('#errorMessaage').removeClass('hide-element').addClass(
+                'alert-warning').html('');
+        }
+
+    } else {
+        $('#errorMessaage').removeClass('hide-element').addClass(
+            'alert-warning').html('');
+    }
+    if (proceed) {
+        var input = "";
+        var formData = new FormData();
+        $('input[name=featured_image]').on("change", function (e) {
+            var counter = 0;
+            var modalPreviewItems = "";
+            input = this.files;
+            $($(this)[0].files).each(function (i, file) {
+                formData.append("file[]", file);
+            });
+            $('#previewImages').removeClass('hide-element');
+            $('#imagesUpload').removeClass('disabled');
+            var successUpload = 0;
+            var failedUpload = 0;
+            var extraFiles = 0;
+            var size = input.length;
+            $(input).each(function () {
+                var reader = new FileReader();
+                var uploadImage = this;
+                console.log(this);
+                reader.readAsArrayBuffer(this);
+                reader.onload = function (e) {
+                    var magicNumbers = validateImage.magicNumbersForExtension(e);
+                    var fileSize = validateImage.isUploadedFileSizeValid(uploadImage);
+                    var extension = validateImage.uploadFileExtension(uploadImage);
+                    var isValidImage = validateImage.validateExtensionToMagicNumbers(magicNumbers);
+                    var thumbnail = validateImage.generateThumbnail(uploadImage);
+                    if (fileSize && isValidImage) {
+                        $('#' + counter).parents('.media').removeClass('hide-element');
+                        $('#' + counter).attr('src', thumbnail).height('200');
+                        $('#uploadDataInfo').removeClass('hide-element').addClass('alert-success');
+                        successUpload++;
+                        modalPreviewItems += carouselInsideModal.createItemsForSlider(thumbnail, counter);
+
+                    } else {
+                        $('#uploadDataInfo').removeClass('hide-element alert-success').addClass('alert-warning');
+                        failedUpload++;
+                    }
+                    counter++;
+                    if (counter === size) {
+                        $('#myCarousel').append(carouselInsideModal.createIndicators(successUpload, "myCarousel"));
+                        $('#previewItems').append(modalPreviewItems);
+                        $('#previewItems .item').first().addClass('active');
+                        $('#carouselIndicators > li').first().addClass('active');
+                        $('#myCarousel').carousel({
+                            interval: 2000,
+                            cycle: true
+                        });
+                        if (size > 4) {
+                            $('#toManyFilesUploaded').html("Only files displayed below will be uploaded");
+                            extraFiles = size - 4;
+                        }
+
+                        $('#filesCount').html(successUpload + " files are ready to upload");
+                        if (failedUpload !== 0 || extraFiles !== 0) {
+                            failedUpload === 0 ? "" : failedUpload;
+                            extraFiles === 0 ? "" : extraFiles;
+                            $('#filesUnsupported').html(failedUpload + extraFiles + " files were not selected for upload");
+                        }
+
+                    }
+                };
+            });
+
+        });
+
+        var toBeDeleted = [];
+        var eachImageValues = [];
+        $('.media').each(function (index) {
+            var imagePresent = "";
+            $("body").on("click", "#delete" + index, function () {
+                imagePresent = $("#" + index).attr('src');
+                $("#undo" + index).removeClass('hide-element');
+                $("#" + index).attr('src', './img/200x200.gif');
+                $("#delete" + index).addClass('hide-element');
+                toBeDeleted.push(index);
+
+            });
+            $("body").on("click", "#undo" + index, function () {
+                $("#" + index).attr('src', imagePresent);
+                $("#undo" + index).addClass('hide-element');
+                $("#delete" + index).removeClass('hide-element');
+                var indexToDelete = toBeDeleted.indexOf(index);
+                if (indexToDelete > -1) {
+                    toBeDeleted.splice(indexToDelete, 1);
+                    // console.log(toBeDeleted);
+                    $("#delete" + index).parent().find('input[type="text"]').prop('disabled', false).removeClass('disabled');
+                }
+                if (toBeDeleted.length === 4) {
+                    $('#sendImagesToServer').prop('disabled', true).html('No Files to Upload');
+
+                } else {
+                    $('#sendImagesToServer').prop('disabled', false).html('Update &amp; Preview');
+                }
+            });
+        });
+
+
+        var validateImage = {
+            magicNumbersForExtension: function (event) {
+                var headerArray = (new Uint8Array(event.target.result)).subarray(0, 4);
+                var magicNumber = "";
+                for (var counter = 0; counter < headerArray.length; counter++) {
+                    magicNumber += headerArray[counter].toString(16);
+                }
+                return magicNumber;
+            },
+            isUploadedFileSizeValid: function (fileUploaded) {
+                var fileSize = fileUploaded.size;
+                var maximumSize = 2097125;
+                var isValid = "";
+                if (fileSize <= maximumSize) {
+                    isValid = true;
+                } else {
+                    isValid = false;
+                }
+                return isValid;
+            },
+            uploadFileExtension: function (fileUploaded) {
+                var fileExtension = "";
+                var imageType = "";
+                imageType = fileUploaded.type.toLowerCase();
+                fileExtension = imageType.substr((imageType.lastIndexOf('/') + 1));
+                return fileExtension;
+            },
+            validateExtensionToMagicNumbers: function (magicNumbers) {
+                var properExtension = "";
+                if (magicNumbers.toLowerCase() === "ffd8ffe0" || magicNumbers.toLowerCase() === "ffd8ffe1" ||
+                    magicNumbers.toLowerCase() === "ffd8ffe8" ||
+                    magicNumbers.toLocaleLowerCase() === "89504e47") {
+                    properExtension = true;
+
+                } else {
+                    properExtension = false;
+                }
+                return properExtension;
+            },
+            generateThumbnail: function (uploadImage) {
+                if (window.URL)
+                    imageSrc = window.URL.createObjectURL(uploadImage);
+                else
+                    imageSrc = window.webkitURL.createObjectURL(uploadImage);
+                return imageSrc;
+            }
+        };
+        var carouselInsideModal = {
+            createIndicators: function (carouselLength, dataTarget) {
+                var carouselIndicators = '<ol class = "carousel-indicators" id="carouselIndicators">';
+                for (var counter = 0; counter < carouselLength; counter++) {
+                    carouselIndicators += '<li data-target = "#' + dataTarget + '"data-slide-to="' + counter + '"></li>';
+                }
+                carouselIndicators += "</ol>";
+                return carouselIndicators;
+            },
+            createItemsForSlider: function (imgSrc, counter) {
+                var item = '<div class = "item">' + '<img src="' + imgSrc + '" id="preview' + counter + '" /></div>';
+                return item;
+            }
+        };
+    }
+});
+//    ********************File Attachment featured_image*******************
+$(document).ready(function(){
+    $(".attachment_upload").on('change',function(){
+        var loc = window.location;
+        var base_url = loc.protocol + "//" + loc.hostname + (loc.port? ":"+loc.port : "");
+        var uploader = $('input[name="featured_image"]');
+        var data = new FormData();
+        // var uploader = $('.attachment_upload[name="featured_image"]');
+        uploader.each(function(){
+            data.append('featured_image', $(this).prop('files')[0]);
+            data.append('featureDescription', $('#featureDescription').val());
+            data.append('featureCaption', $('#featureCaption').val());
+
+        })
+        data.append('_token', $('[name="csrf-token"]').attr('content'));
+        $.ajax({
+            url:  base_url + "/panel/product_uploads/FeaturedImage",
+            method: 'POST',
+            data: data,
+            processData: false,
+            contentType: false,
+            success: function(data) {
+
+            }
+        });
+    });
+});
+//****************
+$(document).ready(function(){
+    $(".attachment_upload_gallery").on('change',function(){
+        var loc = window.location;
+        var base_url = loc.protocol + "//" + loc.hostname + (loc.port? ":"+loc.port : "");
+        for( let i=0; i<$(this).prop('files').length; i++ ){
+            var uploader = $('.attachment_upload_gallery[name="gallery_image[]"]');
+            var data = new FormData();
+            uploader.each(function(){
+                data.append('gallery_image[]', $(this).prop('files')[i]);
+                data.append('descriptionGallery[]', $('#descriptionGallery').val());
+                data.append('captionGallery[]', $('#captionGallery').val());
+            })
+            data.append('_token', $('[name="csrf-token"]').attr('content'));
+            $.ajax({
+                url:  base_url + "/panel/product_uploads/GalleryImage",
+                method: 'POST',
+                data: data,
+                processData: false,
+                contentType: false,
+                success: function(data) {
+
+                }
+            });
+        };
+    });
+});
+//delete
+// $('#previewImages').on('click', '#delete', function(){
+//     var loc = window.location;
+//     var base_url = loc.protocol + "//" + loc.hostname + (loc.port? ":"+loc.port : "");
+//     var target = $(this).closest('.attachment_file_upload ');
+//     Swal.fire({
+//         title: 'آیا اطمینان دارید؟',
+//         text: 'در صورت تایید فایل آپلود شده حذف خواهد شد.',
+//         type: 'warning',
+//         customClass: {
+//             icon: 'swal2-arabic-question-mark'
+//         },
+//         showCancelButton: true,
+//         confirmButtonColor: '#e3342f',
+//         cancelButtonColor: '#38c172',
+//         cancelButtonText: 'انصراف',
+//         confirmButtonText: 'تایید و حذف'
+//     }).then((result) => {
+//         if(result.value){
+//             Swal.fire({
+//                 title: 'در حال اجرای درخواست',
+//                 type: 'info',
+//                 allowEscapeKey: false,
+//                 allowOutsideClick: false,
+//                 onOpen: () => {
+//                     Swal.showLoading();
+//                 }
+//             });
+//
+//             $.ajax({
+//                 type: 'post',
+//                 url: base_url + "/panel/uploads/{upload}",
+//                 dataType: 'json',
+//                 data: data,
+//                 success: function(response){
+//                     target.remove();
+//                     Swal.fire({
+//                         title: 'عملیات موفق',
+//                         text: 'فایل با موفقیت حذف شد.',
+//                         type: 'info'
+//                     });
+//                 },
+//                 error: function(response){
+//                     if( response.status == 404 ){
+//                         var response_text = $.parseJSON( response.responseText )
+//                         Swal.fire({
+//                             title: 'خطا در حذف فایل',
+//                             html: response_text.errors.file[0],
+//                             type: 'error',
+//                             customClass: {
+//                                 icon: 'swal2-arabic-question-mark'
+//                             },
+//                             confirmButtonText: 'تایید'
+//                         })
+//                     }
+//                 }
+//             });
+//         }
+//     });
+// });
+//***************************************

+ 14 - 408
packages/product/src/js/product.js

@@ -1,420 +1,26 @@
-
-//**************************show images gallery**********************************************
-// $(document).ready(function(){
-//     $('.upload-widget').on('click', '.deleteGallary', function(e){
-//         e.preventDefault();
-//         $(this).closest(".DeleteImages").remove();
-//     });
-// });
-var FileUploader = (function() {
-    function FileUploader(options) {
-        options = options || {};
-
-        this.widget = document.querySelector(options.className);
-        this.dropZone = this.widget.querySelector('.dropZone');
-        this.input = this.widget.querySelector('.files');
-        this.output = this.widget.querySelector('.list');
-    };
-    FileUploader.prototype.init = function() {
-        var self = this;
-
-        self.dropZone.addEventListener('drop', function(e) {self.handleFile(e, self);}, false);
-        self.input.addEventListener('change', function(e) {self.handleFile(e, self);}, false);
-        self.dropZone.addEventListener('dragover', self.handleDragOver, false);
-    };
-    FileUploader.prototype.handleFile = function(evt, that) {
-        var self = that;
-        var files;
-
-        evt.stopPropagation();
-        evt.preventDefault();
-
-        if (evt.type === 'change') {
-            files = evt.target.files;
-        } else if (evt.type === 'drop') {
-            files = evt.dataTransfer.files;
-        }
-
-        self.selectLogic(files, self);
-    };
-    FileUploader.prototype.handleDragOver = function(evt) {
-        evt.stopPropagation();
-        evt.preventDefault();
-        evt.dataTransfer.dropEffect = 'link';
-    };
-    FileUploader.prototype.selectLogic = function(files, that) {
-        var self = that;
-        var reader;
-        for (var i = 0, file; file = files[i]; i++) {
-
-            reader = new FileReader();
-            reader.onload = (function(theFile) {
-                return function(e) {
-                    var
-                        div = document.createElement('div'),
-                        canvas = document.createElement('canvas'),
-                        ctx = canvas.getContext('2d'),
-                        image = new Image(),
-                        ratio,
-                        thumb;
-                    div.className = 'b';
-                    image.src = e.target.result;
-                    //size image
-                    image.onload = function() {
-                        ratio = 150/image.width;
-                        ratio = 150/image.height;
-
-
-                        canvas.width = image.width * ratio;
-                        canvas.height = image.height * ratio;
-                        ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
-
-                        // Gallery Description Input Fields
-                        thumb = canvas.toDataURL(theFile.type);
-
-                        div.innerHTML = '<div class="DeleteImages">' +
-                            '<a href="" class="deleteGallary btn btn-danger pull-right position-absolute"> ' +
-                            '<i class="icon fa fa-close"></i>' +
-                            '</a>' +
-                            '<img class="thumb img-thumbnail" style="width: 200px; height: 150px;" src="' + thumb + '" title="' + escape(theFile.name) + '">' +
-                            '<span class="form-input py-3 md-form" style="display: block;"> ' +
-                            '<label for="description">توضیحات: </label>' +
-                            '<input type="text" class="form-control" name="descriptionGallery[]">\n' +
-                            '<label for="caption">عنوان: </label>' +
-                            '<input type="text" class="form-control" name="captionGallery[]">' +
-                            '</span>' +
-                            '</div>';
-                    }
-                    self.output.insertBefore(div, null);
-                }
-            })(file)
-            reader.readAsDataURL(file);
-        }
-    }
-    return FileUploader;
-})();
-    if( $('.GalleryImageChoice').length > 0 ){
-        var GalleryImageChoice = new FileUploader({className: '.GalleryImageChoice'});
-        GalleryImageChoice.init();
-    }
-//***************FEATURE IMAGES***************************************
-$(document).ready(function () {
-    $('[data-toggle="tooltip"]').tooltip({
-        html: true
-    });
-    $('.media').addClass('hide-element');
-    $('#imagesUploadForm').submit(function (evt) {
-        evt.preventDefault();
-    });
-    $('#edit').click(function () {
-        console.log('click detected inside circl-o of edit');
-        $('#edit').toggleClass('fa-circle-o').toggleClass('fa-check-circle');
-        if ($('#edit').hasClass('fa-check-circle')) {
-            $('#captionForImage').toggleClass('hide-element');
-        } else {
-            $('#captionForImage').toggleClass('hide-element');
-        }
+// Add Attribute
+$(document).on('click', '.attribute_creator', function () {
+    let new_select = $('<div>').append( $(".added_attribute:first").append('label.label').clone() );
+    new_select.find('span').remove();
+    new_select.find('select').removeClass();
+    $('div.added_attribute:last').after( new_select.html() );
+    $('div.added_attribute:last').show();
+    $(".added_attribute select").select2({
+        tags: true
     });
-    //Delete features Image
-    // $(document).ready(function(){
-    //     $('#previewImages').on('click', '#delete', function(e){
-    //         e.preventDefault();
-    //         $(this).closest(".media").remove();
-    //     });
-    // });
-    //namespace variable to determine whether to continue or not
-    var proceed = false;
-    //Ensure that FILE API is supported by the browser to proceed
-    if (window.File && window.FileReader && window.FileList && window.Blob) {
-        if (window.webkitURL || window.URL) {
-            $('#errorMessaage').removeClass('hide-element').addClass(
-                '').html('');
-            proceed = true;
-        } else {
-            $('#errorMessaage').removeClass('hide-element').addClass(
-                'alert-warning').html('');
-        }
-
-    } else {
-        $('#errorMessaage').removeClass('hide-element').addClass(
-            'alert-warning').html('');
-    }
-    if (proceed) {
-        var input = "";
-        var formData = new FormData();
-        $('input[name=featured_image]').on("change", function (e) {
-            var counter = 0;
-            var modalPreviewItems = "";
-            input = this.files;
-            $($(this)[0].files).each(function (i, file) {
-                formData.append("file[]", file);
-            });
-            $('#previewImages').removeClass('hide-element');
-            $('#imagesUpload').removeClass('disabled');
-            var successUpload = 0;
-            var failedUpload = 0;
-            var extraFiles = 0;
-            var size = input.length;
-            $(input).each(function () {
-                var reader = new FileReader();
-                var uploadImage = this;
-                console.log(this);
-                reader.readAsArrayBuffer(this);
-                reader.onload = function (e) {
-                    var magicNumbers = validateImage.magicNumbersForExtension(e);
-                    var fileSize = validateImage.isUploadedFileSizeValid(uploadImage);
-                    var extension = validateImage.uploadFileExtension(uploadImage);
-                    var isValidImage = validateImage.validateExtensionToMagicNumbers(magicNumbers);
-                    var thumbnail = validateImage.generateThumbnail(uploadImage);
-                    if (fileSize && isValidImage) {
-                        $('#' + counter).parents('.media').removeClass('hide-element');
-                        $('#' + counter).attr('src', thumbnail).height('200');
-                        $('#uploadDataInfo').removeClass('hide-element').addClass('alert-success');
-                        successUpload++;
-                        modalPreviewItems += carouselInsideModal.createItemsForSlider(thumbnail, counter);
-
-                    } else {
-                        $('#uploadDataInfo').removeClass('hide-element alert-success').addClass('alert-warning');
-                        failedUpload++;
-                    }
-                    counter++;
-                    if (counter === size) {
-                        $('#myCarousel').append(carouselInsideModal.createIndicators(successUpload, "myCarousel"));
-                        $('#previewItems').append(modalPreviewItems);
-                        $('#previewItems .item').first().addClass('active');
-                        $('#carouselIndicators > li').first().addClass('active');
-                        $('#myCarousel').carousel({
-                            interval: 2000,
-                            cycle: true
-                        });
-                        if (size > 4) {
-                            $('#toManyFilesUploaded').html("Only files displayed below will be uploaded");
-                            extraFiles = size - 4;
-                        }
-
-                        $('#filesCount').html(successUpload + " files are ready to upload");
-                        if (failedUpload !== 0 || extraFiles !== 0) {
-                            failedUpload === 0 ? "" : failedUpload;
-                            extraFiles === 0 ? "" : extraFiles;
-                            $('#filesUnsupported').html(failedUpload + extraFiles + " files were not selected for upload");
-                        }
-
-                    }
-                };
-            });
-
-        });
-
-        var toBeDeleted = [];
-        var eachImageValues = [];
-        $('.media').each(function (index) {
-            var imagePresent = "";
-            $("body").on("click", "#delete" + index, function () {
-                imagePresent = $("#" + index).attr('src');
-                $("#undo" + index).removeClass('hide-element');
-                $("#" + index).attr('src', './img/200x200.gif');
-                $("#delete" + index).addClass('hide-element');
-                toBeDeleted.push(index);
-
-            });
-            $("body").on("click", "#undo" + index, function () {
-                $("#" + index).attr('src', imagePresent);
-                $("#undo" + index).addClass('hide-element');
-                $("#delete" + index).removeClass('hide-element');
-                var indexToDelete = toBeDeleted.indexOf(index);
-                if (indexToDelete > -1) {
-                    toBeDeleted.splice(indexToDelete, 1);
-                    // console.log(toBeDeleted);
-                    $("#delete" + index).parent().find('input[type="text"]').prop('disabled', false).removeClass('disabled');
-                }
-                if (toBeDeleted.length === 4) {
-                    $('#sendImagesToServer').prop('disabled', true).html('No Files to Upload');
+});
+//add value Attribute
 
-                } else {
-                    $('#sendImagesToServer').prop('disabled', false).html('Update &amp; Preview');
-                }
-            });
-        });
 
 
-        var validateImage = {
-            magicNumbersForExtension: function (event) {
-                var headerArray = (new Uint8Array(event.target.result)).subarray(0, 4);
-                var magicNumber = "";
-                for (var counter = 0; counter < headerArray.length; counter++) {
-                    magicNumber += headerArray[counter].toString(16);
-                }
-                return magicNumber;
-            },
-            isUploadedFileSizeValid: function (fileUploaded) {
-                var fileSize = fileUploaded.size;
-                var maximumSize = 2097125;
-                var isValid = "";
-                if (fileSize <= maximumSize) {
-                    isValid = true;
-                } else {
-                    isValid = false;
-                }
-                return isValid;
-            },
-            uploadFileExtension: function (fileUploaded) {
-                var fileExtension = "";
-                var imageType = "";
-                imageType = fileUploaded.type.toLowerCase();
-                fileExtension = imageType.substr((imageType.lastIndexOf('/') + 1));
-                return fileExtension;
-            },
-            validateExtensionToMagicNumbers: function (magicNumbers) {
-                var properExtension = "";
-                if (magicNumbers.toLowerCase() === "ffd8ffe0" || magicNumbers.toLowerCase() === "ffd8ffe1" ||
-                    magicNumbers.toLowerCase() === "ffd8ffe8" ||
-                    magicNumbers.toLocaleLowerCase() === "89504e47") {
-                    properExtension = true;
 
-                } else {
-                    properExtension = false;
-                }
-                return properExtension;
-            },
-            generateThumbnail: function (uploadImage) {
-                if (window.URL)
-                    imageSrc = window.URL.createObjectURL(uploadImage);
-                else
-                    imageSrc = window.webkitURL.createObjectURL(uploadImage);
-                return imageSrc;
-            }
-        };
-        var carouselInsideModal = {
-            createIndicators: function (carouselLength, dataTarget) {
-                var carouselIndicators = '<ol class = "carousel-indicators" id="carouselIndicators">';
-                for (var counter = 0; counter < carouselLength; counter++) {
-                    carouselIndicators += '<li data-target = "#' + dataTarget + '"data-slide-to="' + counter + '"></li>';
-                }
-                carouselIndicators += "</ol>";
-                return carouselIndicators;
-            },
-            createItemsForSlider: function (imgSrc, counter) {
-                var item = '<div class = "item">' + '<img src="' + imgSrc + '" id="preview' + counter + '" /></div>';
-                return item;
-            }
-        };
-    }
-});
-//    ********************File Attachment featured_image*******************
-$(document).ready(function(){
-    $(".attachment_upload").on('change',function(){
-        var loc = window.location;
-        var base_url = loc.protocol + "//" + loc.hostname + (loc.port? ":"+loc.port : "");
-         var uploader = $('input[name="featured_image"]');
-         var data = new FormData();
-        // var uploader = $('.attachment_upload[name="featured_image"]');
-        uploader.each(function(){
-            data.append('featured_image', $(this).prop('files')[0]);
-            data.append('featureDescription', $('#featureDescription').val());
-            data.append('featureCaption', $('#featureCaption').val());
 
-        })
-        data.append('_token', $('[name="csrf-token"]').attr('content'));
-        $.ajax({
-            url:  base_url + "/panel/product_uploads/FeaturedImage",
-            method: 'POST',
-            data: data,
-            processData: false,
-            contentType: false,
-            success: function(data) {
+$(document).on('click', '.variable_creator', function () {
+    $(".added_variable:last").after($(".added_variable:last").clone());
+    $("div.added_variable").addClass("added_variable_show");
 
-            }
-        });
-    });
 });
-//****************
-$(document).ready(function(){
-    $(".attachment_upload_gallery").on('change',function(){
-        var loc = window.location;
-        var base_url = loc.protocol + "//" + loc.hostname + (loc.port? ":"+loc.port : "");
- for( let i=0; i<$(this).prop('files').length; i++ ){
-        var uploader = $('.attachment_upload_gallery[name="gallery_image[]"]');
-        var data = new FormData();
-        uploader.each(function(){
-            data.append('gallery_image[]', $(this).prop('files')[i]);
-            data.append('descriptionGallery[]', $('#descriptionGallery').val());
-            data.append('captionGallery[]', $('#captionGallery').val());
-        })
-        data.append('_token', $('[name="csrf-token"]').attr('content'));
-        $.ajax({
-            url:  base_url + "/panel/product_uploads/GalleryImage",
-            method: 'POST',
-            data: data,
-            processData: false,
-            contentType: false,
-            success: function(data) {
 
-            }
-        });
-     };
-});
-});
-//delete
-// $('#previewImages').on('click', '#delete', function(){
-//     var loc = window.location;
-//     var base_url = loc.protocol + "//" + loc.hostname + (loc.port? ":"+loc.port : "");
-//     var target = $(this).closest('.attachment_file_upload ');
-//     Swal.fire({
-//         title: 'آیا اطمینان دارید؟',
-//         text: 'در صورت تایید فایل آپلود شده حذف خواهد شد.',
-//         type: 'warning',
-//         customClass: {
-//             icon: 'swal2-arabic-question-mark'
-//         },
-//         showCancelButton: true,
-//         confirmButtonColor: '#e3342f',
-//         cancelButtonColor: '#38c172',
-//         cancelButtonText: 'انصراف',
-//         confirmButtonText: 'تایید و حذف'
-//     }).then((result) => {
-//         if(result.value){
-//             Swal.fire({
-//                 title: 'در حال اجرای درخواست',
-//                 type: 'info',
-//                 allowEscapeKey: false,
-//                 allowOutsideClick: false,
-//                 onOpen: () => {
-//                     Swal.showLoading();
-//                 }
-//             });
-//
-//             $.ajax({
-//                 type: 'post',
-//                 url: base_url + "/panel/uploads/{upload}",
-//                 dataType: 'json',
-//                 data: data,
-//                 success: function(response){
-//                     target.remove();
-//                     Swal.fire({
-//                         title: 'عملیات موفق',
-//                         text: 'فایل با موفقیت حذف شد.',
-//                         type: 'info'
-//                     });
-//                 },
-//                 error: function(response){
-//                     if( response.status == 404 ){
-//                         var response_text = $.parseJSON( response.responseText )
-//                         Swal.fire({
-//                             title: 'خطا در حذف فایل',
-//                             html: response_text.errors.file[0],
-//                             type: 'error',
-//                             customClass: {
-//                                 icon: 'swal2-arabic-question-mark'
-//                             },
-//                             confirmButtonText: 'تایید'
-//                         })
-//                     }
-//                 }
-//             });
-//         }
-//     });
-// });
-//***************************************
 
 
 

+ 32 - 1
packages/product/src/sass/product.scss

@@ -11,7 +11,7 @@
     padding: 0 !important;
 }
 .select2 {
-    width: 100% !important;
+    width: 90% !important;
 }
 .photo {
     border: 0px;
@@ -113,6 +113,10 @@ output span {
     background-color: hsl(315, 22%, 86%);
     height: calc(2em + .75rem + 5px);
 }
+.select2-simple {
+    background-color: hsl(10, 22%, 86%) !important;
+    height: calc(2em + .75rem + 5px) !important;
+}
 .required {
     color: red;
 }
@@ -142,3 +146,30 @@ output span {
 .card {
     margin-bottom: 15px;
 }
+.added_attribute {
+    display: none;
+    border: 1px solid #752360;
+    padding: 20px;
+    border-radius: 5px;
+    margin: 10px 20px;
+}  .added_variable{
+     display: none;
+    border: 4px solid #752360;
+    padding: 10px;
+   border-radius: 5px;
+ }
+   .c{
+       margin: 10px;
+   }
+.added_attribute_show {
+    display: inline !important;
+}
+.added_variable_show{
+     display: inline !important;
+ }
+.btn{
+    height: 3em ;
+}
+//.AddPad {
+//    padding-top: 8px;
+//}

+ 5 - 3
packages/product/src/views/attributes/create.blade.php

@@ -8,12 +8,14 @@
         <p>ثبت ویژگی های محصول در فروشگاه.</p>
     @endslot
     @slot('breadcrumb')
-        <li class="breadcrumb-item"> ویژگی های محصول</li>
+
+        <a href="{{ route('attributes.index') }}" ><li class="breadcrumb-item"> &nbsp;ویژگی های محصول</li></a>
+        <li class="breadcrumb-item">/&nbsp;  ایجاد ویژگی &nbsp; </li>
     @endslot
 
     @slot('content')
         <div class="auth-background h-auto py-5">
-            <div class="container py-5">
+            <div class=" py-5">
                 <div class="row align-items-center ">
                     <div class="col-lg-12 col-md-12 mx-auto">
                         <div class="card">
@@ -22,7 +24,7 @@
                             </div>
                             @component('product::components.message')
                             @endcomponent
-                            <div class="card-body mx-lg-5 px-lg-3">
+                            <div class="card-body mx-lg-6 px-lg-4">
                                 <form method="POST" action="{{ route('attributes.store') }}" enctype="multipart/form-data" >
                                     @csrf
                                     <div class="form-group">

+ 88 - 0
packages/product/src/views/attributes/edit.blade.php

@@ -0,0 +1,88 @@
+@component('panel.layouts.component', ['title' => 'ویرایش دسته جدید'])
+
+    @slot('style')
+    @endslot
+    @slot('subject')
+        <h1><i class="fa fa-users"></i> ویرایش دسته بندی </h1>
+
+    @endslot
+
+    @slot('breadcrumb')
+        <a href="{{ route('attributes.index') }}" ><li class="breadcrumb-item">&nbsp;ویژگی های محصول&nbsp;</li></a>
+        <li class="breadcrumb-item">/  ویرایش ویژگی  </li>
+        <li class="breadcrumb-item">{{ $attribute->title}}  &nbsp; </li>
+    @endslot
+    @slot('content')
+        <div class="auth-background h-auto py-5">
+            <div class=" py-5">
+                <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>
+                            @component('product::components.message')
+                            @endcomponent
+                            <div class="card-body mx-lg-6 px-lg-4">
+                                <form method="POST" action="{{ route('attributes.update', $attribute->id) }}" enctype="multipart/form-data" >
+                                    @csrf
+                                    @if ($attribute)
+                                        @method('PUT')
+                                    @endif
+                                    <div class="form-group">
+                                        <label for="title">{{ __('attribute.title') }}</label><i class="required">&nbsp; *</i>
+                                        <input id="title" type="text" class="form-control @error('title') is-invalid @enderror" name="title" value="{{ $attribute->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-6">
+                                            <label for="key">{{ __('attribute.key') }}</label>
+                                            <input type="text" name="key" class="form-control @error('key') is-invalid  @enderror" value="{{$attribute->key}}" autocomplete="key" autofocus>
+                                            @error('key')
+                                            <div class="alert alert-danger">{{$message}}</div>
+                                            @enderror
+                                        </div>
+
+
+                                        <div class="form-group col-lg-6">
+                                            <label for="use_in_veriation">{{ __('attribute.use_in_veriation') }}</label>
+                                            <select id="use_in_veriation" type="text" class="form-control @error('use_in_veriation') is-invalid @enderror" name="use_in_veriation" value="{{ $attribute->use_in_veriation}}" autocomplete="use_in_veriation">
+                                                <option value="0" >خیر</option>
+                                                <option value="1" @if ($attribute->use_in_veriation === 'بله')  selected='selected' @endif>بله</option>
+
+                                            </select>
+                                            @error('use_in_veriation')
+                                            <span class="invalid-feedback" role="alert">
+                                                    <strong>{{ $message }}</strong>
+                                                </span>
+                                            @enderror
+                                        </div>
+                                    </div>
+                                    <div class="form-group mb-0">
+                                        <div class="">
+                                            <button type="submit" class="btn btn-primary" >
+                                                {{ __('ثبت محصول') }}
+                                            </button>
+                                            <a href="{{ route('attributes.index') }}" type="button" class="btn btn-warning" > انصراف</a>
+                                        </div>
+                                    </div>
+                                </form>
+                            </div>
+                            <div class="card-footer">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    @endslot
+    @slot('script')
+
+    @endslot
+
+@endcomponent
+

+ 64 - 6
packages/product/src/views/attributes/index.blade.php

@@ -1,15 +1,73 @@
-@component('panel.layouts.component', ['title' => 'محصولات'])
+@component('panel.layouts.component', ['title' => 'ویژگی ها'])
     @slot('style')
-        <style>
-        </style>
+
     @endslot
     @slot('subject')
-        <h1><i class="fa fa-users"></i>لیست محصولات </h1>
-        <p>لیست محصولات تعریف شده برای مدیریت محصولات</p>
+        <h1><i class="fa fa-users"></i> ویژگی ها </h1>
+        <p>لیست ویژگی های تعریف شده برای مدیریت سطوح دسترسی.</p>
     @endslot
     @slot('breadcrumb')
-        <li class="breadcrumb-item">محصولات</li>
+        <li class="breadcrumb-item">ویژگی ها</li>
+    @endslot
+    @slot('content')
+        <div class="row">
+            <div class="col-md-12">
+                <div class="col-md-11 message">
+                </div>
+                @component('components.collapse-card' , ['title' => ' ویژگی های محصولات'])
+                    @slot('body')
+                        @component('product::components.message')
+                        @endcomponent
+                        <div class="mt-4">
+                            <a href="{{ route('attributes.create') }}" type="button" class="btn btn-primary"><i
+                                    class="fa fa-plus"></i> ایجاد ویژگی</a>
+                            <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>key</th>
+                                    <th>استفاده در محصول متغییر</th>
+                                    <th> مدیریت</th>
+                                </tr>
+                            @endslot
+                            @slot('tbody')
 
+                                @forelse ($attributes as $attribute)
+                                    <tr>
+                                        <td>{{$attribute->id}}</td>
+                                        <td>{{$attribute->title}}</td>
+                                        <td>{{$attribute->key}}</td>
+                                        <td>{{$attribute->use_in_veriation}}</td>
+                                        <td class="d-flex">
+                                            <a href="{{route('attributes.edit', $attribute->id)}}"
+                                               class="btn btn-sm btn-primary mr-2"><i class="icon fa fa-pencil"></i></a>
+                                            <form action="{{route('attributes.destroy', $attribute->id)}}" method="POST" onsubmit="return confirm('آیا مطمئن هستید؟');">
+                                                @csrf
+                                                @method('DELETE')
+                                                <button type="submit" class="btn btn-sm btn-danger"><i class="icon fa fa-close"></i></button>
+                                            </form>
+                                        </td>
+                                    </tr>
+                                @empty
+                                    <tr>
+                                        <td colspan="5" class="text-center">موردی برای نمایش وجود ندارد.</td>
+                                    </tr>
+                                @endforelse
+                            @endslot
+                        @endcomponent
+                        {{--Paginate section--}}
+
+                    @endslot
+                @endcomponent
+            </div>
+        </div>
+    @endslot
     @slot('script')
     @endslot
 @endcomponent
+

+ 4 - 8
packages/product/src/views/index.blade.php

@@ -12,16 +12,12 @@
     @endslot
     @slot('content')
         <div class="row">
-            <div class="col-md-12">
-                <div class="col-md-11 message">
-                    @component('product::components.message')
-                    @endcomponent
-                </div>
+            <div class="col-lg-12">
                 @component('components.collapse-card' , ['title' => 'جست جو محصولات'])
-                    @component('product::components.message')
-                    @endcomponent
                     @slot('body')
                           <form method="GET" action="">
+                              @component('product::components.message')
+                              @endcomponent
                                 <div class="form-row">
                                     <div class="col">
                                         <label for="categories">{{ __(' نام محصول:') }}</label>
@@ -48,7 +44,7 @@
                                   </div>
                                     <div class="col">
                                       <label for="categories">{{ __('  نام ثبت کننده:') }}</label>
-                                      <input type="text" class="form-control" placeholder="ایجاد کننده دسته بندی..." name="creatorId" value="{{ request()->query('creatorId') }}">
+                                      <input type="text" class="form-control" placeholder="ایجاد کننده محصول..." name="creatorId" value="{{ request()->query('creatorId') }}">
                                     </div>
                               </div>
                                 <button type="submit" class="btn btn-primary float-left btnSearch" id="showProduct">جستجو

+ 5 - 5
packages/product/src/views/product/create.blade.php

@@ -13,16 +13,16 @@
 
     @slot('content')
         <div class="auth-background h-auto py-5">
-            <div class="container py-5">
+            <div class="py-5">
                 <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>
-                            @component('product::components.message')
-                            @endcomponent
-                            <div class="card-body mx-lg-5 px-lg-3">
+                            <div class="card-body mx-lg-6 px-lg-4">
+                                @component('product::components.message')
+                                @endcomponent
                                 <form method="POST" action="{{ route('products.store') }}" enctype="multipart/form-data" >
                                     @csrf
                                     <div class="form-group">
@@ -74,7 +74,7 @@
                                     </div>
                                     <div class="form-group">
                                         <label for="discription">{{ __('product.discription') }}</label></label><i class="required">&nbsp;*</i>
-                                        <textarea id="discription" type="text"class="form-control editor @error('discription') is-invalid @enderror" name="discription" autocomplete="discription" autofocus>
+                                        <textarea id="discription" type="text" class="form-control editor @error('discription') is-invalid @enderror" name="discription" autocomplete="discription" autofocus>
                                             {{ old('discription') }}
                                         </textarea>
 

+ 7 - 4
packages/product/src/views/product/edit.blade.php

@@ -12,9 +12,8 @@
     @endslot
     @slot('content')
         <div class="auth-background h-auto py-5">
-            <div class="container py-5">
-                @component('product::components.message')
-                @endcomponent
+            <div class=" py-5">
+
                 @if(session()->has('image_deleted'))
                     <div class="alert alert-dismissible alert-success">
                         <button class="close" type="button" data-dismiss="alert">×</button>
@@ -25,7 +24,9 @@
                     <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">
+                            <div class="card-body mx-lg-6 px-lg-4">
+                                @component('product::components.message')
+                                @endcomponent
                                 <form method="POST" action="{{ route('products.update',$product->id) }}"
                                       enctype="multipart/form-data">
                                     @csrf
@@ -125,6 +126,7 @@
                                             @enderror
                                         </div>
                                     </div>
+                                    <div class="form-row ">
                                     <div class="form-group col-lg-4">
                                         <label for="ReleaseStatus">{{ __('product.ReleaseStatus') }}</label><i class="required"> *</i>
                                         <select id="ReleaseStatus" type="text" class="form-control @error('ReleaseStatus') is-invalid @enderror" name="ReleaseStatus" autocomplete="ReleaseStatus">
@@ -138,6 +140,7 @@
                                             </span>
                                         @enderror
                                     </div>
+                                    </div>
                                     <div class="form-group">
                                         <label for="discription">{{ __('product.discription') }}</label><i class="required">&nbsp;*</i>
                                         <textarea id="discription" type="text" class="form-control editor @error('discription') is-invalid @enderror" name="discription" autocomplete="discription">

+ 58 - 0
packages/product/src/views/product/include/simpleProduct.blade.php

@@ -0,0 +1,58 @@
+<div class="card">
+    <div class="card-header">
+        <strong>{{ __('ثبت اطلاعات محصول ساده') }}</strong>&nbsp;<i class="required">{{$product->id}}</i>
+    </div>
+    <div class="card-body mx-lg-6 px-lg-4">
+    <div class="form-row ">
+        <input type="hidden" value="{{$product->id}}" name="product_id">
+        <div class="form-group col-lg-3">
+            <label for="sku">{{ __('product.sku') }}</label>
+            <input id="sku" type="text" class="form-control @error('sku') is-invalid @enderror" name="sku"
+                   autocomplete="sku" value="{{$product->sku}}" autofocus>
+            @error('sku')
+            <span class="invalid-feedback" role="alert">
+                     <strong>{{ $message }}</strong>
+                 </span>
+            @enderror
+        </div>
+        <div class="form-group col-lg-3">
+            <label for="status">{{ __('product.status') }}</label><i class="required">&nbsp;*</i>
+            <select id="status" type="text" class="form-control  @error('status') is-invalid @enderror" name="status" autocomplete="status">
+                <option value="1" @if ($product->status === 'موجود')  selected='selected'@endif>موجود</option>
+                <option value="0" {{ (old('status') == '1') ? 'selected' : '' }}>ناموجود</option>
+
+            </select>
+            @error('status')
+            <span class="invalid-feedback" role="alert">
+                    <strong>{{ $message }}</strong>
+                </span>
+            @enderror
+        </div>
+        <div class="form-group col-lg-3">
+            <label for="title">{{ __('product.price') }}</label><i class="required">&nbsp;*</i>
+            <input id="input.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 col-lg-3">
+            <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="{{$product->sale_price}}" autocomplete="sale_price" autofocus>
+            @error('sale_price')
+            <span class="invalid-feedback" role="alert">
+                     <strong>{{ $message }}</strong>
+                 </span>
+            @enderror
+        </div>
+    </div>
+</div>
+</div>
+
+
+
+
+
+
+

+ 39 - 32
packages/product/src/views/product/include/variableAttribute.blade.php

@@ -1,40 +1,47 @@
-
-
 <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.store') }}" enctype="multipart/form-data">
-                    @csrf
-                    <div class="form-row ">
-                        <div class="form-group col-lg-7">
-                            <label for="status">{{ __('attribute.titleProduct') }}</label><i class="required">&nbsp;*</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>
-                            </select>
-                            @error('status')
-                            <span class="invalid-feedback" role="alert">
-                                 <strong>{{ $message }}</strong>
-                             </span>
-                            @enderror
-                        </div>
-                        <div class="col-lg-2">
-                            <button type="submit" class="btn btn-primary btn_create">
-                                {{ __('افزودن ') }}
-                            </button>
-                        </div>
-                    </div>
-                </form>
-            </div>
-            <div class="card-footer">
-            </div>
+            <strong>{{ __('انتخاب ویژگی ها') }}</strong>
         </div>
-    </div>
+        <div class="card-body mx-lg-6 px-lg-4">
+            @csrf
+            <div class="form-row ">
 
+                <div class="form-group col-lg-4">
+                    <label for="status">{{ __('attribute.titleProduct') }}</label><i class="required">&nbsp; *</i>
+                    <select id="attributes" type="text"
+                            class="form-control attributes @error('attributes') is-invalid @enderror"
+                            name="attributes" value="{{ old('attributes') }}" autocomplete="attributes">
 
+                        @foreach($attributes as $attr_id)
 
+                            <option value="{{$attr_id->id}}">{{$attr_id->title}}</option>
 
+                        @endforeach
+                    </select>
+                    @error('ReleaseStatus')
+                    <span class="invalid-feedback" role="alert">
+                           <strong>{{ $message }}</strong>
+                    </span>
+                    @enderror
+                </div>
+                <span class="btn btn-primary btn_create attribute_creator">
+                       <i class="fa fa-plus"></i> {{ __('افزودن ') }}
+                </span>
+            </div>
+            <div class="form-row">
+                <div class="col-lg-5 added_attribute "  >
+                    <div class="col-lg-6">
+                        <label for="" class="label"></label>
+                    </div>
+                    <select name="" id="" class="js-example-tokenizer" multiple="multiple">
+                        <option value=""></option>
+                    </select>
+                    <a href="" class="deleteGallery btn btn-danger pull-left">
+                        <i class="icon fa fa-close AddPad"></i>
+                    </a>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 54 - 0
packages/product/src/views/product/include/variableAttribute.php

@@ -0,0 +1,54 @@
+<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-6 px-lg-4">
+            @csrf
+            <div class="form-row ">
+                <div class="form-group col-lg-4">
+                    <label for="status">{{ __('attribute.titleProduct') }}</label><i class="required">&nbsp; *</i>
+                    <select id="attributes[]" type="text"
+                            class="form-control select2-simple @error('attributes') is-invalid @enderror"
+                            name="attributes" value="{{ old('attributes') }}" autocomplete="attributes"
+                            multiple="multiple">
+                        <option value="">انتخاب کنید...</option>
+                        @foreach($attributes as $attr_id)
+                            <option value="{{$attr_id->id}}">{{$attr_id->title}}</option>
+                        @endforeach
+                    </select>
+                    @error('ReleaseStatus')
+                    <span class="invalid-feedback" role="alert">
+                           <strong>{{ $message }}</strong>
+                    </span>
+                    @enderror
+                </div>
+                <span class="btn btn-primary btn_create attribute_creator">
+                       <i class="fa fa-plus"></i> {{ __('افزودن ') }}
+                </span>
+            </div>
+            <div class="form-row ">
+                <div class="col-lg-6 added_attribute" id="added_attribute">
+                    <label for="">{{$attr_id->title}}</label>
+                    <select name="states[]" id="" class="js-example-tokenizer" multiple>
+                        <option value="">uyt</option>
+                    </select>
+                    <a href="" class="deleteGallery btn btn-danger pull-left">
+                        <i class="icon fa fa-close AddPad"></i>
+                    </a>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script>
+    $(document).on('click', '.attribute_creator', function () {
+        $(".added_attribute:last").after($(".added_attribute:last").clone());
+        $("div#added_attribute").addClass("added_attribute_show");
+        selecte2.init(selecte2);
+    });
+</script>
+
+
+
+

+ 114 - 0
packages/product/src/views/product/simpleEditProduct.blade.php

@@ -0,0 +1,114 @@
+@component('panel.layouts.component', ['title' => 'ثبت محصول ساده'])
+
+    @slot('style')
+
+    @endslot
+    @slot('subject')
+        <h1><i class="fa fa-users"></i> ثبت محصول ساده </h1>
+        <p>ثبت محصول ساده در فروشگاه.</p>
+    @endslot
+    @slot('breadcrumb')
+        <li class="breadcrumb-item">محصولات</li>
+    @endslot
+
+    @slot('content')
+        <div class="auth-background h-auto py-5">
+            <div class="py-5">
+                <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>&nbsp;<i class="required">{{$product->id}}</i>
+                            </div>
+
+                            <div class="card-body mx-lg-6 px-lg-4">
+                                @component('product::components.message')
+                                @endcomponent
+                                <form method="POST" action="{{ route('saveProductStepThree') }}" enctype="multipart/form-data" >
+                                    @csrf
+                                    <input type="hidden" value="{{$product->id}}" name="product_id">
+                                    <div class="form-group">
+                                        <label for="title">{{ __('product.title') }}</label><i class="required">&nbsp;*</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-row ">
+                                        <div class="form-group col-lg-6">
+                                            <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 col-lg-6">
+                                            <label for="ReleaseStatus">{{ __('product.ReleaseStatus') }}</label><i
+                                                class="required"> *</i>
+                                            <select id="ReleaseStatus" type="text"
+                                                    class="form-control @error('ReleaseStatus') is-invalid @enderror"
+                                                    name="ReleaseStatus" autocomplete="ReleaseStatus">
+                                                <option value="draft"
+                                                        @if($product->ReleaseStatus==='پیشنویس') selected='selected' @endif>
+                                                    پیشنویس
+                                                </option>
+                                                <option value="pending"
+                                                        @if($product->ReleaseStatus==='در انتظار انتشار') selected='selected' @endif>
+                                                    در انتظار انتشار
+                                                </option>
+                                                <option value="published"
+                                                        @if($product->ReleaseStatus==='منتشر شده') selected='selected' @endif>
+                                                    منتشر شده
+                                                </option>
+                                            </select>
+                                            @error('ReleaseStatus')
+                                            <span class="invalid-feedback" role="alert">
+                                                <strong>{{ $message }}</strong>
+                                            </span>
+                                            @enderror
+                                        </div>
+                                    </div>
+
+                                        <div class="form-group">
+                                            <label for="discription">{{ __('product.discription') }}</label><i class="required">&nbsp;*</i>
+                                            <textarea id="discription" type="text" class="form-control editor @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>
+                                    @include('product::product.include.simpleProduct')
+                                    <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 class="card-footer">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+            </div>
+        </div>
+    @endslot
+
+    @slot('script')
+
+    @endslot
+
+@endcomponent
+

+ 0 - 96
packages/product/src/views/product/simpleProduct.blade.php

@@ -1,96 +0,0 @@
-@component('panel.layouts.component', ['title' => 'ثبت محصول جدید'])
-
-    @slot('style')
-
-    @endslot
-    @slot('subject')
-        <h1><i class="fa fa-users"></i> ثبت محصول جدید </h1>
-        <p>ثبت محصول جدید در فروشگاه.</p>
-    @endslot
-    @slot('breadcrumb')
-        <li class="breadcrumb-item">محصولات</li>
-    @endslot
-
-    @slot('content')
-        <div class="auth-background h-auto py-5">
-            <div class="container py-5">
-                <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>&nbsp;<i class="required">{{$product->id}}</i>
-                            </div>
-                            @component('product::components.message')
-                            @endcomponent
-                            <div class="card-body mx-lg-5 px-lg-3">
-                                <form method="POST" action="{{ route('saveProductStepThree') }}" enctype="multipart/form-data" >
-                                    @csrf
-                                    <div class="form-row ">
-                                        <input type="hidden" value="{{$product->id}}" name="product_id">
-                                    <div class="form-group col-lg-3">
-                                        <label for="sku">{{ __('product.sku') }}</label>
-                                        <input id="sku" type="text" class="form-control @error('sku') is-invalid @enderror" name="sku"
-                                               autocomplete="sku" value="{{$product->sku}}" autofocus>
-                                        @error('sku')
-                                        <span class="invalid-feedback" role="alert">
-                                                     <strong>{{ $message }}</strong>
-                                                 </span>
-                                        @enderror
-                                    </div>
-                                    <div class="form-group col-lg-3">
-                                        <label for="status">{{ __('product.status') }}</label><i class="required">&nbsp;*</i>
-                                        <select id="status" type="text" class="form-control  @error('status') is-invalid @enderror" name="status" autocomplete="status">
-                                            <option value="">انتخاب کنید</option>
-                                            <option value="0" {{ (old('status') == '1') ? 'selected' : '' }}>ناموجود</option>
-                                            <option value="1" @if ($product->status === 'موجود')  selected='selected'@endif>موجود</option>
-                                        </select>
-                                        @error('status')
-                                        <span class="invalid-feedback" role="alert">
-                                                    <strong>{{ $message }}</strong>
-                                                </span>
-                                        @enderror
-                                    </div>
-                                        <div class="form-group col-lg-3">
-                                            <label for="title">{{ __('product.price') }}</label><i class="required">&nbsp;*</i>
-                                            <input id="input.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 col-lg-3">
-                                            <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="{{$product->sale_price}}" autocomplete="sale_price" autofocus>
-                                            @error('sale_price')
-                                            <span class="invalid-feedback" role="alert">
-                                                     <strong>{{ $message }}</strong>
-                                                 </span>
-                                            @enderror
-                                        </div>
-                                        </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 class="card-footer">
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-    @endslot
-
-    @slot('script')
-
-    @endslot
-
-@endcomponent
-

+ 26 - 24
packages/product/src/views/product/variableProduct.blade.php

@@ -10,7 +10,7 @@
     @endslot
     @slot('content')
         <div class="auth-background h-auto">
-                @include('product::product.include.variableAttribute')
+            @include('product::product.include.variableAttribute')
         <div class="col-lg-12 col-md-12 mx-auto">
             <div class="card">
                 <div class="card-header">
@@ -18,35 +18,37 @@
                 </div>
                 @component('product::components.message')
                 @endcomponent
-                <div class="card-body mx-lg-5 px-lg-3">
-                    <form method="POST" action="{{ route('products.store',$product->id) }}" enctype="multipart/form-data" >
+                <div class="card-body mx-lg-6 px-lg-4">
+                    <form method="POST" action="{{ route('products.store',$product->id) }}"
+                          enctype="multipart/form-data">
                         @csrf
                         <div class="form-row ">
-                            <div class="form-group col-lg-7">
-                                <label for="status">{{ __('product.titleVariable') }}</label><i
-                                    class="required">&nbsp;*</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>
-                                </select>
-                                @error('status')
-                                <span class="invalid-feedback" role="alert">
-                                      <strong>{{ $message }}</strong>
+                            <div class="col-lg-2">
+                                <span class="btn btn-primary btn_create variable_creator">
+                                    <i class="fa fa-plus"></i> {{ __('افزودن ') }}
                                 </span>
-                                @enderror
                             </div>
-                            <div class="col-lg-2">
-                                <button type="submit" class="btn btn-primary btn_create">
-                                    {{ __('افزودن ') }}
-                                </button>
+                        </div>
+
+                        <div class="form-row container">
+                            <div class="col-lg-12 added_variable">
+                                <label for="" class="col-lg-12">tyui</label>
+                                <select type="text" class="col-lg-2 c">
+                                    <option value="">{{$product->id}}</option>
+                                </select>
+                                <select type="text" class="col-lg-2 c">
+                                    <option value="">{{$product->id}}</option>
+                                </select>
+                                <select type="text" class="col-lg-2 c">
+                                    <option value="">{{$product->id}}</option>
+                                </select>
+                                <select type="text" class="col-lg-2 c">
+                                    <option value="">{{$product->id}}</option>
+                                </select>
+                                @include('product::product.include.simpleProduct')
                             </div>
                         </div>
+
                     </form>
                 </div>
                 <div class="card-footer">

+ 5 - 2
resources/js/panel/panel.js

@@ -37,9 +37,12 @@ require('../app');
 // use the select2
 
   $(document).ready(function () {
-    $('.select2').select2();
+    $('.select2-simple').select2();
   });
-$('.select2-simple').select2();
+$(".js-example-tokenizer").select2({
+    tags: true,
+    tokenSeparators: [',', ' ']
+})
 //***************************************************************
 // setting tinymce(editor)
 var editor_config = {

+ 1 - 1
resources/lang/fa/category.php

@@ -4,7 +4,7 @@ return [
   'parent'          => ' parent ',
   'slug'          => ' slug ',
   'category_type'   => 'نوع دسته بندی',
-  'discription'     => ' توضیحات دسته بندی',
+  'discription'     => ' توضیحات ',
 
 ];
 

+ 1 - 1
resources/lang/fa/product.php

@@ -3,7 +3,7 @@ return [
   'categories'  => 'دسته بندی',
   'sale_price'  => 'قیمت فروش ویژه',
   'price'       => 'قیمت ',
-  'discription' => ' توضیحات محصول',
+  'discription' => ' توضیحات ',
   'ReleaseStatus' => 'وضعیت انتشار',
   'status'      => 'وضعیت محصول',
   'type'        => ' نوع محصول',

+ 1 - 1
resources/views/components/collapse-card.blade.php

@@ -1,5 +1,5 @@
 <div id="accordion" class="accordion">
-    <div class="container">
+    <div class="">
         <div class="card">
             <div class="card-header pb-2 bg-white border-bottom-0" id="headingOne">
                 <div class="mb-0 row">

+ 2 - 2
resources/views/panel/categories/create.blade.php

@@ -12,12 +12,12 @@
     @endslot
     @slot('content')
         <div class="auth-background h-auto py-5">
-            <div class="container py-5">
+            <div class="py-5">
                 <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">
+                            <div class="card-body mx-lg-6 px-lg-4">
                                 <form method="POST" action="{{ route('categories.store') }}" id="form">
                                     @csrf
                                     <div class="form-group">

+ 5 - 25
resources/views/panel/categories/edit.blade.php

@@ -1,24 +1,6 @@
 @component('panel.layouts.component', ['title' => 'ویرایش دسته جدید'])
 
     @slot('style')
-        <style>
-            .card-header {
-                text-align: center !important;
-            }
-
-            .form-control {
-
-                background-color: hsl(315, 22%, 86%);
-            }
-
-            .required {
-                color: red;
-            }
-
-            .py-5 {
-                padding-top: 0 !important;
-            }
-        </style>
     @endslot
     @slot('subject')
         <h1><i class="fa fa-users"></i> ویرایش دسته بندی </h1>
@@ -37,17 +19,15 @@
 
     @slot('content')
         <div class="auth-background h-auto py-5">
-            @component('product::components.message')
-            @endcomponent
-            <div class="container py-5">
-                <div class="row align-items-center">
 
+            <div class="py-5">
+                <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">
+                            <div class="card-body mx-lg-6 px-lg-4">
+                                @component('product::components.message')
+                                @endcomponent
                                 <form method="POST" action="{{ route('categories.update',$category->id) }}">
                                     @csrf
                                     @if ($category)

+ 3 - 4
resources/views/panel/categories/index.blade.php

@@ -18,12 +18,11 @@
     @slot('content')
         <div class="row">
             <div class="col-md-12">
-                <div class="col-md-11 message">
-                @component('product::components.message')
-                @endcomponent
-                </div>
                 @component('components.collapse-card' , ['title' => 'جست جو دسته بندی'])
+
                     @slot('body')
+                            @component('product::components.message')
+                            @endcomponent
                         <form method="GET" action="">
                             <div class="form-row">
                                 <div class="col">