@extends('layouts.app') @section('title', ' - Riwayat Pencarian') @section('content')

Riwayat Pencarian

Berikut adalah daftar pencarian yang pernah Anda lakukan.

@if($histories->isEmpty())

Belum Ada Riwayat Pencarian

Anda belum pernah melakukan pencarian cafe. Mulai pencarian pertama Anda sekarang!

@else
@foreach($histories as $history) @endforeach
Tanggal Pencarian Kriteria Hasil Teratas Aksi
{{ $history->created_at->format('d M Y') }}
{{ $history->created_at->format('H:i') }}
@php $criteria = []; if (!empty($history->weights)) { foreach ($history->weights as $categoryId => $weight) { if ($weight > 0) { $category = \App\Models\Category::find($categoryId); if ($category) { $criteria[] = $category->name . ' (' . round(($weight / array_sum($history->weights) * 100), 0) . '%)'; } } } } @endphp @if(count($criteria) > 0)
@foreach($criteria as $c) {{ $c }} @endforeach
@else Tidak ada kriteria khusus @endif
@if(!empty($history->results))
@php $count = 0; @endphp @foreach($history->results as $cafeId => $result) @if($count < 3)
{{ $count + 1 }} {{ $result['name'] ?? 'Cafe #'.$cafeId }} ({{ number_format($result['score'], 2) }})
@php $count++; @endphp @endif @endforeach
@else Tidak ada hasil @endif
Detail
@foreach($histories as $history)
{{ $history->created_at->format('d M Y') }}
{{ $history->created_at->format('H:i') }}
Detail
Hasil Teratas:
@if(!empty($history->results))
@php $count = 0; @endphp @foreach($history->results as $cafeId => $result) @if($count < 3)
{{ $count + 1 }} {{ $result['name'] ?? 'Cafe #'.$cafeId }} ({{ number_format($result['score'], 2) }})
@php $count++; @endphp @endif @endforeach
@else Tidak ada hasil @endif
@endforeach
{{ $histories->links() }}
@endif
@endsection