Project Sibantudes

This commit is contained in:
Ryanpratama01 2026-02-27 22:43:50 +07:00
commit 8b9581f103
144 changed files with 51907 additions and 0 deletions

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[compose.yaml]
indent_size = 4

65
.env.example Normal file
View File

@ -0,0 +1,65 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
# PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=sqlite
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
# CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

24
.gitignore vendored Normal file
View File

@ -0,0 +1,24 @@
*.log
.DS_Store
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
/.fleet
/.idea
/.nova
/.phpunit.cache
/.vscode
/.zed
/auth.json
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
Homestead.json
Homestead.yaml
Thumbs.db

2299
.phpstorm.meta.php Normal file

File diff suppressed because it is too large Load Diff

59
README.md Normal file
View File

@ -0,0 +1,59 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. You can also check out [Laravel Learn](https://laravel.com/learn), where you will be guided through building a modern Laravel application.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Redberry](https://redberry.international/laravel-development)**
- **[Active Logic](https://activelogic.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

28434
_ide_helper.php Normal file

File diff suppressed because it is too large Load Diff

188
_ide_helper_models.php Normal file
View File

@ -0,0 +1,188 @@
<?php
// @formatter:off
// phpcs:ignoreFile
/**
* A helper file for your Eloquent Models
* Copy the phpDocs from this file to the correct Model,
* And remove them from this file, to prevent double declarations.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
*/
namespace App\Models{
/**
* @property int $id
* @property int $user_id
* @property int $rt_id
* @property string $no_kk
* @property string $nik
* @property string $nama_lengkap
* @property string $jenis_kelamin
* @property string $tempat_lahir
* @property \Illuminate\Support\Carbon $tanggal_lahir
* @property string $alamat
* @property string $desa
* @property string $pekerjaan
* @property numeric $penghasilan
* @property int $jumlah_tanggungan
* @property string $aset_kepemilikan
* @property string $bantuan_lain
* @property int $usia
* @property string $status_perkawinan
* @property string $status_verifikasi
* @property string|null $catatan_admin
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\PenerimaFinal|null $penerimaFinal
* @property-read \App\Models\PrediksiKelayakan|null $prediksiKelayakan
* @property-read \App\Models\RT $rt
* @property-read \App\Models\User $user
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereAlamat($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereAsetKepemilikan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereBantuanLain($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereCatatanAdmin($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereDesa($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereJenisKelamin($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereJumlahTanggungan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereNamaLengkap($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereNik($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereNoKk($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima wherePekerjaan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima wherePenghasilan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereRtId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereStatusPerkawinan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereStatusVerifikasi($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereTanggalLahir($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereTempatLahir($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|CalonPenerima whereUsia($value)
*/
class CalonPenerima extends \Eloquent {}
}
namespace App\Models{
/**
* @property int $id
* @property string $nama_dusun
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\RT> $rts
* @property-read int|null $rts_count
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dusun newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dusun newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dusun query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dusun whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dusun whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dusun whereNamaDusun($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|Dusun whereUpdatedAt($value)
*/
class Dusun extends \Eloquent {}
}
namespace App\Models{
/**
* @property int $id
* @property int $calon_penerima_id
* @property \Illuminate\Support\Carbon $tanggal_penetapan
* @property string $periode_bantuan
* @property numeric $jumlah_bantuan
* @property string $status_pencairan
* @property \Illuminate\Support\Carbon|null $tanggal_pencairan
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\CalonPenerima $calonPenerima
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal whereCalonPenerimaId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal whereJumlahBantuan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal wherePeriodeBantuan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal whereStatusPencairan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal whereTanggalPencairan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal whereTanggalPenetapan($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PenerimaFinal whereUpdatedAt($value)
*/
class PenerimaFinal extends \Eloquent {}
}
namespace App\Models{
/**
* @property int $id
* @property int $calon_penerima_id
* @property numeric $probability
* @property string $recommendation
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \App\Models\CalonPenerima $calonPenerima
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan whereCalonPenerimaId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan whereProbability($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan whereRecommendation($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|PrediksiKelayakan whereUpdatedAt($value)
*/
class PrediksiKelayakan extends \Eloquent {}
}
namespace App\Models{
/**
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CalonPenerima> $calonPenerimas
* @property-read int|null $calon_penerimas_count
* @property-read \App\Models\Dusun|null $dusun
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\User> $users
* @property-read int|null $users_count
* @method static \Illuminate\Database\Eloquent\Builder<static>|RT newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|RT newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|RT query()
*/
class RT extends \Eloquent {}
}
namespace App\Models{
/**
* @property int $id
* @property string $name
* @property string $email
* @property \Illuminate\Support\Carbon|null $email_verified_at
* @property string $password
* @property string $role
* @property string|null $remember_token
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property int|null $rt_id
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\CalonPenerima> $calonPenerimas
* @property-read int|null $calon_penerimas_count
* @property-read \Illuminate\Notifications\DatabaseNotificationCollection<int, \Illuminate\Notifications\DatabaseNotification> $notifications
* @property-read int|null $notifications_count
* @property-read \App\Models\RT|null $rt
* @method static \Database\Factories\UserFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder<static>|User newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|User newQuery()
* @method static \Illuminate\Database\Eloquent\Builder<static>|User query()
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereEmail($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereEmailVerifiedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User wherePassword($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereRememberToken($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereRole($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereRtId($value)
* @method static \Illuminate\Database\Eloquent\Builder<static>|User whereUpdatedAt($value)
*/
class User extends \Eloquent {}
}

View File

@ -0,0 +1,147 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Http\Request;
class AdminController extends Controller
{
/**
* Halaman Data Akun: list semua user + role
*/
public function dataAkun(Request $request)
{
$this->guardAdmin($request);
$q = trim((string) $request->query('q', ''));
$usersQuery = User::query()->orderByDesc('id');
if ($q !== '') {
$usersQuery->where(function ($sub) use ($q) {
$sub->where('name', 'like', "%{$q}%")
->orWhere('email', 'like', "%{$q}%");
});
}
$users = $usersQuery->paginate(10)->withQueryString();
return view('admin.data-akun', compact('users'));
}
/**
* Ubah Role: rt <-> admin
*/
public function ubahRole(Request $request, $id)
{
$this->guardAdmin($request);
$actor = $request->user();
$target = User::findOrFail($id);
// Tidak boleh ubah diri sendiri
if ($target->id === $actor->id) {
return back()->with('error', 'Kamu tidak bisa mengubah role akun sendiri.');
}
$validated = $request->validate([
'role' => 'required|in:admin,rt',
]);
// Kalau target adalah admin, lalu mau diturunkan jadi RT,
// pastikan masih ada minimal 1 admin aktif setelah perubahan
if ($target->role === 'admin' && $validated['role'] === 'rt') {
if ($this->countActiveAdmins() <= 1) {
return back()->with('error', 'Tidak bisa menurunkan role admin terakhir.');
}
}
$target->update([
'role' => $validated['role'],
]);
return back()->with('success', "Role {$target->name} berhasil diubah menjadi {$validated['role']}.");
}
/**
* Aktifkan / Nonaktifkan Akun
* NOTE: butuh kolom users.is_active (boolean)
*/
public function toggleAktif(Request $request, $id)
{
$this->guardAdmin($request);
$actor = $request->user();
$target = User::findOrFail($id);
// Tidak boleh nonaktifkan diri sendiri
if ($target->id === $actor->id) {
return back()->with('error', 'Kamu tidak bisa menonaktifkan akun sendiri.');
}
// Kalau mau menonaktifkan admin, pastikan bukan admin terakhir yang masih aktif
$willDeactivate = (bool) $target->is_active === true; // kalau sekarang aktif, maka toggle jadi nonaktif
if ($willDeactivate && $target->role === 'admin') {
if ($this->countActiveAdmins() <= 1) {
return back()->with('error', 'Tidak bisa menonaktifkan admin terakhir.');
}
}
$target->is_active = !$target->is_active;
$target->save();
$status = $target->is_active ? 'diaktifkan' : 'dinonaktifkan';
return back()->with('success', "Akun {$target->name} berhasil {$status}.");
}
/**
* Hapus akun
*/
public function hapusUser(Request $request, $id)
{
$this->guardAdmin($request);
$actor = $request->user();
$target = User::findOrFail($id);
// Tidak boleh hapus diri sendiri
if ($target->id === $actor->id) {
return back()->with('error', 'Kamu tidak bisa menghapus akun sendiri.');
}
// Kalau menghapus admin, pastikan bukan admin terakhir yang masih aktif
if ($target->role === 'admin' && (bool) $target->is_active === true) {
if ($this->countActiveAdmins() <= 1) {
return back()->with('error', 'Tidak bisa menghapus admin terakhir.');
}
}
$target->delete();
return back()->with('success', "Akun {$target->name} berhasil dihapus.");
}
/**
* =========================
* Helper
* =========================
*/
private function guardAdmin(Request $request): void
{
$user = $request->user();
if (!$user || $user->role !== 'admin') {
abort(403, 'Akses ditolak: hanya Admin.');
}
}
private function countActiveAdmins(): int
{
return User::where('role', 'admin')
->where('is_active', 1)
->count();
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\CalonPenerima;
use App\Models\Dusun;
use App\Models\PenerimaFinal;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class FilterisasiController extends Controller
{
public function index(Request $request)
{
$user = $request->user();
if (!$user || $user->role !== 'admin') abort(403, 'Akses ditolak: hanya Admin.');
$dusuns = Dusun::orderBy('nama_dusun')->get();
$dusunId = (int) $request->query('dusun_id', 0);
$kuota = (int) $request->query('kuota', 7);
if ($kuota <= 0) $kuota = 7;
$candidates = collect();
$pickedIds = collect();
if ($dusunId > 0) {
$query = CalonPenerima::query()
->with(['rt.dusun', 'prediksiKelayakan'])
->where('status_verifikasi', 'disetujui') // ✅ ONLY DISETUJUI
->whereHas('rt', fn($q) => $q->where('dusun_id', $dusunId));
// urut probability DESC (null jadi 0)
$query->leftJoin('prediksi_kelayakans', 'prediksi_kelayakans.calon_penerima_id', '=', 'calon_penerimas.id')
->select('calon_penerimas.*', DB::raw('COALESCE(prediksi_kelayakans.probability, 0) as prob'))
->orderByDesc('prob')
->orderByDesc('calon_penerimas.created_at');
$candidates = $query->paginate(15)->withQueryString();
// tandai yang sudah masuk penerima_final
$pickedIds = PenerimaFinal::whereIn('calon_penerima_id', $candidates->pluck('id')->all())
->pluck('calon_penerima_id');
}
return view('admin.filterisasi', compact('dusuns', 'dusunId', 'kuota', 'candidates', 'pickedIds'));
}
public function tetapkan(Request $request)
{
$user = $request->user();
if (!$user || $user->role !== 'admin') abort(403, 'Akses ditolak: hanya Admin.');
$data = $request->validate([
'dusun_id' => 'required|exists:dusuns,id',
'kuota' => 'nullable|integer|min:1|max:100',
]);
$dusunId = (int) $data['dusun_id'];
$kuota = (int) ($data['kuota'] ?? 7);
DB::transaction(function () use ($dusunId, $kuota) {
$top = CalonPenerima::query()
->where('status_verifikasi', 'disetujui') // ✅ ONLY DISETUJUI
->whereHas('rt', fn($r) => $r->where('dusun_id', $dusunId))
->leftJoin('prediksi_kelayakans', 'prediksi_kelayakans.calon_penerima_id', '=', 'calon_penerimas.id')
->select('calon_penerimas.id', DB::raw('COALESCE(prediksi_kelayakans.probability, 0) as prob'))
->orderByDesc('prob')
->orderByDesc('calon_penerimas.created_at')
->limit($kuota)
->get();
foreach ($top as $row) {
PenerimaFinal::updateOrCreate(
['calon_penerima_id' => $row->id],
['dusun_id' => $dusunId] // kalau tabel kamu ga punya dusun_id, bilang ya nanti aku rapikan
);
}
});
return back()->with('success', "Berhasil menetapkan kuota {$kuota} penerima (status disetujui) untuk dusun terpilih.");
}
public function resetDusun(Request $request)
{
$user = $request->user();
if (!$user || $user->role !== 'admin') abort(403, 'Akses ditolak: hanya Admin.');
$data = $request->validate([
'dusun_id' => 'required|exists:dusuns,id',
]);
$dusunId = (int) $data['dusun_id'];
PenerimaFinal::where('dusun_id', $dusunId)->delete();
return back()->with('success', 'Hasil filterisasi dusun berhasil di-reset.');
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\LoginRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class AuthenticatedSessionController extends Controller
{
/**
* Display the login view.
*/
public function create(): View
{
return view('auth.login');
}
/**
* Handle an incoming authentication request.
*/
public function store(LoginRequest $request): RedirectResponse
{
$request->authenticate();
$request->session()->regenerate();
return redirect()->intended(route('dashboard', absolute: false));
}
/**
* Destroy an authenticated session.
*/
public function destroy(Request $request): RedirectResponse
{
Auth::guard('web')->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
class ConfirmablePasswordController extends Controller
{
/**
* Show the confirm password view.
*/
public function show(): View
{
return view('auth.confirm-password');
}
/**
* Confirm the user's password.
*/
public function store(Request $request): RedirectResponse
{
if (! Auth::guard('web')->validate([
'email' => $request->user()->email,
'password' => $request->password,
])) {
throw ValidationException::withMessages([
'password' => __('auth.password'),
]);
}
$request->session()->put('auth.password_confirmed_at', time());
return redirect()->intended(route('dashboard', absolute: false));
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class EmailVerificationNotificationController extends Controller
{
/**
* Send a new email verification notification.
*/
public function store(Request $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false));
}
$request->user()->sendEmailVerificationNotification();
return back()->with('status', 'verification-link-sent');
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
class EmailVerificationPromptController extends Controller
{
/**
* Display the email verification prompt.
*/
public function __invoke(Request $request): RedirectResponse|View
{
return $request->user()->hasVerifiedEmail()
? redirect()->intended(route('dashboard', absolute: false))
: view('auth.verify-email');
}
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
use SendsPasswordResetEmails;
public function __construct()
{
$this->middleware('guest');
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; // TAMBAHKAN INI
class LoginController extends Controller
{
use AuthenticatesUsers;
protected $redirectTo = '/dashboard';
public function __construct()
{
$this->middleware('guest')->except('logout');
$this->middleware('auth')->only('logout');
}
public function username()
{
return 'email';
}
protected function authenticated(Request $request, $user)
{
// Pastikan method isAdmin() ada di model User
// Atau ganti dengan pengecekan role yang sesuai
if ($user->role === 'admin') { // Sesuaikan dengan struktur database Anda
return redirect()->route('dashboard');
}
return redirect()->route('dashboard');
}
public function logout(Request $request)
{
Auth::guard()->logout(); // Gunakan Auth facade
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect('/login')->with('success', 'Anda telah berhasil keluar.');
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules;
use Illuminate\View\View;
class NewPasswordController extends Controller
{
/**
* Display the password reset view.
*/
public function create(Request $request): View
{
return view('auth.reset-password', ['request' => $request]);
}
/**
* Handle an incoming new password request.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'token' => ['required'],
'email' => ['required', 'email'],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
// Here we will attempt to reset the user's password. If it is successful we
// will update the password on an actual user model and persist it to the
// database. Otherwise we will parse the error and return the response.
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function (User $user) use ($request) {
$user->forceFill([
'password' => Hash::make($request->password),
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
// If the password was successfully reset, we will redirect the user back to
// the application's home authenticated view. If there is an error we can
// redirect them back to where they came from with their error message.
return $status == Password::PASSWORD_RESET
? redirect()->route('login')->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules\Password;
class PasswordController extends Controller
{
/**
* Update the user's password.
*/
public function update(Request $request): RedirectResponse
{
$validated = $request->validateWithBag('updatePassword', [
'current_password' => ['required', 'current_password'],
'password' => ['required', Password::defaults(), 'confirmed'],
]);
$request->user()->update([
'password' => Hash::make($validated['password']),
]);
return back()->with('status', 'password-updated');
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\View\View;
class PasswordResetLinkController extends Controller
{
/**
* Display the password reset link request view.
*/
public function create(): View
{
return view('auth.forgot-password');
}
/**
* Handle an incoming password reset link request.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'email' => ['required', 'email'],
]);
// We will send the password reset link to this user. Once we have attempted
// to send the link, we will examine the response then see the message we
// need to show to the user. Finally, we'll send out a proper response.
$status = Password::sendResetLink(
$request->only('email')
);
return $status == Password::RESET_LINK_SENT
? back()->with('status', __($status))
: back()->withInput($request->only('email'))
->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
use RegistersUsers;
protected $redirectTo = '/dashboard';
public function __construct()
{
$this->middleware('guest');
}
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
'rt_id' => [
'required',
'exists:rts,id',
function ($attribute, $value, $fail) {
// Validasi: RT sudah terdaftar atau belum
$exists = User::where('rt_id', $value)->where('role', 'rt')->exists();
if ($exists) {
$fail('RT ini sudah terdaftar. Silakan pilih RT lain atau hubungi admin.');
}
},
],
'alamat' => ['required', 'string'],
'tanggal_lahir' => ['required', 'date'],
], [
'name.required' => 'Nama lengkap wajib diisi.',
'email.required' => 'Email wajib diisi.',
'email.email' => 'Format email tidak valid.',
'email.unique' => 'Email sudah terdaftar.',
'password.required' => 'Password wajib diisi.',
'password.min' => 'Password minimal 8 karakter.',
'password.confirmed' => 'Konfirmasi password tidak cocok.',
'rt_id.required' => 'RT wajib dipilih.',
'rt_id.exists' => 'RT tidak ditemukan.',
'alamat.required' => 'Alamat wajib diisi.',
'tanggal_lahir.required' => 'Tanggal lahir wajib diisi.',
'tanggal_lahir.date' => 'Format tanggal lahir tidak valid.',
]);
}
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'role' => 'rt',
'rt_id' => $data['rt_id'],
]);
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules;
use Illuminate\View\View;
class RegisteredUserController extends Controller
{
/**
* Display the registration view.
*/
public function create(): View
{
return view('auth.register');
}
/**
* Handle an incoming registration request.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function store(Request $request): RedirectResponse
{
$request->validate([
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'lowercase', 'email', 'max:255', 'unique:'.User::class],
'password' => ['required', 'confirmed', Rules\Password::defaults()],
]);
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
event(new Registered($user));
Auth::login($user);
return redirect(route('dashboard', absolute: false));
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Auth\Events\Verified;
use Illuminate\Foundation\Auth\EmailVerificationRequest;
use Illuminate\Http\RedirectResponse;
class VerifyEmailController extends Controller
{
/**
* Mark the authenticated user's email address as verified.
*/
public function __invoke(EmailVerificationRequest $request): RedirectResponse
{
if ($request->user()->hasVerifiedEmail()) {
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
}
if ($request->user()->markEmailAsVerified()) {
event(new Verified($request->user()));
}
return redirect()->intended(route('dashboard', absolute: false).'?verified=1');
}
}

View File

@ -0,0 +1,8 @@
<?php
namespace App\Http\Controllers;
abstract class Controller
{
//
}

View File

@ -0,0 +1,230 @@
<?php
namespace App\Http\Controllers\Rt;
use App\Http\Controllers\Controller;
use App\Models\CalonPenerima;
use App\Models\PrediksiKelayakan;
use App\Models\RT;
use App\Services\MLPredictionService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
class CalonPenerimaController extends Controller
{
protected $mlService;
public function __construct(MLPredictionService $mlService)
{
$this->mlService = $mlService;
}
public function index()
{
$user = Auth::user();
// KHUSUS RT: hanya data milik RT tersebut
$calonPenerimas = CalonPenerima::with(['rt.dusun', 'prediksiKelayakan'])
->where('user_id', $user->id)
->orderBy('created_at', 'desc')
->paginate(20);
return view('rt.calon-penerima.index', compact('calonPenerimas'));
}
public function create()
{
$user = Auth::user();
$rts = RT::where('id', $user->rt_id)->with('dusun')->get();
if ($rts->isEmpty()) {
$rts = RT::with('dusun')->get();
}
return view('rt.calon-penerima.create', compact('rts'));
}
public function store(Request $request)
{
$validated = $request->validate([
'rt_id' => 'required|exists:rts,id',
'no_kk' => 'required|string|max:16',
'nik' => 'required|digits:16|unique:calon_penerimas,nik',
'nama_lengkap' => 'required|string|max:255',
'jenis_kelamin' => 'required|in:Laki-laki,Perempuan',
'tempat_lahir' => 'required|string|max:255',
'tanggal_lahir' => 'required|date',
'alamat' => 'required|string',
'desa' => 'required|string|max:255',
'pekerjaan' => 'required|string',
'penghasilan' => 'required|numeric|min:0',
'jumlah_tanggungan' => 'required|integer|min:0',
'aset_kepemilikan' => 'required|string',
'bantuan_lain' => 'required|in:ya,tidak',
'usia' => 'required|integer|min:17|max:100',
'status_perkawinan' => 'required|string',
]);
DB::beginTransaction();
try {
$calonPenerima = CalonPenerima::create([
'user_id' => Auth::id(),
'rt_id' => $validated['rt_id'],
'no_kk' => $validated['no_kk'],
'nik' => $validated['nik'],
'nama_lengkap' => $validated['nama_lengkap'],
'jenis_kelamin' => $validated['jenis_kelamin'],
'tempat_lahir' => $validated['tempat_lahir'],
'tanggal_lahir' => $validated['tanggal_lahir'],
'alamat' => $validated['alamat'],
'desa' => $validated['desa'],
'pekerjaan' => $validated['pekerjaan'],
'penghasilan' => $validated['penghasilan'],
'jumlah_tanggungan' => $validated['jumlah_tanggungan'],
'aset_kepemilikan' => $validated['aset_kepemilikan'],
'bantuan_lain' => $validated['bantuan_lain'],
'usia' => $validated['usia'],
'status_perkawinan' => $validated['status_perkawinan'],
'status_verifikasi' => 'pending',
]);
$predictionData = [
'pekerjaan' => $validated['pekerjaan'],
'penghasilan' => $validated['penghasilan'],
'jumlah_tanggungan' => $validated['jumlah_tanggungan'],
'aset_kepemilikan' => $validated['aset_kepemilikan'],
'bantuan_lain' => $validated['bantuan_lain'],
'usia' => $validated['usia'],
];
$prediction = $this->mlService->getPrediction($predictionData);
if ($prediction) {
PrediksiKelayakan::create([
'calon_penerima_id' => $calonPenerima->id,
'probability' => $prediction['probability'],
'recommendation' => $prediction['recommendation'],
]);
}
DB::commit();
return redirect()->route('rt.calon-penerima.index')
->with('success', 'Data calon penerima berhasil ditambahkan!');
} catch (\Exception $e) {
DB::rollBack();
return redirect()->back()
->withInput()
->with('error', 'Terjadi kesalahan: ' . $e->getMessage());
}
}
public function show(CalonPenerima $calonPenerima)
{
$user = Auth::user();
// pastikan RT hanya bisa lihat miliknya
if ($calonPenerima->user_id !== $user->id) {
abort(403, 'Unauthorized action.');
}
$calonPenerima->load(['rt.dusun', 'prediksiKelayakan', 'penerimaFinal']);
return view('rt.calon-penerima.show', compact('calonPenerima'));
}
public function edit(CalonPenerima $calonPenerima)
{
$user = Auth::user();
if ($calonPenerima->user_id !== $user->id || $calonPenerima->status_verifikasi !== 'pending') {
abort(403, 'Unauthorized action.');
}
$rts = RT::where('id', $user->rt_id)->with('dusun')->get();
if ($rts->isEmpty()) {
$rts = RT::with('dusun')->get();
}
return view('rt.calon-penerima.edit', compact('calonPenerima', 'rts'));
}
public function update(Request $request, CalonPenerima $calonPenerima)
{
$user = Auth::user();
if ($calonPenerima->user_id !== $user->id || $calonPenerima->status_verifikasi !== 'pending') {
abort(403, 'Unauthorized action.');
}
$validated = $request->validate([
'rt_id' => 'required|exists:rts,id',
'no_kk' => 'required|string|max:16',
'nik' => 'required|digits:16|unique:calon_penerimas,nik,' . $calonPenerima->id,
'nama_lengkap' => 'required|string|max:255',
'jenis_kelamin' => 'required|in:Laki-laki,Perempuan',
'tempat_lahir' => 'required|string|max:255',
'tanggal_lahir' => 'required|date',
'alamat' => 'required|string',
'desa' => 'required|string|max:255',
'pekerjaan' => 'required|string',
'penghasilan' => 'required|numeric|min:0',
'jumlah_tanggungan' => 'required|integer|min:0',
'aset_kepemilikan' => 'required|string',
'bantuan_lain' => 'required|in:ya,tidak',
'usia' => 'required|integer|min:17|max:100',
'status_perkawinan' => 'required|string',
]);
DB::beginTransaction();
try {
$calonPenerima->update($validated);
$predictionData = [
'pekerjaan' => $validated['pekerjaan'],
'penghasilan' => $validated['penghasilan'],
'jumlah_tanggungan' => $validated['jumlah_tanggungan'],
'aset_kepemilikan' => $validated['aset_kepemilikan'],
'bantuan_lain' => $validated['bantuan_lain'],
'usia' => $validated['usia'],
];
$prediction = $this->mlService->getPrediction($predictionData);
if ($prediction) {
$calonPenerima->prediksiKelayakan()->updateOrCreate(
['calon_penerima_id' => $calonPenerima->id],
[
'probability' => $prediction['probability'],
'recommendation' => $prediction['recommendation'],
]
);
}
DB::commit();
return redirect()->route('rt.calon-penerima.index')
->with('success', 'Data calon penerima berhasil diupdate!');
} catch (\Exception $e) {
DB::rollBack();
return redirect()->back()
->withInput()
->with('error', 'Terjadi kesalahan: ' . $e->getMessage());
}
}
public function destroy(CalonPenerima $calonPenerima)
{
$user = Auth::user();
if ($calonPenerima->user_id !== $user->id || $calonPenerima->status_verifikasi !== 'pending') {
abort(403, 'Unauthorized action.');
}
$calonPenerima->delete();
return redirect()->route('rt.calon-penerima.index')
->with('success', 'Data calon penerima berhasil dihapus!');
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace App\Http\Controllers\Rt;
use App\Http\Controllers\Controller;
use App\Models\CalonPenerima;
use App\Models\PenerimaFinal;
use App\Models\Dusun;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class DashboardController extends Controller
{
public function index()
{
$user = Auth::user();
if ($user->isAdmin()) {
// Dashboard Admin
$stats = [
'total_calon' => CalonPenerima::count(),
'pending' => CalonPenerima::where('status_verifikasi', 'pending')->count(),
'disetujui' => CalonPenerima::where('status_verifikasi', 'disetujui')->count(),
'ditolak' => CalonPenerima::where('status_verifikasi', 'ditolak')->count(),
'penerima_final' => PenerimaFinal::count(),
'total_dusun' => Dusun::count(),
];
$recentCalonPenerima = CalonPenerima::with(['rt.dusun', 'user', 'prediksiKelayakan'])
->orderBy('created_at', 'desc')
->take(10)
->get();
return view('admin.dashboard', compact('stats', 'recentCalonPenerima'));
} else {
// Dashboard RT
$stats = [
'total_input' => CalonPenerima::where('user_id', $user->id)->count(),
'pending' => CalonPenerima::where('user_id', $user->id)
->where('status_verifikasi', 'pending')->count(),
'disetujui' => CalonPenerima::where('user_id', $user->id)
->where('status_verifikasi', 'disetujui')->count(),
'ditolak' => CalonPenerima::where('user_id', $user->id)
->where('status_verifikasi', 'ditolak')->count(),
];
$recentCalonPenerima = CalonPenerima::with(['rt.dusun', 'prediksiKelayakan'])
->where('user_id', $user->id)
->orderBy('created_at', 'desc')
->take(10)
->get();
return view('rt.dashboard', compact('stats', 'recentCalonPenerima'));
}
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers;
use App\Models\PenerimaFinal;
use Illuminate\Http\Request;
class PenerimaFinalController extends Controller
{
public function index()
{
$penerimaFinals = PenerimaFinal::with(['calonPenerima.rt.dusun'])
->orderBy('tanggal_penetapan', 'desc')
->paginate(20);
return view('admin.penerima-final.index', compact('penerimaFinals'));
}
public function show(PenerimaFinal $penerimaFinal)
{
$penerimaFinal->load(['calonPenerima.rt.dusun', 'calonPenerima.prediksiKelayakan']);
return view('admin.penerima-final.show', compact('penerimaFinal'));
}
public function updatePencairan(Request $request, PenerimaFinal $penerimaFinal)
{
$validated = $request->validate([
'status_pencairan' => 'required|in:belum_cair,sudah_cair',
'tanggal_pencairan' => 'required_if:status_pencairan,sudah_cair|nullable|date',
]);
$penerimaFinal->update($validated);
return redirect()->route('penerima-final.index')
->with('success', 'Status pencairan berhasil diupdate!');
}
public function export()
{
// TODO: Implement export to Excel/PDF
return redirect()->back()
->with('info', 'Fitur export sedang dalam pengembangan');
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests\ProfileUpdateRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use Illuminate\View\View;
class ProfileController extends Controller
{
/**
* Display the user's profile form.
*/
public function edit(Request $request): View
{
return view('profile.edit', [
'user' => $request->user(),
]);
}
/**
* Update the user's profile information.
*/
public function update(ProfileUpdateRequest $request): RedirectResponse
{
$request->user()->fill($request->validated());
if ($request->user()->isDirty('email')) {
$request->user()->email_verified_at = null;
}
$request->user()->save();
return Redirect::route('profile.edit')->with('status', 'profile-updated');
}
/**
* Delete the user's account.
*/
public function destroy(Request $request): RedirectResponse
{
$request->validateWithBag('userDeletion', [
'password' => ['required', 'current_password'],
]);
$user = $request->user();
Auth::logout();
$user->delete();
$request->session()->invalidate();
$request->session()->regenerateToken();
return Redirect::to('/');
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace App\Http\Controllers;
use App\Models\CalonPenerima;
use App\Models\PenerimaFinal;
use Illuminate\Http\Request;
class VerifikasiController extends Controller
{
public function index()
{
$pendingList = CalonPenerima::with(['rt.dusun', 'user', 'prediksiKelayakan'])
->where('status_verifikasi', 'pending')
->orderBy('created_at', 'desc')
->paginate(20);
return view('admin.verifikasi.index', compact('pendingList'));
}
public function review(CalonPenerima $calonPenerima)
{
$calonPenerima->load(['rt.dusun', 'user', 'prediksiKelayakan']);
return view('admin.verifikasi.review', compact('calonPenerima'));
}
public function approve(Request $request, CalonPenerima $calonPenerima)
{
$validated = $request->validate([
'catatan_admin' => 'nullable|string',
]);
$calonPenerima->update([
'status_verifikasi' => 'disetujui',
'catatan_admin' => $validated['catatan_admin'] ?? 'Disetujui oleh admin',
]);
return redirect()->route('verifikasi.index')
->with('success', 'Calon penerima telah disetujui!');
}
public function reject(Request $request, CalonPenerima $calonPenerima)
{
$validated = $request->validate([
'catatan_admin' => 'required|string',
]);
$calonPenerima->update([
'status_verifikasi' => 'ditolak',
'catatan_admin' => $validated['catatan_admin'],
]);
return redirect()->route('verifikasi.index')
->with('success', 'Calon penerima telah ditolak!');
}
public function disetujui()
{
$disetujuiList = CalonPenerima::with(['rt.dusun', 'user', 'prediksiKelayakan'])
->where('status_verifikasi', 'disetujui')
->orderBy('updated_at', 'desc')
->paginate(20);
return view('admin.verifikasi.disetujui', compact('disetujuiList'));
}
public function ditolak()
{
$ditolakList = CalonPenerima::with(['rt.dusun', 'user', 'prediksiKelayakan'])
->where('status_verifikasi', 'ditolak')
->orderBy('updated_at', 'desc')
->paginate(20);
return view('admin.verifikasi.ditolak', compact('ditolakList'));
}
public function tetapkanPenerima(Request $request, CalonPenerima $calonPenerima)
{
if ($calonPenerima->status_verifikasi !== 'disetujui') {
return redirect()->back()
->with('error', 'Hanya calon penerima yang disetujui yang bisa ditetapkan!');
}
$validated = $request->validate([
'periode_bantuan' => 'required|string',
'jumlah_bantuan' => 'required|numeric|min:0',
]);
PenerimaFinal::create([
'calon_penerima_id' => $calonPenerima->id,
'tanggal_penetapan' => now(),
'periode_bantuan' => $validated['periode_bantuan'],
'jumlah_bantuan' => $validated['jumlah_bantuan'],
'status_pencairan' => 'belum_cair',
]);
return redirect()->route('penerima-final.index')
->with('success', 'Penerima final berhasil ditetapkan!');
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class EnsureUserIsActive
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
return $next($request);
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace App\Http\Requests\Auth;
use Illuminate\Auth\Events\Lockout;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class LoginRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'email' => ['required', 'string', 'email'],
'password' => ['required', 'string'],
];
}
/**
* Attempt to authenticate the request's credentials.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function authenticate(): void
{
$this->ensureIsNotRateLimited();
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
RateLimiter::hit($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.failed'),
]);
}
RateLimiter::clear($this->throttleKey());
}
/**
* Ensure the login request is not rate limited.
*
* @throws \Illuminate\Validation\ValidationException
*/
public function ensureIsNotRateLimited(): void
{
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
return;
}
event(new Lockout($this));
$seconds = RateLimiter::availableIn($this->throttleKey());
throw ValidationException::withMessages([
'email' => trans('auth.throttle', [
'seconds' => $seconds,
'minutes' => ceil($seconds / 60),
]),
]);
}
/**
* Get the rate limiting throttle key for the request.
*/
public function throttleKey(): string
{
return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip());
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ProfileUpdateRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:255'],
'email' => [
'required',
'string',
'lowercase',
'email',
'max:255',
Rule::unique(User::class)->ignore($this->user()->id),
],
];
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class CalonPenerima extends Model
{
use HasFactory;
protected $fillable = [
'user_id', 'rt_id', 'no_kk', 'nik', 'nama_lengkap', 'jenis_kelamin',
'tempat_lahir', 'tanggal_lahir', 'alamat', 'desa', 'pekerjaan',
'penghasilan', 'jumlah_tanggungan', 'aset_kepemilikan', 'bantuan_lain',
'usia', 'status_perkawinan', 'status_verifikasi', 'catatan_admin',
];
protected $casts = [
'penghasilan' => 'decimal:2',
'tanggal_lahir' => 'date',
];
public function user()
{
return $this->belongsTo(User::class);
}
public function rt()
{
return $this->belongsTo(RT::class);
}
public function prediksiKelayakan()
{
return $this->hasOne(PrediksiKelayakan::class);
}
public function penerimaFinal()
{
return $this->hasOne(PenerimaFinal::class);
}
}

30
app/Models/Dusun.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Dusun extends Model
{
use HasFactory;
protected $fillable = ['nama_dusun'];
public function rts()
{
return $this->hasMany(RT::class);
}
// TAMBAHAN INI SAJA UNTUK FIX ERROR ADMIN DASHBOARD
public function calonPenerimas()
{
return $this->hasManyThrough(
\App\Models\CalonPenerima::class,
\App\Models\RT::class,
'dusun_id', // foreign key di tabel rts
'rt_id', // foreign key di tabel calon_penerimas
'id', // primary key dusuns
'id' // primary key rts
);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PenerimaFinal extends Model
{
use HasFactory;
protected $fillable = [
'calon_penerima_id', 'tanggal_penetapan', 'periode_bantuan',
'jumlah_bantuan', 'status_pencairan', 'tanggal_pencairan',
];
protected $casts = [
'tanggal_penetapan' => 'date',
'tanggal_pencairan' => 'date',
'jumlah_bantuan' => 'decimal:2',
];
public function calonPenerima()
{
return $this->belongsTo(CalonPenerima::class);
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class PrediksiKelayakan extends Model
{
use HasFactory;
protected $fillable = ['calon_penerima_id', 'probability', 'recommendation'];
protected $casts = ['probability' => 'decimal:2'];
public function calonPenerima()
{
return $this->belongsTo(CalonPenerima::class);
}
}

31
app/Models/RT.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class RT extends Model
{
use HasFactory;
// ✅ Tambahkan ini supaya Laravel tidak mencari tabel r_t_s
protected $table = 'rts';
protected $fillable = ['dusun_id', 'nomor_rt', 'kode_rt'];
public function dusun()
{
return $this->belongsTo(Dusun::class);
}
public function users()
{
return $this->hasMany(User::class);
}
public function calonPenerimas()
{
return $this->hasMany(CalonPenerima::class);
}
}

45
app/Models/User.php Normal file
View File

@ -0,0 +1,45 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
protected $fillable = ['name', 'email', 'password', 'role', 'rt_id'];
protected $hidden = ['password', 'remember_token'];
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
public function rt()
{
return $this->belongsTo(RT::class);
}
public function calonPenerimas()
{
return $this->hasMany(CalonPenerima::class);
}
public function isAdmin()
{
return $this->role === 'admin';
}
public function isRT()
{
return $this->role === 'rt';
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
//
}
}

View File

@ -0,0 +1,82 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class MLPredictionService
{
protected $apiUrl;
public function __construct()
{
$this->apiUrl = config('services.ml_api.url', 'http://127.0.0.1:5000');
}
/**
* Dapatkan prediksi dari ML API
*/
public function getPrediction(array $data)
{
try {
/** @var \Illuminate\Http\Client\Response $response */
$response = Http::timeout(30)->post($this->apiUrl . '/predict', [
'pekerjaan' => $data['pekerjaan'],
'penghasilan' => (float) $data['penghasilan'],
'jumlah_tanggungan' => (int) $data['jumlah_tanggungan'],
'aset_kepemilikan' => $data['aset_kepemilikan'],
'bantuan_lain' => $data['bantuan_lain'],
'usia' => (int) $data['usia'],
]);
if ($response->successful()) {
return $response->json();
}
Log::error('ML API Error: ' . $response->body());
return null;
} catch (\Exception $e) {
Log::error('ML API Exception: ' . $e->getMessage());
return null;
}
}
/**
* Cek apakah ML API sedang online
*/
public function healthCheck()
{
try {
/** @var \Illuminate\Http\Client\Response $response */
$response = Http::timeout(5)->get($this->apiUrl . '/health');
return $response->successful();
} catch (\Exception $e) {
return false;
}
}
/**
* Prediksi untuk banyak data sekaligus
*/
public function getBatchPredictions(array $dataArray)
{
try {
/** @var \Illuminate\Http\Client\Response $response */
$response = Http::timeout(60)->post($this->apiUrl . '/batch-predict', [
'data' => $dataArray
]);
if ($response->successful()) {
return $response->json();
}
return null;
} catch (\Exception $e) {
Log::error('ML Batch API Exception: ' . $e->getMessage());
return null;
}
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class AppLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.app');
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace App\View\Components;
use Illuminate\View\Component;
use Illuminate\View\View;
class GuestLayout extends Component
{
/**
* Get the view / contents that represents the component.
*/
public function render(): View
{
return view('layouts.guest');
}
}

18
artisan Normal file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env php
<?php
use Illuminate\Foundation\Application;
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
/** @var Application $app */
$app = require_once __DIR__.'/bootstrap/app.php';
$status = $app->handleCommand(new ArgvInput);
exit($status);

22
bootstrap/app.php Normal file
View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
$middleware->alias([
'is_active' => \App\Http\Middleware\EnsureUserIsActive::class,
]);
})
->withExceptions(function (Exceptions $exceptions): void {
//
})->create();

2
bootstrap/cache/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

5
bootstrap/providers.php Normal file
View File

@ -0,0 +1,5 @@
<?php
return [
App\Providers\AppServiceProvider::class,
];

88
composer.json Normal file
View File

@ -0,0 +1,88 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^3.6",
"fakerphp/faker": "^1.23",
"laravel/breeze": "^2.3",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.24",
"laravel/sail": "^1.41",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"phpunit/phpunit": "^11.5.3"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"setup": [
"composer install",
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"",
"@php artisan key:generate",
"@php artisan migrate --force",
"npm install",
"npm run build"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1 --timeout=0\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
],
"test": [
"@php artisan config:clear --ansi",
"@php artisan test"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"pre-package-uninstall": [
"Illuminate\\Foundation\\ComposerScripts::prePackageUninstall"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

8751
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

126
config/app.php Normal file
View File

@ -0,0 +1,126 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', (string) env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

115
config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the number of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

117
config/cache.php Normal file
View File

@ -0,0 +1,117 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_STORE', 'database'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane",
| "failover", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
'failover' => [
'driver' => 'failover',
'stores' => [
'database',
'array',
],
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'),
];

183
config/database.php Normal file
View File

@ -0,0 +1,183 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
'transaction_mode' => 'DEFERRED',
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
(PHP_VERSION_ID >= 80500 ? \Pdo\Mysql::ATTR_SSL_CA : \PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => env('DB_SSLMODE', 'prefer'),
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
'persistent' => env('REDIS_PERSISTENT', false),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
'max_retries' => env('REDIS_MAX_RETRIES', 3),
'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
],
],
];

80
config/filesystems.php Normal file
View File

@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

132
config/logging.php Normal file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', (string) env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'handler_with' => [
'stream' => 'php://stderr',
],
'formatter' => env('LOG_STDERR_FORMATTER'),
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

118
config/mail.php Normal file
View File

@ -0,0 +1,118 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
'retry_after' => 60,
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
'retry_after' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];

129
config/queue.php Normal file
View File

@ -0,0 +1,129 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis",
| "deferred", "background", "failover", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
'deferred' => [
'driver' => 'deferred',
],
'background' => [
'driver' => 'background',
],
'failover' => [
'driver' => 'failover',
'connections' => [
'database',
'deferred',
],
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

42
config/services.php Normal file
View File

@ -0,0 +1,42 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
'ml_api' => [
'url' => env('ML_API_URL', 'http://127.0.0.1:5000'),
],
];

217
config/session.php Normal file
View File

@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "memcached",
| "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug((string) env('APP_NAME', 'laravel')).'-session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain without subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration')->index();
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};

View File

@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};

View File

@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('dusuns', function (Blueprint $table) {
$table->id();
$table->string('nama_dusun');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('dusuns');
}
};

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rts', function (Blueprint $table) {
$table->id();
$table->foreignId('dusun_id')->constrained('dusuns')->onDelete('cascade');
$table->string('nomor_rt', 3); // 001, 002, 003, dst
$table->string('kode_rt')->unique(); // MJR-RT01, KRJ-RT02, dst
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('rts');
}
};

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->enum('role', ['admin', 'rt'])->default('rt')->after('password');
$table->foreignId('rt_id')->nullable()->constrained('rts')->onDelete('set null')->after('role');
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropForeign(['rt_id']);
$table->dropColumn(['role', 'rt_id']);
});
}
};

View File

@ -0,0 +1,48 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('calon_penerimas', function (Blueprint $table) {
$table->id(); // NO. URUT
$table->foreignId('user_id')->constrained('users')->onDelete('cascade');
$table->foreignId('rt_id')->constrained('rts')->onDelete('cascade');
// Data Sesuai Kebutuhan
$table->string('no_kk', 16); // NO. KK
$table->string('nik', 16)->unique(); // NO. NIK KTP
$table->string('nama_lengkap'); // NAMA LENGKAP
$table->enum('jenis_kelamin', ['Laki-laki', 'Perempuan']); // JENIS KELAMIN
$table->string('tempat_lahir'); // TEMPAT LAHIR
$table->date('tanggal_lahir'); // TANGGAL LAHIR
$table->text('alamat'); // ALAMAT
$table->string('desa'); // DESA
$table->string('pekerjaan'); // PEKERJAAN
$table->decimal('penghasilan', 15, 2); // PENGHASILAN
$table->integer('jumlah_tanggungan'); // JUMLAH TANGGUNGAN
$table->string('aset_kepemilikan'); // ASET KEPEMILIKAN
$table->enum('bantuan_lain', ['ya', 'tidak']); // BANTUAN LAIN
$table->integer('usia'); // USIA
$table->string('status_perkawinan'); // STATUS PERKAWINAN
// Untuk sistem (verifikasi admin)
$table->enum('status_verifikasi', ['pending', 'disetujui', 'ditolak'])->default('pending');
$table->text('catatan_admin')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('calon_penerimas');
}
};

View File

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('prediksi_kelayakans', function (Blueprint $table) {
$table->id();
$table->foreignId('calon_penerima_id')->constrained('calon_penerimas')->onDelete('cascade');
$table->decimal('probability', 5, 2); // Probabilitas kelayakan (0-100)
$table->string('recommendation'); // Sangat Layak, Layak, Kurang Layak
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('prediksi_kelayakans');
}
};

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('penerima_finals', function (Blueprint $table) {
$table->id();
$table->foreignId('calon_penerima_id')->constrained('calon_penerimas')->onDelete('cascade');
$table->date('tanggal_penetapan');
$table->string('periode_bantuan'); // Contoh: "2024 Triwulan 1"
$table->decimal('jumlah_bantuan', 15, 2);
$table->enum('status_pencairan', ['belum_cair', 'sudah_cair'])->default('belum_cair');
$table->date('tanggal_pencairan')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('penerima_finals');
}
};

View File

@ -0,0 +1,27 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class EnsureUserIsActive
{
public function handle(Request $request, Closure $next)
{
$user = $request->user();
// kalau user login tapi nonaktif -> logout + balik ke login
if ($user && (int)($user->is_active ?? 1) === 0) {
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('login')
->with('error', 'Akun kamu sudah dinonaktifkan oleh Admin.');
}
return $next($request);
}
}

View File

@ -0,0 +1,62 @@
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Hash; // ← TAMBAHKAN INI!
use App\Models\Dusun;
use App\Models\RT;
class DatabaseSeeder extends Seeder
{
use WithoutModelEvents;
/**
* Seed the application's database.
*/
public function run(): void
{
// Buat Dusun
$mojorejo = Dusun::create(['nama_dusun' => 'Mojorejo']);
$karangploso = Dusun::create(['nama_dusun' => 'KarangPloso']);
$payaman = Dusun::create(['nama_dusun' => 'Payaman']);
// Buat RT untuk Mojoreja (5 RT)
for ($i = 1; $i <= 5; $i++) {
RT::create([
'dusun_id' => $mojorejo->id,
'nomor_rt' => str_pad($i, 3, '0', STR_PAD_LEFT),
'kode_rt' => 'MJR-RT' . str_pad($i, 2, '0', STR_PAD_LEFT),
]);
}
// Buat RT untuk Dummy Utara (4 RT)
for ($i = 1; $i <= 4; $i++) {
RT::create([
'dusun_id' => $karangploso->id,
'nomor_rt' => str_pad($i, 3, '0', STR_PAD_LEFT),
'kode_rt' => 'UTR-RT' . str_pad($i, 2, '0', STR_PAD_LEFT),
]);
}
// Buat RT untuk Dummy Selatan (3 RT)
for ($i = 1; $i <= 3; $i++) {
RT::create([
'dusun_id' => $payaman->id,
'nomor_rt' => str_pad($i, 3, '0', STR_PAD_LEFT),
'kode_rt' => 'SEL-RT' . str_pad($i, 2, '0', STR_PAD_LEFT),
]);
}
// Buat Admin
User::create([
'name' => 'Admin Kelurahan',
'email' => 'admin@desangerong.go.id',
'password' => Hash::make('admin123'),
'role' => 'admin',
'rt_id' => null,
]);
}
}

3500
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

21
package.json Normal file
View File

@ -0,0 +1,21 @@
{
"$schema": "https://www.schemastore.org/package.json",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
"@tailwindcss/vite": "^4.0.0",
"alpinejs": "^3.4.2",
"autoprefixer": "^10.4.2",
"axios": "^1.11.0",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0",
"postcss": "^8.4.31",
"tailwindcss": "^3.1.0",
"vite": "^7.0.7"
}
}

35
phpunit.xml Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="BROADCAST_CONNECTION" value="null"/>
<env name="CACHE_STORE" value="array"/>
<env name="DB_CONNECTION" value="sqlite"/>
<env name="DB_DATABASE" value=":memory:"/>
<env name="MAIL_MAILER" value="array"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="TELESCOPE_ENABLED" value="false"/>
<env name="NIGHTWATCH_ENABLED" value="false"/>
</php>
</phpunit>

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

25
public/.htaccess Normal file
View File

@ -0,0 +1,25 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle X-XSRF-Token Header
RewriteCond %{HTTP:x-xsrf-token} .
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

0
public/favicon.ico Normal file
View File

20
public/index.php Normal file
View File

@ -0,0 +1,20 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request...
/** @var Application $app */
$app = require_once __DIR__.'/../bootstrap/app.php';
$app->handleRequest(Request::capture());

2
public/robots.txt Normal file
View File

@ -0,0 +1,2 @@
User-agent: *
Disallow:

13
resources/css/app.css Normal file
View File

@ -0,0 +1,13 @@
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.input-field {
@apply w-full rounded-lg border border-gray-300 bg-white py-2.5 px-4 text-gray-900 placeholder-gray-400 shadow-sm focus:border-primary-500 focus:ring-2 focus:ring-primary-500/30 outline-none;
}
.btn-primary {
@apply w-full rounded-lg bg-primary-600 text-white shadow-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500/40 disabled:opacity-50 disabled:cursor-not-allowed;
}
}

7
resources/js/app.js Normal file
View File

@ -0,0 +1,7 @@
import './bootstrap';
import Alpine from 'alpinejs';
window.Alpine = Alpine;
Alpine.start();

4
resources/js/bootstrap.js vendored Normal file
View File

@ -0,0 +1,4 @@
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

View File

@ -0,0 +1,356 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<div>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Dashboard Kelurahan</h2>
<p class="text-sm text-gray-500 mt-0.5">Ringkasan data kelayakan penerima BLT-DD seluruh dusun</p>
</div>
<div class="inline-flex items-center gap-2 bg-gray-50 border border-gray-200 rounded-xl px-3 py-1.5 text-xs text-gray-500">
<svg class="w-3.5 h-3.5 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
<span id="admin-clock"></span>
</div>
</div>
</x-slot>
<script>
function updateAdminClock() {
const now = new Date();
const dateStr = now.toLocaleDateString('id-ID', { timeZone:'Asia/Jakarta', weekday:'long', day:'2-digit', month:'long', year:'numeric' });
const timeStr = now.toLocaleTimeString('id-ID', { timeZone:'Asia/Jakarta', hour:'2-digit', minute:'2-digit', second:'2-digit', hour12:false });
const el = document.getElementById('admin-clock');
if (el) el.textContent = dateStr + ' — ' + timeStr + ' WIB';
}
updateAdminClock();
setInterval(updateAdminClock, 1000);
</script>
<div class="space-y-4">
{{-- GREETING + NOTIFIKASI --}}
<div class="flex flex-col sm:flex-row gap-3">
<div class="flex items-center gap-3 bg-white border border-gray-100 rounded-xl px-4 py-3 shadow-sm flex-1">
<div class="w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white text-sm font-bold shrink-0">
{{ strtoupper(substr(Auth::user()->name ?? 'A', 0, 1)) }}
</div>
<div>
<p class="text-sm font-medium text-gray-800">Selamat datang, <span class="text-blue-600">{{ Auth::user()->name ?? 'Admin' }}</span> 👋</p>
<p class="text-xs text-gray-400">Panel admin kelola dan pantau seluruh data warga.</p>
</div>
</div>
<div class="flex items-center gap-3 bg-amber-50 border border-amber-100 rounded-xl px-4 py-3 shadow-sm">
<div class="w-8 h-8 rounded-full bg-amber-500 flex items-center justify-center shrink-0">
<svg class="w-4 h-4 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6 6 0 00-9.33-4.976A6 6 0 006 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"/>
</svg>
</div>
<div>
<p class="text-xs font-semibold text-amber-800">{{ $totalPending ?? 0 }} data menunggu verifikasi</p>
<a href="{{ route('admin.data-warga') }}" class="text-xs text-amber-600 hover:underline">Proses sekarang </a>
</div>
</div>
</div>
{{-- STAT CARDS --}}
<div class="grid grid-cols-2 lg:grid-cols-4 gap-3">
<div class="relative bg-blue-600 text-white rounded-xl p-4 flex items-center justify-between overflow-hidden shadow-md shadow-blue-200">
<div class="absolute -right-3 -top-3 w-20 h-20 bg-white/10 rounded-full"></div>
<div class="absolute -right-1 -bottom-4 w-14 h-14 bg-white/10 rounded-full"></div>
<div class="relative z-10">
<p class="text-xs font-medium text-blue-100">Total Warga Masuk</p>
<p class="text-3xl font-bold mt-0.5">{{ $totalWarga ?? 0 }}</p>
<p class="text-xs text-blue-200 mt-0.5">Dari semua dusun</p>
</div>
<div class="relative z-10 w-11 h-11 bg-white/20 rounded-lg flex items-center justify-center shrink-0">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
</div>
</div>
<div class="relative bg-amber-500 text-white rounded-xl p-4 flex items-center justify-between overflow-hidden shadow-md shadow-amber-200">
<div class="absolute -right-3 -top-3 w-20 h-20 bg-white/10 rounded-full"></div>
<div class="absolute -right-1 -bottom-4 w-14 h-14 bg-white/10 rounded-full"></div>
<div class="relative z-10">
<p class="text-xs font-medium text-amber-100">Pending Verifikasi</p>
<p class="text-3xl font-bold mt-0.5">{{ $totalPending ?? 0 }}</p>
<p class="text-xs text-amber-200 mt-0.5">Belum diproses</p>
</div>
<div class="relative z-10 w-11 h-11 bg-white/20 rounded-lg flex items-center justify-center shrink-0">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
</div>
</div>
<div class="relative bg-emerald-500 text-white rounded-xl p-4 flex items-center justify-between overflow-hidden shadow-md shadow-emerald-200">
<div class="absolute -right-3 -top-3 w-20 h-20 bg-white/10 rounded-full"></div>
<div class="absolute -right-1 -bottom-4 w-14 h-14 bg-white/10 rounded-full"></div>
<div class="relative z-10">
<p class="text-xs font-medium text-emerald-100">Diterima / Ditetapkan</p>
<p class="text-3xl font-bold mt-0.5">{{ $totalPenerima ?? 0 }}</p>
<p class="text-xs text-emerald-200 mt-0.5">Sudah ditetapkan</p>
</div>
<div class="relative z-10 w-11 h-11 bg-white/20 rounded-lg flex items-center justify-center shrink-0">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
</div>
</div>
<div class="relative bg-rose-500 text-white rounded-xl p-4 flex items-center justify-between overflow-hidden shadow-md shadow-rose-200">
<div class="absolute -right-3 -top-3 w-20 h-20 bg-white/10 rounded-full"></div>
<div class="absolute -right-1 -bottom-4 w-14 h-14 bg-white/10 rounded-full"></div>
<div class="relative z-10">
<p class="text-xs font-medium text-rose-100">Ditolak</p>
<p class="text-3xl font-bold mt-0.5">{{ $totalDitolak ?? 0 }}</p>
<p class="text-xs text-rose-200 mt-0.5">Tidak memenuhi syarat</p>
</div>
<div class="relative z-10 w-11 h-11 bg-white/20 rounded-lg flex items-center justify-center shrink-0">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
</div>
</div>
</div>
{{-- GRAFIK + DATA PER DUSUN --}}
<div class="grid grid-cols-1 lg:grid-cols-3 gap-4">
{{-- GRAFIK POLIGON LINE PER DUSUN (SVG murni, seperti referensi) --}}
<div class="lg:col-span-2 bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="px-5 py-3 border-b border-gray-100 flex items-center justify-between bg-gray-50">
<div class="flex items-center gap-2">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="text-sm font-semibold text-gray-700">Jumlah Warga per Dusun</h3>
</div>
<span class="text-xs text-gray-400 bg-white border border-gray-100 px-2.5 py-0.5 rounded-full">
{{ $wargaPerDusun->sum('total') }} total warga
</span>
</div>
<div class="p-5">
@php
$dusuns = $wargaPerDusun->values();
$n = max($dusuns->count(), 1);
$maxV = max((int)$dusuns->max('total'), 1);
// Canvas
$W = 560; $H = 210;
$pL = 40; $pR = 20;
$pT = 30; $pB = 45;
$cW = $W - $pL - $pR;
$cH = $H - $pT - $pB;
// Y ticks (0 .. maxV, max 5 steps)
$step = max(1, (int)ceil($maxV / 4));
$yTicks = range(0, $maxV + $step, $step);
// Compute point coords
$pts = [];
foreach ($dusuns as $i => $d) {
$x = $pL + ($n === 1 ? $cW / 2 : ($i / ($n - 1)) * $cW);
$y = $pT + $cH - ($d->total / $maxV) * $cH;
$pts[] = ['x' => round($x, 1), 'y' => round($y, 1), 'val' => $d->total, 'name' => $d->dusun];
}
$poly = implode(' ', array_map(fn($p) => "{$p['x']},{$p['y']}", $pts));
$firstPt = $pts[0];
$lastPt = $pts[count($pts)-1];
$botY = $pT + $cH;
$areaPath = "M {$firstPt['x']},{$firstPt['y']} "
. implode(' ', array_map(fn($p) => "L {$p['x']},{$p['y']}", array_slice($pts, 1)))
. " L {$lastPt['x']},{$botY} L {$firstPt['x']},{$botY} Z";
@endphp
<svg viewBox="0 0 {{ $W }} {{ $H }}" width="100%" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="fillGrad" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#3b82f6" stop-opacity="0.18"/>
<stop offset="100%" stop-color="#3b82f6" stop-opacity="0"/>
</linearGradient>
</defs>
{{-- Y grid + label --}}
@foreach($yTicks as $t)
@if($t <= $maxV + $step)
@php $gy = $pT + $cH - min($t, $maxV) / $maxV * $cH; @endphp
<line x1="{{ $pL }}" y1="{{ $gy }}" x2="{{ $W - $pR }}" y2="{{ $gy }}"
stroke="#f1f5f9" stroke-width="1"/>
<text x="{{ $pL - 5 }}" y="{{ $gy + 4 }}" text-anchor="end"
font-size="10" fill="#94a3b8">{{ $t }}</text>
@endif
@endforeach
{{-- Label sumbu Y --}}
<text x="10" y="{{ $pT + $cH / 2 }}" text-anchor="middle"
font-size="9" fill="#94a3b8"
transform="rotate(-90,10,{{ $pT + $cH / 2 }})">Jumlah Warga</text>
{{-- Sumbu X --}}
<line x1="{{ $pL }}" y1="{{ $botY }}" x2="{{ $W - $pR }}" y2="{{ $botY }}"
stroke="#cbd5e1" stroke-width="1.5"/>
{{-- Panah X --}}
<polygon points="{{ $W - $pR }},{{ $botY - 4 }} {{ $W - $pR + 8 }},{{ $botY }} {{ $W - $pR }},{{ $botY + 4 }}"
fill="#94a3b8"/>
{{-- Sumbu Y --}}
<line x1="{{ $pL }}" y1="{{ $pT }}" x2="{{ $pL }}" y2="{{ $botY }}"
stroke="#cbd5e1" stroke-width="1.5"/>
{{-- Panah Y --}}
<polygon points="{{ $pL - 4 }},{{ $pT }} {{ $pL }},{{ $pT - 8 }} {{ $pL + 4 }},{{ $pT }}"
fill="#94a3b8"/>
{{-- Area fill --}}
<path d="{{ $areaPath }}" fill="url(#fillGrad)"/>
{{-- Garis poligon biru --}}
<polyline points="{{ $poly }}"
fill="none" stroke="#2563eb" stroke-width="2.5"
stroke-linejoin="round" stroke-linecap="round"/>
{{-- Titik & label per dusun --}}
@foreach($pts as $p)
{{-- Dot --}}
<circle cx="{{ $p['x'] }}" cy="{{ $p['y'] }}" r="5"
fill="white" stroke="#2563eb" stroke-width="2.5"/>
{{-- Nilai di atas titik --}}
<text x="{{ $p['x'] }}" y="{{ $p['y'] - 10 }}" text-anchor="middle"
font-size="11" font-weight="700" fill="#2563eb">{{ $p['val'] }}</text>
{{-- Nama dusun di bawah sumbu X --}}
<text x="{{ $p['x'] }}" y="{{ $botY + 16 }}" text-anchor="middle"
font-size="10" fill="#64748b">{{ Str::limit($p['name'], 9) }}</text>
@endforeach
{{-- Label "Nama Dusun" sumbu X --}}
<text x="{{ $W - $pR + 10 }}" y="{{ $botY + 4 }}" text-anchor="start"
font-size="9" fill="#94a3b8">Dusun</text>
</svg>
</div>
</div>
{{-- DATA PER DUSUN (tidak diubah) --}}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="px-5 py-3 border-b border-gray-100 flex items-center gap-2 bg-gray-50">
<div class="w-1 h-4 bg-emerald-500 rounded-full"></div>
<h3 class="text-sm font-semibold text-gray-700">Data Per Dusun</h3>
</div>
<div class="p-4 space-y-2.5">
@php $maxDusun = $wargaPerDusun->max('total') ?: 1; @endphp
@foreach($wargaPerDusun as $data)
<div class="p-3 bg-gray-50 hover:bg-blue-50 border border-gray-100 hover:border-blue-100 rounded-xl transition-all duration-150">
<div class="flex items-center justify-between mb-1.5">
<div class="flex items-center gap-2">
<div class="w-7 h-7 bg-blue-100 rounded-lg flex items-center justify-center shrink-0">
<svg class="w-3.5 h-3.5 text-blue-600" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M4 4a2 2 0 012-2h8a2 2 0 012 2v12a1 1 0 110 2h-3a1 1 0 01-1-1v-2a1 1 0 00-1-1H9a1 1 0 00-1 1v2a1 1 0 01-1 1H4a1 1 0 110-2V4zm3 1h2v2H7V5zm2 4H7v2h2V9zm2-4h2v2h-2V5zm2 4h-2v2h2V9z" clip-rule="evenodd"/>
</svg>
</div>
<span class="text-sm font-semibold text-gray-800">{{ $data->dusun }}</span>
</div>
<span class="text-base font-bold text-blue-600">{{ $data->total }}</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-1.5">
<div class="h-1.5 bg-blue-500 rounded-full" style="width: {{ ($data->total / $maxDusun) * 100 }}%"></div>
</div>
</div>
@endforeach
</div>
</div>
</div>
{{-- TOP 10 (tidak diubah) --}}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="px-5 py-3 border-b border-gray-100 flex items-center justify-between bg-gray-50">
<div class="flex items-center gap-2">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="text-sm font-semibold text-gray-700">Top 10 Probabilitas Tertinggi</h3>
</div>
<a href="{{ route('admin.filterisasi') }}" class="text-xs text-blue-600 hover:underline font-medium">Lihat Semua </a>
</div>
<div class="overflow-x-auto">
<table class="min-w-full text-sm">
<thead>
<tr class="bg-gray-50 border-b border-gray-100">
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide w-12">Rank</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Nama</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">NIK</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Dusun</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Penghasilan</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Probabilitas</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Status</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-50">
@forelse($topWarga as $index => $warga)
<tr class="hover:bg-blue-50/30 transition-colors duration-150">
<td class="px-4 py-3">
@if($index == 0)
<div class="w-7 h-7 rounded-full bg-yellow-100 text-yellow-600 flex items-center justify-center text-xs font-bold">1</div>
@elseif($index == 1)
<div class="w-7 h-7 rounded-full bg-gray-100 text-gray-500 flex items-center justify-center text-xs font-bold">2</div>
@elseif($index == 2)
<div class="w-7 h-7 rounded-full bg-orange-100 text-orange-500 flex items-center justify-center text-xs font-bold">3</div>
@else
<div class="w-7 h-7 rounded-full bg-blue-50 text-blue-400 flex items-center justify-center text-xs">{{ $index + 1 }}</div>
@endif
</td>
<td class="px-4 py-3">
<div class="flex items-center gap-2">
<div class="w-7 h-7 rounded-full bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center shrink-0">
<span class="text-xs font-bold text-white">{{ strtoupper(substr($warga->nama, 0, 1)) }}</span>
</div>
<div>
<div class="text-sm font-medium text-gray-800">{{ $warga->nama }}</div>
<div class="text-xs text-gray-400">{{ $warga->pekerjaan }}</div>
</div>
</div>
</td>
<td class="px-4 py-3 text-xs font-mono text-gray-500">{{ $warga->nik }}</td>
<td class="px-4 py-3 text-xs text-gray-600">{{ $warga->dusun }}</td>
<td class="px-4 py-3 text-xs text-gray-600">Rp {{ number_format($warga->penghasilan, 0, ',', '.') }}</td>
<td class="px-4 py-3">
<div class="flex items-center gap-2">
<div class="flex-1 bg-gray-100 rounded-full h-1.5" style="min-width:60px">
<div class="h-1.5 rounded-full {{ $warga->probabilitas >= 70 ? 'bg-emerald-500' : ($warga->probabilitas >= 40 ? 'bg-amber-400' : 'bg-rose-400') }}"
style="width: {{ min($warga->probabilitas, 100) }}%"></div>
</div>
<span class="text-xs font-bold {{ $warga->probabilitas >= 70 ? 'text-emerald-600' : ($warga->probabilitas >= 40 ? 'text-amber-600' : 'text-rose-500') }}">
{{ number_format($warga->probabilitas, 1) }}%
</span>
</div>
</td>
<td class="px-4 py-3">
@if($warga->status == 'pending')
<span class="inline-flex items-center gap-1 px-2.5 py-0.5 text-xs font-semibold rounded-full bg-amber-100 text-amber-700"><span class="w-1.5 h-1.5 rounded-full bg-amber-500"></span>Pending</span>
@elseif($warga->status == 'diterima')
<span class="inline-flex items-center gap-1 px-2.5 py-0.5 text-xs font-semibold rounded-full bg-emerald-100 text-emerald-700"><span class="w-1.5 h-1.5 rounded-full bg-emerald-500"></span>Diterima</span>
@elseif($warga->status == 'ditolak')
<span class="inline-flex items-center gap-1 px-2.5 py-0.5 text-xs font-semibold rounded-full bg-rose-100 text-rose-700"><span class="w-1.5 h-1.5 rounded-full bg-rose-500"></span>Ditolak</span>
@else
<span class="inline-flex items-center gap-1 px-2.5 py-0.5 text-xs font-semibold rounded-full bg-blue-100 text-blue-700"><span class="w-1.5 h-1.5 rounded-full bg-blue-500"></span>{{ ucfirst($warga->status) }}</span>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="7" class="px-4 py-10 text-center">
<div class="w-10 h-10 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-2">
<svg class="w-5 h-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
</svg>
</div>
<p class="text-xs text-gray-400">Belum ada data warga</p>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
</x-app-layout>

View File

@ -0,0 +1,299 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<div>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Data Akun</h2>
<p class="text-sm text-gray-500 mt-0.5">Kelola akun Admin & RT yang menggunakan sistem.</p>
</div>
<div class="inline-flex items-center gap-2 bg-gray-50 border border-gray-200 rounded-xl px-3 py-1.5 text-xs text-gray-500">
<svg class="w-3.5 h-3.5 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<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>
@if(isset($users) && method_exists($users, 'total'))
{{ $users->total() }} akun terdaftar
@endif
</div>
</div>
</x-slot>
<div class="space-y-4">
{{-- NOTIFIKASI --}}
@if(session('success'))
<div class="flex items-center gap-3 rounded-xl border border-green-200 bg-green-50 px-4 py-3 text-sm text-green-700">
<svg class="w-4 h-4 shrink-0 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
{{ session('success') }}
</div>
@endif
@if(session('error'))
<div class="flex items-center gap-3 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700">
<svg class="w-4 h-4 shrink-0 text-red-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01M12 3a9 9 0 100 18A9 9 0 0012 3z"/>
</svg>
{{ session('error') }}
</div>
@endif
{{-- SEARCH --}}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-5">
<div class="flex items-center gap-2 mb-3">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="text-sm font-semibold text-gray-700">Pencarian</h3>
</div>
<form method="GET" action="{{ route('admin.data-akun') }}" class="flex flex-col md:flex-row gap-3">
<div class="relative flex-1">
<svg class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
<input type="text" name="q" value="{{ request('q') }}"
placeholder="Cari nama / email..."
class="w-full pl-9 pr-3 py-2 text-sm border border-gray-200 rounded-xl bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"/>
</div>
<div class="flex gap-2">
<button type="submit"
class="inline-flex items-center justify-center gap-2 px-5 py-2 text-sm font-semibold bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition shadow-sm shadow-blue-200">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
Cari
</button>
@if(request()->filled('q'))
<a href="{{ route('admin.data-akun') }}"
class="inline-flex items-center justify-center w-10 text-sm bg-gray-100 text-gray-500 rounded-xl hover:bg-gray-200 transition">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</a>
@endif
</div>
</form>
</div>
{{-- TABLE CARD --}}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="px-5 py-3 border-b border-gray-100 bg-gray-50 flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<span class="text-sm font-semibold text-gray-700">
Daftar Akun
@if(isset($users) && method_exists($users, 'total'))
<span class="ml-1 text-gray-400 font-normal">({{ $users->total() }} akun)</span>
@endif
</span>
</div>
@if(isset($users) && method_exists($users, 'currentPage') && $users->lastPage() > 1)
<span class="text-xs text-gray-400">Hal. {{ $users->currentPage() }} / {{ $users->lastPage() }}</span>
@endif
</div>
<div class="overflow-x-auto w-full">
<table class="w-full text-sm table-fixed">
<colgroup>
<col style="width:28%">
<col style="width:23%">
<col style="width:11%">
<col style="width:11%">
<col style="width:27%">
</colgroup>
<thead>
<tr class="bg-gray-50/80 border-b border-gray-100">
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Nama</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Email</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Role</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Status</th>
<th class="px-4 py-3 text-right text-xs font-semibold text-gray-400 uppercase tracking-wide">Aksi</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($users ?? [] as $u)
@php
$isMe = ($u->id === auth()->id());
$isActive = isset($u->is_active) ? (bool)$u->is_active : true;
$isAdmin = $u->role === 'admin';
$newRole = $isAdmin ? 'rt' : 'admin';
$newRoleLabel = $isAdmin ? 'RT' : 'Admin';
$initial = strtoupper(substr($u->name, 0, 1));
$avatarGrad = $isAdmin
? 'from-emerald-500 to-emerald-600 shadow-emerald-200'
: 'from-blue-500 to-blue-600 shadow-blue-200';
@endphp
<tr class="hover:bg-blue-50/20 transition-colors duration-150 {{ !$isActive ? 'opacity-50' : '' }}">
{{-- NAMA --}}
<td class="px-4 py-6">
<div class="flex items-center gap-2.5">
<div class="relative shrink-0">
<div class="w-10 h-10 rounded-full bg-gradient-to-br {{ $avatarGrad }} flex items-center justify-center shadow-sm">
<span class="text-sm font-bold text-white">{{ $initial }}</span>
</div>
@if($isActive)
<span class="absolute -bottom-0.5 -right-0.5 w-3 h-3 bg-emerald-500 border-2 border-white rounded-full"></span>
@endif
</div>
<div class="min-w-0">
<div class="text-sm font-semibold text-gray-800 truncate flex items-center gap-1.5 flex-wrap">
{{ $u->name }}
@if($isMe)
<span class="text-[10px] px-1.5 py-0.5 rounded-full bg-indigo-100 text-indigo-600 border border-indigo-200 font-semibold leading-none">Kamu</span>
@endif
</div>
<div class="text-xs text-gray-400 mt-0.5">ID #{{ $u->id }}</div>
</div>
</div>
</td>
{{-- EMAIL --}}
<td class="px-4 py-6">
<span class="text-sm text-gray-500 truncate block">{{ $u->email }}</span>
</td>
{{-- ROLE --}}
<td class="px-4 py-6">
@if($isAdmin)
<span class="inline-flex items-center gap-1 px-2 py-1 text-xs font-semibold rounded-lg bg-emerald-100 text-emerald-700 border border-emerald-200">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-6-3a2 2 0 11-4 0 2 2 0 014 0zm-2 4a5 5 0 00-4.546 2.916A5.986 5.986 0 0010 16a5.986 5.986 0 004.546-2.084A5 5 0 0010 11z" clip-rule="evenodd"/>
</svg>
Admin
</span>
@else
<span class="inline-flex items-center gap-1 px-2 py-1 text-xs font-semibold rounded-lg bg-blue-100 text-blue-700 border border-blue-200">
<svg class="w-3 h-3" fill="currentColor" viewBox="0 0 20 20">
<path d="M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"/>
</svg>
RT
</span>
@endif
</td>
{{-- STATUS --}}
<td class="px-4 py-6">
@if($isActive)
<span class="inline-flex items-center gap-1 px-2 py-1 text-xs font-semibold rounded-lg bg-emerald-50 text-emerald-700 border border-emerald-100">
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500 animate-pulse"></span>
Aktif
</span>
@else
<span class="inline-flex items-center gap-1 px-2 py-1 text-xs font-semibold rounded-lg bg-gray-100 text-gray-400 border border-gray-200">
<span class="w-1.5 h-1.5 rounded-full bg-gray-400"></span>
Nonaktif
</span>
@endif
</td>
{{-- AKSI --}}
<td class="px-4 py-6">
<div class="flex items-center justify-end gap-1.5">
@if($isMe)
<span class="inline-flex items-center gap-1.5 px-2.5 py-1 text-xs font-medium bg-gray-100 text-gray-400 rounded-lg border border-gray-200">
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/>
</svg>
Terkunci
</span>
@else
{{-- UBAH ROLE --}}
<form action="{{ route('admin.data-akun.role', $u->id) }}" method="POST">
@csrf
<input type="hidden" name="role" value="{{ $newRole }}">
<button type="submit"
onclick="return confirm('Ubah role {{ addslashes($u->name) }} menjadi {{ $newRoleLabel }}?')"
class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium bg-slate-100 text-slate-600 rounded-lg hover:bg-slate-200 transition">
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4"/>
</svg>
{{ $newRoleLabel }}
</button>
</form>
{{-- AKTIF / NONAKTIF --}}
<form action="{{ route('admin.data-akun.toggle-aktif', $u->id) }}" method="POST">
@csrf
<button type="submit"
onclick="return confirm('{{ $isActive ? 'Nonaktifkan' : 'Aktifkan' }} akun {{ addslashes($u->name) }}?')"
class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium rounded-lg transition
{{ $isActive ? 'bg-amber-100 text-amber-700 hover:bg-amber-200' : 'bg-emerald-100 text-emerald-700 hover:bg-emerald-200' }}">
@if($isActive)
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"/>
</svg>
Nonaktifkan
@else
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
Aktifkan
@endif
</button>
</form>
{{-- HAPUS --}}
<form action="{{ route('admin.data-akun.hapus', $u->id) }}" method="POST"
onsubmit="return confirm('Yakin hapus akun {{ addslashes($u->name) }}? Tindakan ini tidak bisa dibatalkan.')">
@csrf
@method('DELETE')
<button type="submit"
class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium bg-rose-100 text-rose-700 rounded-lg hover:bg-rose-200 transition">
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/>
</svg>
Hapus
</button>
</form>
@endif
</div>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="py-16 text-center">
<div class="flex flex-col items-center gap-3">
<div class="w-14 h-14 bg-gray-100 rounded-2xl flex items-center justify-center">
<svg class="w-7 h-7 text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" 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 font-semibold text-gray-500">Belum ada akun</p>
@if(request()->filled('q'))
<p class="text-xs text-gray-400 mt-0.5">Tidak ada hasil untuk "<span class="font-medium">{{ request('q') }}</span>"</p>
<a href="{{ route('admin.data-akun') }}" class="inline-block mt-2 text-xs text-blue-600 hover:underline"> Hapus pencarian</a>
@endif
</div>
</div>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
{{-- PAGINATION --}}
@if(isset($users) && method_exists($users, 'links') && $users->hasPages())
<div class="px-5 py-3 border-t border-gray-100 bg-gray-50">
{{ $users->appends(request()->query())->links() }}
</div>
@endif
{{-- CREDIT WATERMARK --}}
<div class="px-5 py-5 border-t border-gray-100 flex items-center justify-center gap-2 select-none mt-1">
<svg class="w-3.5 h-3.5 text-gray-300" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M4 4a2 2 0 012-2h8a2 2 0 012 2v12a1 1 0 110 2h-3a1 1 0 01-1-1v-2a1 1 0 00-1-1H9a1 1 0 00-1 1v2a1 1 0 01-1 1H4a1 1 0 110-2V4zm3 1h2v2H7V5zm2 4H7v2h2V9zm2-4h2v2h-2V5zm2 4h-2v2h2V9z" clip-rule="evenodd"/>
</svg>
<span class="text-xs text-gray-300 font-medium tracking-wide">Aplikasi SiBantuDes</span>
<span class="text-gray-200">·</span>
<span class="text-xs text-gray-300 tracking-wide">Desa Ngerong</span>
</div>
</div>
</div>
</x-app-layout>

View File

@ -0,0 +1,594 @@
<x-app-layout>
<x-slot name="header">
<div class="flex items-center justify-between">
<div>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Data Warga</h2>
<p class="text-sm text-gray-500 mt-0.5">Kelola dan pantau seluruh data warga dari semua dusun.</p>
</div>
<div class="inline-flex items-center gap-2 bg-gray-50 border border-gray-200 rounded-xl px-3 py-1.5 text-xs text-gray-500">
<svg class="w-3.5 h-3.5 text-blue-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/>
</svg>
{{ \Carbon\Carbon::now('Asia/Jakarta')->translatedFormat('l, d F Y') }} {{ \Carbon\Carbon::now('Asia/Jakarta')->format('H:i') }} WIB
</div>
</div>
</x-slot>
<div class="space-y-4">
{{-- NOTIFIKASI --}}
@if(session('success'))
<div class="flex items-center gap-3 rounded-xl border border-green-200 bg-green-50 px-4 py-3 text-sm text-green-700">
<svg class="w-4 h-4 shrink-0 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
</svg>
{{ session('success') }}
</div>
@endif
@if(session('error'))
<div class="flex items-center gap-3 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700">
<svg class="w-4 h-4 shrink-0 text-red-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01M12 3a9 9 0 100 18A9 9 0 0012 3z"/>
</svg>
{{ session('error') }}
</div>
@endif
{{-- SEARCH CARD --}}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-5">
<div class="flex items-center gap-2 mb-3">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="text-sm font-semibold text-gray-700">Pencarian</h3>
</div>
<form method="GET" action="{{ url()->current() }}" class="grid grid-cols-1 md:grid-cols-4 gap-3">
<div class="relative md:col-span-3">
<svg class="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
<input type="text" name="q" value="{{ request('q') }}"
placeholder="Cari NIK / Nama / Email..."
class="w-full pl-9 pr-3 py-2 text-sm border border-gray-200 rounded-xl bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"/>
</div>
<div class="flex gap-2">
<button type="submit"
class="flex-1 inline-flex items-center justify-center gap-2 px-4 py-2 text-sm font-semibold bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition shadow-sm shadow-blue-200">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
</svg>
Cari
</button>
@if(request()->filled('q'))
<a href="{{ url()->current() }}"
class="inline-flex items-center justify-center w-10 text-sm font-medium bg-gray-100 text-gray-500 rounded-xl hover:bg-gray-200 transition">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</a>
@endif
</div>
</form>
</div>
{{-- TABLE CARD --}}
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
{{-- Table header info --}}
<div class="px-5 py-3 border-b border-gray-100 bg-gray-50 flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<span class="text-sm font-semibold text-gray-700">
Daftar Warga
@if(isset($wargas) && method_exists($wargas, 'total'))
<span class="ml-1 text-gray-400 font-normal">({{ $wargas->total() }} data)</span>
@endif
</span>
</div>
@if(isset($wargas) && method_exists($wargas, 'currentPage') && $wargas->lastPage() > 1)
<span class="text-xs text-gray-400">
Halaman {{ $wargas->currentPage() }} dari {{ $wargas->lastPage() }}
</span>
@endif
</div>
<div class="overflow-x-auto w-full">
<table class="w-full text-sm table-fixed">
<colgroup>
<col style="width:13%">
<col style="width:21%">
<col style="width:14%">
<col style="width:12%">
<col style="width:16%">
<col style="width:10%">
<col style="width:14%">
</colgroup>
<thead>
<tr class="bg-gray-50 border-b border-gray-100">
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">NIK</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Nama</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Dusun / RT</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Penghasilan</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Probabilitas</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase tracking-wide">Status</th>
<th class="px-4 py-3 text-right text-xs font-semibold text-gray-400 uppercase tracking-wide">Aksi</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-50">
@forelse($wargas ?? [] as $warga)
@php
$prob = optional($warga->prediksiKelayakan)->probability ?? null;
$probPct = $prob !== null ? ($prob <= 1 ? $prob * 100 : $prob) : null;
$detailPayload = [
'nik' => $warga->nik,
'no_kk' => $warga->no_kk ?? '-',
'nama_lengkap' => $warga->nama_lengkap,
'jenis_kelamin' => $warga->jenis_kelamin ?? '-',
'tempat_lahir' => $warga->tempat_lahir ?? '-',
'tanggal_lahir' => $warga->tanggal_lahir
? \Carbon\Carbon::parse($warga->tanggal_lahir)->translatedFormat('d F Y')
: '-',
'usia' => $warga->usia ?? '-',
'status_perkawinan' => $warga->status_perkawinan ?? '-',
'alamat' => $warga->alamat ?? '-',
'desa' => $warga->desa ?? '-',
'aset_kepemilikan' => $warga->aset_kepemilikan ?? '-',
'pekerjaan' => $warga->pekerjaan ?? '-',
'penghasilan' => $warga->penghasilan ?? 0,
'jumlah_tanggungan' => $warga->jumlah_tanggungan ?? '-',
'bantuan_lain' => $warga->bantuan_lain ?? '-',
'status_verifikasi' => $warga->status_verifikasi ?? '-',
'dusun' => $warga->rt->dusun->nama_dusun ?? '-',
'rt' => $warga->rt->nomor_rt ?? '-',
'probability' => optional($warga->prediksiKelayakan)->probability,
'recommendation' => optional($warga->prediksiKelayakan)->recommendation,
'input_oleh' => optional($warga->user)->name ?? (optional($warga->user)->email ?? '-'),
'created_at' => optional($warga->created_at)->translatedFormat('d F Y, H:i') ?? '-',
];
@endphp
<tr class="hover:bg-blue-50/20 transition-colors duration-150 group">
{{-- NIK --}}
<td class="px-4 py-3">
<span class="font-mono text-xs text-gray-500 bg-gray-100 px-2 py-0.5 rounded-lg">{{ $warga->nik }}</span>
</td>
{{-- NAMA --}}
<td class="px-4 py-3">
<div class="flex items-center gap-2.5">
<div class="w-8 h-8 rounded-full bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center shrink-0 shadow-sm shadow-blue-200">
<span class="text-xs font-bold text-white">{{ strtoupper(substr($warga->nama_lengkap, 0, 1)) }}</span>
</div>
<div class="min-w-0">
<div class="text-sm font-semibold text-gray-800 truncate">{{ $warga->nama_lengkap }}</div>
<div class="text-xs text-gray-400 truncate">{{ $warga->pekerjaan ?? '-' }}</div>
</div>
</div>
</td>
{{-- DUSUN / RT --}}
<td class="px-4 py-3">
<div class="text-sm font-medium text-gray-700">{{ $warga->rt->dusun->nama_dusun ?? '-' }}</div>
<span class="inline-flex items-center px-2 py-0.5 rounded-md bg-blue-50 text-blue-600 text-xs font-medium border border-blue-100 mt-0.5">
RT {{ str_pad($warga->rt->nomor_rt ?? '-', 3, '0', STR_PAD_LEFT) }}
</span>
</td>
{{-- PENGHASILAN --}}
<td class="px-4 py-3 text-sm text-gray-600">
Rp {{ number_format($warga->penghasilan ?? 0, 0, ',', '.') }}
</td>
{{-- PROBABILITAS --}}
<td class="px-4 py-3">
@if($probPct !== null)
<div class="flex items-center gap-2">
<div class="flex-1 bg-gray-100 rounded-full h-1.5">
<div class="h-1.5 rounded-full transition-all {{ $probPct >= 70 ? 'bg-emerald-500' : ($probPct >= 40 ? 'bg-amber-400' : 'bg-rose-400') }}"
style="width: {{ min($probPct, 100) }}%"></div>
</div>
<span class="text-xs font-bold tabular-nums {{ $probPct >= 70 ? 'text-emerald-600' : ($probPct >= 40 ? 'text-amber-600' : 'text-rose-500') }}">
{{ number_format($probPct, 1) }}%
</span>
</div>
@else
<span class="text-xs text-gray-300"></span>
@endif
</td>
{{-- STATUS --}}
<td class="px-4 py-3">
@if($warga->status_verifikasi === 'pending')
<span class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-semibold rounded-full bg-amber-100 text-amber-700 border border-amber-200">
<span class="w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse"></span>Pending
</span>
@elseif($warga->status_verifikasi === 'disetujui')
<span class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-semibold rounded-full bg-emerald-100 text-emerald-700 border border-emerald-200">
<span class="w-1.5 h-1.5 rounded-full bg-emerald-500"></span>Disetujui
</span>
@else
<span class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-semibold rounded-full bg-rose-100 text-rose-700 border border-rose-200">
<span class="w-1.5 h-1.5 rounded-full bg-rose-500"></span>Ditolak
</span>
@endif
</td>
{{-- AKSI --}}
<td class="px-4 py-3">
<div class="flex items-center justify-end gap-1.5">
{{-- DETAIL --}}
<button type="button"
onclick="openDetailModal({{ $warga->id }})"
class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium bg-slate-100 text-slate-600 rounded-lg hover:bg-slate-200 transition">
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"/>
</svg>
Detail
</button>
@if($warga->status_verifikasi === 'pending')
<form action="{{ route('admin.data-warga.setujui', $warga->id) }}" method="POST">
@csrf
<button type="submit"
class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium bg-emerald-100 text-emerald-700 rounded-lg hover:bg-emerald-200 transition">
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
</svg>
Setujui
</button>
</form>
<form action="{{ route('admin.data-warga.tolak', $warga->id) }}" method="POST"
onsubmit="return confirm('Yakin menolak data {{ addslashes($warga->nama_lengkap) }}?')">
@csrf
<button type="submit"
class="inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium bg-rose-100 text-rose-700 rounded-lg hover:bg-rose-200 transition">
<svg class="w-3 h-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
Tolak
</button>
</form>
@else
<span class="text-xs text-gray-300"></span>
@endif
</div>
{{-- Data JSON tersembunyi --}}
<script type="application/json" id="warga-{{ $warga->id }}">{!! json_encode($detailPayload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) !!}</script>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="py-16 text-center">
<div class="flex flex-col items-center gap-3">
<div class="w-14 h-14 bg-gray-100 rounded-2xl flex items-center justify-center">
<svg class="w-7 h-7 text-gray-300" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"/>
</svg>
</div>
<div>
<p class="text-sm font-semibold text-gray-500">Belum ada data warga</p>
@if(request()->filled('q'))
<p class="text-xs text-gray-400 mt-0.5">Tidak ada hasil untuk "<span class="font-medium">{{ request('q') }}</span>"</p>
<a href="{{ url()->current() }}" class="inline-block mt-2 text-xs text-blue-600 hover:underline"> Hapus pencarian</a>
@endif
</div>
</div>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
{{-- PAGINATION --}}
@if(isset($wargas) && method_exists($wargas, 'links') && $wargas->hasPages())
<div class="px-5 py-3 border-t border-gray-100 bg-gray-50">
{{ $wargas->links() }}
</div>
@endif
</div>
</div>
{{-- ═══════════════════════════════════════════
MODAL DETAIL WARGA
════════════════════════════════════════════ --}}
{{-- Backdrop --}}
<div id="detailBackdrop"
onclick="closeDetailModal()"
class="fixed inset-0 z-40 hidden bg-black/40 backdrop-blur-sm">
</div>
{{-- Panel z-50 di atas backdrop --}}
<div id="detailModal"
class="fixed inset-0 z-50 hidden overflow-y-auto"
style="pointer-events:none;">
<div class="flex min-h-full items-center justify-center p-4">
<div class="w-full max-w-2xl bg-white rounded-2xl shadow-2xl border border-gray-100 overflow-hidden flex flex-col max-h-[90vh]"
style="pointer-events:auto;">
{{-- HERO HEADER --}}
<div class="relative bg-gradient-to-br from-blue-600 to-blue-500 px-6 py-5 shrink-0">
{{-- Decorative circles --}}
<div class="absolute -right-4 -top-4 w-24 h-24 bg-white/10 rounded-full"></div>
<div class="absolute right-8 -bottom-6 w-16 h-16 bg-white/10 rounded-full"></div>
<div class="relative flex items-center justify-between">
<div class="flex items-center gap-4">
<div id="modal-avatar"
class="w-12 h-12 rounded-2xl bg-white/20 border-2 border-white/30 flex items-center justify-center shrink-0">
<span id="modal-initial" class="text-xl font-bold text-white">?</span>
</div>
<div>
<h3 id="modal-title" class="text-base font-bold text-white"></h3>
<p id="modal-subtitle" class="text-xs text-blue-100 mt-0.5"></p>
</div>
</div>
<button onclick="closeDetailModal()"
class="w-8 h-8 flex items-center justify-center rounded-xl bg-white/20 hover:bg-white/30 transition text-white">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
</svg>
</button>
</div>
{{-- Status badge in header --}}
<div class="relative mt-3">
<div id="modal-status-badge" class="inline-flex items-center gap-1.5 px-3 py-1 rounded-full text-xs font-semibold bg-white/20 text-white border border-white/30">
<span id="modal-status-dot" class="w-1.5 h-1.5 rounded-full bg-white"></span>
<span id="modal-status-text"></span>
</div>
</div>
</div>
{{-- BODY (scrollable) --}}
<div class="overflow-y-auto flex-1 p-5 space-y-4 bg-gray-50/50">
{{-- IDENTITAS --}}
<div class="bg-white rounded-2xl border border-gray-100 overflow-hidden shadow-sm">
<div class="px-4 py-2.5 bg-gray-50 border-b border-gray-100 flex items-center gap-2">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<span class="text-xs font-bold text-gray-600 uppercase tracking-wider">Data Identitas</span>
</div>
<div class="p-4 grid grid-cols-2 gap-x-6 gap-y-3">
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">NIK</div>
<div id="d_nik" class="text-sm font-mono font-semibold text-gray-800 bg-gray-50 border border-gray-100 rounded-lg px-2.5 py-1.5">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">No. KK</div>
<div id="d_no_kk" class="text-sm font-mono font-semibold text-gray-800 bg-gray-50 border border-gray-100 rounded-lg px-2.5 py-1.5">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Nama Lengkap</div>
<div id="d_nama" class="text-sm font-semibold text-gray-800">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Jenis Kelamin</div>
<div id="d_jk" class="text-sm font-medium text-gray-800">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Tempat, Tgl Lahir</div>
<div id="d_lahir" class="text-sm font-medium text-gray-800">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Usia</div>
<div id="d_usia" class="text-sm font-semibold text-gray-800">-</div>
</div>
<div class="col-span-2">
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Status Perkawinan</div>
<div id="d_kawin" class="text-sm font-medium text-gray-800">-</div>
</div>
</div>
</div>
{{-- TEMPAT TINGGAL --}}
<div class="bg-white rounded-2xl border border-gray-100 overflow-hidden shadow-sm">
<div class="px-4 py-2.5 bg-gray-50 border-b border-gray-100 flex items-center gap-2">
<div class="w-1 h-4 bg-emerald-500 rounded-full"></div>
<span class="text-xs font-bold text-gray-600 uppercase tracking-wider">Tempat Tinggal</span>
</div>
<div class="p-4 grid grid-cols-2 gap-x-6 gap-y-3">
<div class="col-span-2">
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Alamat</div>
<div id="d_alamat" class="text-sm font-medium text-gray-800">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Dusun</div>
<div id="d_dusun" class="text-sm font-medium text-gray-800">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">RT</div>
<div id="d_rt" class="text-sm font-medium text-gray-800">-</div>
</div>
<div class="col-span-2">
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Aset Kepemilikan</div>
<div id="d_aset" class="text-sm font-medium text-gray-800">-</div>
</div>
</div>
</div>
{{-- EKONOMI --}}
<div class="bg-white rounded-2xl border border-gray-100 overflow-hidden shadow-sm">
<div class="px-4 py-2.5 bg-gray-50 border-b border-gray-100 flex items-center gap-2">
<div class="w-1 h-4 bg-amber-500 rounded-full"></div>
<span class="text-xs font-bold text-gray-600 uppercase tracking-wider">Data Ekonomi</span>
</div>
<div class="p-4 grid grid-cols-2 gap-x-6 gap-y-3">
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Pekerjaan</div>
<div id="d_pekerjaan" class="text-sm font-medium text-gray-800">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Penghasilan</div>
<div id="d_penghasilan" class="text-sm font-bold text-gray-800">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Jumlah Tanggungan</div>
<div id="d_tanggungan" class="text-sm font-medium text-gray-800">-</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Bantuan Lain</div>
<div id="d_bantuan" class="text-sm font-medium text-gray-800">-</div>
</div>
</div>
</div>
{{-- PREDIKSI --}}
<div class="bg-white rounded-2xl border border-gray-100 overflow-hidden shadow-sm">
<div class="px-4 py-2.5 bg-gray-50 border-b border-gray-100 flex items-center gap-2">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<span class="text-xs font-bold text-gray-600 uppercase tracking-wider">Prediksi Kelayakan</span>
</div>
<div class="p-4">
<div id="d_pred_empty" class="hidden py-4 text-center text-xs text-gray-400">
Belum ada data prediksi dari sistem ML.
</div>
<div id="d_pred_wrap">
<div class="flex items-end gap-4 mb-3">
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1">Probabilitas</div>
<div id="d_prob" class="text-3xl font-bold text-gray-800 tabular-nums"></div>
</div>
<div class="flex-1 pb-1.5">
<div class="w-full bg-gray-100 rounded-full h-2.5">
<div id="d_prob_bar" class="h-2.5 rounded-full transition-all duration-500 bg-emerald-500" style="width:0%"></div>
</div>
</div>
</div>
<div>
<div class="text-xs font-medium text-gray-400 uppercase tracking-wide mb-1.5">Rekomendasi</div>
<div id="d_reco_badge" class="inline-flex items-center px-3 py-1.5 rounded-xl text-sm font-semibold bg-gray-100 text-gray-700"></div>
</div>
</div>
</div>
</div>
{{-- META --}}
<div class="flex items-center justify-between px-1 text-xs text-gray-400">
<span>Input oleh: <span id="d_input_oleh" class="text-gray-600 font-semibold">-</span></span>
<span>Didaftarkan: <span id="d_created" class="text-gray-600 font-semibold">-</span></span>
</div>
</div>
{{-- FOOTER --}}
<div class="px-5 py-4 border-t border-gray-100 bg-white shrink-0 flex justify-end">
<button onclick="closeDetailModal()"
class="inline-flex items-center gap-2 px-5 py-2 text-sm font-semibold bg-gray-100 text-gray-700 rounded-xl hover:bg-gray-200 transition">
Tutup
</button>
</div>
</div>
</div>
</div>
<script>
function set(id, val) {
const el = document.getElementById(id);
if (el) el.textContent = val;
}
function openDetailModal(id) {
const el = document.getElementById('warga-' + id);
if (!el) return;
const d = JSON.parse(el.textContent);
// ── Header hero ─────────────────────────────────
set('modal-initial', (d.nama_lengkap || '?').charAt(0).toUpperCase());
set('modal-title', d.nama_lengkap || '-');
set('modal-subtitle', d.pekerjaan ? d.pekerjaan + ' · ' + (d.dusun || '-') : (d.dusun || '-'));
// ── Status badge di hero ─────────────────────────
const dot = document.getElementById('modal-status-dot');
const txt = document.getElementById('modal-status-text');
const st = d.status_verifikasi || '';
if (st === 'pending') {
if (dot) { dot.className = 'w-1.5 h-1.5 rounded-full bg-amber-300 animate-pulse'; }
if (txt) txt.textContent = 'Menunggu Verifikasi';
} else if (st === 'disetujui') {
if (dot) { dot.className = 'w-1.5 h-1.5 rounded-full bg-emerald-300'; }
if (txt) txt.textContent = 'Disetujui';
} else {
if (dot) { dot.className = 'w-1.5 h-1.5 rounded-full bg-rose-300'; }
if (txt) txt.textContent = 'Ditolak';
}
// ── Identitas ────────────────────────────────────
set('d_nik', d.nik || '-');
set('d_no_kk', d.no_kk || '-');
set('d_nama', d.nama_lengkap || '-');
set('d_jk', d.jenis_kelamin || '-');
set('d_lahir', (d.tempat_lahir || '-') + ', ' + (d.tanggal_lahir || '-'));
set('d_usia', d.usia ? d.usia + ' tahun' : '-');
set('d_kawin', d.status_perkawinan || '-');
// ── Tempat tinggal ───────────────────────────────
set('d_alamat', d.alamat || '-');
set('d_dusun', d.dusun || '-');
set('d_rt', 'RT ' + String(d.rt || '-').padStart(3, '0'));
set('d_aset', d.aset_kepemilikan || '-');
// ── Ekonomi ──────────────────────────────────────
set('d_pekerjaan', d.pekerjaan || '-');
set('d_penghasilan','Rp ' + Number(d.penghasilan || 0).toLocaleString('id-ID'));
set('d_tanggungan', d.jumlah_tanggungan != null ? d.jumlah_tanggungan + ' orang' : '-');
set('d_bantuan', d.bantuan_lain || '-');
// ── Prediksi ─────────────────────────────────────
const prob = d.probability;
const emptyEl = document.getElementById('d_pred_empty');
const wrapEl = document.getElementById('d_pred_wrap');
if (prob === null || prob === undefined) {
emptyEl && emptyEl.classList.remove('hidden');
wrapEl && wrapEl.classList.add('hidden');
} else {
emptyEl && emptyEl.classList.add('hidden');
wrapEl && wrapEl.classList.remove('hidden');
const pct = prob <= 1 ? prob * 100 : Number(prob);
set('d_prob', pct.toFixed(1) + '%');
const bar = document.getElementById('d_prob_bar');
if (bar) {
bar.style.width = Math.min(pct, 100) + '%';
bar.className = 'h-2.5 rounded-full transition-all duration-700 ' +
(pct >= 70 ? 'bg-emerald-500' : pct >= 40 ? 'bg-amber-400' : 'bg-rose-400');
}
const recoBadge = document.getElementById('d_reco_badge');
if (recoBadge) {
const reco = d.recommendation || '—';
recoBadge.textContent = reco;
const isLayak = reco.toLowerCase().includes('layak');
recoBadge.className = 'inline-flex items-center px-3 py-1.5 rounded-xl text-sm font-semibold ' +
(isLayak ? 'bg-emerald-100 text-emerald-700' : 'bg-rose-100 text-rose-700');
}
}
// ── Meta ─────────────────────────────────────────
set('d_input_oleh', d.input_oleh || '-');
set('d_created', d.created_at || '-');
// ── Tampilkan backdrop + modal ────────────────────
document.getElementById('detailBackdrop').classList.remove('hidden');
document.getElementById('detailModal').classList.remove('hidden');
document.body.style.overflow = 'hidden';
}
function closeDetailModal() {
document.getElementById('detailBackdrop').classList.add('hidden');
document.getElementById('detailModal').classList.add('hidden');
document.body.style.overflow = '';
}
document.addEventListener('keydown', e => { if (e.key === 'Escape') closeDetailModal(); });
</script>
</x-app-layout>

View File

@ -0,0 +1,147 @@
<x-app-layout>
<x-slot name="header">
<div>
<h2 class="font-semibold text-xl text-gray-800 leading-tight">Filterisasi</h2>
<p class="text-sm text-gray-500 mt-0.5">
Penetapan penerima BLT-DD berdasarkan probabilitas (hanya data yang sudah <b>disetujui</b>).
</p>
</div>
</x-slot>
<div class="space-y-4">
@if(session('success'))
<div class="rounded-xl border border-green-200 bg-green-50 px-4 py-3 text-sm text-green-700">
{{ session('success') }}
</div>
@endif
@if(session('error'))
<div class="rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700">
{{ session('error') }}
</div>
@endif
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-5">
<div class="flex items-center gap-2 mb-4">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<h3 class="text-sm font-semibold text-gray-700">Pilih Dusun & Kuota (Disetujui saja)</h3>
</div>
<form method="GET" action="{{ route('admin.filterisasi') }}" class="grid grid-cols-1 md:grid-cols-4 gap-3">
<div>
<label class="text-xs text-gray-500">Dusun</label>
<select name="dusun_id" class="mt-1 w-full border border-gray-200 rounded-xl bg-gray-50 px-3 py-2 text-sm">
<option value="0">-- pilih dusun --</option>
@foreach($dusuns as $d)
<option value="{{ $d->id }}" {{ (int)($dusunId ?? 0) === $d->id ? 'selected' : '' }}>
{{ $d->nama_dusun }}
</option>
@endforeach
</select>
</div>
<div>
<label class="text-xs text-gray-500">Kuota per dusun</label>
<input type="number" name="kuota" min="1" max="100" value="{{ (int)($kuota ?? 7) }}"
class="mt-1 w-full border border-gray-200 rounded-xl bg-gray-50 px-3 py-2 text-sm" />
</div>
<div class="flex items-end gap-2 md:col-span-2">
<button type="submit"
class="px-5 py-2 text-sm font-semibold bg-blue-600 text-white rounded-xl hover:bg-blue-700 transition">
Tampilkan
</button>
@if(!empty($dusunId))
<form method="POST" action="{{ route('admin.filterisasi.reset') }}">
@csrf
<input type="hidden" name="dusun_id" value="{{ $dusunId }}">
<button type="submit"
onclick="return confirm('Reset hasil filterisasi dusun ini?')"
class="px-4 py-2 text-sm font-semibold bg-gray-100 text-gray-700 rounded-xl hover:bg-gray-200 transition">
Reset
</button>
</form>
<form method="POST" action="{{ route('admin.filterisasi.tetapkan') }}" class="ml-auto">
@csrf
<input type="hidden" name="dusun_id" value="{{ $dusunId }}">
<input type="hidden" name="kuota" value="{{ (int)($kuota ?? 7) }}">
<button type="submit"
onclick="return confirm('Tetapkan {{ (int)($kuota ?? 7) }} orang teratas untuk dusun ini?')"
class="px-5 py-2 text-sm font-semibold bg-emerald-600 text-white rounded-xl hover:bg-emerald-700 transition">
Tetapkan {{ (int)($kuota ?? 7) }} Teratas
</button>
</form>
@endif
</div>
</form>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 overflow-hidden">
<div class="px-5 py-3 border-b border-gray-100 bg-gray-50 flex items-center justify-between">
<div class="flex items-center gap-2">
<div class="w-1 h-4 bg-blue-600 rounded-full"></div>
<span class="text-sm font-semibold text-gray-700">Kandidat Disetujui (urut probabilitas)</span>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="bg-gray-50 border-b border-gray-100">
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase">Nama</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase">NIK</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase">Dusun</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase">Prob</th>
<th class="px-4 py-3 text-left text-xs font-semibold text-gray-400 uppercase">Final</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-50">
@forelse(($candidates ?? []) as $w)
@php
$prob = optional($w->prediksiKelayakan)->probability;
$picked = isset($pickedIds) ? $pickedIds->contains($w->id) : false;
@endphp
<tr class="hover:bg-blue-50/20 {{ $picked ? 'bg-emerald-50/40' : '' }}">
<td class="px-4 py-3 font-semibold text-gray-800">{{ $w->nama_lengkap }}</td>
<td class="px-4 py-3 text-gray-600">{{ $w->nik }}</td>
<td class="px-4 py-3 text-gray-600">{{ optional(optional($w->rt)->dusun)->nama_dusun ?? '-' }}</td>
<td class="px-4 py-3 text-gray-700">
{{ $prob !== null ? number_format((float)$prob, 4) : '-' }}
</td>
<td class="px-4 py-3">
@if($picked)
<span class="px-2 py-1 rounded-full text-xs bg-emerald-100 text-emerald-700">Terpilih</span>
@else
<span class="px-2 py-1 rounded-full text-xs bg-gray-100 text-gray-600">Belum</span>
@endif
</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-4 py-12 text-center text-sm text-gray-400">
Pilih dusun dulu untuk menampilkan kandidat.
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@if(isset($candidates) && method_exists($candidates, 'links') && $candidates->hasPages())
<div class="px-5 py-3 border-t border-gray-100 bg-gray-50">
{{ $candidates->appends(request()->query())->links() }}
</div>
@endif
</div>
<div class="bg-amber-50 border border-amber-100 rounded-2xl px-5 py-4 text-xs text-amber-700">
<b>Catatan:</b> Kandidat yang ditampilkan hanya yang <b>status_verifikasi = disetujui</b>. Kuota default 7 per dusun.
</div>
</div>
</x-app-layout>

View File

@ -0,0 +1,24 @@
<x-app-layout>
@section('content')
<div class="space-y-6">
<div>
<h1 class="text-2xl font-bold text-gray-800">Laporan</h1>
<p class="text-sm text-gray-500">Rekap data penerima & status, siap untuk cetak/ekspor.</p>
</div>
<div class="bg-white rounded-xl shadow-sm p-6">
<p class="text-gray-700">
Placeholder Laporan. Biasanya isi:
</p>
<ul class="list-disc ml-5 mt-3 text-sm text-gray-600 space-y-1">
<li>Rekap per dusun</li>
<li>Rekap diterima/ditolak</li>
<li>Export PDF/Excel</li>
</ul>
</div>
</div>
</x-app-layout>

View File

@ -0,0 +1,27 @@
<x-guest-layout>
<div class="mb-4 text-sm text-gray-600">
{{ __('This is a secure area of the application. Please confirm your password before continuing.') }}
</div>
<form method="POST" action="{{ route('password.confirm') }}">
@csrf
<!-- Password -->
<div>
<x-input-label for="password" :value="__('Password')" />
<x-text-input id="password" class="block mt-1 w-full"
type="password"
name="password"
required autocomplete="current-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<div class="flex justify-end mt-4">
<x-primary-button>
{{ __('Confirm') }}
</x-primary-button>
</div>
</form>
</x-guest-layout>

View File

@ -0,0 +1,25 @@
<x-guest-layout>
<div class="mb-4 text-sm text-gray-600">
{{ __('Forgot your password? No problem. Just let us know your email address and we will email you a password reset link that will allow you to choose a new one.') }}
</div>
<!-- Session Status -->
<x-auth-session-status class="mb-4" :status="session('status')" />
<form method="POST" action="{{ route('password.email') }}">
@csrf
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required autofocus />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<div class="flex items-center justify-end mt-4">
<x-primary-button>
{{ __('Email Password Reset Link') }}
</x-primary-button>
</div>
</form>
</x-guest-layout>

View File

@ -0,0 +1,128 @@
<!-- TEST-LOGIN-CUSTOM -->
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - Sistem BLT-DD</title>
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="bg-gradient-to-br from-primary-50 via-white to-blue-50">
<div class="min-h-screen flex items-center justify-center p-4">
<div class="max-w-5xl w-full bg-white rounded-2xl shadow-2xl overflow-hidden flex">
<!-- Left Side - Image -->
<div class="hidden lg:block lg:w-1/2 bg-gradient-to-br from-primary-600 to-primary-800 p-12">
<div class="h-full flex flex-col justify-between">
<div>
<div class="flex items-center space-x-3 mb-8">
<div class="w-12 h-12 bg-white rounded-xl flex items-center justify-center">
<svg class="w-8 h-8 text-primary-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
</svg>
</div>
<div>
<h1 class="text-2xl font-bold text-white">SIBANTUDDES</h1>
<p class="text-primary-200 text-sm">Sistem Bantuan Tunai Desa</p>
</div>
</div>
<h2 class="text-3xl font-bold text-white mb-4">Selamat Datang!</h2>
<p class="text-primary-100 text-lg leading-relaxed">
Sistem Informasi Kelayakan Penerima Bantuan Langsung Tunai Dana Desa (BLT-DD) berbasis Machine Learning
</p>
</div>
<div class="space-y-4">
<div class="flex items-start space-x-3">
<svg class="w-6 h-6 text-primary-300 flex-shrink-0 mt-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<p class="text-primary-100">Pendataan warga calon penerima bantuan</p>
</div>
<div class="flex items-start space-x-3">
<svg class="w-6 h-6 text-primary-300 flex-shrink-0 mt-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<p class="text-primary-100">Prediksi kelayakan dengan Machine Learning</p>
</div>
<div class="flex items-start space-x-3">
<svg class="w-6 h-6 text-primary-300 flex-shrink-0 mt-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<p class="text-primary-100">Laporan dan monitoring penyaluran bantuan</p>
</div>
</div>
</div>
</div>
<!-- Right Side - Form -->
<div class="w-full lg:w-1/2 p-12">
<div class="max-w-md mx-auto">
<div class="mb-8">
<h2 class="text-3xl font-bold text-gray-800 mb-2">Masuk</h2>
<p class="text-gray-600">Silakan masuk dengan akun Anda</p>
</div>
@if($errors->any())
<div class="mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded-lg">
<p class="text-red-700 text-sm">{{ $errors->first() }}</p>
</div>
@endif
<form action="{{ route('login') }}" method="POST" class="space-y-6">
@csrf
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Email</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="w-5 h-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207"></path>
</svg>
</div>
<input type="email" name="email" value="{{ old('email') }}" required
class="input-field pl-10" placeholder="nama@email.com">
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Password</label>
<div class="relative">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="w-5 h-5 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path>
</svg>
</div>
<input type="password" name="password" required
class="input-field pl-10" placeholder="••••••••">
</div>
</div>
<div class="flex items-center justify-between">
<label class="flex items-center">
<input type="checkbox" name="remember" class="w-4 h-4 text-primary-600 border-gray-300 rounded focus:ring-primary-500">
<span class="ml-2 text-sm text-gray-600">Ingat saya</span>
</label>
</div>
<button type="submit" class="w-full btn-primary py-3 text-lg font-semibold">
Masuk
</button>
</form>
<div class="mt-6 text-center">
<p class="text-sm text-gray-600">
Belum punya akun?
<a href="{{ route('register') }}" class="text-primary-600 hover:text-primary-700 font-medium">Daftar sebagai RT</a>
</p>
</div>
<div class="mt-8 pt-6 border-t border-gray-200">
<p class="text-xs text-gray-500 text-center">
© 2025 Sistem BLT-DD. All rights reserved.
</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Register - Sistem BLT-DD</title>
@vite(['resources/css/app.css', 'resources/js/app.js'])
</head>
<body class="bg-gradient-to-br from-primary-50 via-white to-blue-50">
<div class="min-h-screen flex items-center justify-center p-4">
<div class="max-w-md w-full bg-white rounded-2xl shadow-2xl p-8">
<div class="mb-8">
<div class="flex items-center justify-center mb-4">
<div class="w-16 h-16 bg-primary-600 rounded-xl flex items-center justify-center">
<svg class="w-10 h-10 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path>
</svg>
</div>
</div>
<h2 class="text-3xl font-bold text-gray-800 text-center mb-2">Daftar Akun RT</h2>
<p class="text-gray-600 text-center">Lengkapi data untuk mendaftar</p>
</div>
@if($errors->any())
<div class="mb-6 bg-red-50 border-l-4 border-red-500 p-4 rounded-lg">
<ul class="text-red-700 text-sm space-y-1">
@foreach($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('register') }}" method="POST" class="space-y-5">
@csrf
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Nama Lengkap</label>
<input type="text" name="name" value="{{ old('name') }}" required
class="input-field" placeholder="Masukkan nama lengkap">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Email</label>
<input type="email" name="email" value="{{ old('email') }}" required
class="input-field" placeholder="nama@email.com">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Nama Dusun</label>
<input type="text" name="dusun" value="{{ old('dusun') }}" required
class="input-field" placeholder="Contoh: Ngronggo">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Password</label>
<input type="password" name="password" required
class="input-field" placeholder="Minimal 6 karakter">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Konfirmasi Password</label>
<input type="password" name="password_confirmation" required
class="input-field" placeholder="Ulangi password">
</div>
<button type="submit" class="w-full btn-primary py-3 text-lg font-semibold mt-6">
Daftar Sekarang
</button>
</form>
<div class="mt-6 text-center">
<p class="text-sm text-gray-600">
Sudah punya akun?
<a href="{{ route('login') }}" class="text-primary-600 hover:text-primary-700 font-medium">Masuk di sini</a>
</p>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,39 @@
<x-guest-layout>
<form method="POST" action="{{ route('password.store') }}">
@csrf
<!-- Password Reset Token -->
<input type="hidden" name="token" value="{{ $request->route('token') }}">
<!-- Email Address -->
<div>
<x-input-label for="email" :value="__('Email')" />
<x-text-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email', $request->email)" required autofocus autocomplete="username" />
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>
<!-- Password -->
<div class="mt-4">
<x-input-label for="password" :value="__('Password')" />
<x-text-input id="password" class="block mt-1 w-full" type="password" name="password" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>
<!-- Confirm Password -->
<div class="mt-4">
<x-input-label for="password_confirmation" :value="__('Confirm Password')" />
<x-text-input id="password_confirmation" class="block mt-1 w-full"
type="password"
name="password_confirmation" required autocomplete="new-password" />
<x-input-error :messages="$errors->get('password_confirmation')" class="mt-2" />
</div>
<div class="flex items-center justify-end mt-4">
<x-primary-button>
{{ __('Reset Password') }}
</x-primary-button>
</div>
</form>
</x-guest-layout>

View File

@ -0,0 +1,31 @@
<x-guest-layout>
<div class="mb-4 text-sm text-gray-600">
{{ __('Thanks for signing up! Before getting started, could you verify your email address by clicking on the link we just emailed to you? If you didn\'t receive the email, we will gladly send you another.') }}
</div>
@if (session('status') == 'verification-link-sent')
<div class="mb-4 font-medium text-sm text-green-600">
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
</div>
@endif
<div class="mt-4 flex items-center justify-between">
<form method="POST" action="{{ route('verification.send') }}">
@csrf
<div>
<x-primary-button>
{{ __('Resend Verification Email') }}
</x-primary-button>
</div>
</form>
<form method="POST" action="{{ route('logout') }}">
@csrf
<button type="submit" class="underline text-sm text-gray-600 hover:text-gray-900 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
{{ __('Log Out') }}
</button>
</form>
</div>
</x-guest-layout>

View File

@ -0,0 +1,3 @@
<svg viewBox="0 0 316 316" xmlns="http://www.w3.org/2000/svg" {{ $attributes }}>
<path d="M305.8 81.125C305.77 80.995 305.69 80.885 305.65 80.755C305.56 80.525 305.49 80.285 305.37 80.075C305.29 79.935 305.17 79.815 305.07 79.685C304.94 79.515 304.83 79.325 304.68 79.175C304.55 79.045 304.39 78.955 304.25 78.845C304.09 78.715 303.95 78.575 303.77 78.475L251.32 48.275C249.97 47.495 248.31 47.495 246.96 48.275L194.51 78.475C194.33 78.575 194.19 78.725 194.03 78.845C193.89 78.955 193.73 79.045 193.6 79.175C193.45 79.325 193.34 79.515 193.21 79.685C193.11 79.815 192.99 79.935 192.91 80.075C192.79 80.285 192.71 80.525 192.63 80.755C192.58 80.875 192.51 80.995 192.48 81.125C192.38 81.495 192.33 81.875 192.33 82.265V139.625L148.62 164.795V52.575C148.62 52.185 148.57 51.805 148.47 51.435C148.44 51.305 148.36 51.195 148.32 51.065C148.23 50.835 148.16 50.595 148.04 50.385C147.96 50.245 147.84 50.125 147.74 49.995C147.61 49.825 147.5 49.635 147.35 49.485C147.22 49.355 147.06 49.265 146.92 49.155C146.76 49.025 146.62 48.885 146.44 48.785L93.99 18.585C92.64 17.805 90.98 17.805 89.63 18.585L37.18 48.785C37 48.885 36.86 49.035 36.7 49.155C36.56 49.265 36.4 49.355 36.27 49.485C36.12 49.635 36.01 49.825 35.88 49.995C35.78 50.125 35.66 50.245 35.58 50.385C35.46 50.595 35.38 50.835 35.3 51.065C35.25 51.185 35.18 51.305 35.15 51.435C35.05 51.805 35 52.185 35 52.575V232.235C35 233.795 35.84 235.245 37.19 236.025L142.1 296.425C142.33 296.555 142.58 296.635 142.82 296.725C142.93 296.765 143.04 296.835 143.16 296.865C143.53 296.965 143.9 297.015 144.28 297.015C144.66 297.015 145.03 296.965 145.4 296.865C145.5 296.835 145.59 296.775 145.69 296.745C145.95 296.655 146.21 296.565 146.45 296.435L251.36 236.035C252.72 235.255 253.55 233.815 253.55 232.245V174.885L303.81 145.945C305.17 145.165 306 143.725 306 142.155V82.265C305.95 81.875 305.89 81.495 305.8 81.125ZM144.2 227.205L100.57 202.515L146.39 176.135L196.66 147.195L240.33 172.335L208.29 190.625L144.2 227.205ZM244.75 114.995V164.795L226.39 154.225L201.03 139.625V89.825L219.39 100.395L244.75 114.995ZM249.12 57.105L292.81 82.265L249.12 107.425L205.43 82.265L249.12 57.105ZM114.49 184.425L96.13 194.995V85.305L121.49 70.705L139.85 60.135V169.815L114.49 184.425ZM91.76 27.425L135.45 52.585L91.76 77.745L48.07 52.585L91.76 27.425ZM43.67 60.135L62.03 70.705L87.39 85.305V202.545V202.555V202.565C87.39 202.735 87.44 202.895 87.46 203.055C87.49 203.265 87.49 203.485 87.55 203.695V203.705C87.6 203.875 87.69 204.035 87.76 204.195C87.84 204.375 87.89 204.575 87.99 204.745C87.99 204.745 87.99 204.755 88 204.755C88.09 204.905 88.22 205.035 88.33 205.175C88.45 205.335 88.55 205.495 88.69 205.635L88.7 205.645C88.82 205.765 88.98 205.855 89.12 205.965C89.28 206.085 89.42 206.225 89.59 206.325C89.6 206.325 89.6 206.325 89.61 206.335C89.62 206.335 89.62 206.345 89.63 206.345L139.87 234.775V285.065L43.67 229.705V60.135ZM244.75 229.705L148.58 285.075V234.775L219.8 194.115L244.75 179.875V229.705ZM297.2 139.625L253.49 164.795V114.995L278.85 100.395L297.21 89.825V139.625H297.2Z"/>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -0,0 +1,7 @@
@props(['status'])
@if ($status)
<div {{ $attributes->merge(['class' => 'font-medium text-sm text-green-600']) }}>
{{ $status }}
</div>
@endif

View File

@ -0,0 +1,3 @@
<button {{ $attributes->merge(['type' => 'submit', 'class' => 'inline-flex items-center px-4 py-2 bg-red-600 border border-transparent rounded-md font-semibold text-xs text-white uppercase tracking-widest hover:bg-red-500 active:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 transition ease-in-out duration-150']) }}>
{{ $slot }}
</button>

View File

@ -0,0 +1 @@
<a {{ $attributes->merge(['class' => 'block w-full px-4 py-2 text-start text-sm leading-5 text-gray-700 hover:bg-gray-100 focus:outline-none focus:bg-gray-100 transition duration-150 ease-in-out']) }}>{{ $slot }}</a>

View File

@ -0,0 +1,35 @@
@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white'])
@php
$alignmentClasses = match ($align) {
'left' => 'ltr:origin-top-left rtl:origin-top-right start-0',
'top' => 'origin-top',
default => 'ltr:origin-top-right rtl:origin-top-left end-0',
};
$width = match ($width) {
'48' => 'w-48',
default => $width,
};
@endphp
<div class="relative" x-data="{ open: false }" @click.outside="open = false" @close.stop="open = false">
<div @click="open = ! open">
{{ $trigger }}
</div>
<div x-show="open"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-end="opacity-100 scale-100"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
class="absolute z-50 mt-2 {{ $width }} rounded-md shadow-lg {{ $alignmentClasses }}"
style="display: none;"
@click="open = false">
<div class="rounded-md ring-1 ring-black ring-opacity-5 {{ $contentClasses }}">
{{ $content }}
</div>
</div>
</div>

View File

@ -0,0 +1,9 @@
@props(['messages'])
@if ($messages)
<ul {{ $attributes->merge(['class' => 'text-sm text-red-600 space-y-1']) }}>
@foreach ((array) $messages as $message)
<li>{{ $message }}</li>
@endforeach
</ul>
@endif

View File

@ -0,0 +1,5 @@
@props(['value'])
<label {{ $attributes->merge(['class' => 'block font-medium text-sm text-gray-700']) }}>
{{ $value ?? $slot }}
</label>

View File

@ -0,0 +1,78 @@
@props([
'name',
'show' => false,
'maxWidth' => '2xl'
])
@php
$maxWidth = [
'sm' => 'sm:max-w-sm',
'md' => 'sm:max-w-md',
'lg' => 'sm:max-w-lg',
'xl' => 'sm:max-w-xl',
'2xl' => 'sm:max-w-2xl',
][$maxWidth];
@endphp
<div
x-data="{
show: @js($show),
focusables() {
// All focusable element types...
let selector = 'a, button, input:not([type=\'hidden\']), textarea, select, details, [tabindex]:not([tabindex=\'-1\'])'
return [...$el.querySelectorAll(selector)]
// All non-disabled elements...
.filter(el => ! el.hasAttribute('disabled'))
},
firstFocusable() { return this.focusables()[0] },
lastFocusable() { return this.focusables().slice(-1)[0] },
nextFocusable() { return this.focusables()[this.nextFocusableIndex()] || this.firstFocusable() },
prevFocusable() { return this.focusables()[this.prevFocusableIndex()] || this.lastFocusable() },
nextFocusableIndex() { return (this.focusables().indexOf(document.activeElement) + 1) % (this.focusables().length + 1) },
prevFocusableIndex() { return Math.max(0, this.focusables().indexOf(document.activeElement)) -1 },
}"
x-init="$watch('show', value => {
if (value) {
document.body.classList.add('overflow-y-hidden');
{{ $attributes->has('focusable') ? 'setTimeout(() => firstFocusable().focus(), 100)' : '' }}
} else {
document.body.classList.remove('overflow-y-hidden');
}
})"
x-on:open-modal.window="$event.detail == '{{ $name }}' ? show = true : null"
x-on:close-modal.window="$event.detail == '{{ $name }}' ? show = false : null"
x-on:close.stop="show = false"
x-on:keydown.escape.window="show = false"
x-on:keydown.tab.prevent="$event.shiftKey || nextFocusable().focus()"
x-on:keydown.shift.tab.prevent="prevFocusable().focus()"
x-show="show"
class="fixed inset-0 overflow-y-auto px-4 py-6 sm:px-0 z-50"
style="display: {{ $show ? 'block' : 'none' }};"
>
<div
x-show="show"
class="fixed inset-0 transform transition-all"
x-on:click="show = false"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
>
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<div
x-show="show"
class="mb-6 bg-white rounded-lg overflow-hidden shadow-xl transform transition-all sm:w-full {{ $maxWidth }} sm:mx-auto"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
>
{{ $slot }}
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More