done
This commit is contained in:
parent
edf4f3893d
commit
3084846b2a
|
@ -340,41 +340,66 @@
|
|||
<div class="row mt-5">
|
||||
@foreach (['dana', 'gopay', 'shopeepay'] as $key)
|
||||
@php
|
||||
// Path ke CSV: storage/app/public/top_features_{key}.csv
|
||||
// Path ke CSV (perhatikan key: 'shopeepay' kalau memang file bernama top_features_shopeepay.csv)
|
||||
$featuresPath = storage_path("app/public/top_features_{$key}.csv");
|
||||
$featuresData = [];
|
||||
$featuresRaw = [];
|
||||
if (file_exists($featuresPath)) {
|
||||
$featuresData = array_map('str_getcsv', file($featuresPath));
|
||||
// Baca CSV (masing‐masing baris jadi array)
|
||||
$featuresRaw = array_map('str_getcsv', file($featuresPath));
|
||||
}
|
||||
|
||||
// Siapkan array untuk menampung fitur per kelas
|
||||
$classFeatures = [
|
||||
'neutral' => [], // nanti kita label sebagai “Netral”
|
||||
'positive' => [], // nanti jadi “Positif”
|
||||
'negative' => [], // nanti jadi “Negatif”
|
||||
];
|
||||
|
||||
if (count($featuresRaw) > 1) {
|
||||
// Baris pertama adalah header: [rank,neutral,positive,negative]
|
||||
// Mulai loop dari index ke-1 (data sebenarnya)
|
||||
foreach (array_slice($featuresRaw, 1) as $row) {
|
||||
// $row[1] = neutral, $row[2] = positive, $row[3] = negative
|
||||
$classFeatures['neutral'][] = $row[1] ?? '';
|
||||
$classFeatures['positive'][] = $row[2] ?? '';
|
||||
$classFeatures['negative'][] = $row[3] ?? '';
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
<div class="col-lg-4 col-md-6 mb-4">
|
||||
<div class="card bg-white border-radius-lg shadow-lg h-100">
|
||||
{{-- Header Kartu dengan Gradient Soft UI --}}
|
||||
{{-- Header Kartu --}}
|
||||
<div class="card-header bg-gradient-secondary border-radius-lg-top text-center py-2">
|
||||
<h6 class="mb-0 text-uppercase text-white font-weight-bold">
|
||||
{{ $key }} Top Features
|
||||
{{ ucfirst($key) }} Top Features
|
||||
</h6>
|
||||
</div>
|
||||
|
||||
{{-- Body Kartu --}}
|
||||
<div class="card-body p-0">
|
||||
@if (count($featuresData) > 1)
|
||||
<ul class="list-group list-group-flush">
|
||||
@foreach (array_slice($featuresData, 1) as $row)
|
||||
{{-- Kolom pertama = nama fitur, kolom kedua = skor --}}
|
||||
<li
|
||||
class="list-group-item d-flex justify-content-between align-items-center px-3 py-2">
|
||||
<span class="font-weight-medium text-dark">
|
||||
{{ $row[0] }}
|
||||
</span>
|
||||
<span class="badge badge-sm bg-gradient-secondary">
|
||||
{{ $row[1] }}
|
||||
</span>
|
||||
</li>
|
||||
<div class="card-body p-3">
|
||||
@if (count($featuresRaw) > 1)
|
||||
<div class="row">
|
||||
{{-- Tiga kolom kecil: Netral, Positif, Negatif --}}
|
||||
@foreach ([
|
||||
'neutral' => 'Netral',
|
||||
'positive' => 'Positif',
|
||||
'negative' => 'Negatif',
|
||||
] as $clsKey => $clsLabel)
|
||||
<div class="col-4">
|
||||
<h6 class="text-secondary text-uppercase text-center">{{ $clsLabel }}</h6>
|
||||
<ul class="list-group list-group-flush">
|
||||
@foreach ($classFeatures[$clsKey] as $feature)
|
||||
<li class="list-group-item px-2 py-1 small">
|
||||
{{ $feature }}
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@else
|
||||
{{-- Jika file tidak ada atau kosong --}}
|
||||
<div class="alert alert-warning text-center mb-0 py-3 small rounded-bottom-lg">
|
||||
File <code>top_features_{{ $key }}.csv</code> tidak ditemukan atau kosong.
|
||||
</div>
|
||||
|
@ -385,6 +410,7 @@
|
|||
@endforeach
|
||||
</div>
|
||||
|
||||
|
||||
{{-- ======================================================================== --}}
|
||||
@endsection
|
||||
|
||||
|
|
Loading…
Reference in New Issue