MIF_E31220412/resources/views/admin/dashboard.blade.php

151 lines
7.7 KiB
PHP

@extends('layouts.admin')
@section('title', 'Admin Dashboard - INUFA')
@section('header', 'Admin Dashboard')
@section('content')
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<!-- Total Users -->
<div class="bg-white rounded-xl shadow-sm p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-blue-100 text-blue-600 mr-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" />
</svg>
</div>
<div>
<p class="text-sm text-gray-500">Total Pengguna</p>
<p class="text-2xl font-semibold text-gray-800">{{ $stats['users'] ?? 0 }}</p>
</div>
</div>
</div>
<!-- Total Packages -->
<div class="bg-white rounded-xl shadow-sm p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-green-100 text-green-600 mr-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4" />
</svg>
</div>
<div>
<p class="text-sm text-gray-500">Total Paket</p>
<p class="text-2xl font-semibold text-gray-800">{{ $stats['packages'] ?? 0 }}</p>
</div>
</div>
</div>
<!-- Total Rentals -->
<div class="bg-white rounded-xl shadow-sm p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-yellow-100 text-yellow-600 mr-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
</svg>
</div>
<div>
<p class="text-sm text-gray-500">Total Sewa</p>
<p class="text-2xl font-semibold text-gray-800">{{ $stats['rentals'] ?? 0 }}</p>
</div>
</div>
</div>
<!-- Total Revenue -->
<div class="bg-white rounded-xl shadow-sm p-6">
<div class="flex items-center">
<div class="p-3 rounded-full bg-purple-100 text-purple-600 mr-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<div>
<p class="text-sm text-gray-500">Total Pendapatan</p>
<p class="text-2xl font-semibold text-gray-800">Rp {{ number_format($stats['revenue'] ?? 0, 0, ',', '.') }}</p>
</div>
</div>
</div>
</div>
<!-- Recent Activities -->
<div class="bg-white rounded-xl shadow-sm p-6">
<div class="flex items-center justify-between mb-6">
<h3 class="text-lg font-semibold text-gray-800">Aktivitas Terbaru</h3>
<a href="{{ route('riwayat') }}" class="text-blue-600 hover:text-blue-800 text-sm font-medium">Lihat Semua</a>
</div>
<div class="space-y-4">
@if(isset($activities) && count($activities) > 0)
@foreach($activities as $activity)
<div class="flex items-start p-4 rounded-lg hover:bg-gray-50">
<div class="bg-{{ $activity['color'] }}-100 text-{{ $activity['color'] }}-600 rounded-full p-2 mr-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="{{ $activity['icon'] }}" />
</svg>
</div>
<div class="flex-1">
<p class="font-medium text-gray-800">{{ $activity['title'] }}</p>
<p class="text-sm text-gray-600">{{ $activity['description'] }}</p>
<p class="text-xs text-gray-400 mt-1">{{ $activity['time'] }}</p>
</div>
</div>
@endforeach
@else
<div class="text-center py-8">
<svg xmlns="http://www.w3.org/2000/svg" class="h-12 w-12 mx-auto text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
<p class="mt-2 text-gray-500">Belum ada aktivitas terbaru</p>
</div>
@endif
</div>
</div>
@if(session('success_rekening'))
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-4 rounded">
{{ session('success_rekening') }}
</div>
@endif
<!-- Notifikasi Pesanan Dibatalkan -->
@if(isset($recentCancellations) && count($recentCancellations) > 0)
<div class="bg-red-50 border-l-4 border-red-400 p-4 mb-6">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-red-800">
Pesanan Dibatalkan Terbaru
</h3>
<div class="mt-2 text-sm text-red-700">
<p>Ada {{ count($recentCancellations) }} pesanan yang baru dibatalkan oleh customer.
<a href="{{ route('admin.cancelled-orders') }}" class="font-medium underline hover:text-red-600">Lihat Detail</a></p>
</div>
<div class="mt-3">
@foreach($recentCancellations->take(3) as $cancellation)
<div class="text-xs text-red-600 mb-1">
{{ $cancellation->user->name ?? 'User' }} membatalkan pesanan #{{ $cancellation->id }}
({{ $cancellation->paket->nama ?? 'Paket' }}) - {{ $cancellation->updated_at->diffForHumans() }}
</div>
@endforeach
</div>
</div>
</div>
</div>
@endif
<div class="bg-white rounded-lg shadow-md p-6 mb-6 max-w-lg">
<h2 class="text-lg font-semibold mb-4">Pengaturan Nomor Rekening</h2>
<form action="{{ route('admin.save-rekening') }}" method="POST">
@csrf
<div class="mb-4">
<label for="nomor_rekening" class="block text-gray-700 font-medium mb-2">Nomor Rekening</label>
<input type="text" id="nomor_rekening" name="nomor_rekening" value="{{ old('nomor_rekening', $nomor_rekening ?? '') }}" class="w-full border border-gray-300 rounded-md px-3 py-2">
</div>
<button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded">Simpan</button>
</form>
</div>