diff --git a/app/Http/Controllers/Admin/ClassificationController.php b/app/Http/Controllers/Admin/ClassificationController.php
new file mode 100644
index 0000000..eff5d7d
--- /dev/null
+++ b/app/Http/Controllers/Admin/ClassificationController.php
@@ -0,0 +1,28 @@
+latest()
+ ->paginate(10);
+
+ return Inertia::render('admin/Classification', [
+ 'classifications' => $classifications
+ ]);
+ }
+
+ public function destroy(Classification $classification)
+ {
+ $classification->delete();
+ return redirect()->back()->with('success', 'History classification deleted successfully.');
+ }
+}
diff --git a/resources/js/components/AppSidebar.vue b/resources/js/components/AppSidebar.vue
index 7c28627..f181b0e 100644
--- a/resources/js/components/AppSidebar.vue
+++ b/resources/js/components/AppSidebar.vue
@@ -34,6 +34,11 @@ const user = computed(() => page.props.auth.user);
href: route('admin.users.index'),
icon: Users,
},
+ {
+ title: 'History Klasifikasi',
+ href: route('admin.classifications.index'),
+ icon: ScanSearch,
+ },
];
const userNavItems: NavItem[] = [
diff --git a/resources/js/components/public/Hero.vue b/resources/js/components/public/Hero.vue
index 6a7edba..ac86506 100644
--- a/resources/js/components/public/Hero.vue
+++ b/resources/js/components/public/Hero.vue
@@ -54,6 +54,7 @@
:src="avatar"
:alt="`Avatar ${index + 1}`"
class="w-10 h-10 rounded-full border-2 border-zinc-950 object-cover"
+ loading="lazy"
/>
diff --git a/resources/js/components/public/Scanner.vue b/resources/js/components/public/Scanner.vue
index 179f822..cc265e9 100644
--- a/resources/js/components/public/Scanner.vue
+++ b/resources/js/components/public/Scanner.vue
@@ -53,7 +53,7 @@
-
+
Klik untuk mengganti
diff --git a/resources/js/components/ui/avatar/AvatarImage.vue b/resources/js/components/ui/avatar/AvatarImage.vue
index 24a8166..e1baef2 100644
--- a/resources/js/components/ui/avatar/AvatarImage.vue
+++ b/resources/js/components/ui/avatar/AvatarImage.vue
@@ -10,6 +10,7 @@ const props = defineProps()
data-slot="avatar-image"
v-bind="props"
class="aspect-square size-full"
+ loading="lazy"
>
diff --git a/resources/js/pages/admin/Classification.vue b/resources/js/pages/admin/Classification.vue
new file mode 100644
index 0000000..cea35e1
--- /dev/null
+++ b/resources/js/pages/admin/Classification.vue
@@ -0,0 +1,196 @@
+
+
+
+
+
+
+
+
+
History Klasifikasi
+
Daftar semua hasil klasifikasi yang dilakukan oleh pengguna maupun tamu.
+
+
+
+
+
+
+
+ Waktu
+ User Pembuat
+ Hasil
+ Confidence
+ Status
+ Aksi
+
+
+
+
+ Tidak ada data klasifikasi.
+
+
+ {{ formatDate(item.created_at) }}
+
+
+ {{ item.user ? item.user.name : 'Guess' }}
+
+
+ {{ item.user.email }}
+
+
+
+
+ {{ item.result }}
+
+
+ {{ item.confidence }}%
+
+
+ {{ item.status }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/js/pages/admin/Dashboard.vue b/resources/js/pages/admin/Dashboard.vue
index 007b242..f89fa04 100644
--- a/resources/js/pages/admin/Dashboard.vue
+++ b/resources/js/pages/admin/Dashboard.vue
@@ -36,12 +36,28 @@ const props = defineProps<{
const chartConfig = computed(() => ({
labels: props.chartData.map(item => item.result),
datasets: [{
- backgroundColor: ['#eab308', '#22c55e', '#3b82f6'], // Honey (Yellow), Natural (Green), Washed (Blue)
+ backgroundColor: props.chartData.map(item => {
+ switch (item.result?.toLowerCase()) {
+ case 'honey': return '#f59e0b'; // Amber-500
+ case 'washed': return '#3b82f6'; // Blue-500
+ case 'natural': return '#10b981'; // Emerald-500
+ default: return '#94a3b8'; // Slate-400
+ }
+ }),
data: props.chartData.map(item => item.total),
borderWidth: 1
}]
}));
+const getResultColorClass = (result: string) => {
+ switch (result?.toLowerCase()) {
+ case 'honey': return 'text-amber-600 dark:text-amber-500';
+ case 'washed': return 'text-blue-600 dark:text-blue-500';
+ case 'natural': return 'text-emerald-600 dark:text-emerald-500';
+ default: return 'text-muted-foreground';
+ }
+};
+
const chartOptions = {
responsive: true,
maintainAspectRatio: false,
@@ -133,11 +149,13 @@ const chartOptions = {
- |
- {{ new Date(item.created_at).toLocaleDateString('id-ID') }}
+ |
+ {{ new Date(item.created_at).toLocaleDateString('id-ID', { day: '2-digit', month: 'short' }) }}
|
- {{ item.result }} |
- {{ item.confidence }}% |
+
+ {{ item.result }}
+ |
+ {{ item.confidence }}% |
| Tidak ada data. |
diff --git a/resources/js/pages/user/classification/ClassificationIndex.vue b/resources/js/pages/user/classification/ClassificationIndex.vue
index f9454ab..b11c604 100644
--- a/resources/js/pages/user/classification/ClassificationIndex.vue
+++ b/resources/js/pages/user/classification/ClassificationIndex.vue
@@ -64,6 +64,32 @@ const toggleScanner = () => {
}
};
+const getResultColorText = (result: string) => {
+ switch (result?.toLowerCase()) {
+ case 'honey':
+ return 'text-amber-600 dark:text-amber-500';
+ case 'washed':
+ return 'text-blue-600 dark:text-blue-500';
+ case 'natural':
+ return 'text-emerald-600 dark:text-emerald-500';
+ default:
+ return 'text-emerald-600 dark:text-emerald-500';
+ }
+};
+
+const getResultColorBar = (result: string) => {
+ switch (result?.toLowerCase()) {
+ case 'honey':
+ return 'bg-amber-500';
+ case 'washed':
+ return 'bg-blue-500';
+ case 'natural':
+ return 'bg-emerald-500';
+ default:
+ return 'bg-emerald-500';
+ }
+};
+
@@ -120,6 +146,7 @@ const toggleScanner = () => {
@@ -131,7 +158,7 @@ const toggleScanner = () => {
{{ new Date(item.created_at).toLocaleDateString('id-ID', { day: 'numeric', month: 'short' }) }}
- {{ item.result }}
+ {{ item.result }}
diff --git a/routes/web.php b/routes/web.php
index 02f4619..951470b 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -4,7 +4,8 @@
use Laravel\Fortify\Features;
use App\Http\Controllers\Admin\UserController;
use App\Http\Controllers\Admin\DashboardController;
-use App\Http\Controllers\Public\ClassificationController; // Import Controller
+use App\Http\Controllers\Public\ClassificationController;
+use App\Http\Controllers\Admin\ClassificationController as AdminClassificationController;
Route::get('dashboard', function () {
if (auth()->user()->role === 'admin') {
@@ -30,9 +31,8 @@
Route::prefix('admin')->name('admin.')->middleware(['auth', 'verified'])->group(function () {
Route::get('dashboard', [DashboardController::class, 'index'])->name('dashboard');
Route::resource('users', UserController::class)->names('users');
-
- // Route tambahan untuk Admin jika ingin melihat history klasifikasi secara global
- // Route::get('history', [DashboardController::class, 'history'])->name('history');
+ Route::get('classifications', [AdminClassificationController::class, 'index'])->name('classifications.index');
+ Route::delete('classifications/{classification}', [AdminClassificationController::class, 'destroy'])->name('classifications.destroy');
});