]> _ Git - pmi.git/commitdiff
wait #6231 @0:10
authorsoufiane <soufiane@cubedesigners.com>
Thu, 31 Aug 2023 15:01:43 +0000 (17:01 +0200)
committersoufiane <soufiane@cubedesigners.com>
Thu, 31 Aug 2023 15:01:43 +0000 (17:01 +0200)
resources/js/app.js
resources/views/pages/product-detail.blade.php

index 5fe35ec5757e3df608c15e510e879b5ace52a0b5..83e080f684937eb4f0661006f8379039755eb6cc 100644 (file)
@@ -733,3 +733,8 @@ $(document).on('click', 'button.cart-add', function () {
     }, 2000)
 });
 
+$(document).on("click", "#open-configurator", function() {
+    $(this).hide()
+    $("#product-price-container, #features-quotes").removeClass("hidden")
+})
+
index 28530ec0326f15483e0de3e2f82042f9eb487255..da21190a831fe6792e4f24c13b44965a4a700b91 100644 (file)
                 @endguest
 
                 @auth('web-clients')
-                    @if($product->basic_selling_price)
-                        @if($specs)
-                            <div class="opt-configurator bg-grey-200 p-12 mb-8">
-                                <div class="opt-group">
-                                    @foreach($specs as $spec)
-                                        @php
-                                            $containEmptyOption = array_filter($spec['options'], function($n) {
-                                                return empty($n['name_fr']);
-                                            });
-                                        @endphp
-                                        @if(sizeof($containEmptyOption) < 1 )
-                                        <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)
-                                                        @if($option['name_fr'] != "")
-                                                            <option data-price="{{ $option['sale_price'] }}" data-ref="{{ $option['ref'] }}">
-                                                                {{ $option['name_fr'] }}
-                                                                {{ floatval($option['sale_price']) > 0 ? '(+'.$option['sale_price'].' € HT)' : '' }}
-                                                            </option>
-                                                        @endif
-                                                    @endforeach
-                                                </select>
+                    @if($options)
+                        <button id="open-configurator" class="btn">
+                            Configurer le produit
+                        </button>
+                    @endif
+                    <div id="product-price-container" class="{{ $options ? 'hidden' : '' }}">
+                        @if($product->basic_selling_price)
+                            @if($specs)
+                                <div class="opt-configurator bg-grey-200 p-12 mb-8">
+                                    <div class="opt-group">
+                                        @foreach($specs as $spec)
+                                            @php
+                                                $containEmptyOption = array_filter($spec['options'], function($n) {
+                                                    return empty($n['name_fr']);
+                                                });
+                                            @endphp
+                                            @if(sizeof($containEmptyOption) < 1 )
+                                            <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)
+                                                            @if($option['name_fr'] != "")
+                                                                <option data-price="{{ $option['sale_price'] }}" data-ref="{{ $option['ref'] }}">
+                                                                    {{ $option['name_fr'] }}
+                                                                    {{ floatval($option['sale_price']) > 0 ? '(+'.$option['sale_price'].' € HT)' : '' }}
+                                                                </option>
+                                                            @endif
+                                                        @endforeach
+                                                    </select>
+                                                </div>
                                             </div>
+                                            @endif
+                                        @endforeach
+                                    </div>
+                                </div>
+                            @endif
+                            <div class="opt-infos mb-8">
+                                <div class="opt-ref text-navy" v-cloak>{{ __('Référence') }} : <span ref="refProduct" data-ref="{{ $product->reference }}">@{{ ref }}</span></div>
+                                <div class="opt-price text-navy">
+                                    @if($discount)
+                                        <div>
+                                            {{ __('Prix catalogue') }} :
+                                            <span class="line-through" ref="optprice" v-cloak data-default="{{ $product->basic_selling_price }}">@{{ price }}</span>{{ "€ ".__('HT') }}
                                         </div>
-                                        @endif
-                                    @endforeach
+                                        <div>
+                                            {{ __('Votre prix') }} :
+                                            <span ref="discount" data-value="{{ $discount }}"></span>
+                                            <span v-cloak data-default="{{ $product->basic_selling_price }}">@{{ priceDiscount }}</span>{{ "€ ".__('HT') }}
+                                        </div>
+                                    @else
+                                        {{ __('Prix unitaire') }} :
+                                        <span ref="optprice" v-cloak data-default="{{ $product->basic_selling_price }}">@{{ price }}</span>{{ "€ ".__('HT') }}
+                                    @endif
+                                </div>
+                                @if($options)
+                                <div class="opt-statut">{{ __('Statut') }} :
+                                    <span 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
-                        <div class="opt-infos mb-8">
-                            <div class="opt-ref text-navy" v-cloak>{{ __('Référence') }} : <span ref="refProduct" data-ref="{{ $product->reference }}">@{{ ref }}</span></div>
-                            <div class="opt-price text-navy">
-                                @if($discount)
-                                    <div>
-                                        {{ __('Prix catalogue') }} :
-                                        <span class="line-through" ref="optprice" v-cloak data-default="{{ $product->basic_selling_price }}">@{{ price }}</span>{{ "€ ".__('HT') }}
-                                    </div>
-                                    <div>
-                                        {{ __('Votre prix') }} :
-                                        <span ref="discount" data-value="{{ $discount }}"></span>
-                                        <span v-cloak data-default="{{ $product->basic_selling_price }}">@{{ priceDiscount }}</span>{{ "€ ".__('HT') }}
-                                    </div>
-                                @else
-                                    {{ __('Prix unitaire') }} :
-                                    <span ref="optprice" v-cloak data-default="{{ $product->basic_selling_price }}">@{{ price }}</span>{{ "€ ".__('HT') }}
                                 @endif
+                                <input type="hidden" ref="optionsExist" data-val="{{$options}}">
                             </div>
-                            @if($options)
-                            <div class="opt-statut">{{ __('Statut') }} :
-                                <span 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>
-                            @endif
-                            <input type="hidden" ref="optionsExist" data-val="{{$options}}">
-                        </div>
-                    @endif
+                        @endif
+                    </div>
                 @endauth
 
                 @if(config('features.quote'))
-                    <cart-add :id="$product->id" price="" reference="" :hasprice="$product->basic_selling_price" template="product-detail"></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>
+                    <div id="features-quotes" class="{{ $options ? 'hidden' : '' }}">
+                        <cart-add :id="$product->id" price="" reference="" :hasprice="$product->basic_selling_price" template="product-detail"></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>
+                    </div>
                 @endif
 
                 @isset($product->time_limit)