]> _ Git - pmi.git/commitdiff
#2810
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Jun 2019 15:37:12 +0000 (17:37 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Jun 2019 15:37:12 +0000 (17:37 +0200)
.env.production
app/Models/Category.php
app/Models/Product.php
app/Models/Producttype.php
app/Models/Specification.php
config/app.php
config/backpack/crud.php

index bd70f010b7a6ab7540978cdb954ee15480117814..5dcfe61b0df7b750cc6c2e15102bbc7a015f174d 100644 (file)
@@ -39,3 +39,4 @@ MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
 MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
 
 GOOGLE_ANALYTICS_ID=UA-4339912-10
+BACKPACK_LICENSE=YwdOWjeEczPAwy06GzkBJggW
index 57edddd0ee4b2dcbcc5d9a4d2cafc4fbeb3bb4d0..99b94ae9cd1764b6c1499979cc71cd8b2adc3247 100644 (file)
@@ -9,7 +9,8 @@ class Category extends CubistMagicNestedModel
     protected $table = 'catalog_categories';
 
     protected $_options = ['name' => 'category',
-        'plural' => 'categories',
+        'singular' => 'catégorie',
+        'plural' => 'catégories',
         'route' => 'catalog_category'];
 
     public function setFields()
index dbb4a3c82de7e61c0c90d8986f05813bc164fb7f..e5384a93b5a0ba076c54bf3ce4fa7e31a5872fcb 100644 (file)
@@ -11,20 +11,21 @@ class Product extends CubistMagicModel
     protected $table = 'catalog_products';
 
     protected $_options = ['name' => 'product',
-        'plural' => 'products'];
+        'singular'=>'produit',
+        'plural' => 'produits'];
 
     public function setFields()
     {
         parent::setFields();
 
         $this->addField(['name' => 'name',
-            'label' => 'Product name',
+            'label' => 'Nom du produit',
             'type' => 'Text',
             'column' => true,
             'tab' => 'General']);
 
         $this->addField(['name' => 'reference',
-            'label' => 'SKU',
+            'label' => 'SKU (référence)',
             'type' => 'Text',
             'column' => true,
             'unique' => true,
@@ -50,6 +51,9 @@ class Product extends CubistMagicModel
                     }
                 }
             }
+            if (!count($in)) {
+                continue;
+            }
             $params = ['tab' => 'Specifications',
                 'name' => 's_' . Str::snake($spec->name),
                 'label' => $spec->name,
@@ -58,8 +62,19 @@ class Product extends CubistMagicModel
                 'when' => ['product_type' => $in],
             ];
 
+            if ($spec->prefix) {
+                $params['prefix'] = $spec->prefix;
+            }
+            if ($spec->unit) {
+                $params['suffix'] = $spec->unit;
+            }
+
             if ($spec->type == 'numeric') {
                 $params['type'] = 'Number';
+            } else if ($spec->type == 'range') {
+                $params['type'] = 'Range';
+            } else if ($spec->type == 'text') {
+                $params['type'] = 'Text';
             } else {
                 $params['type'] = 'SelectFromArray';
                 $options = [];
@@ -76,31 +91,31 @@ class Product extends CubistMagicModel
 
 
         $this->addField(['name' => 'slug',
-            'type' => 'Slug',
+            'type' => 'Slug (URL)',
             'label' => 'Slug',
             'column' => true,
             'tab' => 'General']);
 
         $this->addField(['name' => 'online',
             'type' => 'Checkbox',
-            'label' => 'Online',
+            'label' => 'En ligne',
             'column' => true,
             'tab' => 'General']);
 
         $this->addField(['name' => 'public',
             'type' => 'Checkbox',
-            'label' => 'Public',
+            'label' => 'Publique',
             'column' => true,
             'tab' => 'General']);
 
         $this->addField(['name' => 'supplier',
-            'label' => 'Supplier',
+            'label' => 'Fournisseur',
             'type' => 'Text',
             'translatable' => false,
             'tab' => 'Supplier']);
 
         $this->addField(['name' => 'supplier_reference',
-            'label' => 'Supplier reference',
+            'label' => 'Référence fournisseur',
             'type' => 'Text',
             'translatable' => false,
             'tab' => 'Supplier']);
@@ -116,7 +131,7 @@ class Product extends CubistMagicModel
             'tab' => 'Texts']);
 
         $this->addField(['name' => 'images',
-            'label' => 'Product pictures',
+            'label' => 'Images du produit',
             'type' => 'Images',
             'tab' => 'Media']);
 
@@ -131,7 +146,7 @@ class Product extends CubistMagicModel
             'tab' => 'Texts']);
 
         $this->addField(['name' => 'accessories',
-            'label' => 'Accessories',
+            'label' => 'Accessoires',
             'type' => 'Markdown',
             'tab' => 'Texts']);
 
