@extends('facelift2.master') @section('content')

Resultados para: "{{ $query }}"

@php $guitarTriggers = ['guitarra', 'guitar', 'rock', 'rock metal']; $isGuitar = in_array(strtolower($query ?? ''), $guitarTriggers); $isPiano = strtolower($query ?? '') == 'piano'; @endphp @if($isPiano)
@include('facelift2.busca.partials.dental_piano')
@endif @if($isGuitar)
@include('facelift2.busca.partials.dental_guitarra')
@endif @if(isset($error))
{{ $error }}
@endif @php // Restore Original Logic for Data grouping $resultsArray = is_array($results ?? null) ? $results : []; $articles = []; $videos = []; $books = []; foreach ($resultsArray as $item) { $type = $item['product']['productType'] ?? 'article'; if ($type === 'magazine') { $articles[] = $item; } elseif ($type === 'video') { $videos[] = $item; } elseif ($type === 'book') { $books[] = $item; } else { $articles[] = $item; } // Fallback } // Totals $totaisTipos = isset($totaisPorTipo) ? $totaisPorTipo : [ 'magazine' => $contadorFelipino->productTypes->magazine ?? count($articles), 'video' => $contadorFelipino->productTypes->video ?? count($videos), 'book' => $contadorFelipino->productTypes->book ?? count($books), ]; @endphp

Filtros

Ordenar por

Tipo de Conteúdo

@foreach(['magazine' => 'Revistas', 'book' => 'Capítulos de livros', 'video' => 'Vídeos'] as $type => $label) @php $count = $contadorFelipino->productTypes->$type ?? 0; @endphp @endforeach

Coleções (Revistas)

@php $collectionsCounter = $contadorFelipino->collections ?? []; if (is_object($collectionsCounter)) { $collectionsCounter = (array)$collectionsCounter; } $selectedCollectionIds = (array) request()->input('q.collectionIds', []); $hasSelection = count($selectedCollectionIds) > 0; $renderedAny = false; @endphp
@if(isset($buscaColecoes) && is_iterable($buscaColecoes)) @foreach ($buscaColecoes as $colecao) @php $id = is_object($colecao) ? ($colecao->id ?? null) : (is_array($colecao) ? ($colecao['id'] ?? null) : null); $title = is_object($colecao) ? ($colecao->title ?? null) : (is_array($colecao) ? ($colecao['title'] ?? null) : null); if (!$id || !$title) { continue; } $quantidade = $collectionsCounter[$id] ?? 0; $isChecked = $hasSelection ? in_array($id, $selectedCollectionIds) : ($quantidade > 0); $renderedAny = true; @endphp @endforeach @endif @if(!$renderedAny)
Nenhuma coletânea encontrada.
@endif

Idioma

@foreach(['pt' => 'Português', 'en' => 'Inglês', 'es' => 'Espanhol'] as $lang => $label) @php $countLang = $contadorFelipino->languages->$lang ?? 0; @endphp @endforeach
@if(count($resultsArray) === 0)

Nenhum resultado encontrado para sua pesquisa.

@endif
@foreach($resultsArray as $item) @php $coverImage = !empty($item['cover']) ? $item['cover'] : ($item['product']['cover'] ?? null); $productId = $item['product']['id'] ?? 'sem-produto'; $productTitle = isset($item['product']['title']) ? Str::slug($item['product']['title']) : 'sem-titulo'; $articleId = $item['id']; $articleTitle = Str::slug($item['title']); $productType = $item['productType'] ?? 'artigo'; $typeLabel = 'ARTIGO'; switch ($productType) { case 'video': $url = url("facelift25/video/{$productId}/{$productTitle}/{$articleId}"); $typeLabel = 'VÍDEO'; break; case 'livro': case 'book': $url = url("facelift25/livro/{$productId}/{$productTitle}"); $typeLabel = 'LIVRO'; break; case 'gotalks': $url = "#"; $typeLabel = 'GOTALKS'; break; default: $url = url("facelift25/artigo/{$productId}/{$productTitle}/{$articleId}/{$articleTitle}"); $typeLabel = 'ARTIGO'; break; } @endphp
@if($coverImage) @else
Sem imagem
@endif @if($productType === 'video')
@endif @if($productType === 'gotalks')
@endif

{{ $item['title'] }} {{ $typeLabel }}

{{ strip_tags($item['brief'] ?? '') }}

@if(!empty($item['authors']))
{{ implode(', ', array_column($item['authors'], 'name') ?? []) }}
@endif @if(!empty($item['publishDate']))
{{ date('d/m/Y', strtotime($item['publishDate'])) }}
@endif
@endforeach
@if(isset($total) && $total > 0)
@php $currentPage = (int)($page ?? 1); $lastPageNum = (int)($lastPage ?? 1); $prevPage = max(1, $currentPage - 1); $nextPage = min($lastPageNum, $currentPage + 1); // Sliding window: always show 4 pages at a time $pageWindow = (int)(request()->input('pageWindow', 0)); // Which set of 4 pages (0 = 1-4, 1 = 5-8, etc) $startPage = ($pageWindow * 4) + 1; $endPage = min($startPage + 3, $lastPageNum); // Adjust window if current page is outside current range if ($currentPage < $startPage || $currentPage > $endPage) { $pageWindow = floor(($currentPage - 1) / 4); $startPage = ($pageWindow * 4) + 1; $endPage = min($startPage + 3, $lastPageNum); } $hasMorePages = $endPage < $lastPageNum; $nextWindow = $pageWindow + 1; @endphp

Página {{ $currentPage }} de {{ $lastPageNum }} ({{ $total }} resultados)

@if($hasMorePages) @php $remainingPages = $lastPageNum - $endPage; $nextSetStart = $endPage + 1; $nextSetEnd = min($nextSetStart + 3, $lastPageNum); @endphp @endif
@endif
@include('busca.partials.scripts') @endsection