50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
@php
|
|
// Check if article is not visible OR has no offers at all
|
|
$hasNoOffers = empty($article['offers'] ?? false) || !array_filter($article['offers']);
|
|
$shouldShowComingSoon = !($article['visible'] ?? true) || $hasNoOffers;
|
|
@endphp
|
|
|
|
@if ($shouldShowComingSoon)
|
|
{{-- Display "Coming Soon" box when article is not visible or has no offers --}}
|
|
<div class="card border-info">
|
|
<div class="card-body text-center p-4">
|
|
<h4 class="text-info mb-3">
|
|
<i class="fas fa-clock"></i>
|
|
</h4>
|
|
<h5 class="card-title mb-0">Bientôt disponible</h5>
|
|
</div>
|
|
</div>
|
|
@else
|
|
{{-- Display normal offers for visible articles with available offers --}}
|
|
@foreach ($article['offers'] as $natureKey => $natureOffers)
|
|
@if (!empty($natureOffers))
|
|
@include('Shop.Articles.partials.addBasket', [
|
|
'data' => $natureOffers,
|
|
'title' => ucfirst($natureKey),
|
|
'model' => $natureKey,
|
|
'bgClass' => 'bg-green-light',
|
|
])
|
|
@endif
|
|
@endforeach
|
|
@endif
|
|
|
|
@include('load.basket')
|
|
|
|
@push('js')
|
|
<script>
|
|
initBasket();
|
|
|
|
function setPrice(model) {
|
|
var offer_id = $('#' + model + '-offer_id').find('option:selected').val();
|
|
var quantity = $('#' + model + '-quantity').val();
|
|
var data = {
|
|
'offer_id': offer_id,
|
|
'quantity': quantity,
|
|
};
|
|
$.post('{{ route('Shop.Basket.getPrice') }}', data, function(data) {
|
|
$('#' + model + '-price').html(data);
|
|
});
|
|
}
|
|
</script>
|
|
@endpush
|