147 lines
4.8 KiB
PHP
147 lines
4.8 KiB
PHP
@extends('layouts.sentara')
|
||
|
||
@section('content')
|
||
|
||
<div class="max-w-6xl mx-auto space-y-8">
|
||
|
||
<!-- HEADER -->
|
||
<div class="flex justify-between items-center">
|
||
<h2 class="text-3xl font-bold text-gray-800">
|
||
Hasil Analisis Sentimen
|
||
</h2>
|
||
|
||
<!-- Dropdown Filter -->
|
||
<form method="GET" action="{{ route('analisis.index') }}">
|
||
<select name="wisata"
|
||
onchange="this.form.submit()"
|
||
class="bg-white border border-gray-300 text-sm rounded-lg px-4 py-2 shadow-sm
|
||
focus:ring-2 focus:ring-blue-400 focus:outline-none">
|
||
|
||
<option value="">Semua Destinasi</option>
|
||
|
||
@foreach($wisataList as $dest)
|
||
<option value="{{ $dest }}"
|
||
{{ request('wisata') == $dest ? 'selected' : '' }}>
|
||
{{ $dest }}
|
||
</option>
|
||
@endforeach
|
||
</select>
|
||
</form>
|
||
</div>
|
||
|
||
|
||
<!-- TABLE CARD -->
|
||
<div class="bg-white rounded-xl shadow p-6">
|
||
|
||
<h3 class="text-lg font-semibold text-gray-700 mb-4">
|
||
Data Hasil Analisis
|
||
</h3>
|
||
|
||
<div class="overflow-x-auto">
|
||
<table class="w-full text-sm text-left">
|
||
<thead>
|
||
<tr class="bg-gray-100 text-gray-600">
|
||
<th class="px-4 py-3">wisata</th>
|
||
<th class="px-4 py-3">Ulasan Terolah</th>
|
||
<th class="px-4 py-3">Sentimen</th>
|
||
<th class="px-4 py-3">Probabilitas</th>
|
||
</tr>
|
||
</thead>
|
||
|
||
<tbody>
|
||
@forelse($hasil as $row)
|
||
<tr class="border-b">
|
||
|
||
<!-- Destinasi -->
|
||
<td class="px-4 py-3 font-medium">
|
||
{{ $row->wisata }}
|
||
</td>
|
||
|
||
<!-- Ulasan -->
|
||
<td class="px-4 py-3 text-gray-700">
|
||
{{ $row->ulasan_terolah }}
|
||
</td>
|
||
|
||
<!-- Badge Sentimen -->
|
||
<td class="px-4 py-3">
|
||
@if($row->sentimen == 'positif')
|
||
<span class="px-3 py-1 rounded-full bg-green-100 text-green-700 text-xs font-semibold">
|
||
Positif
|
||
</span>
|
||
@elseif($row->sentimen == 'negatif')
|
||
<span class="px-3 py-1 rounded-full bg-red-100 text-red-700 text-xs font-semibold">
|
||
Negatif
|
||
</span>
|
||
@else
|
||
<span class="px-3 py-1 rounded-full bg-yellow-100 text-yellow-700 text-xs font-semibold">
|
||
Netral
|
||
</span>
|
||
@endif
|
||
</td>
|
||
|
||
<!-- Probabilitas -->
|
||
<td class="px-4 py-3 font-semibold text-gray-700">
|
||
{{ number_format($row->probabilitas, 2) }}
|
||
</td>
|
||
|
||
</tr>
|
||
@empty
|
||
<tr>
|
||
<td colspan="4" class="text-center py-6 text-gray-400">
|
||
Belum ada hasil analisis sentimen.
|
||
</td>
|
||
</tr>
|
||
@endforelse
|
||
</tbody>
|
||
|
||
</table>
|
||
</div>
|
||
|
||
<!-- PAGINATION -->
|
||
<div class="text-sm text-gray-500 mt-4 text-center">
|
||
Showing {{ $hasil->firstItem() }} to {{ $hasil->lastItem() }}
|
||
of {{ $hasil->total() }} results
|
||
</div>
|
||
|
||
<div class="flex justify-center mt-3 items-center gap-2 text-sm">
|
||
|
||
{{-- PREV --}}
|
||
@if ($hasil->onFirstPage())
|
||
<span class="text-gray-400">‹</span>
|
||
@else
|
||
<a href="{{ $hasil->previousPageUrl() }}">‹</a>
|
||
@endif
|
||
|
||
@php
|
||
$start = max($hasil->currentPage() - 2, 1);
|
||
$end = min($hasil->currentPage() + 2, $hasil->lastPage());
|
||
@endphp
|
||
|
||
{{-- NUMBER --}}
|
||
@for ($i = $start; $i <= $end; $i++)
|
||
@if ($i == $hasil->currentPage())
|
||
<span class="px-3 py-1 bg-blue-600 text-white rounded-full">
|
||
{{ $i }}
|
||
</span>
|
||
@else
|
||
<a href="{{ $hasil->url($i) }}" class="px-2 hover:underline">
|
||
{{ $i }}
|
||
</a>
|
||
@endif
|
||
@endfor
|
||
|
||
{{-- NEXT --}}
|
||
@if ($hasil->hasMorePages())
|
||
<a href="{{ $hasil->nextPageUrl() }}">›</a>
|
||
@else
|
||
<span class="text-gray-400">›</span>
|
||
@endif
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
@endsection
|