index 830d24a7af7c8f4b9d87d139c577ebcaf25bc4ed..75adaf75223893baa0240a54bf13670bf91c2107 100644 (file)
@@ -10,12 +10,14 @@ class ProductType extends CubistMagicModel
 
     protected $_options = ['name' => 'product type',
         'route' => 'producttype',
-        'plural' => 'product types'];
+        'singular' => 'type de produit',
+        'plural' => 'types de produit'
+    ];
 
     public function setFields()
     {
         $this->addField(['name' => 'name',
-            'label' => 'Type name',
+            'label' => 'Nom du type de produit',
             'type' => 'Text',
             'column' => true]);
 
@@ -28,13 +30,18 @@ class ProductType extends CubistMagicModel
         );
 
         $this->addField(['name' => 'featured_on_home',
-            'label' => 'Featured on homepage',
+            'label' => 'Mis en avant sur la page d\'accueil',
             'type' => 'Checkbox',
             'column' => true,
             'default' => 1]);
 
+        $this->addField(['name' => 'filters',
+            'label' => 'Spécifications utilisées comme filtre',
+            'type' => 'SelectFromModelMultiple',
+            'model' => 'App\Models\Specification']);
+
         $this->addField(['name' => 'specifications',
-            'label' => 'Specifications',
+            'label' => 'Autre spécifications',
             'type' => 'SelectFromModelMultiple',
             'model' => "App\Models\Specification",
         ]);
@@ -44,4 +51,9 @@ class ProductType extends CubistMagicModel
     {
         return $this->relationship('specifications');
     }
+
+    public function filters()
+    {
+        return $this->relationship('filters');
+    }
 }
index 0ee9a22ab3feab3ac1188d2cd375746edbf6a963..fac4b390bd5d0461862e80ffdbe16328cedfa1a0 100644 (file)
@@ -10,14 +10,15 @@ class Specification extends CubistMagicModel
     protected $table = 'catalog_specifications';
 
     protected $_options = ['name' => 'specification',
-        'plural' => 'specifications'];
+        'singular' => 'spécification',
+        'plural' => 'spécifications'];
 
     public function setFields()
     {
         parent::setFields();
 
         $this->addField(['name' => 'name',
-            'label' => 'Specification name',
+            'label' => 'Nom de la spécification',
             'type' => 'Text',
             'column' => true]);
 
@@ -25,7 +26,7 @@ class Specification extends CubistMagicModel
             'label' => 'Type',
             'type' => 'SelectFromArray',
             'column' => true,
-            'options' => ['numeric' => 'Numeric value', 'list' => 'Value in a list']]);
+            'options' => ['numeric' => 'Numeric value', 'range' => 'Numeric range', 'list' => 'Value in a list', 'text' => 'Text value']]);
 
         $this->addField(['name' => 'options',
             'label' => 'Options',
@@ -34,12 +35,32 @@ class Specification extends CubistMagicModel
             'columns' => [
                 'name' => 'Name',
             ],
+            'when' => ['type' => 'list'],
         ]);
+
+        $this->addField(['name' => 'prefix',
+            'label' => 'Préfixe',
+            'type' => 'SelectFromArray',
+            'options' => ['' => 'no prefix', '>' => '>', '<' => '<', '±' => '±', '≥' => '≥', '≤' => '≤'],
+            'when' => ['type' => 'numeric']
+        ]);
+
+        $this->addField(['name' => 'unit',
+            'label' => 'Unité',
+            'type' => 'Text',
+            'when' => ['type' => ['numeric', 'interval']],
+            'translatable' => false,
+        ]);
+    }
+
+    public function product_type_filters()
+    {
+        return $this->belongsToMany('App\Models\ProductType', 'catalog_product_types_filters_rel_btm');
     }
 
-    public function product_type()
+    public function product_type_specifications()
     {
-        return $this->belongsToMany('App\Models\ProductType', 'rel_btm_catalog_specifications_catalog_product_types');
+        return $this->belongsToMany('App\Models\ProductType', 'catalog_product_types_specifications_rel_btm');
     }
 
 }
index c800454963ace84f48f77c695a1ea76838a5e472..696ac99060f29268d49877c9f0f45da15f5f53a3 100644 (file)
@@ -80,7 +80,7 @@ return [
     |
     */
 
-    'locale' => 'en',
+    'locale' => 'fr',
 
     /*
     |--------------------------------------------------------------------------
index 2634c87bced6a9d592ed73239055b399c3ec1014..470bc49b5c45366f18e67ddfdf173ac8125d2629 100644 (file)
@@ -107,6 +107,9 @@ return [
     'translatable_field_icon_position' => 'right', // left or right
 
     'locales' => [
+        'fr' => 'French',
+        'en' => 'English',
+        "de" => "German",
         // "af_NA" => "Afrikaans (Namibia)",
         // "af_ZA" => "Afrikaans (South Africa)",
         // "af" => "Afrikaans",
@@ -223,7 +226,7 @@ return [
         // "en_GB" => "English (United Kingdom)",
         // "en_US" => "English (United States)",
         // "en_ZW" => "English (Zimbabwe)",
-        'en' => 'English',
+
         // "eo" => "Esperanto",
         // "et_EE" => "Estonian (Estonia)",
         // "et" => "Estonian",
@@ -282,7 +285,7 @@ return [
         // "de_LI" => "German (Liechtenstein)",
         // "de_LU" => "German (Luxembourg)",
         // "de_CH" => "German (Switzerland)",
-        "de" => "German",
+
         // "el_CY" => "Greek (Cyprus)",
         // "el_GR" => "Greek (Greece)",
         // "el" => "Greek",