enhance add to basket
This commit is contained in:
@@ -32,14 +32,32 @@
|
||||
'offer_id': offer_id,
|
||||
'quantity': quantity,
|
||||
};
|
||||
$.post('{{ route("Shop.Basket.addBasket") }}', data, function() {
|
||||
console.log('ici');
|
||||
});
|
||||
console.log(type);
|
||||
console.log(offer_id);
|
||||
console.log(quantity);
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
var buttons = {
|
||||
cancel: {
|
||||
label: '{{ __('Continuer mes achats') }}',
|
||||
className: 'btn-secondary'
|
||||
},
|
||||
confirm: {
|
||||
label: '{{ __('Commander') }}',
|
||||
className: 'btn-success',
|
||||
callback: function() {
|
||||
submitModal(form_id);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
openModal(
|
||||
'Ajout dans le panier',
|
||||
'basket-form',
|
||||
"{{ route('Shop.Basket.modalBasket') }}/" + offer_id + '/' + quantity,
|
||||
"{{ route('Shop.Basket.addBasket') }}",
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
buttons
|
||||
);
|
||||
});
|
||||
|
||||
function setPrice(model) {
|
||||
var offer_id = $('#' + model + '-offer_id').find('option:selected').val();
|
||||
|
||||
@@ -20,3 +20,5 @@
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@include('load.layout.modal')
|
||||
34
resources/views/Shop/Baskets/partials/modalBasket.blade.php
Normal file
34
resources/views/Shop/Baskets/partials/modalBasket.blade.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<img src="{{ App\Repositories\Shop\Articles::getPreviewSrc($offer['article']['image'] ?? false) }}" class="card-img-top" alt="...">
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="text-uppercase">
|
||||
{{ $offer['article']['article_nature']['name'] }}
|
||||
</div>
|
||||
<div>
|
||||
{{ $offer['article']['name'] }}
|
||||
</div>
|
||||
<div>
|
||||
{{ $offer['tariff']['price_lists'][0]['price_list_values'][0]['price_taxed'] }} €
|
||||
</div>
|
||||
<div>
|
||||
{{ $offer['variation']['name'] }}
|
||||
</div>
|
||||
<div>
|
||||
Quantité : {{ $basket['added']['quantity'] ?? 0 }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-7">
|
||||
<div>
|
||||
Il y a {{ $basket['quantity'] ?? 0 }} articles dans votre panier.
|
||||
</div>
|
||||
<div>
|
||||
<strong>Total produits : </strong> {{ $basket['total'] ?? 0 }} €
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,18 +1,18 @@
|
||||
@if ($shelve['articles'])
|
||||
<div class="mb-3 bg-light">
|
||||
<div class="mb-3 bg-green-light">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<h1 style="font-size: 2em;">{{ $shelve['name'] }}</h1>
|
||||
<h1 class="green" style="font-size: 2em;">{{ $shelve['name'] }}</h1>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<a href="{{ route('Shop.Categories.show', ['id' => $shelve['id']]) }}">Découvrir la sélection</a>
|
||||
<a href="{{ route('Shop.Categories.show', ['id' => $shelve['id']]) }}">Tout voir</a>
|
||||
<a class="green-dark btn" href="{{ route('Shop.Categories.show', ['id' => $shelve['id']]) }}">Découvrir la sélection</a>
|
||||
<a class="green-dark btn" href="{{ route('Shop.Categories.show', ['id' => $shelve['id']]) }}">Tout voir</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row shelve_slider_{{ $shelve['id'] }} slider">
|
||||
@foreach ($shelve['articles'] as $name => $article)
|
||||
<div class="text-center pr-2 pl-2">
|
||||
<a href="{{ route('Shop.Articles.show', ['id' => $article['id']]) }}">
|
||||
<a class="green-dark" href="{{ route('Shop.Articles.show', ['id' => $article['id']]) }}">
|
||||
<img data-lazy="{{ App\Repositories\Shop\Articles::getPreviewSrc($article['image'] ?? false) }}" class="d-block w-100" alt="{{ $name }}"/>
|
||||
{{ $name }}
|
||||
</a>
|
||||
|
||||
38
resources/views/Shop/layout/partials/megamenu.blade.php
Normal file
38
resources/views/Shop/layout/partials/megamenu.blade.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<div class="container">
|
||||
<div class="row rounded m-0 drop-shadow bg-white p-2">
|
||||
<div class="col mb-4">
|
||||
@for ($i = 0; $i < round(count($category['children']) / 3); $i++)
|
||||
<strong>
|
||||
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $category['children'][$i]['id']]) }}">
|
||||
{{ $category['children'][$i]['name'] }}
|
||||
</a>
|
||||
</strong><br>
|
||||
@foreach ($category['children'][$i]['children'] ?? [] as $leaf)
|
||||
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
|
||||
{{ $leaf['name'] }}
|
||||
</a><br>
|
||||
@endforeach
|
||||
@endfor
|
||||
</div>
|
||||
<div class="col mb-4">
|
||||
@for ($i = round(count($category['children']) / 3); $i < round(2 * count($category['children']) / 3); $i++)
|
||||
<strong>{{ $category['children'][$i]['name'] }}</strong><br>
|
||||
@foreach ($category['children'][$i]['children'] ?? [] as $leaf)
|
||||
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
|
||||
{{ $leaf['name'] }}
|
||||
</a><br>
|
||||
@endforeach
|
||||
@endfor
|
||||
</div>
|
||||
<div class="col mb-4">
|
||||
@for ($i = round(2 * count($category['children']) / 3); $i < count($category['children']); $i++)
|
||||
<strong>{{ $category['children'][$i]['name'] }}</strong><br>
|
||||
@foreach ($category['children'][$i]['children'] ?? [] as $leaf)
|
||||
<a class="green-dark" href="{{ route('Shop.Categories.show', ['id' => $leaf['id']]) }}">
|
||||
{{ $leaf['name'] }}
|
||||
</a><br>
|
||||
@endforeach
|
||||
@endfor
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,23 +1,18 @@
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<div class="collapse navbar-collapse" id="navbarContent">
|
||||
<ul class="navbar-nav mx-auto">
|
||||
@foreach ($categories as $category)
|
||||
@if (isset($category['children']))
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ $category['name'] }}
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
@include('Shop.layout.partials.submenu', ['categories' => $category['children']])
|
||||
</ul>
|
||||
</li>
|
||||
@else
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('Shop.Categories.show', ['id' => $category['id']]) }}">{{ $category['name'] }}</a>
|
||||
</li>
|
||||
@endif
|
||||
<li class="nav-item dropdown megamenu">
|
||||
<a id="megamenu_{{ $category['id'] }}" href="{{ route('Shop.Categories.show', ['id' => $category['id']]) }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle font-weight-bold text-uppercase">
|
||||
{{ $category['name'] }}
|
||||
</a>
|
||||
@if (isset($category['children']))
|
||||
<div aria-labelledby="megamenu_{{ $category['id'] }}" class="dropdown-menu border-0 p-0 m-0">
|
||||
@include('Shop.layout.partials.megamenu')
|
||||
</div>
|
||||
@endif
|
||||
</li>
|
||||
@endforeach
|
||||
|
||||
</ul>
|
||||
|
||||
<span style="font-family: Arial Narrow; font-size: 1.1em; font-weight: 900;">
|
||||
|
||||
28
resources/views/Shop/layout/partials/sections_old.blade.php
Normal file
28
resources/views/Shop/layout/partials/sections_old.blade.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
@foreach ($categories as $category)
|
||||
@if (isset($category['children']))
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ $category['name'] }}
|
||||
</a>
|
||||
<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
@include('Shop.layout.partials.submenu', ['categories' => $category['children']])
|
||||
</ul>
|
||||
</li>
|
||||
@else
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('Shop.Categories.show', ['id' => $category['id']]) }}">{{ $category['name'] }}</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
</ul>
|
||||
|
||||
<span style="font-family: Arial Narrow; font-size: 1.1em; font-weight: 900;">
|
||||
Variétés Paysannes de la Semence à l'Assiette
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</nav>
|
||||
@@ -3,7 +3,7 @@
|
||||
@push('js')
|
||||
|
||||
<script>
|
||||
function openModal(title, form_id, url_open, url_save, callback, size, no_confirm) {
|
||||
function openModal(title, form_id, url_open, url_save, callback, size, no_confirm, buttons) {
|
||||
var status = 0;
|
||||
var dialog = bootbox.dialog({
|
||||
title: title,
|
||||
@@ -13,7 +13,7 @@
|
||||
onHide: function(e) {
|
||||
console.log(status);
|
||||
},
|
||||
buttons: buildModalButtons(form_id, no_confirm)
|
||||
buttons: buildModalButtons(form_id, no_confirm, buttons)
|
||||
});
|
||||
|
||||
dialog.init(function() {
|
||||
@@ -53,7 +53,7 @@
|
||||
window.open(url,title,"menubar=no, status=no, scrollbars=no, menubar=no, width=" + width + ", height=400");
|
||||
}
|
||||
|
||||
function buildModalButtons(form_id, no_confirm) {
|
||||
function buildModalButtons(form_id, no_confirm, buttons) {
|
||||
if (!no_confirm) {
|
||||
var buttons = {
|
||||
cancel: {
|
||||
@@ -68,8 +68,6 @@
|
||||
}
|
||||
},
|
||||
};
|
||||
} else {
|
||||
buttons = '';
|
||||
}
|
||||
return buttons;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user