]> _ Git - pmi.git/commitdiff
#2825
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Jun 2019 18:15:50 +0000 (20:15 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Jun 2019 18:15:50 +0000 (20:15 +0200)
app/Models/Product.php
app/Models/Producttype.php
resources/views/vendor/backpack/base/inc/sidebar_content.blade.php

index e5384a93b5a0ba076c54bf3ce4fa7e31a5872fcb..7b2072b2d4443ec09576b18176c4f79abcdcfcc0 100644 (file)
@@ -3,7 +3,6 @@
 namespace App\Models;
 
 use Cubist\Backpack\app\Magic\Models\CubistMagicModel;
-use Cubist\Util\ObjectUtil;
 use Illuminate\Support\Str;
 
 class Product extends CubistMagicModel
@@ -11,7 +10,7 @@ class Product extends CubistMagicModel
     protected $table = 'catalog_products';
 
     protected $_options = ['name' => 'product',
-        'singular'=>'produit',
+        'singular' => 'produit',
         'plural' => 'produits'];
 
     public function setFields()
@@ -22,7 +21,7 @@ class Product extends CubistMagicModel
             'label' => 'Nom du produit',
             'type' => 'Text',
             'column' => true,
-            'tab' => 'General']);
+            'tab' => 'Informations génerales']);
 
         $this->addField(['name' => 'reference',
             'label' => 'SKU (référence)',
@@ -30,14 +29,14 @@ class Product extends CubistMagicModel
             'column' => true,
             'unique' => true,
             'translatable' => false,
-            'tab' => 'General']);
+            'tab' => 'Informations génerales']);
 
         $this->addField(['name' => 'product_type',
             'label' => 'Type de produit',
             'type' => 'SelectFromModel',
             'model' => 'App\Models\ProductType',
             'column' => true,
-            'tab' => 'Specifications']);
+            'tab' => 'Spécifications']);
 
         $specifications = Specification::all();
         $types = ProductType::all();
@@ -50,11 +49,18 @@ class Product extends CubistMagicModel
                         break;
                     }
                 }
+                foreach ($type->filters as $rel_specification) {
+                    if ($spec->id == $rel_specification->id) {
+                        $in[] = $type->id;
+                        break;
+                    }
+                }
+                $in = array_unique($in);
             }
             if (!count($in)) {
                 continue;
             }
-            $params = ['tab' => 'Specifications',
+            $params = ['tab' => 'Spécifications',
                 'name' => 's_' . Str::snake($spec->name),
                 'label' => $spec->name,
                 'fake' => true,
@@ -91,64 +97,64 @@ class Product extends CubistMagicModel
 
 
         $this->addField(['name' => 'slug',
-            'type' => 'Slug (URL)',
-            'label' => 'Slug',
+            'type' => 'Slug',
+            'label' => 'Slug (URL)',
             'column' => true,
-            'tab' => 'General']);
+            'tab' => 'Informations génerales']);
 
         $this->addField(['name' => 'online',
             'type' => 'Checkbox',
             'label' => 'En ligne',
             'column' => true,
-            'tab' => 'General']);
+            'tab' => 'Informations génerales']);
 
         $this->addField(['name' => 'public',
             'type' => 'Checkbox',
             'label' => 'Publique',
             'column' => true,
-            'tab' => 'General']);
+            'tab' => 'Informations génerales']);
 
         $this->addField(['name' => 'supplier',
             'label' => 'Fournisseur',
             'type' => 'Text',
             'translatable' => false,
-            'tab' => 'Supplier']);
+            'tab' => 'Informations fournisseur']);
 
         $this->addField(['name' => 'supplier_reference',
             'label' => 'Référence fournisseur',
             'type' => 'Text',
             'translatable' => false,
-            'tab' => 'Supplier']);
+            'tab' => 'Informations fournisseur']);
 
         $this->addField(['name' => 'highlights',
             'label' => 'Product highlights',
             'type' => 'Markdown',
-            'tab' => 'Texts']);
+            'tab' => 'Textes']);
 
         $this->addField(['name' => 'descriptions',
             'label' => 'Description',
             'type' => 'Markdown',
-            'tab' => 'Texts']);
+            'tab' => 'Textes']);
 
         $this->addField(['name' => 'images',
             'label' => 'Images du produit',
             'type' => 'Images',
-            'tab' => 'Media']);
+            'tab' => 'Média']);
 
         $this->addField(['name' => 'dimensions',
             'label' => 'Dimensions',
             'type' => 'Markdown',
-            'tab' => 'Texts']);
+            'tab' => 'Textes']);
 
         $this->addField(['name' => 'options',
             'label' => 'Options',
             'type' => 'Markdown',
-            'tab' => 'Texts']);
+            'tab' => 'Textes']);
 
         $this->addField(['name' => 'accessories',
             'label' => 'Accessoires',
             'type' => 'Markdown',
-            'tab' => 'Texts']);
+            'tab' => 'Textes']);
 
     }
 }
index 75adaf75223893baa0240a54bf13670bf91c2107..cc2f40858f39b0f22f77e7f72018bd198c72488f 100644 (file)
@@ -21,8 +21,9 @@ class ProductType extends CubistMagicModel
             'type' => 'Text',
             'column' => true]);
 
-        $this->addField(['name' => 'type',
-                'label' => 'Product family',
+        $this->addField([
+            'name' => 'type',
+                'label' => 'Famille de produits',
                 'type' => 'SelectFromArray',
                 'options' => ['captor' => 'Captor', 'system' => 'System'],
                 'column' => true,
@@ -32,7 +33,7 @@ class ProductType extends CubistMagicModel
         $this->addField(['name' => 'featured_on_home',
             'label' => 'Mis en avant sur la page d\'accueil',
             'type' => 'Checkbox',
-            'column' => true,
+            'column' => false,
             'default' => 1]);
 
         $this->addField(['name' => 'filters',
index b2902e878f7a69f2ac103b91bf861a01231fee1e..d0a67244aaab800b3afa0578967c930ad254dd9c 100644 (file)
@@ -38,9 +38,9 @@
     <li><a href='{{ backpack_url('specification') }}'><i class='fa fa-align-left'></i>
             <span>Spécifications</span></a>
     </li>
-    <li><a href='{{ backpack_url('catalog_category') }}'><i class='fa fa-folder-open'></i>
-            <span>Catégories</span></a>
-    </li>
+{{--    <li><a href='{{ backpack_url('catalog_category') }}'><i class='fa fa-folder-open'></i>--}}
+{{--            <span>Catégories</span></a>--}}
+{{--    </li>--}}
 @endcan
 
 @can('dev')