feat: tambah website publik dengan halaman beranda, tentang, dan kegiatan
This commit is contained in:
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Activity;
|
||||||
|
use App\Models\Division;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class PublicController extends Controller
|
||||||
|
{
|
||||||
|
public function home()
|
||||||
|
{
|
||||||
|
return view('public.home', [
|
||||||
|
'totalAnggota' => User::where('status', 'aktif')->count(),
|
||||||
|
'totalDivisi' => Division::count(),
|
||||||
|
'kegiatan' => Activity::where('status', 'approved')
|
||||||
|
->latest('start_date')->take(3)->get(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function tentang()
|
||||||
|
{
|
||||||
|
return view('public.tentang', [
|
||||||
|
'divisi' => Division::withCount('members')->get(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function kegiatan()
|
||||||
|
{
|
||||||
|
return view('public.kegiatan', [
|
||||||
|
'kegiatan' => Activity::where('status', 'approved')
|
||||||
|
->latest('start_date')->paginate(9),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function kegiatanDetail(Activity $activity)
|
||||||
|
{
|
||||||
|
abort_if($activity->status !== 'approved', 404);
|
||||||
|
|
||||||
|
return view('public.kegiatan-detail', compact('activity'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
@extends('public.layout')
|
||||||
|
|
||||||
|
@section('title', 'Beranda')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
{{-- Hero --}}
|
||||||
|
<div class="text-center py-16 bg-green-700 text-white rounded-2xl mb-12 px-6">
|
||||||
|
<h1 class="text-4xl font-bold mb-3">Persegi</h1>
|
||||||
|
<p class="text-lg opacity-90">Organisasi Pemuda Desa Karangdadap</p>
|
||||||
|
<p class="text-sm opacity-75 mt-1">Kecamatan Kalibagor, Kabupaten Banyumas</p>
|
||||||
|
<a href="{{ route('tentang') }}" class="mt-6 inline-block bg-white text-green-700 font-semibold px-6 py-2 rounded-full hover:bg-green-50">
|
||||||
|
Kenali Kami
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Stats --}}
|
||||||
|
<div class="grid grid-cols-2 md:grid-cols-3 gap-6 mb-12 text-center">
|
||||||
|
<div class="bg-white rounded-xl shadow p-6">
|
||||||
|
<div class="text-3xl font-bold text-green-700">{{ $totalAnggota }}</div>
|
||||||
|
<div class="text-sm text-gray-500 mt-1">Anggota Aktif</div>
|
||||||
|
</div>
|
||||||
|
<div class="bg-white rounded-xl shadow p-6">
|
||||||
|
<div class="text-3xl font-bold text-green-700">{{ $totalDivisi }}</div>
|
||||||
|
<div class="text-sm text-gray-500 mt-1">Divisi</div>
|
||||||
|
</div>
|
||||||
|
<div class="bg-white rounded-xl shadow p-6 col-span-2 md:col-span-1">
|
||||||
|
<div class="text-3xl font-bold text-green-700">{{ $kegiatan->count() }}</div>
|
||||||
|
<div class="text-sm text-gray-500 mt-1">Kegiatan Terbaru</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- Kegiatan Terbaru --}}
|
||||||
|
<h2 class="text-2xl font-bold mb-6">Kegiatan Terbaru</h2>
|
||||||
|
<div class="grid md:grid-cols-3 gap-6">
|
||||||
|
@forelse($kegiatan as $item)
|
||||||
|
<a href="{{ route('kegiatan.detail', $item) }}" class="bg-white rounded-xl shadow hover:shadow-md transition p-5 block">
|
||||||
|
<div class="text-xs text-green-600 font-semibold mb-1">
|
||||||
|
{{ $item->start_date->format('d M Y') }}
|
||||||
|
</div>
|
||||||
|
<h3 class="font-bold text-gray-800 mb-2">{{ $item->title }}</h3>
|
||||||
|
<p class="text-sm text-gray-500 line-clamp-3">{{ $item->description }}</p>
|
||||||
|
</a>
|
||||||
|
@empty
|
||||||
|
<p class="text-gray-400 col-span-3">Belum ada kegiatan.</p>
|
||||||
|
@endforelse
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($kegiatan->count())
|
||||||
|
<div class="text-center mt-8">
|
||||||
|
<a href="{{ route('kegiatan') }}" class="text-green-700 font-semibold hover:underline">Lihat semua kegiatan →</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
@extends('public.layout')
|
||||||
|
|
||||||
|
@section('title', $activity->title)
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<a href="{{ route('kegiatan') }}" class="text-green-700 text-sm hover:underline">← Kembali ke Kegiatan</a>
|
||||||
|
|
||||||
|
<div class="bg-white rounded-xl shadow p-8 mt-6">
|
||||||
|
<div class="text-sm text-green-600 font-semibold mb-2">
|
||||||
|
{{ $activity->start_date->format('d M Y') }}
|
||||||
|
@if($activity->start_date->ne($activity->end_date))
|
||||||
|
— {{ $activity->end_date->format('d M Y') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1 class="text-3xl font-bold mb-4">{{ $activity->title }}</h1>
|
||||||
|
|
||||||
|
<p class="text-gray-600 leading-relaxed mb-6">{{ $activity->description }}</p>
|
||||||
|
|
||||||
|
<div class="grid md:grid-cols-2 gap-4 text-sm text-gray-500 border-t pt-6">
|
||||||
|
<div>
|
||||||
|
<span class="font-semibold text-gray-700">Dibuat oleh:</span>
|
||||||
|
{{ $activity->creator->name }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="font-semibold text-gray-700">Peserta:</span>
|
||||||
|
{{ $activity->participants->count() }} orang
|
||||||
|
</div>
|
||||||
|
@if($activity->executed_at)
|
||||||
|
<div>
|
||||||
|
<span class="font-semibold text-gray-700">Dilaksanakan:</span>
|
||||||
|
{{ $activity->executed_at->format('d M Y') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($activity->execution_notes)
|
||||||
|
<div class="mt-6 bg-green-50 rounded-lg p-4">
|
||||||
|
<div class="font-semibold text-green-800 mb-1">Catatan Pelaksanaan</div>
|
||||||
|
<p class="text-sm text-green-700">{{ $activity->execution_notes }}</p>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
@extends('public.layout')
|
||||||
|
|
||||||
|
@section('title', 'Kegiatan')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<h1 class="text-3xl font-bold mb-2">Kegiatan</h1>
|
||||||
|
<p class="text-gray-500 mb-10">Dokumentasi kegiatan organisasi Persegi</p>
|
||||||
|
|
||||||
|
<div class="grid md:grid-cols-3 gap-6">
|
||||||
|
@forelse($kegiatan as $item)
|
||||||
|
<a href="{{ route('kegiatan.detail', $item) }}" class="bg-white rounded-xl shadow hover:shadow-md transition p-5 block">
|
||||||
|
<div class="text-xs text-green-600 font-semibold mb-1">
|
||||||
|
{{ $item->start_date->format('d M Y') }}
|
||||||
|
@if($item->start_date->ne($item->end_date))
|
||||||
|
— {{ $item->end_date->format('d M Y') }}
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
<h3 class="font-bold text-gray-800 mb-2">{{ $item->title }}</h3>
|
||||||
|
<p class="text-sm text-gray-500 line-clamp-3">{{ $item->description }}</p>
|
||||||
|
@if($item->executed_at)
|
||||||
|
<span class="mt-3 inline-block text-xs bg-green-100 text-green-700 px-2 py-1 rounded-full">Terlaksana</span>
|
||||||
|
@else
|
||||||
|
<span class="mt-3 inline-block text-xs bg-yellow-100 text-yellow-700 px-2 py-1 rounded-full">Akan Datang</span>
|
||||||
|
@endif
|
||||||
|
</a>
|
||||||
|
@empty
|
||||||
|
<p class="text-gray-400 col-span-3">Belum ada kegiatan.</p>
|
||||||
|
@endforelse
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-10">
|
||||||
|
{{ $kegiatan->links() }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="id">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>@yield('title', 'Persegi') — Organisasi Pemuda Desa Karangdadap</title>
|
||||||
|
<script src="https://cdn.tailwindcss.com"></script>
|
||||||
|
</head>
|
||||||
|
<body class="bg-gray-50 text-gray-800 font-sans">
|
||||||
|
|
||||||
|
<nav class="bg-green-700 text-white shadow">
|
||||||
|
<div class="max-w-5xl mx-auto px-4 py-3 flex items-center justify-between">
|
||||||
|
<a href="{{ route('home') }}" class="font-bold text-xl tracking-wide">🌿 Persegi</a>
|
||||||
|
<div class="flex gap-6 text-sm font-medium">
|
||||||
|
<a href="{{ route('home') }}" class="hover:underline">Beranda</a>
|
||||||
|
<a href="{{ route('tentang') }}" class="hover:underline">Tentang</a>
|
||||||
|
<a href="{{ route('kegiatan') }}" class="hover:underline">Kegiatan</a>
|
||||||
|
<a href="{{ route('filament.admin.auth.login') }}" class="bg-white text-green-700 px-3 py-1 rounded hover:bg-green-50">Login</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="max-w-5xl mx-auto px-4 py-10">
|
||||||
|
@yield('content')
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="bg-green-800 text-white text-center text-sm py-6 mt-16">
|
||||||
|
<p>© {{ date('Y') }} Persegi — Organisasi Pemuda Desa Karangdadap, Kalibagor, Banyumas</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
@extends('public.layout')
|
||||||
|
|
||||||
|
@section('title', 'Tentang Kami')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<h1 class="text-3xl font-bold mb-2">Tentang Persegi</h1>
|
||||||
|
<p class="text-gray-500 mb-10">Organisasi Pemuda Independen Desa Karangdadap</p>
|
||||||
|
|
||||||
|
<div class="bg-white rounded-xl shadow p-8 mb-10 prose max-w-none">
|
||||||
|
<p>
|
||||||
|
<strong>Persegi</strong> adalah organisasi pemuda independen yang berdiri di Desa Karangdadap,
|
||||||
|
Kecamatan Kalibagor, Kabupaten Banyumas. Kami berkomitmen untuk mendorong partisipasi aktif
|
||||||
|
pemuda dalam pembangunan desa melalui kegiatan sosial, pendidikan, olahraga, dan budaya.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Dengan prinsip <em>transparansi, gotong royong, dan inovasi</em>, Persegi hadir sebagai
|
||||||
|
wadah bagi pemuda desa untuk berkontribusi nyata bagi masyarakat.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 class="text-2xl font-bold mb-6">Divisi Organisasi</h2>
|
||||||
|
<div class="grid md:grid-cols-2 gap-6">
|
||||||
|
@foreach($divisi as $div)
|
||||||
|
<div class="bg-white rounded-xl shadow p-6">
|
||||||
|
<h3 class="font-bold text-green-700 text-lg mb-1">{{ $div->name }}</h3>
|
||||||
|
<p class="text-sm text-gray-500 mb-3">{{ $div->description }}</p>
|
||||||
|
<span class="text-xs bg-green-100 text-green-700 px-2 py-1 rounded-full">
|
||||||
|
{{ $div->members_count }} anggota
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@endsection
|
||||||
+4
-3
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', [\App\Http\Controllers\PublicController::class, 'home'])->name('home');
|
||||||
return view('welcome');
|
Route::get('/tentang', [\App\Http\Controllers\PublicController::class, 'tentang'])->name('tentang');
|
||||||
});
|
Route::get('/kegiatan', [\App\Http\Controllers\PublicController::class, 'kegiatan'])->name('kegiatan');
|
||||||
|
Route::get('/kegiatan/{activity}', [\App\Http\Controllers\PublicController::class, 'kegiatanDetail'])->name('kegiatan.detail');
|
||||||
|
|||||||
Reference in New Issue
Block a user