329 lines
12 KiB
PHP
329 lines
12 KiB
PHP
@extends('admin.layouts.app')
|
|
|
|
@section('content')
|
|
|
|
<style>
|
|
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
|
|
|
|
*, *::before, *::after { box-sizing: border-box; }
|
|
|
|
.keg-wrap {
|
|
padding: 2rem 2.5rem 3rem;
|
|
max-width: 1440px;
|
|
margin: 0 auto;
|
|
font-family: 'Plus Jakarta Sans', sans-serif;
|
|
}
|
|
|
|
/* ── Header ─── */
|
|
.keg-topbar {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: flex-end;
|
|
margin-bottom: 1.75rem;
|
|
}
|
|
.keg-title { font-size: 22px; font-weight: 700; color: #0D215C; }
|
|
.keg-sub { font-size: 12.5px; color: #94a3b8; margin-top: 4px; }
|
|
|
|
.keg-btn-back {
|
|
padding: 8px 18px;
|
|
border-radius: 10px;
|
|
background: #eef2ff;
|
|
color: #3730a3;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
text-decoration: none;
|
|
transition: all .2s;
|
|
}
|
|
.keg-btn-back:hover { background: #dbeafe; color: #1d4ed8; }
|
|
|
|
/* ── Stats Strip ─── */
|
|
.keg-stats {
|
|
display: grid;
|
|
grid-template-columns: repeat(3,1fr);
|
|
gap: 16px;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
.kstat {
|
|
background: #fff;
|
|
border: 1px solid #edf1f7;
|
|
border-radius: 16px;
|
|
padding: 1.2rem 1.4rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 14px;
|
|
}
|
|
.kstat-icon {
|
|
width: 42px; height: 42px;
|
|
border-radius: 12px;
|
|
display: flex; align-items: center; justify-content: center;
|
|
}
|
|
.kstat-icon.blue { background: #eff6ff; color: #3b82f6; }
|
|
.kstat-icon.green { background: #f0fdf4; color: #16a34a; }
|
|
.kstat-icon.yellow { background: #fffbeb; color: #d97706; }
|
|
.kstat-num { font-size: 28px; font-weight: 700; color: #0f172a; line-height: 1; }
|
|
.kstat-label { font-size: 12px; color: #94a3b8; margin-top: 3px; font-weight: 500; }
|
|
|
|
/* ── Search + Filter ─── */
|
|
.keg-filter-bar {
|
|
display: flex;
|
|
gap: 12px;
|
|
align-items: center;
|
|
margin-bottom: 1.2rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
.keg-search {
|
|
flex: 1;
|
|
min-width: 200px;
|
|
padding: 9px 14px;
|
|
border: 1.5px solid #e2e8f0;
|
|
border-radius: 10px;
|
|
font-size: 13px;
|
|
outline: none;
|
|
transition: border .2s;
|
|
}
|
|
.keg-search:focus { border-color: #3b82f6; }
|
|
.keg-select {
|
|
padding: 9px 14px;
|
|
border: 1.5px solid #e2e8f0;
|
|
border-radius: 10px;
|
|
font-size: 13px;
|
|
outline: none;
|
|
background: #fff;
|
|
cursor: pointer;
|
|
}
|
|
.keg-filter-btn {
|
|
padding: 9px 20px;
|
|
background: #0D215C;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 10px;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: .2s;
|
|
}
|
|
.keg-filter-btn:hover { background: #1e3a8a; }
|
|
|
|
/* ── Table Card ─── */
|
|
.keg-card {
|
|
background: #fff;
|
|
border: 1px solid #edf1f7;
|
|
border-radius: 20px;
|
|
overflow: hidden;
|
|
box-shadow: 0 2px 12px rgba(13,33,92,.04);
|
|
}
|
|
.keg-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
font-size: 13px;
|
|
}
|
|
.keg-table thead { background: #f8fafc; }
|
|
.keg-table thead th {
|
|
padding: 14px 18px;
|
|
text-align: left;
|
|
font-size: 11px;
|
|
font-weight: 700;
|
|
color: #94a3b8;
|
|
text-transform: uppercase;
|
|
letter-spacing: .5px;
|
|
}
|
|
.keg-table tbody td {
|
|
padding: 14px 18px;
|
|
border-top: 1px solid #f1f5f9;
|
|
vertical-align: middle;
|
|
color: #334155;
|
|
}
|
|
.keg-table tbody tr:hover { background: #f8fafc; }
|
|
|
|
.pill {
|
|
font-size: 10px;
|
|
font-weight: 700;
|
|
padding: 4px 12px;
|
|
border-radius: 50px;
|
|
letter-spacing: .3px;
|
|
white-space: nowrap;
|
|
}
|
|
.pill-ok { background: #dcfce7; color: #15803d; }
|
|
.pill-run { background: #dbeafe; color: #1d4ed8; }
|
|
.pill-rev { background: #fef9c3; color: #92400e; }
|
|
.pill-del { background: #fee2e2; color: #b91c1c; }
|
|
|
|
.act-btn {
|
|
padding: 6px 14px;
|
|
border-radius: 8px;
|
|
font-size: 11px;
|
|
font-weight: 700;
|
|
text-decoration: none;
|
|
border: none;
|
|
cursor: pointer;
|
|
transition: .15s;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 4px;
|
|
}
|
|
.btn-view { background: #eff6ff; color: #2563eb; }
|
|
.btn-view:hover { background: #dbeafe; }
|
|
.btn-edit-k { background: #f0fdf4; color: #15803d; }
|
|
.btn-edit-k:hover { background: #dcfce7; }
|
|
.btn-del-k { background: #fff1f2; color: #be123c; }
|
|
.btn-del-k:hover { background: #fee2e2; }
|
|
|
|
.pg-wrap { padding: 16px 18px; border-top: 1px solid #f1f5f9; }
|
|
|
|
.empty-row td {
|
|
text-align: center;
|
|
padding: 3rem;
|
|
color: #94a3b8;
|
|
font-size: 13px;
|
|
}
|
|
|
|
/* ── Responsive ─── */
|
|
@media (max-width: 768px) {
|
|
.keg-wrap { padding: 1rem; }
|
|
.keg-topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
|
|
.keg-stats { grid-template-columns: 1fr; gap: 12px; }
|
|
.keg-filter-bar { flex-direction: column; align-items: stretch; }
|
|
.keg-search, .keg-select, .keg-filter-btn { width: 100%; }
|
|
}
|
|
</style>
|
|
|
|
<div class="keg-wrap">
|
|
|
|
{{-- ALERTS --}}
|
|
@if(session('success'))
|
|
<div style="background:#dcfce7;color:#166534;padding:12px 18px;border-radius:12px;margin-bottom:1.2rem;font-size:13px;font-weight:600;">
|
|
✓ {{ session('success') }}
|
|
</div>
|
|
@endif
|
|
@if(session('error'))
|
|
<div style="background:#fee2e2;color:#b91c1c;padding:12px 18px;border-radius:12px;margin-bottom:1.2rem;font-size:13px;font-weight:600;">
|
|
✗ {{ session('error') }}
|
|
</div>
|
|
@endif
|
|
|
|
{{-- TOPBAR --}}
|
|
<div class="keg-topbar">
|
|
<div>
|
|
<div class="keg-title">Daftar Kegiatan</div>
|
|
<div class="keg-sub">Monitor dan kelola seluruh kegiatan lapangan</div>
|
|
</div>
|
|
<a href="{{ route('admin.dashboard') }}" class="keg-btn-back">← Kembali ke Dashboard</a>
|
|
</div>
|
|
|
|
{{-- STATS --}}
|
|
@php
|
|
$totalAll = $allItems->count();
|
|
$totalSelesai = $allItems->where('status','selesai')->count();
|
|
$totalProses = $allItems->where('status','on_progres')->count();
|
|
@endphp
|
|
<div class="keg-stats">
|
|
<div class="kstat">
|
|
<div class="kstat-icon blue">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2"/><rect x="9" y="3" width="6" height="4" rx="1"/></svg>
|
|
</div>
|
|
<div>
|
|
<div class="kstat-num">{{ $totalAll }}</div>
|
|
<div class="kstat-label">Total Kegiatan</div>
|
|
</div>
|
|
</div>
|
|
<div class="kstat">
|
|
<div class="kstat-icon green">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>
|
|
</div>
|
|
<div>
|
|
<div class="kstat-num">{{ $totalSelesai }}</div>
|
|
<div class="kstat-label">Selesai</div>
|
|
</div>
|
|
</div>
|
|
<div class="kstat">
|
|
<div class="kstat-icon yellow">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>
|
|
</div>
|
|
<div>
|
|
<div class="kstat-num">{{ $totalProses }}</div>
|
|
<div class="kstat-label">Sedang Berjalan</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- FILTER BAR --}}
|
|
<form method="GET" action="{{ route('admin.kegiatan.index') }}" class="keg-filter-bar">
|
|
<input type="text" name="search" class="keg-search" placeholder="Cari nama kegiatan / penanggung jawab..." value="{{ request('search') }}">
|
|
<select name="status" class="keg-select">
|
|
<option value="semua" {{ request('status','semua')=='semua' ? 'selected':'' }}>Semua Status</option>
|
|
<option value="on_progres" {{ request('status')=='on_progres' ? 'selected':'' }}>Sedang Berjalan</option>
|
|
<option value="selesai" {{ request('status')=='selesai' ? 'selected':'' }}>Selesai</option>
|
|
<option value="telah_ditinjau" {{ request('status')=='telah_ditinjau' ? 'selected':'' }}>Telah Ditinjau</option>
|
|
</select>
|
|
<button type="submit" class="keg-filter-btn">Cari</button>
|
|
@if(request('search') || request('status'))
|
|
<a href="{{ route('admin.kegiatan.index') }}" class="keg-btn-back" style="padding:9px 16px;font-size:12px;">Reset</a>
|
|
@endif
|
|
</form>
|
|
|
|
{{-- TABLE --}}
|
|
<div class="keg-card">
|
|
<div style="overflow-x: auto; width: 100%;">
|
|
<table class="keg-table" style="min-width: 700px;">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Nama Kegiatan</th>
|
|
<th>Penanggung Jawab</th>
|
|
<th>Tanggal</th>
|
|
<th>Status</th>
|
|
<th>Aksi</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@forelse($activities as $i => $item)
|
|
@php
|
|
$namaUser = optional($item->user)->name ?? 'User Tidak Ada';
|
|
$inisial = collect(explode(' ', $namaUser))
|
|
->take(2)
|
|
->map(fn($w) => strtoupper(substr($w,0,1)))
|
|
->join('');
|
|
$pillMap = [
|
|
'selesai' => ['pill-ok', 'Selesai'],
|
|
'on_progres' => ['pill-run', 'Berjalan'],
|
|
'telah_ditinjau' => ['pill-rev', 'Ditinjau'],
|
|
'dibatalkan' => ['pill-del', 'Dibatalkan'],
|
|
];
|
|
$pc = $pillMap[$item->status] ?? ['pill-run', ucfirst($item->status)];
|
|
@endphp
|
|
<tr>
|
|
<td>{{ $activities->firstItem() + $i }}</td>
|
|
<td><strong>{{ $item->nama_kegiatan }}</strong></td>
|
|
<td>
|
|
<div style="display:flex;align-items:center;gap:8px;">
|
|
<span style="background:#e0e7ff;color:#3730a3;width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;">{{ $inisial }}</span>
|
|
{{ $namaUser }}
|
|
</div>
|
|
</td>
|
|
<td>{{ \Carbon\Carbon::parse($item->tanggal)->format('d M Y') }}</td>
|
|
<td><span class="pill {{ $pc[0] }}">{{ $pc[1] }}</span></td>
|
|
<td>
|
|
<div style="display:flex;gap:6px;">
|
|
<a href="{{ route('admin.kegiatan.show', $item->id) }}" class="act-btn btn-view">Lihat</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr class="empty-row">
|
|
<td colspan="6">
|
|
<div style="display:flex;flex-direction:column;align-items:center;gap:8px;color:#94a3b8;">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"/><polyline points="13 2 13 9 20 9"/></svg>
|
|
Tidak ada data kegiatan yang ditemukan.
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="pg-wrap">{{ $activities->links() }}</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@endsection |