fix basket
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
<input type="hidden" name="user_id_client_assoc" id="user_id_client_assoc" value="{{ $id }}" class="form-control" />
|
||||
<select multiple class="multi-select form-no-control" name="user_clients_list" id="user_clients_list">
|
||||
@foreach ($clients as $client)
|
||||
<option value="{{ $client->id }}" {{ !($client->active) ? 'disabled' : '' }} {{ in-array($client->id, $clients_selected) ?? 'selected' : ''>
|
||||
<option value="{{ $client->id }}" {{ !($client->active) ? 'disabled' : '' }} {{ in_array($client->id, $clients_selected) ? 'selected' : '' }}>
|
||||
{{ $client->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
<div id="collapse_{{ $app }}" class="collapse content-box light p-2" role="tabpanel">
|
||||
|
||||
@foreach ($modules as $module = $actions)
|
||||
@foreach ($modules as $module => $actions)
|
||||
<h4 class="brand">{{ $module }}</h4>
|
||||
<div class="inline-group">
|
||||
@foreach ($actions as $permission)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<input type="hidden" name="user_id_client_assoc" id="user_id_client_assoc" value="{{ $id }}" class="form-control" />
|
||||
<select multiple class="multi-select form-no-control" name="user_clients_list" id="user_clients_list">
|
||||
@foreach ($clients as $client)
|
||||
<option value="{{ $client->id }}" {{ !($client->active) ? 'disabled' : '' }} {{ in-array($client->id, $clients_selected) ?? 'selected' : ''>
|
||||
<option value="{{ $client->id }}" {{ !($client->active) ? 'disabled' : '' }} {{ in_array($client->id, $clients_selected ?? []) ? 'selected' : '' }}>
|
||||
{{ $client->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<input type="hidden" name="user_id_client_assoc" id="user_id_client_assoc" value="{{ $id }}" class="form-control" />
|
||||
<select multiple class="multi-select form-no-control" name="user_clients_list" id="user_clients_list">
|
||||
@foreach ($clients as $client)
|
||||
<option value="{{ $client->id }}" {{ !($client->active) ? 'disabled' : '' }} {{ in-array($client->id, $clients_selected) ?? 'selected' : ''>
|
||||
<option value="{{ $client->id }}" {{ !($client->active) ? 'disabled' : '' }} {{ in_array($client->id, $clients_selected) ? 'selected' : '' }}>
|
||||
{{ $client->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
|
||||
@@ -25,43 +25,11 @@
|
||||
])
|
||||
@endif
|
||||
|
||||
@include('load.basket')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
$('.basket').click(function() {
|
||||
var type = $(this).data('type');
|
||||
var offer_id = $('#' + type + '-offer_id').find('option:selected').val();
|
||||
var quantity = $('#' + type + '-quantity').val();
|
||||
var data = {
|
||||
'offer_id': offer_id,
|
||||
'quantity': quantity,
|
||||
};
|
||||
|
||||
var buttons = {
|
||||
cancel: {
|
||||
label: '{{ __('Continuer mes achats') }}',
|
||||
className: 'btn-secondary'
|
||||
},
|
||||
confirm: {
|
||||
label: '{{ __('Commander') }}',
|
||||
className: 'btn-success',
|
||||
callback: function() {
|
||||
window.location = "{{ route('Shop.Basket.basket') }}";
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
openModal(
|
||||
'Ajout dans le panier',
|
||||
'basket-form',
|
||||
"{{ route('Shop.Basket.modalBasket') }}/" + offer_id + '/' + quantity,
|
||||
"{{ route('Shop.Orders.order') }}",
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
buttons,
|
||||
"refreshBasketTop()",
|
||||
);
|
||||
});
|
||||
initBasket();
|
||||
|
||||
function setPrice(model) {
|
||||
var offer_id = $('#' + model + '-offer_id').find('option:selected').val();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
@component('components.card', [
|
||||
'id_card' => $model . '-basket',
|
||||
'title' => $title,
|
||||
'class' => 'mb-3 ' . ($bgClass ?? null),
|
||||
'class' => 'mb-3 addBasket ' . ($bgClass ?? null),
|
||||
'classTitle' => 'mb-0',
|
||||
'outline' => false,
|
||||
])
|
||||
@@ -10,13 +10,14 @@
|
||||
'name' => 'offer_id',
|
||||
'id_name' => $model . '-offer_id',
|
||||
'list' => collect($data)->pluck('name', 'id')->toArray(),
|
||||
'class' => 'select2 mb-2',
|
||||
'class' => 'select2 mb-2 offer_id',
|
||||
])
|
||||
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
@include('components.form.inputs.number', [
|
||||
'name' => 'quantity',
|
||||
'class' => 'quantity',
|
||||
'id_name' => $model . '-quantity',
|
||||
'value' => 1,
|
||||
])
|
||||
|
||||
@@ -1,29 +1,41 @@
|
||||
@if ($article_nature == 'semences')
|
||||
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center">
|
||||
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center addBasket">
|
||||
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['semences']['price'] ?? null }}</span> €<br>
|
||||
{{ $article['semences']['variation'] }}
|
||||
<div>
|
||||
Quantité : 1
|
||||
Quantité :
|
||||
@include('components.form.inputs.number', [
|
||||
'name' => uniqid(),
|
||||
'class' => 'quantity',
|
||||
'value' => 1,
|
||||
'style' => 'max-width: 64px; display: inline-block',
|
||||
])
|
||||
</div>
|
||||
<input type="hidden" class="offer_id" value="{{ $article['semences']['offer_id'] ?? null }}" />
|
||||
@include('components.form.button', [
|
||||
'class' => 'btn-green-dark basket semences mb-3 mt-2 shadow',
|
||||
'txt' => 'Ajouter au panier',
|
||||
'data_id' => $article['semences']['offer_id'] ?? null,
|
||||
])
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($article_nature == 'plants')
|
||||
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center">
|
||||
<div class="w-100 mt-3 p-1 bg-green-light green-dark rounded-lg border text-center addBasket">
|
||||
<span style="font-size: 1.4em; font-weight: bold;">{{ $article['plants']['price'] ?? null }}</span> €<br>
|
||||
{{ $article['plants']['variation'] }}
|
||||
<div>
|
||||
Quantité : 1
|
||||
Quantité :
|
||||
@include('components.form.inputs.number', [
|
||||
'name' => uniqid(),
|
||||
'class' => 'quantity',
|
||||
'value' => 1,
|
||||
'style' => 'max-width: 64px; display: inline-block',
|
||||
])
|
||||
</div>
|
||||
<input type="hidden" class="offer_id" value="{{ $article['plants']['offer_id'] ?? null }}" />
|
||||
@include('components.form.button', [
|
||||
'class' => 'btn-success basket plants mb-3 mt-2 shadow',
|
||||
'txt' => 'Ajouter au panier',
|
||||
'data_id' => $article['plants']['offer_id'] ?? null,
|
||||
])
|
||||
</div>
|
||||
@endif
|
||||
@@ -47,3 +47,10 @@
|
||||
@endsection
|
||||
|
||||
@include('load.layout.modal')
|
||||
@include('load.basket')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
initBasket();
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
@component('components.layout.box-collapse', [
|
||||
'title' => $group['name'],
|
||||
'id' => 'tag_group_' . $tag_group_id,
|
||||
'collapsed' => App\Repositories\Shop\TagGroups::isTagGroupHaveSelected($tags_selected, $group['tags']),
|
||||
'collapsed' => App\Repositories\Shop\TagGroups::isTagGroupHaveSelected($tags_selected ?? [], $group['tags']),
|
||||
])
|
||||
@foreach ($group['tags'] as $tag)
|
||||
<div class="form-inline">
|
||||
|
||||
@@ -1 +1,4 @@
|
||||
@include('components.form.button', ['class' => 'btn-danger ' . ($class ?? ''), 'icon' => ($icon ?? 'fa-trash)'])
|
||||
@include('components.form.button', [
|
||||
'class' => 'btn-danger ' . ($class ?? ''),
|
||||
'icon' => $icon ?? 'fa-trash',
|
||||
])
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
@include('components.form.label')
|
||||
|
||||
<input type="number" name="{{ $name }}" id="{{ $id_name ?? str_slug($name,'-') }}" class="form-control {{ $class ?? ''}}" value="{{ $value ?? ''}}"
|
||||
@if ($style ?? false) style="{{ $style }}" @endif
|
||||
@if ($required ?? false) required @endif
|
||||
@if ($disabled ?? false) disabled @endif
|
||||
@if ($readonly ?? false) readonly @endif
|
||||
|
||||
48
resources/views/load/basket.blade.php
Normal file
48
resources/views/load/basket.blade.php
Normal file
@@ -0,0 +1,48 @@
|
||||
@if(!defined('BASKET'))
|
||||
@push('scripts')
|
||||
<script>
|
||||
function initBasket(sel) {
|
||||
var selector = (typeof(sel) == 'undefined') ? '.basket' : sel;
|
||||
|
||||
$(selector).off().click(function() {
|
||||
var $addBasket = $(this).closest('.addBasket');
|
||||
var offerId = $addBasket.find('.offer_id').val();
|
||||
var quantity = $addBasket.find('.quantity').val();
|
||||
var data = {
|
||||
'offer_id': offerId,
|
||||
'quantity': quantity,
|
||||
};
|
||||
|
||||
console.log(data);
|
||||
|
||||
var buttons = {
|
||||
cancel: {
|
||||
label: '{{ __('Continuer mes achats') }}',
|
||||
className: 'btn-secondary'
|
||||
},
|
||||
confirm: {
|
||||
label: '{{ __('Commander') }}',
|
||||
className: 'btn-success',
|
||||
callback: function() {
|
||||
window.location = "{{ route('Shop.Basket.basket') }}";
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
openModal(
|
||||
'Ajout dans le panier',
|
||||
'basket-form',
|
||||
"{{ route('Shop.Basket.modalBasket') }}/" + offerId + '/' + quantity,
|
||||
"{{ route('Shop.Orders.order') }}",
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
buttons,
|
||||
"refreshBasketTop()",
|
||||
);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@php(define('BASKET', true))
|
||||
@endif
|
||||
Reference in New Issue
Block a user