File: /home/lesanew/anestetues2/web/app/themes/anes-tetues/resources/views/pages/line-up.blade.php
{{--
Template Name: Line up
--}}
@extends('layouts.app')
@push('vite-head')
@vite(['resources/css/pages/line-up.scss', 'resources/js/pages/line-up.ts'])
@endpush
@section('content')
<section>
<x-top-content />
</section>
@php
$line_up_title = get_field('titre');
$home_id = get_option('page_on_front');
$line_up = $home_id ? get_field('line_up', $home_id) : null;
$dateDebut = get_field('date_de_debut', 'option');
$dateFin = get_field('date_de_fin', 'option');
$days = [];
try {
if ($dateDebut) {
$start = \Carbon\Carbon::createFromFormat('d/m/Y', $dateDebut);
if ($dateFin) {
$end = \Carbon\Carbon::createFromFormat('d/m/Y', $dateFin);
if ($end->lessThan($start)) {
[$start, $end] = [$end, $start];
}
for ($date = $start->copy(); $date->lte($end); $date->addDay()) {
$days[] = $date->format('Y-m-d');
}
} else {
$days[] = $start->format('Y-m-d');
}
}
} catch (\Exception $e) {
$days = [];
}
@endphp
@if (! empty($days))
@foreach ($days as $index => $day)
@php($bgClass = $index % 2 === 0 ? 'bg-secondary' : 'bg-primary')
@php($primaryButtonClass =
$bgClass === 'bg-primary' ? 'btn bg-secondary arrow-primary' : 'btn arrow-secondary')
@php($dateObj = \Carbon\Carbon::parse($day)->locale('fr'))
@php($line_up_btn = $line_up['bouton'] ?? null)
<section class="container {{ $bgClass }}">
<div class="line-up-header">
<h2 class="text-light">
{{ ucfirst($dateObj->translatedFormat('l j F')) }}
</h2>
@if (! empty($line_up_btn))
<a
href="{{ $line_up_btn['url'] }}"
class="{{ $primaryButtonClass }}"
@if (! empty($line_up_btn['target'])) target="{{ $line_up_btn['target'] }}" @endif
>
{{ $line_up_btn['title'] }}
</a>
@endif
</div>
<x-lineup-featured mode="day" :day="$day" />
</section>
@endforeach
@endif
<section class="container top-wave">
<x-instagram-feed />
</section>
@endsection