$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";
}
}
return view('pages.product-detail', $this->data);
}
-
-
- public function excelToJson($file){
-
- }
}
$values = [];
foreach ($products as $product) {
-
$pv = $product->get($spec_name);
if (is_array($pv) && $data->type === 'list') {
}
$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);
continue;
}
-
if (null !== $filter_value) {
$fvmax = $filter_value[1];
$fvmin = $filter_value[0];
errorsForm: {},
user: '',
default_billing_address: null,
- default_delivery_address: null
+ default_delivery_address: null,
+ //
+ price: '',
+ ref: '',
+ statusConfig: false,
+ statusText: ''
},
beforeMount() {
id: id
});
});
+
+ this.price = this.$refs.optprice ?.dataset.default
+ this.statusText = this.$refs.statusConfig ?.dataset.incomplete
},
watch: {
.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)
}
},
/**
--- /dev/null
+<script>
+ export default {
+ data() {
+ return {
+ price: ''
+ }
+ },
+
+ methods: {
+
+ }
+ }
+</script>
.product-detail
+ .text-block-body
+ max-width: 570px
+ width: 100%
+
&-specifications
display: block
width: 100%
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)
-<button data-product-id="{{ $id }}" class="btn cart-add">
+<button data-product-id="{{ $id }}" class="btn cart-add" :class="{ 'pointer-events-none bg-grey-disabled' : price && !statusConfig }">
<span class="btn-text relative">
<span class="add">
- {{ __('Ajouter à ma sélection') }}
+ @if(isset($price))
+ {{ __('Ajouter au panier') }}
+ @else
+ {{ __('Ajouter à ma sélection') }}
+ @endif
</span>
<span class="added absolute top-0 left-0 w-full h-full flex items-center justify-ce hidden" style="top:-2px">
@svg('tick', 'w-4 mr-3 mt-1 inline absolute left-0') <span>{{ __('Produit ajouté') }}</span>
@extends('layouts/app')
+@php
+// dd(json_encode($filters, JSON_THROW_ON_ERROR),json_encode($filter_results));
+@endphp
+
@section('content')
@intro(['padding' => 'pb-1v'])
@php
$technical_sheet = $product->getMediaUrl('technical_sheet', false);
+ $specs = $product->json;
@endphp
@extends('layouts/app')
@include('partials.product-gallery')
{{-- Product text --}}
- <text-block class="product-detail-text sm:mt-6">
+ <text-block class="product-detail-text sm:mt-6 flex-auto">
<div class="mb-6">
@markdown($product->highlights)
</div>
</p>
@endif
+ @guest('web-clients')
+ @if($product->basic_selling_price)
+ <div class="mb-8">
+ <div>{{ __('Connectez-vous à votre compte pour afficher les prix') }}</div>
+ <a href="/se-connecter">{{ __('Se connecter') }}</a>
+ </div>
+ @endif
+ @endguest
+
+ @auth('web-clients')
+ @if($product->basic_selling_price)
+ <div class="opt-configurator bg-grey-200 p-12 mb-8">
+ <div class="opt-group">
+ @foreach($specs as $spec)
+ <div class="opt-group">
+ <label class="opt-name mb-2 inline-block">
+ {{ \Illuminate\Support\Str::ucfirst( $spec['name_fr']) }}
+ </label>
+ <div>
+ <select class="opt-select" v-on:change="changePrice">
+ <option selected disabled value="">Sélectionner</option>
+ @foreach($spec['options'] as $option)
+ <option data-price="{{ $option['sale_price'] }}" data-ref="{{ $option['ref'] }}">
+ {{ $option['name_fr'] }}
+ </option>
+ @endforeach
+ </select>
+ </div>
+ </div>
+ @endforeach
+ </div>
+ </div>
+ <div class="opt-infos mb-8">
+ <div class="opt-ref" v-cloak v-if="ref">{{ __('Référence') }} : <span id="opt-ref">@{{ ref }}</span></div>
+ <div class="opt-price">
+ {{ __('Prix unitaire') }} :
+ <span id="opt-price" ref="optprice" v-cloak data-default="{{ $product->basic_selling_price }}">@{{ price }}</span>{{ "€ ".__('HT') }}
+ </div>
+ <div class="opt-statut">{{ __('Statut') }} :
+ <span id="opt-statut" v-cloak :class="{ 'text-green' : statusConfig }" ref="statusConfig" data-incomplete="{{ __('La configuration est incomplète') }}" data-completed="{{ __('La configuration est complète') }}">
+ @{{ statusText }}
+ </span>
+ </div>
+ </div>
+ @endif
+ @endauth
@if(config('features.quote'))
- <cart-add :id="$product->id"></cart-add>
+ <cart-add :id="$product->id" :price="$product->basic_selling_price"></cart-add>
<span
data-tooltip="{{__('Ajoutez un ou plusieurs produits à votre sélection, ajustez les quantités et obtenez un devis.')}}"
class="font-display text-lg inline-block align-middle rounded-full border-grey-dark border-2 h-8 w-8 text-center ml-6">?</span>
@if ($filters && $filter_results)
<products-filters v-cloak
:product-type="{{ $product_type->id }}"
- :filter-data='@json($filters)'
+ :filter-data='JSON.parse($filters)'
:result-data='@json($filter_results)'
:translations='@json([
'result' => __('résultat'),
'navy-dark': '#0C213A',
'red': '#F81E60',
'light-b': '#D5D7DF',
+ 'green': '#369841',
'grey': {
+ 'disabled': '#B0B4C1',
'100': '#F7F8FC',
'200': '#EEF1F8',
'250': '#E7E9F3',