From: soufiane
Date: Wed, 5 Apr 2023 17:07:15 +0000 (+0200)
Subject: wip #5850 @7:30
X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=0dc0e24e55a49a0954f038e11c0d9a900598c1cb;p=pmi.git
wip #5850 @7:30
---
diff --git a/app/Http/Controllers/Admin/ProductBaseController.php b/app/Http/Controllers/Admin/ProductBaseController.php
index 31c547c..c557d65 100644
--- a/app/Http/Controllers/Admin/ProductBaseController.php
+++ b/app/Http/Controllers/Admin/ProductBaseController.php
@@ -208,7 +208,7 @@ class ProductBaseController extends CubistMagicController {
$contents = $datas['resume']. "\n";
$contents .= "Details : \r\n\n";
foreach ($datas['details'] as $filename => $values ) {
- $contents .= $filename."\r\n";
+ $contents .= "Fichier $filename \r\n";
foreach ($values as $product => $value) {
$contents .= "> $product : $value \r\n";
}
diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php
index dc8481c..3527e3a 100644
--- a/app/Http/Controllers/ProductController.php
+++ b/app/Http/Controllers/ProductController.php
@@ -59,9 +59,4 @@ class ProductController extends CubistFrontController
}
return view('pages.product-detail', $this->data);
}
-
-
- public function excelToJson($file){
-
- }
}
diff --git a/app/Models/Product.php b/app/Models/Product.php
index 3cd479b..8c8bf97 100644
--- a/app/Models/Product.php
+++ b/app/Models/Product.php
@@ -548,7 +548,6 @@ class Product extends CubistMagicPageModel
$values = [];
foreach ($products as $product) {
-
$pv = $product->get($spec_name);
if (is_array($pv) && $data->type === 'list') {
@@ -598,17 +597,21 @@ class Product extends CubistMagicPageModel
}
$f['options'] = $options;
} else if ($data->type === 'numeric' || $data->type === 'range' || $data->type === 'numeric_list') {
- $f['min'] = INF;
- $f['max'] = -INF;
- $f['unit'] = $data->unit;
- $f['type'] = 'range';
- $f['scale'] = $data->logarithmic_scale ? 'log' : 'linear';
-
- if ($data->type === 'numeric' || $data->type === 'numeric_list') {
- $f['prefix'] = $data['prefix'];
- } else {
- $f['prefix'] = '';
- }
+ //$checkV = array_filter($products, function($n) use($spec_name) { return $n->get($spec_name) !== null; });
+
+ //if($checkV) {
+ $f['min'] = INF;
+ $f['max'] = -INF;
+ $f['unit'] = $data->unit;
+ $f['type'] = 'range';
+ $f['scale'] = $data->logarithmic_scale ? 'log' : 'linear';
+
+ if ($data->type === 'numeric' || $data->type === 'numeric_list') {
+ $f['prefix'] = $data['prefix'];
+ } else {
+ $f['prefix'] = '';
+ }
+ //}
foreach ($products as $product) {
$v = $product->get($spec_name);
@@ -618,7 +621,6 @@ class Product extends CubistMagicPageModel
continue;
}
-
if (null !== $filter_value) {
$fvmax = $filter_value[1];
$fvmin = $filter_value[0];
diff --git a/resources/js/app.js b/resources/js/app.js
index 472fa79..ac305c0 100644
--- a/resources/js/app.js
+++ b/resources/js/app.js
@@ -76,7 +76,12 @@ const app = new Vue({
errorsForm: {},
user: '',
default_billing_address: null,
- default_delivery_address: null
+ default_delivery_address: null,
+ //
+ price: '',
+ ref: '',
+ statusConfig: false,
+ statusText: ''
},
beforeMount() {
@@ -102,6 +107,9 @@ const app = new Vue({
id: id
});
});
+
+ this.price = this.$refs.optprice ?.dataset.default
+ this.statusText = this.$refs.statusConfig ?.dataset.incomplete
},
watch: {
@@ -402,6 +410,30 @@ const app = new Vue({
.catch(function (error) {
}
)
+ },
+ /**
+ *
+ */
+ changePrice() {
+ let options = [];
+ const selectOptions = document.querySelectorAll(".opt-select")
+
+ selectOptions.forEach(function(e, i) {
+ options.push(e.selectedOptions[0])
+ })
+
+ let prices = options.map(opt => parseFloat(opt.dataset.price)).filter(n => !isNaN(n)),
+ refs = options.map(opt => opt.dataset.ref).filter(n => n !== undefined).join("/")
+
+ if(prices.length === selectOptions.length) {
+ this.statusConfig = true
+ this.statusText = this.$refs.statusConfig.dataset.completed
+ }
+
+ let total = prices.reduce((init, current) => init + current)
+
+ this.ref = refs
+ this.price = total + parseFloat(this.$refs.optprice.dataset.default)
}
},
/**
diff --git a/resources/js/components/Configurator.vue b/resources/js/components/Configurator.vue
new file mode 100644
index 0000000..fa35921
--- /dev/null
+++ b/resources/js/components/Configurator.vue
@@ -0,0 +1,13 @@
+
diff --git a/resources/styles/components/product-details.styl b/resources/styles/components/product-details.styl
index 5b2ef4c..8a27bec 100644
--- a/resources/styles/components/product-details.styl
+++ b/resources/styles/components/product-details.styl
@@ -1,5 +1,9 @@
.product-detail
+ .text-block-body
+ max-width: 570px
+ width: 100%
+
&-specifications
display: block
width: 100%
@@ -18,3 +22,21 @@
dd
width: 40%
max-width: 400px
+
+.opt
+ &-group:not(:last-of-type)
+ margin-bottom: 12px
+
+ &-select
+ display: block
+ width: 100%
+ outline: 2px solid transparent
+ outline-offset: 2px
+ border-width: 1px
+ border-color: rgba(247, 248, 252, 1)
+ color: theme('colors.grey.dark')
+ border-radius: 0.25rem
+ padding: 15px 20px
+ appearance: none
+ background: url(/images/icon-angle-down.svg) no-repeat right #fff
+ background-position-x: calc(100% - 20px)
diff --git a/resources/views/components/cart-add.blade.php b/resources/views/components/cart-add.blade.php
index dc5aa01..61591be 100644
--- a/resources/views/components/cart-add.blade.php
+++ b/resources/views/components/cart-add.blade.php
@@ -1,7 +1,11 @@
-
@endif
+ @guest('web-clients')
+ @if($product->basic_selling_price)
+
+ @endif
+ @endguest
+
+ @auth('web-clients')
+ @if($product->basic_selling_price)
+
+
+ @foreach($specs as $spec)
+
+
+
+
+
+
+ @endforeach
+
+
+
+
{{ __('Référence') }} : @{{ ref }}
+
+ {{ __('Prix unitaire') }} :
+ @{{ price }}{{ "⬠".__('HT') }}
+
+
{{ __('Statut') }} :
+
+ @{{ statusText }}
+
+
+
+ @endif
+ @endauth
@if(config('features.quote'))
-
+
?
diff --git a/resources/views/pages/products.blade.php b/resources/views/pages/products.blade.php
index 362b051..ec53d15 100644
--- a/resources/views/pages/products.blade.php
+++ b/resources/views/pages/products.blade.php
@@ -10,7 +10,7 @@
@if ($filters && $filter_results)
__('résultat'),
diff --git a/tailwind.config.js b/tailwind.config.js
index d435ecb..14a8423 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -22,7 +22,9 @@ module.exports = {
'navy-dark': '#0C213A',
'red': '#F81E60',
'light-b': '#D5D7DF',
+ 'green': '#369841',
'grey': {
+ 'disabled': '#B0B4C1',
'100': '#F7F8FC',
'200': '#EEF1F8',
'250': '#E7E9F3',