car.blade.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. @extends('layouts.app')
  2. @section('title', ($car->title ?: $car->make . ' ' . $car->model . ' ' . $car->year) . ' — Точка')
  3. @php
  4. $fuelLabels = ['petrol'=>'Бензин','diesel'=>'Дизель','hybrid'=>'Гибрид','electric'=>'Электро','gas'=>'Газ','other'=>'Другое'];
  5. $transLabels = ['automatic'=>'Автомат','manual'=>'Механика','robot'=>'Робот','variator'=>'Вариатор','electric'=>'Электро'];
  6. $driveLabels = ['FWD'=>'Передний','RWD'=>'Задний','AWD'=>'Полный (AWD)','4WD'=>'Полный (4WD)'];
  7. $countryFlags= ['Германия'=>'🇩🇪','Япония'=>'🇯🇵','Корея'=>'🇰🇷','США'=>'🇺🇸','Китай'=>'🇨🇳','ОАЭ'=>'🇦🇪','Грузия'=>'🇬🇪','Великобритания'=>'🇬🇧','Франция'=>'🇫🇷','Италия'=>'🇮🇹'];
  8. $carName = $car->title ?: ($car->make . ' ' . $car->model . ' ' . $car->year);
  9. // Галерея
  10. $photos = [];
  11. if ($car->photo_main) $photos[] = asset('storage/' . $car->photo_main);
  12. if ($car->photos_gallery) {
  13. foreach ((array)$car->photos_gallery as $p) $photos[] = asset('storage/' . $p);
  14. }
  15. $telegram = $siteSettings['telegram'] ?? '';
  16. // OG: описание для страницы автомобиля
  17. $carPriceStr = $car->price_rub
  18. ? number_format($car->price_rub, 0, '.', ' ') . ' ₽'
  19. : ($car->price_usd ? number_format($car->price_usd, 0, '.', ' ') . ' $' : '');
  20. $ogCarDesc = trim(implode('. ', array_filter([
  21. $carName,
  22. $car->year ? 'Год выпуска: ' . $car->year : '',
  23. $car->mileage_km !== null ? 'Пробег: ' . number_format($car->mileage_km, 0, '.', ' ') . ' км' : '',
  24. $carPriceStr ? 'Цена: ' . $carPriceStr : '',
  25. $car->country_origin ? 'Из ' . $car->country_origin : '',
  26. ])));
  27. @endphp
  28. {{-- OG-теги специфичные для этой страницы — переопределяют дефолты из настроек --}}
  29. @section('og_type', 'product')
  30. @section('og_title', $carName . ' — Точка')
  31. @section('og_description', $ogCarDesc)
  32. @if($car->photo_main)
  33. @section('og_image', asset('storage/' . $car->photo_main))
  34. @endif
  35. @section('content')
  36. {{-- Хлебные крошки --}}
  37. <section class="page-hdr" style="padding:40px 0 32px">
  38. <div class="container">
  39. <nav class="breadcrumb">
  40. <a href="{{ route('home') }}">Главная</a>
  41. <span>/</span>
  42. <a href="{{ route('catalog') }}">Каталог</a>
  43. <span>/</span>
  44. <span>{{ $carName }}</span>
  45. </nav>
  46. </div>
  47. </section>
  48. <section class="section sec-alt" style="padding-top:24px">
  49. <div class="container">
  50. <a href="{{ route('catalog') }}"
  51. style="display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;color:var(--muted);margin-bottom:28px;transition:color var(--tr);letter-spacing:.03em"
  52. onmouseover="this.style.color='var(--red)'" onmouseout="this.style.color='var(--muted)'">
  53. ← Назад в каталог
  54. </a>
  55. <div class="car-detail-grid reveal">
  56. {{-- ═══ ЛЕВАЯ КОЛОНКА: Галерея + Вкладки ═══ --}}
  57. <div>
  58. @include('pages.partials._car_gallery')
  59. @include('pages.partials._car_tabs')
  60. </div>
  61. {{-- ═══ ПРАВАЯ КОЛОНКА: Инфопанель ═══ --}}
  62. <div>
  63. @include('pages.partials._car_info_panel')
  64. </div>
  65. </div>
  66. {{-- Похожие автомобили --}}
  67. @if($similar->isNotEmpty())
  68. <div style="margin-top:60px">
  69. <div class="sh reveal" style="margin-bottom:28px">
  70. <div class="sh-label">Похожие авто</div>
  71. <h2 style="font-size:clamp(28px,3.5vw,40px)">ВАМ ТАКЖЕ ПОНРАВИТСЯ</h2>
  72. </div>
  73. <div class="stagger" style="display:grid;grid-template-columns:repeat(auto-fill,minmax(min(300px,100%),1fr));gap:20px">
  74. @foreach($similar as $sc)
  75. @include('pages.partials._car_card', ['car' => $sc, 'fuelLabels' => $fuelLabels, 'countryFlags' => $countryFlags])
  76. @endforeach
  77. </div>
  78. </div>
  79. @endif
  80. </div>
  81. </section>
  82. @endsection
  83. @push('scripts')
  84. <script>
  85. function switchTab(id, btn) {
  86. document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
  87. document.querySelectorAll('.tab-pane').forEach(p => p.classList.remove('active'));
  88. btn.classList.add('active');
  89. document.getElementById('tp-' + id).classList.add('active');
  90. }
  91. function setThumb(i, src) {
  92. document.getElementById('mainImg').src = src;
  93. document.querySelectorAll('.thumb').forEach((t, j) => t.classList.toggle('active', i === j));
  94. }
  95. </script>
  96. @endpush