first commit

This commit is contained in:
yericoramadhani 2026-06-22 12:04:41 +07:00
commit 127916666f
134 changed files with 24795 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
[docker-compose.yml]
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

53
.github/copilot-instructions.md vendored Normal file
View File

@ -0,0 +1,53 @@
# Copilot Instructions for absensi_TA (Laravel Attendance System)
## Project Overview
- This is a Laravel-based web application for attendance management and related admin/employee workflows.
- Main features: user management, attendance tracking, leave (cuti) requests, damaged goods (barang rusak) reporting.
- Follows standard Laravel MVC structure: `app/Models`, `app/Http/Controllers`, `resources/views`, `routes/web.php`.
## Architecture & Data Flow
- **Models**: Eloquent ORM models in `app/Models` (e.g., `Attendance.php`, `User.php`, `BarangRusak.php`).
- **Controllers**: Business logic in `app/Http/Controllers`. Each domain (attendance, user, etc.) has its own controller.
- **Views**: Blade templates in `resources/views/`, organized by feature (e.g., `absensi/`, `admin/`, `barang-rusak/`, `cuti/`).
- **Routes**: Main routing in `routes/web.php`. Console commands in `routes/console.php`.
- **Migrations**: Database schema changes in `database/migrations/`. Multiple migrations for user table extensions (roles, usernames, profile fields).
- **Seeders/Factories**: Test data in `database/seeders/` and `database/factories/`.
## Developer Workflows
- **Local Development**: Use XAMPP for local server (`public/index.php`).
- **Environment**: Configure `.env` for DB and app settings. SQLite is used by default (`database/database.sqlite`).
- **Build Assets**: Use Vite (`vite.config.js`). Run `npm install` then `npm run dev` to build front-end assets.
- **Testing**: PHPUnit config in `phpunit.xml`. Run tests with `vendor/bin/phpunit`.
- **Database Migrations**: Run `php artisan migrate` to apply migrations. Use `php artisan db:seed` for seed data.
- **Debugging**: Use Laravel's built-in error pages and logging (`storage/logs/`).
## Project-Specific Conventions
- **User Table**: Extended with multiple migrations for roles, usernames, and profile fields. Check migration files for schema evolution.
- **Views**: Blade templates are grouped by feature. Layouts in `resources/views/layouts/`.
- **Role Management**: User roles are managed via DB fields and checked in controllers/views.
- **Attendance Logic**: Core attendance logic in `Attendance.php` model and related controllers.
- **Damaged Goods**: Managed via `BarangRusak.php` model and `barang-rusak/` views.
## Integration Points
- **External Packages**: Managed via Composer (`composer.json`).
- **Front-End**: Uses Vite for asset bundling. JS/CSS in `resources/js/` and `resources/css/`.
- **Storage**: Public and private storage in `storage/app/` and `public/storage`.
## Key Files & Directories
- `app/Models/` — Eloquent models
- `app/Http/Controllers/` — Controllers
- `resources/views/` — Blade templates
- `routes/web.php` — Main routes
- `database/migrations/` — DB schema
- `.env` — Environment config
- `vite.config.js` — Front-end build config
- `phpunit.xml` — Test config
## Example Commands
- Migrate DB: `php artisan migrate`
- Seed DB: `php artisan db:seed`
- Run tests: `vendor/bin/phpunit`
- Build assets: `npm run dev`
---
_If any section is unclear or missing important project-specific details, please provide feedback to improve these instructions._

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

9
.htaccess Normal file
View File

@ -0,0 +1,9 @@
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect any URL that still includes /public back to the clean path
RewriteRule ^(.+?)/public/?(.*)$ /$1/$2 [R=301,L]
# Serve the app from the public folder
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

85
DEPLOY_FTP.md Normal file
View File

@ -0,0 +1,85 @@
# Panduan Deploy ke Hosting FTP
## 1) Siapkan file yang wajib di-upload
Upload seluruh isi project, kecuali folder yang biasanya tidak perlu di-upload (atau bisa di-skip jika hosting sudah menyediakannya):
- `app/`
- `bootstrap/`
- `config/`
- `database/`
- `public/`
- `resources/`
- `routes/`
- `storage/` (upload isi folder, termasuk `app`, `framework`, `logs`)
- `vendor/`
- `.env`
- `artisan`
- `composer.json`
- `composer.lock`
- `package.json`
- `vite.config.js`
> Untuk shared hosting, biasanya yang penting adalah semua file aplikasi kecuali `node_modules` dan folder cache yang bisa dibuat ulang.
## 2) Atur folder root hosting
Jika hosting Anda memakai folder publik seperti `public_html`, maka:
- upload semua project ke folder utama project, misalnya `public_html` atau subfolder.
- pastikan file `index.php` dari folder `public/` dipindahkan ke root web atau gunakan aturan pointing domain ke folder `public`.
## 3) Konfigurasi `.env` untuk produksi
Ubah nilai berikut sesuai hosting:
```env
APP_NAME="Absensi TA"
APP_ENV=production
APP_DEBUG=false
APP_URL=https://domain-anda.com
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=nama_database
DB_USERNAME=username_database
DB_PASSWORD=password_database
CACHE_STORE=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
FILESYSTEM_DISK=local
```
## 4) Jalankan perintah setelah upload
Karena Anda deploy lewat FTP, perintah berikut biasanya perlu dijalankan via panel hosting / SSH (kalau tersedia):
```bash
php artisan key:generate
php artisan config:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan migrate --force
php artisan storage:link
```
## 5) Atur izin folder
Pastikan folder berikut writable:
- `storage/`
- `bootstrap/cache/`
Biasanya set permission:
- `storage/` = 775 atau 777 (tergantung hosting)
- `bootstrap/cache/` = 775 atau 777
## 6) Jika domain tidak langsung mengarah ke folder `public`
Buat file `.htaccess` di root hosting dengan isi seperti ini:
```apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
```
## 7) Tips penting
- Jangan upload file `.env.example` ke produksi.
- Setelah upload, pastikan file `public/index.php` benar-benar dipakai sebagai entry point.
- Jika ada error 500, cek log error hosting atau file `storage/logs/`.

61
README.md Normal file
View File

@ -0,0 +1,61 @@
<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 may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
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).

View File

@ -0,0 +1,430 @@
<?php
namespace App\Http\Controllers;
use App\Models\Attendance;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Response;
use Illuminate\Validation\Rule;
class AbsensiController extends Controller
{
/**
* Tampilkan riwayat absensi pengguna saat ini.
*/
public function indexUser(Request $request)
{
$this->finalizeExpiredAttendancesForUser(Auth::id());
$baseQuery = Attendance::where('user_id', Auth::id());
if ($request->filled('start_date')) {
$baseQuery->whereDate('clock_in', '>=', $request->start_date);
}
if ($request->filled('end_date')) {
$baseQuery->whereDate('clock_in', '<=', $request->end_date);
}
if ($request->filled('q')) {
$q = $request->q;
$baseQuery->where(function ($inner) use ($q) {
$inner->where('status', 'like', "%{$q}%")
->orWhere('note', 'like', "%{$q}%");
});
}
$items = (clone $baseQuery)
->orderByDesc('clock_in')
->paginate(10)
->withQueryString();
// Validasi diterima: clock_in & clock_out ada, durasi >= 12 jam
$verifiedCount = (clone $baseQuery)
->whereNotNull('clock_in')
->whereNotNull('clock_out')
->get()
->filter(function ($item) {
return $item->clock_in && $item->clock_out && $item->clock_in->diffInHours($item->clock_out) >= 12;
})
->count();
// Validasi ditolak: clock_in & clock_out ada, durasi < 12 jam
$rejectedCount = (clone $baseQuery)
->whereNotNull('clock_in')
->whereNotNull('clock_out')
->get()
->filter(function ($item) {
return $item->clock_in && $item->clock_out && $item->clock_in->diffInHours($item->clock_out) < 12;
})
->count();
$todayDate = now()->toDateString();
$nowTz = now(config('app.timezone'));
$attendanceEnabled = (bool) (Auth::user()->attendance_enabled ?? true);
$todayAttendance = (clone $baseQuery)
->whereDate('clock_in', $todayDate)
->orderByDesc('clock_in')
->first();
$openAttendance = (clone $baseQuery)
->whereNull('clock_out')
->where(function ($inner) {
$inner->whereNull('status')->orWhere('status', 'hadir');
})
->orderByDesc('clock_in')
->first();
$canClockIn = $todayAttendance === null;
$canMarkSpecial = $canClockIn;
$canClockOut = $openAttendance !== null;
$openClockInTime = $openAttendance?->clock_in?->timezone(config('app.timezone'));
if (! $attendanceEnabled) {
$canClockIn = false;
$canMarkSpecial = false;
$canClockOut = false;
}
return view('absensi.history', compact(
'items',
'verifiedCount',
'rejectedCount',
'todayAttendance',
'openAttendance',
'canClockIn',
'canClockOut',
'canMarkSpecial',
'openClockInTime',
'nowTz',
'attendanceEnabled'
));
}
public function edit(Attendance $attendance)
{
abort_unless($attendance->user_id === Auth::id(), 403);
$statuses = [
'hadir' => 'Hadir',
'izin' => 'Izin',
'sakit' => 'Sakit',
'alpha' => 'Alpha',
];
return view('absensi.edit', [
'attendance' => $attendance,
'statuses' => $statuses,
]);
}
public function update(Request $request, Attendance $attendance)
{
abort_unless($attendance->user_id === Auth::id(), 403);
$validated = $request->validate([
'note' => ['nullable', 'string', 'max:255'],
'action' => ['nullable', 'string', Rule::in(['update_note', 'mark_sick', 'mark_izin'])],
]);
$action = $validated['action'] ?? 'update_note';
if (in_array($action, ['mark_sick', 'mark_izin'], true)) {
$status = $action === 'mark_sick' ? 'sakit' : 'izin';
$attendance->update([
'status' => $status,
'note' => $validated['note'] ?? null,
'clock_out' => null,
]);
return redirect()
->route('user.absensi')
->with('status', 'Data absensi ditandai sebagai ' . strtoupper($status) . '.');
}
$attendance->update([
'note' => $validated['note'] ?? null,
]);
return redirect()
->route('user.absensi')
->with('status', 'Data absensi berhasil diperbarui.');
}
/**
* Export data absensi user ke CSV
*/
public function exportCsv(Request $request)
{
$query = Attendance::where('user_id', Auth::id());
// Filter tanggal mulai
if ($request->filled('start_date')) {
$query->whereDate('clock_in', '>=', $request->start_date);
}
// Filter tanggal akhir
if ($request->filled('end_date')) {
$query->whereDate('clock_in', '<=', $request->end_date);
}
// Pencarian keyword status/catatan
if ($request->filled('q')) {
$q = $request->q;
$query->where(function ($w) use ($q) {
$w->where('status', 'like', "%{$q}%")
->orWhere('note', 'like', "%{$q}%");
});
}
$rows = $query->orderBy('clock_in')->get();
$callback = function () use ($rows) {
$out = fopen('php://output', 'w');
// Header CSV
fputcsv($out, ['Tanggal', 'Masuk', 'Keluar', 'Durasi (menit)', 'Status', 'Catatan']);
foreach ($rows as $r) {
$in = $r->clock_in ? $r->clock_in->timezone(config('app.timezone')) : null;
$outAt = $r->clock_out ? $r->clock_out->timezone(config('app.timezone')) : null;
$minutes = ($in && $outAt) ? $outAt->diffInMinutes($in) : 0;
fputcsv($out, [
$in ? $in->format('Y-m-d') : '-',
$in ? $in->format('H:i') : '-',
$outAt ? $outAt->format('H:i') : '-',
$minutes,
$r->status ?? '-',
$r->note ?? '-',
]);
}
fclose($out);
};
$fname = 'absensi_' . now()->format('Ymd_His') . '.csv';
return Response::streamDownload($callback, $fname, [
'Content-Type' => 'text/csv',
]);
}
/**
* Absen masuk (clock in)
*/
public function clockIn(Request $request)
{
$userId = Auth::id();
if (! (Auth::user()->attendance_enabled ?? true)) {
return back()->withErrors([
'absensi' => 'Absensi untuk akun Anda sedang dinonaktifkan oleh admin.',
]);
}
$this->finalizeExpiredAttendancesForUser($userId);
$unfinishedAttendance = Attendance::where('user_id', $userId)
->whereNull('clock_out')
->where(function ($inner) {
$inner->whereNull('status')->orWhere('status', 'hadir');
})
->orderByDesc('clock_in')
->first();
if ($unfinishedAttendance) {
$openedAt = $unfinishedAttendance->clock_in?->timezone(config('app.timezone'));
$dateLabel = $openedAt ? $openedAt->format('d M Y H:i') : 'sebelumnya';
$nowTz = now(config('app.timezone'));
if ($openedAt && $openedAt->isSameDay($nowTz)) {
return back()->withErrors([
'absensi' => 'Anda masih memiliki absensi yang belum diselesaikan sejak ' . $dateLabel . '. Silakan selesaikan terlebih dahulu.',
]);
}
$autoRejectNote = 'Sistem: Absensi ditolak karena tidak melakukan absen keluar.';
$note = trim($autoRejectNote . ' ' . ($unfinishedAttendance->note ?? ''));
$unfinishedAttendance->update([
'status' => 'alpha',
'note' => $note,
]);
$request->merge([
'note' => trim($autoRejectNote . ' ' . ($request->note ?? '')),
]);
}
$todayDate = now()->toDateString();
$hasTodayAttendance = Attendance::where('user_id', $userId)
->whereDate('clock_in', $todayDate)
->exists();
if ($hasTodayAttendance) {
return back()->withErrors([
'absensi' => 'Anda sudah memiliki data absensi pada tanggal ini.',
]);
}
$validated = $request->validate([
'selfie_photo' => 'required|image|mimes:jpeg,png,jpg|max:2048',
'note' => 'nullable|string|max:255',
'latitude' => 'nullable|numeric|between:-90,90',
'longitude' => 'nullable|numeric|between:-180,180',
'accuracy' => 'nullable|numeric|min:0',
'location_name' => 'nullable|string|max:255',
]);
$path = $request->file('selfie_photo')->store('selfies', 'public');
Attendance::create([
'user_id' => Auth::id(),
'clock_in' => now(),
'status' => 'hadir',
'selfie_photo' => $path, // contoh: selfies/abc.jpg
'clock_in_latitude' => $validated['latitude'] ?? null,
'clock_in_longitude' => $validated['longitude'] ?? null,
'clock_in_accuracy' => $validated['accuracy'] ?? null,
'clock_in_location_name' => $validated['location_name'] ?? null,
'note' => $validated['note'] ?? null,
]);
return back()->with('status', 'Absen masuk berhasil.');
}
/**
* Absen keluar (clock out)
*/
public function clockOut(Request $request)
{
if (! (Auth::user()->attendance_enabled ?? true)) {
return back()->withErrors(['absensi' => 'Absensi untuk akun Anda sedang dinonaktifkan oleh admin.']);
}
$this->finalizeExpiredAttendancesForUser(Auth::id());
$attendance = Attendance::where('user_id', Auth::id())
->whereNull('clock_out')
->orderByDesc('clock_in')
->first();
if (! $attendance) {
return back()->withErrors(['absensi' => 'Belum ada absen masuk hari ini.']);
}
$clockIn = $attendance->clock_in?->timezone(config('app.timezone'));
$now = now(config('app.timezone'));
if ($clockIn && $now->greaterThan($clockIn->copy()->addHours(13))) {
$attendance->update([
'status' => 'alpha',
'note' => trim('Sistem: Absen keluar ditolak karena melebihi batas 13 jam. ' . ($attendance->note ?? '')),
]);
return back()->withErrors(['absensi' => 'Batas 13 jam telah terlampaui, absen keluar tidak dapat diproses.']);
}
// Jika kurang dari 12 jam, status jadi alpha (tidak diterima)
if ($clockIn && $now->diffInHours($clockIn) < 12) {
$attendance->update([
'clock_out' => $now,
'status' => 'alpha',
'note' => trim(($attendance->note ? $attendance->note . ' ' : '') . 'Sistem: Absen keluar sebelum 12 jam, validasi tidak diterima.')
]);
return back()->withErrors(['absensi' => 'Absen keluar tidak diterima karena belum 12 jam kerja. Status: Alpha.']);
}
$attendance->update([
'clock_out' => $now,
'status' => 'hadir',
]);
return back()->with('status', 'Absen keluar berhasil.');
}
public function markSick(Request $request)
{
return $this->createSpecialAttendance($request, 'sakit');
}
public function markIzin(Request $request)
{
return $this->createSpecialAttendance($request, 'izin');
}
protected function createSpecialAttendance(Request $request, string $status)
{
if (! (Auth::user()->attendance_enabled ?? true)) {
return back()->withErrors(['absensi' => 'Absensi untuk akun Anda sedang dinonaktifkan oleh admin.']);
}
$validated = $request->validate([
'note' => ['nullable', 'string', 'max:255'],
]);
$today = now()->toDateString();
$alreadyExists = Attendance::where('user_id', Auth::id())
->whereDate('clock_in', $today)
->exists();
if ($alreadyExists) {
return back()->withErrors(['absensi' => 'Anda sudah memiliki data absensi pada tanggal ini.']);
}
Attendance::create([
'user_id' => Auth::id(),
'clock_in' => now(),
'clock_out' => null,
'status' => $status,
'note' => $validated['note'] ?? null,
]);
return back()->with('status', 'Absensi ' . ucfirst($status) . ' berhasil dicatat.');
}
protected function finalizeExpiredAttendancesForUser(int $userId): void
{
$openAttendances = Attendance::where('user_id', $userId)
->whereNull('clock_out')
->where(function ($inner) {
$inner->whereNull('status')->orWhere('status', 'hadir');
})
->get();
if ($openAttendances->isEmpty()) {
return;
}
$tz = config('app.timezone');
$nowTz = now($tz);
foreach ($openAttendances as $attendance) {
$clockIn = $attendance->clock_in?->timezone($tz);
if (! $clockIn) {
continue;
}
$deadline = $clockIn->copy()->addHours(13);
if ($nowTz->lessThan($deadline)) {
continue;
}
$notePrefix = 'Sistem: Absensi otomatis ditolak karena tidak melakukan absen keluar dalam 13 jam (batas: ' . $deadline->format('d M Y H:i') . ').';
$attendance->update([
'clock_out' => $deadline->copy()->timezone($tz),
'status' => 'alpha',
'note' => trim($notePrefix . ' ' . ($attendance->note ?? '')),
]);
}
}
}

View File

@ -0,0 +1,127 @@
<?php
namespace App\Http\Controllers;
use App\Models\Attendance;
use App\Models\Notification;
use Illuminate\Http\Request;
class AdminAbsensiController extends Controller
{
public function index(Request $request)
{
// Default to today's date if not provided
$dateFilter = $request->input('date') ?? now()->format('Y-m-d');
$items = Attendance::with(['user' => function($query) {
$query->select('id', 'name', 'nik', 'skill');
}])
->whereDate('clock_in', $dateFilter)
->orderByDesc('clock_in')
->orderByDesc('created_at')
->paginate(15)
->withQueryString();
// Get count of people in each jobdesk for the selected date
$jobdeskCounts = Attendance::select('jobdesk', \DB::raw('count(*) as count'))
->whereDate('clock_in', $dateFilter)
->whereNotNull('jobdesk')
->groupBy('jobdesk')
->pluck('count', 'jobdesk');
return view('admin.absensi.index', [
'title' => 'Data Absensi',
'items' => $items,
'jobdeskOptions' => $this->jobdeskOptions(),
'filterDate' => $dateFilter,
'jobdeskCounts' => $jobdeskCounts,
]);
}
public function destroy(Attendance $attendance)
{
$attendance->delete();
return redirect()
->route('admin.absensi.index')
->with('success', 'Data absensi berhasil dihapus.');
}
public function assignJobdesk(Request $request, Attendance $attendance)
{
$options = $this->jobdeskOptions();
$validated = $request->validate([
'jobdesk' => ['nullable', 'in:' . implode(',', $options)],
'admin_note' => ['nullable', 'string', 'max:500'],
]);
$updates = [];
if ($request->has('jobdesk')) {
$updates['jobdesk'] = $validated['jobdesk'] ?? null;
}
if (array_key_exists('admin_note', $validated)) {
$updates['admin_note'] = $validated['admin_note'] !== null
? trim($validated['admin_note'])
: null;
}
if (empty($updates)) {
return back()->with('info', 'Tidak ada perubahan yang disimpan.');
}
$attendance->fill($updates);
$jobdeskChanged = $attendance->isDirty('jobdesk');
$adminNoteChanged = $attendance->isDirty('admin_note');
if (! $jobdeskChanged && ! $adminNoteChanged) {
return back()->with('info', 'Tidak ada perubahan yang disimpan.');
}
$attendance->save();
if ($jobdeskChanged || $adminNoteChanged) {
$messages = [];
if ($jobdeskChanged) {
$messages[] = $attendance->jobdesk
? 'Jobdesk kamu ditetapkan ke ' . strtoupper($attendance->jobdesk) . '.'
: 'Jobdesk kamu dihapus.';
}
if ($adminNoteChanged) {
$messages[] = $attendance->admin_note
? 'Catatan admin: ' . $attendance->admin_note
: 'Catatan admin telah dikosongkan.';
}
$clockIn = $attendance->clock_in
? $attendance->clock_in->timezone(config('app.timezone'))->format('d M Y')
: now()->timezone(config('app.timezone'))->format('d M Y');
Notification::create([
'user_id' => $attendance->user_id,
'title' => 'Perbaruan Absensi ' . $clockIn,
'message' => implode("\n\n", $messages),
'is_read' => false,
]);
}
return back()->with('success', 'Data admin berhasil diperbarui.');
}
protected function jobdeskOptions(): array
{
return [
'km19',
'port',
'km7.5',
'km 33',
'workshop 22',
'werehouse',
];
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace App\Http\Controllers;
use App\Models\BarangRusak;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
class AdminBarangRusakController extends Controller
{
public function index(Request $request)
{
$query = BarangRusak::with('user')
->orderByDesc('tanggal')
->orderByDesc('created_at');
// Search by user name
if ($request->has('q') && !empty($request->q)) {
$search = $request->q;
$query->whereHas('user', function($userQuery) use ($search) {
$userQuery->where('name', 'like', "%{$search}%");
});
}
$items = $query->paginate(15);
return view('admin.barang-rusak.index', [
'title' => 'Laporan Barang Rusak',
'items' => $items,
'q' => $request->q ?? '',
'statusOptions' => $this->statusOptions(),
'editingId' => old('barang_rusak_id'),
]);
}
public function update(Request $request, BarangRusak $barangRusak)
{
$statusOptions = array_keys($this->statusOptions());
$validated = $request->validate([
'status' => ['required', 'string', Rule::in($statusOptions)],
'admin_note' => ['nullable', 'string', 'max:2000'],
'barang_rusak_id' => ['nullable', 'integer'],
]);
$barangRusak->update([
'status' => $validated['status'],
'admin_note' => $validated['admin_note'] ?? null,
]);
return back()->with('success', 'Catatan admin berhasil diperbarui.');
}
public function destroy(BarangRusak $barangRusak)
{
$barangRusak->delete();
return back()->with('success', 'Laporan barang rusak berhasil dihapus.');
}
protected function statusOptions(): array
{
return [
'dilaporkan' => 'Dilaporkan',
'diproses' => 'Diproses',
'selesai' => 'Selesai',
'dibatalkan' => 'Dibatalkan',
];
}
}

View File

@ -0,0 +1,49 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class AdminCutiController extends Controller
{
public function index(Request $request)
{
$q = $request->query('q');
$items = DB::table('cuti')
->leftJoin('users', 'users.id', '=', 'cuti.user_id')
->when($q, function ($query) use ($q) {
$query->where(function ($w) use ($q) {
$w->where('users.name', 'like', "%$q%")
->orWhere('cuti.jenis', 'like', "%$q%")
->orWhere('cuti.alasan', 'like', "%$q%")
->orWhere('cuti.status', 'like', "%$q%");
});
})
->select('cuti.*', 'users.name as user_name', 'users.username')
->orderByDesc('cuti.created_at')
->paginate(15)
->appends($request->query());
return view('admin.cuti.index', [
'title' => 'Persetujuan Cuti',
'items' => $items,
'q' => $q,
]);
}
public function updateStatus(Request $request, int $id)
{
$validated = $request->validate([
'action' => ['required', 'in:setujui,tolak'],
]);
$status = $validated['action'] === 'setujui' ? 'disetujui' : 'ditolak';
DB::table('cuti')->where('id', $id)->update([
'status' => $status,
'updated_at' => now(),
]);
return back()->with('success', "Pengajuan cuti #$id telah $status.");
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers;
use App\Models\Notification;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
class AdminNotificationController extends Controller
{
public function index()
{
$notifications = Notification::with('user')->latest()->get();
[$absensiNotifications, $adminNotifications] = $notifications->partition(function ($notif) {
$title = Str::lower($notif->title ?? '');
$message = Str::lower($notif->message ?? '');
$absensiKeywords = ['absensi', 'clock in', 'clock out', 'jobdesk', 'job desk', 'catatan'];
$shouldBeAbsensi = Str::contains($title, $absensiKeywords) || Str::contains($message, $absensiKeywords);
if ($shouldBeAbsensi && $notif->type !== 'absensi') {
$notif->type = 'absensi';
$notif->save();
}
if (!empty($notif->type)) {
return $notif->type === 'absensi';
}
return $shouldBeAbsensi;
});
return view('admin.notifications.index', [
'absensiNotifications' => $absensiNotifications->values(),
'adminNotifications' => $adminNotifications->values(),
]);
}
public function create()
{
$users = User::all();
return view('admin.notifications.create', compact('users'));
}
public function store(Request $request)
{
$validated = $request->validate([
'user_id' => 'required',
'title' => 'required|string|max:255',
'message' => 'required|string',
'image' => 'nullable|image|max:2048',
]);
$imagePath = null;
if ($request->hasFile('image')) {
$imagePath = $request->file('image')->store('notifications', 'public');
}
$title = Str::lower($validated['title']);
$message = Str::lower($validated['message']);
$absensiKeywords = ['absensi', 'clock in', 'clock out', 'jobdesk', 'job desk', 'catatan'];
$type = Str::contains($title, $absensiKeywords) || Str::contains($message, $absensiKeywords)
? 'absensi'
: 'admin';
if ($validated['user_id'] === 'all') {
$users = User::all();
foreach ($users as $user) {
Notification::create([
'user_id' => $user->id,
'title' => $validated['title'],
'message' => $validated['message'],
'type' => $type,
'is_read' => false,
'image' => $imagePath,
]);
}
} else {
Notification::create([
'user_id' => $validated['user_id'],
'title' => $validated['title'],
'message' => $validated['message'],
'type' => $type,
'is_read' => false,
'image' => $imagePath,
]);
}
return redirect()->route('admin.notifications.index')->with('success', 'Pemberitahuan berhasil dikirim.');
}
}

View File

@ -0,0 +1,138 @@
<?php
namespace App\Http\Controllers;
use App\Models\Attendance;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Storage;
class AdminUserController extends Controller
{
public function index(Request $request)
{
$search = $request->input('search');
$skill = $request->input('skill');
$users = User::where('role', '!=', 'admin')
->when($search, function($query) use ($search) {
return $query->where('name', 'like', "%{$search}%")
->orWhere('email', 'like', "%{$search}%")
->orWhere('nik', 'like', "%{$search}%");
})
->when($skill, function($query) use ($skill) {
return $query->where('skill', $skill);
})
->orderBy('nik')
->orderBy('name')
->paginate(15) // 15 users per page
->withQueryString(); // Preserve search parameters in pagination links
return view('admin.users.index', [
'title' => 'Daftar Pengguna',
'users' => $users,
'search' => $search,
'skill' => $skill
]);
}
public function show(User $user)
{
$attendanceQuery = $user->attendances();
$totalAbsensi = (clone $attendanceQuery)->count();
$verifiedCount = (clone $attendanceQuery)
->whereNotNull('clock_in')
->whereNotNull('clock_out')
->count();
$excusedCount = (clone $attendanceQuery)
->whereIn('status', ['sakit', 'izin'])
->count();
$invalidCount = max($totalAbsensi - ($verifiedCount + $excusedCount), 0);
$recentAttendances = $user->attendances()
->orderByDesc('clock_in')
->orderByDesc('created_at')
->take(10)
->get();
return view('admin.users.show', [
'title' => 'Profil Pegawai',
'user' => $user,
'attendanceSummary' => [
'total' => $totalAbsensi,
'verified' => $verifiedCount,
'excused' => $excusedCount,
'invalid' => $invalidCount,
],
'attendanceRecords' => $recentAttendances,
]);
}
public function toggleAttendance(Request $request, User $user)
{
$validated = $request->validate([
'attendance_enabled' => ['required', 'boolean'],
]);
$user->update([
'attendance_enabled' => (bool) $validated['attendance_enabled'],
]);
Cache::forget('sidebar_users_summary');
return back()->with('status', 'Pengaturan absensi untuk ' . $user->name . ' telah diperbarui.');
}
public function toggleApproval(Request $request, User $user)
{
$validated = $request->validate([
'is_approved' => ['required', 'boolean'],
]);
$user->update([
'is_approved' => (bool) $validated['is_approved'],
]);
Cache::forget('sidebar_users_summary');
return back()->with('status', 'Status persetujuan untuk ' . $user->name . ' telah diperbarui.');
}
public function destroy(User $user)
{
// Prevent deleting yourself
if ($user->id === auth()->id()) {
return redirect()->route('admin.users.index')
->with('error', 'Tidak dapat menghapus akun sendiri');
}
// Delete user's avatar if exists
if ($user->avatar_path && Storage::exists($user->avatar_path)) {
Storage::delete($user->avatar_path);
}
$user->delete();
Cache::forget('sidebar_users_summary');
return redirect()->route('admin.users.index')
->with('status', 'Pengguna berhasil dihapus');
}
public function enableAllAttendance()
{
User::query()->update(['attendance_enabled' => true]);
Cache::forget('sidebar_users_summary');
return back()->with('status', 'Absensi telah diaktifkan untuk semua pengguna.');
}
public function disableAllAttendance()
{
User::query()->update(['attendance_enabled' => false]);
Cache::forget('sidebar_users_summary');
return back()->with('status', 'Absensi telah dinonaktifkan untuk semua pengguna.');
}
}

View File

@ -0,0 +1,105 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Schema;
class AuthController extends Controller
{
public function showLogin()
{
return view('auth.login');
}
public function login(Request $request)
{
$remember = (bool) $request->boolean('remember');
$approvalRequired = Schema::hasTable('users') && Schema::hasColumn('users', 'is_approved');
// Jika login pakai username
if ($request->filled('username')) {
$credentials = $request->validate([
'username' => ['required', 'string'],
'password' => ['required'],
]);
$user = User::where('username', $credentials['username'])
->orWhere('email', $credentials['username'])
->first();
if ($user && $user->role !== 'admin' && ! $user->email_verified_at) {
return redirect()->route('verification.form', ['email' => $user->email]);
}
if ($user && Schema::hasColumn('users', 'is_approved') && ! $user->is_approved) {
return back()->withErrors([
'username' => 'Akun Anda belum disetujui oleh admin.',
])->onlyInput('username');
}
if (
Auth::attempt($credentials, $remember) ||
Auth::attempt(['email' => $credentials['username'], 'password' => $credentials['password']], $remember)
) {
$request->session()->regenerate();
// ✅ cek role setelah login
if (Auth::user()->role === 'admin') {
return redirect()->intended(route('admin.absensi.index')); // halaman admin
} else {
return redirect()->intended(route('user.absensi')); // halaman user
}
}
return back()->withErrors([
'username' => 'Username atau password salah.',
])->onlyInput('username');
}
// Default: login pakai email
$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);
$user = User::where('email', $credentials['email'])->first();
if ($user && $user->role !== 'admin' && ! $user->email_verified_at) {
return redirect()->route('verification.form', ['email' => $user->email]);
}
if ($user && Schema::hasColumn('users', 'is_approved') && ! $user->is_approved) {
return back()->withErrors([
'email' => 'Akun Anda belum disetujui oleh admin.',
])->onlyInput('email');
}
if (Auth::attempt($credentials, $remember)) {
$request->session()->regenerate();
// ✅ cek role setelah login
if (Auth::user()->role === 'admin') {
return redirect()->intended(route('admin.absensi.index'));
} else {
return redirect()->intended(route('user.absensi'));
}
}
return back()->withErrors([
'email' => 'Email atau password salah.',
])->onlyInput('email');
}
public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('login');
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Controllers;
use App\Models\BarangRusak;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class BarangRusakController extends Controller
{
public function index()
{
// Placeholder page for Barang Rusak list
return view('barang-rusak.index', [
'title' => 'Barang Rusak',
]);
}
}

View File

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

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\DB;
class EmailVerificationController extends Controller
{
public function showForm(Request $request)
{
$email = $request->query('email');
return view('auth.verify-otp', compact('email'));
}
public function verify(Request $request)
{
$request->validate([
'email' => ['required', 'email'],
'otp' => ['required', 'digits:6'],
]);
$user = User::where('email', $request->email)
->where('email_verification_code', $request->otp)
->first();
if (!$user) {
return back()->withErrors(['otp' => 'Kode OTP salah atau sudah digunakan.'])->withInput();
}
$user->email_verified_at = now();
$user->email_verification_code = null;
$user->save();
return redirect()->route('login')->with('status', 'Email berhasil diverifikasi. Silakan login.');
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace App\Http\Controllers;
use App\Models\Notification;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
class NotificationController extends Controller
{
public function index()
{
$user = Auth::user();
$notifications = $user->notifications()->latest()->get();
[$absensiNotifications, $adminNotifications] = $notifications->partition(function ($notif) {
$title = Str::lower($notif->title ?? '');
$message = Str::lower($notif->message ?? '');
$absensiKeywords = ['absensi', 'clock in', 'clock out', 'jobdesk', 'job desk', 'catatan'];
$shouldBeAbsensi = Str::contains($title, $absensiKeywords) || Str::contains($message, $absensiKeywords);
if ($shouldBeAbsensi && $notif->type !== 'absensi') {
$notif->type = 'absensi';
$notif->save();
}
if (!empty($notif->type)) {
return $notif->type === 'absensi';
}
return $shouldBeAbsensi;
});
return view('notifications.index', [
'absensiNotifications' => $absensiNotifications->values(),
'adminNotifications' => $adminNotifications->values(),
]);
}
public function markAsRead($id)
{
$notification = Notification::where('user_id', Auth::id())->findOrFail($id);
$notification->is_read = true;
$notification->save();
return back();
}
}

View File

@ -0,0 +1,156 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\Rules\Password as PasswordRule;
class PasswordResetController extends Controller
{
public function requestForm()
{
return view('auth.forgot-password');
}
public function email(Request $request)
{
$request->validate(['email' => ['required', 'email']]);
$user = \App\Models\User::where('email', $request->email)->first();
if (! $user) {
return back()->with('status', 'Jika email terdaftar, kode OTP telah dikirim. Silakan cek inbox (atau folder spam).');
}
$otp = random_int(100000, 999999);
$user->email_verification_code = $otp;
$user->save();
try {
\Mail::mailer('smtp')->to($user->email)->send((new \App\Mail\EmailVerificationCode($otp, 'password_reset'))
->from('e31221353@student.polije.ac.id', 'Absensi PT. Triatra'));
} catch (\Exception $e) {
\Log::error('Gagal mengirim email OTP reset password: ' . $e->getMessage());
}
return redirect()->route('password.otp.verify.form', ['email' => $user->email])
->with('status', 'Kode OTP dikirim ke email Anda. Masukkan kode untuk melanjutkan reset password.');
}
public function otpVerifyForm(Request $request)
{
$email = $request->query('email');
return view('auth.verify-otp', [
'email' => $email,
'formAction' => route('password.otp.verify'),
'title' => 'Verifikasi OTP Lupa Password',
'info' => 'Masukkan kode OTP yang dikirim ke email untuk melakukan reset password.',
]);
}
public function otpVerify(Request $request)
{
$request->validate([
'email' => ['required', 'email'],
'otp' => ['required', 'digits:6'],
]);
$user = \App\Models\User::where('email', $request->email)
->where('email_verification_code', $request->otp)
->first();
if (! $user) {
return back()->withErrors(['otp' => 'Kode OTP salah atau tidak valid.'])->withInput();
}
$user->email_verification_code = null;
$user->save();
$request->session()->put('password_reset_email', $user->email);
return redirect()->route('password.reset')->with('status', 'OTP berhasil diverifikasi. Silakan masukkan password baru.');
}
public function resetForm(Request $request)
{
$email = $request->session()->get('password_reset_email');
if (! $email) {
return redirect()->route('password.request')->withErrors(['email' => 'Proses reset password tidak valid. Silakan mulai dari awal.']);
}
return view('auth.reset-password', [
'email' => $email,
'token' => null,
]);
}
public function resetFormWithToken(string $token)
{
return view('auth.reset-password', ['token' => $token]);
}
public function update(Request $request)
{
$passwordResetEmail = $request->session()->get('password_reset_email');
if ($passwordResetEmail) {
$request->validate([
'email' => ['required', 'email'],
'password' => ['required', 'confirmed', PasswordRule::min(8)],
]);
if ($request->email !== $passwordResetEmail) {
return back()->withErrors(['email' => 'Email tidak sesuai dengan session verifikasi.']);
}
$user = \App\Models\User::where('email', $passwordResetEmail)->first();
if (! $user) {
return redirect()->route('password.request')->withErrors(['email' => 'Akun tidak ditemukan.']);
}
$user->password = $request->password;
$user->remember_token = Str::random(60);
$user->save();
$request->session()->forget('password_reset_email');
return redirect()->route('login')->with('status', 'Password berhasil direset. Silakan login dengan password baru.');
}
$request->validate([
'token' => ['required'],
'email' => ['required', 'email'],
'password' => ['required', 'confirmed', PasswordRule::min(8)],
]);
$status = Password::reset(
$request->only('email', 'password', 'password_confirmation', 'token'),
function ($user) use ($request) {
$user->forceFill([
'password' => $request->password, // auto hashed by cast
'remember_token' => Str::random(60),
])->save();
event(new PasswordReset($user));
}
);
if ($status === Password::PASSWORD_RESET) {
// Optionally auto-login after reset
if (Auth::attempt($request->only('email', 'password'))) {
$request->session()->regenerate();
return redirect()->route('dashboard');
}
return redirect()->route('login')->with('status', __($status));
}
return back()->withErrors(['email' => __($status)]);
}
}

View File

@ -0,0 +1,125 @@
<?php
namespace App\Http\Controllers;
use App\Models\Notification;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Schema;
use Illuminate\Validation\Rules\Password as PasswordRule;
class RegisterController extends Controller
{
public function show()
{
return view('auth.register');
}
public function store(Request $request)
{
// Build validation rules dynamically depending on schema
$rules = [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255'],
'password' => ['required', 'confirmed', PasswordRule::min(8)],
];
if (Schema::hasTable('users') && Schema::hasColumn('users', 'nik')) {
$rules['nik'] = ['required', 'string', 'max:32', 'regex:/^[a-zA-Z0-9]+$/'];
}
if (Schema::hasTable('users') && Schema::hasColumn('users', 'username')) {
$rules['username'] = ['nullable', 'string', 'max:255'];
}
if (Schema::hasTable('users') && Schema::hasColumn('users', 'skill')) {
$rules['skill'] = ['required', 'string', 'in:mechanic,welder'];
}
$validated = $request->validate($rules);
// Hapus akun lama yang belum verified (email_verified_at = null) dengan credential yang sama
User::where('email_verified_at', null)
->where(function ($q) use ($validated) {
$q->where('email', $validated['email']);
if (Schema::hasColumn('users', 'nik') && isset($validated['nik'])) {
$q->orWhere('nik', $validated['nik']);
}
if (Schema::hasColumn('users', 'username') && isset($validated['username']) && $validated['username']) {
$q->orWhere('username', $validated['username']);
}
})
->delete();
// Check apakah email/nik/username sudah ada dan VERIFIED
if (User::where('email', $validated['email'])->where('email_verified_at', '!=', null)->exists()) {
return back()->withErrors(['email' => 'Email sudah terdaftar dan terverifikasi.'])->withInput();
}
if (Schema::hasColumn('users', 'nik') && isset($validated['nik'])) {
if (User::where('nik', $validated['nik'])->where('email_verified_at', '!=', null)->exists()) {
return back()->withErrors(['nik' => 'NIK sudah terdaftar.'])->withInput();
}
}
if (Schema::hasColumn('users', 'username') && isset($validated['username']) && $validated['username']) {
if (User::where('username', $validated['username'])->where('email_verified_at', '!=', null)->exists()) {
return back()->withErrors(['username' => 'Username sudah terdaftar.'])->withInput();
}
}
// Generate kode OTP 6 digit
$otp = random_int(100000, 999999);
$attrs = [
'name' => $validated['name'],
'email' => $validated['email'],
'password' => $validated['password'], // auto hashed via cast in User model
'role' => 'pegawai',
'email_verification_code' => $otp,
];
if (Schema::hasColumn('users', 'nik')) {
$attrs['nik'] = $validated['nik'];
}
if (Schema::hasColumn('users', 'is_approved')) {
$attrs['is_approved'] = false;
}
if (Schema::hasTable('users') && Schema::hasColumn('users', 'username')) {
$attrs['username'] = $validated['username'] ?? null;
}
if (Schema::hasColumn('users', 'skill')) {
$attrs['skill'] = $validated['skill'];
}
$user = User::create($attrs);
// Kirim email OTP ke user dari email institusi
try {
\Mail::mailer('smtp')->to($user->email)
->send((new \App\Mail\EmailVerificationCode($otp))
->from('e31221353@student.polije.ac.id', 'Absensi PT. Triatra'));
} catch (\Exception $e) {
\Log::error('Gagal mengirim email verifikasi: ' . $e->getMessage());
}
if (Schema::hasTable('notifications')) {
$adminRecipients = User::query()
->whereIn('role', ['admin', 'atasan'])
->get(['id', 'name']);
foreach ($adminRecipients as $admin) {
Notification::create([
'user_id' => $admin->id,
'title' => 'Pengguna baru menunggu persetujuan',
'message' => 'Akun ' . $user->name . ' membutuhkan persetujuan sebelum dapat login.',
'type' => 'user_approval',
'is_read' => false,
]);
}
}
// Redirect ke halaman verifikasi OTP, bawa email sebagai parameter
return redirect()->route('verification.form', ['email' => $user->email]);
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Storage;
class SelfieController extends Controller
{
public function show($filename)
{
$safeFilename = basename($filename);
$candidates = array_values(array_unique([
$filename,
$safeFilename,
'selfies/' . $safeFilename,
ltrim($filename, '/'),
ltrim($safeFilename, '/'),
]));
foreach ($candidates as $candidate) {
if (Storage::disk('public')->exists($candidate)) {
$path = Storage::disk('public')->path($candidate);
return response()->file($path, [
'Content-Type' => mime_content_type($path),
'Cache-Control' => 'max-age=86400, public',
]);
}
}
abort(404, 'Selfie file not found.');
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class VerificationController extends Controller
{
public function showForm(Request $request)
{
if (!$request->session()->has('pending_user_id')) {
return redirect()->route('login')->with('error', 'Silakan daftar atau login terlebih dahulu.');
}
return view('auth.verify');
}
public function verify(Request $request)
{
$request->validate([
'code' => ['required', 'digits:6'],
]);
$userId = $request->session()->get('pending_user_id');
$user = User::find($userId);
if (!$user) {
return redirect()->route('login')->with('error', 'User tidak ditemukan.');
}
if ($user->email_verification_code !== $request->code) {
return back()->withErrors(['code' => 'Kode verifikasi salah.'])->withInput();
}
$user->email_verified_at = now();
$user->email_verification_code = null;
$user->save();
Auth::login($user);
$request->session()->forget('pending_user_id');
$request->session()->regenerate();
return redirect()->route('absensi.history')->with('status', 'Verifikasi email berhasil. Akun Anda sudah aktif.');
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class CheckRole
{
/**
* 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,30 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
class EnsureUserHasRole
{
/**
* Handle an incoming request.
*
* @param \Closure(Request): (Response) $next
*/
public function handle(Request $request, Closure $next, string $roles): Response
{
$user = $request->user();
// Support multiple roles separated by comma or pipe
$allowed = preg_split('/[|,]/', $roles);
$allowed = array_filter(array_map('trim', $allowed));
if (! $user || (count($allowed) > 0 && ! in_array($user->role, $allowed, true))) {
abort(403, 'Anda tidak memiliki akses ke halaman ini.');
}
return $next($request);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
class EmailVerificationCode extends Mailable
{
use Queueable, SerializesModels;
public $code;
public $purpose;
public function __construct($code, $purpose = 'verification')
{
$this->code = $code;
$this->purpose = $purpose;
}
public function build()
{
$subject = $this->purpose === 'password_reset' ? 'Kode OTP Reset Password' : 'Kode Verifikasi Email';
return $this->subject($subject)->view('emails.verification_code');
}
}

61
app/Models/Attendance.php Normal file
View File

@ -0,0 +1,61 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Attendance extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'clock_in',
'clock_out',
'status',
'note',
'selfie_photo',
'clock_in_latitude',
'clock_in_longitude',
'clock_in_accuracy',
'clock_in_location_name',
'jobdesk',
'admin_note',
];
/**
* Cast attributes to proper types.
*/
protected $casts = [
'clock_in' => 'datetime',
'clock_out' => 'datetime',
'clock_in_latitude' => 'float',
'clock_in_longitude' => 'float',
'clock_in_accuracy' => 'float',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function getIsVerifiedAttribute(): bool
{
return ! is_null($this->clock_in) && ! is_null($this->clock_out);
}
public function getVerificationLabelAttribute(): string
{
if (strtolower($this->status ?? '') === 'sakit') {
return 'Sakit';
}
if (strtolower($this->status ?? '') === 'izin') {
return 'Izin';
}
return $this->is_verified ? 'Benar' : 'Tidak Diterima';
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class BarangRusak extends Model
{
use HasFactory;
protected $table = 'barang_rusak';
protected $fillable = [
'user_id',
'tanggal',
'lokasi',
'kerusakan',
'keterangan',
'status',
'admin_note',
];
protected $casts = [
'kerusakan' => 'array',
'tanggal' => 'date',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Models;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Notification extends Model
{
use HasFactory;
protected $fillable = [
'user_id',
'title',
'message',
'type',
'is_read',
'image',
];
public function scopeUnread($query)
{
return $query->where('is_read', false);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}

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

@ -0,0 +1,83 @@
<?php
namespace App\Models;
use App\Models\Notification;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Relations\HasMany;
use App\Models\Attendance;
class User extends Authenticatable
{
use HasFactory, Notifiable;
public function notifications(): HasMany
{
return $this->hasMany(Notification::class);
}
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'username',
'nik',
'email',
'password',
'role',
'skill',
'attendance_enabled',
'is_approved',
'email_verification_code',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'attendance_enabled' => 'boolean',
'is_approved' => 'boolean',
];
}
public function attendances()
{
return $this->hasMany(Attendance::class);
}
/**
* Get the skill label
*
* @return string
*/
public function getSkillLabelAttribute()
{
return match($this->skill) {
'mechanic' => 'Mekanik',
'welder' => 'Welder',
default => 'Belum diatur',
};
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
if (config('app.env') === 'production') {
URL::forceScheme('https');
}
}
}

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;
use App\Http\Middleware\EnsureUserHasRole;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
// Register route middleware aliases
$middleware->alias([
'role' => EnsureUserHasRole::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,
];

75
composer.json Normal file
View File

@ -0,0 +1,75 @@
{
"$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": {
"fakerphp/faker": "^1.23",
"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": {
"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"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite --kill-others"
],
"test": [
"@php artisan config:clear --ansi",
"@php artisan test"
]
},
"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
}

8474
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' => env('APP_TIMEZONE', 'Asia/Jakarta'),
/*
|--------------------------------------------------------------------------
| 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),
];

108
config/cache.php Normal file
View File

@ -0,0 +1,108 @@
<?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", "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',
],
],
/*
|--------------------------------------------------------------------------
| 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([
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([
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' => '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' => env('APP_URL').'/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'),
],
];

112
config/queue.php Normal file
View File

@ -0,0 +1,112 @@
<?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", "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,
],
],
/*
|--------------------------------------------------------------------------
| 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',
],
];

38
config/services.php Normal file
View File

@ -0,0 +1,38 @@
<?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' => [
'token' => env('POSTMARK_TOKEN'),
],
'resend' => [
'key' => env('RESEND_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'),
],
],
];

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(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 and all 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');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* 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,31 @@
<?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
{
if (Schema::hasTable('password_reset_tokens')) {
return;
}
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');
}
};

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 {
public function up(): void
{
if (Schema::hasTable('users') && !Schema::hasColumn('users', 'role')) {
Schema::table('users', function (Blueprint $table) {
$table->string('role')->default('pegawai')->after('password');
});
}
}
public function down(): void
{
if (Schema::hasTable('users') && Schema::hasColumn('users', 'role')) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('role');
});
}
}
};

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 {
public function up(): void
{
Schema::create('attendances', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->timestamp('clock_in')->nullable();
$table->timestamp('clock_out')->nullable();
$table->string('status')->default('hadir'); // hadir, izin, sakit, alpha (opsional)
$table->text('note')->nullable();
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('attendances');
}
};

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 {
public function up(): void
{
// Prevent duplicate creation: if the users table already exists (it is
// created by the core 0001_01_01_000000_create_users_table.php), do not
// recreate it. Instead, only add any missing columns expected by this
// project (username, role) if they don't already exist.
if (!Schema::hasTable('users')) {
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('username')->nullable()->unique();
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('role')->default('pegawai'); // 'admin' or 'pegawai'
$table->rememberToken();
$table->timestamps();
});
} else {
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'username')) {
$table->string('username')->nullable()->unique()->after('name');
}
if (!Schema::hasColumn('users', 'role')) {
$table->string('role')->default('pegawai')->after('password');
}
});
}
}
public function down(): void
{
// Be conservative on down: if this migration created the table, drop it.
// Otherwise, only remove the columns we may have added.
if (Schema::hasTable('users')) {
// If the table existed before this migration, it will also be
// referenced by other migrations, so avoid dropping the table.
if (Schema::hasColumn('users', 'username')) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('username');
});
}
if (Schema::hasColumn('users', 'role')) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('role');
});
}
}
}
};

View File

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
if (!Schema::hasTable('users')) {
return; // users table not present (created in another migration), skip
}
if (!Schema::hasColumn('users', 'username')) {
Schema::table('users', function (Blueprint $table) {
// Add username as nullable and unique to avoid conflicts with existing data
$table->string('username')->nullable()->unique()->after('name');
});
}
}
public function down(): void
{
if (Schema::hasTable('users') && Schema::hasColumn('users', 'username')) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('username');
});
}
}
};

View File

@ -0,0 +1,32 @@
<?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('barang_rusak', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
$table->date('tanggal');
$table->string('lokasi');
$table->json('kerusakan');
$table->text('keterangan')->nullable();
$table->string('status')->default('dilaporkan');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('barang_rusak');
}
};

View File

@ -0,0 +1,28 @@
<?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) {
//
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
if (!Schema::hasTable('cuti')) {
Schema::create('cuti', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
$table->date('tanggal_mulai');
$table->date('tanggal_selesai');
$table->string('jenis');
$table->text('alasan');
$table->string('status')->default('menunggu'); // menunggu, disetujui, ditolak
$table->timestamps();
});
}
}
public function down(): void
{
Schema::dropIfExists('cuti');
}
};

View File

@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'phone')) {
$table->string('phone')->nullable()->after('email');
}
if (!Schema::hasColumn('users', 'address')) {
$table->text('address')->nullable()->after('phone');
}
if (!Schema::hasColumn('users', 'avatar_path')) {
$table->string('avatar_path')->nullable()->after('address');
}
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'avatar_path')) {
$table->dropColumn('avatar_path');
}
if (Schema::hasColumn('users', 'address')) {
$table->dropColumn('address');
}
if (Schema::hasColumn('users', 'phone')) {
$table->dropColumn('phone');
}
});
}
};

View File

@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::create('notifications', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->string('title');
$table->text('message');
$table->string('type')->nullable();
$table->boolean('is_read')->default(false);
$table->string('image')->nullable();
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
public function down(): void
{
Schema::dropIfExists('notifications');
}
};

View File

@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('notifications', function (Blueprint $table) {
$table->string('image')->nullable()->after('is_read');
});
}
public function down(): void
{
Schema::table('notifications', function (Blueprint $table) {
$table->dropColumn('image');
});
}
};

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'email_verification_code')) {
$table->string('email_verification_code', 10)->nullable();
}
if (!Schema::hasColumn('users', 'email_verified_at')) {
$table->timestamp('email_verified_at')->nullable();
}
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['email_verification_code', 'email_verified_at']);
});
}
};

View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'email_verification_code')) {
$table->string('email_verification_code', 10)->nullable()->after('email_verified_at');
}
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('email_verification_code');
});
}
};

View File

@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('attendances', function (Blueprint $table) {
$table->string('selfie_photo')->nullable()->after('status');
});
}
public function down(): void
{
Schema::table('attendances', function (Blueprint $table) {
$table->dropColumn('selfie_photo');
});
}
};

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
{
public function up(): void
{
Schema::table('attendances', function (Blueprint $table) {
$table->decimal('clock_in_latitude', 10, 8)->nullable()->after('selfie_photo');
$table->decimal('clock_in_longitude', 11, 8)->nullable()->after('clock_in_latitude');
$table->decimal('clock_in_accuracy', 8, 2)->nullable()->after('clock_in_longitude');
$table->string('clock_in_location_name')->nullable()->after('clock_in_accuracy');
});
}
public function down(): void
{
Schema::table('attendances', function (Blueprint $table) {
$table->dropColumn([
'clock_in_latitude',
'clock_in_longitude',
'clock_in_accuracy',
'clock_in_location_name',
]);
});
}
};

View File

@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('attendances', function (Blueprint $table) {
$table->string('jobdesk')->nullable()->after('note');
});
}
public function down(): void
{
Schema::table('attendances', function (Blueprint $table) {
$table->dropColumn('jobdesk');
});
}
};

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 {
public function up(): void
{
Schema::table('attendances', function (Blueprint $table) {
if (! Schema::hasColumn('attendances', 'admin_note')) {
$table->text('admin_note')->nullable()->after('note');
}
});
}
public function down(): void
{
Schema::table('attendances', function (Blueprint $table) {
if (Schema::hasColumn('attendances', 'admin_note')) {
$table->dropColumn('admin_note');
}
});
}
};

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (Schema::hasTable('barang_rusak') && ! Schema::hasColumn('barang_rusak', 'admin_note')) {
Schema::table('barang_rusak', function (Blueprint $table) {
$table->text('admin_note')->nullable()->after('keterangan');
});
}
}
public function down(): void
{
if (Schema::hasTable('barang_rusak') && Schema::hasColumn('barang_rusak', 'admin_note')) {
Schema::table('barang_rusak', function (Blueprint $table) {
$table->dropColumn('admin_note');
});
}
}
};

View File

@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (Schema::hasTable('barang_rusak') && ! Schema::hasColumn('barang_rusak', 'admin_note')) {
Schema::table('barang_rusak', function (Blueprint $table) {
$table->text('admin_note')->nullable()->after('keterangan');
});
}
}
public function down(): void
{
if (Schema::hasTable('barang_rusak') && Schema::hasColumn('barang_rusak', 'admin_note')) {
Schema::table('barang_rusak', function (Blueprint $table) {
$table->dropColumn('admin_note');
});
}
}
};

View File

@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('attendance_enabled')->default(true)->after('role');
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('attendance_enabled');
});
}
};

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'nik')) {
$afterColumn = null;
if (Schema::hasColumn('users', 'username')) {
$afterColumn = 'username';
} elseif (Schema::hasColumn('users', 'name')) {
$afterColumn = 'name';
}
$column = $table->string('nik', 64);
if ($afterColumn) {
$column->after($afterColumn);
}
$table->unique('nik');
}
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'nik')) {
$table->dropUnique('users_nik_unique');
$table->dropColumn('nik');
}
});
}
};

View File

@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
if (! Schema::hasColumn('users', 'is_approved')) {
$table->boolean('is_approved')->default(false)->after('attendance_enabled');
}
});
if (Schema::hasColumn('users', 'is_approved')) {
DB::table('users')->update(['is_approved' => true]);
}
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'is_approved')) {
$table->dropColumn('is_approved');
}
});
}
};

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 {
public function up(): void
{
Schema::table('notifications', function (Blueprint $table) {
if (! Schema::hasColumn('notifications', 'type')) {
$table->string('type')->nullable()->after('message');
}
});
}
public function down(): void
{
Schema::table('notifications', function (Blueprint $table) {
if (Schema::hasColumn('notifications', 'type')) {
$table->dropColumn('type');
}
});
}
};

View File

@ -0,0 +1,28 @@
<?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) {
//
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,28 @@
<?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) {
//
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
}
};

View File

@ -0,0 +1,39 @@
<?php
namespace Database\Seeders;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
User::factory()->create([
'name' => 'Admin',
'username' => 'admin',
'email' => 'admin@example.com',
'password' => 'password',
'role' => 'admin',
]);
User::factory()->create([
'name' => 'Pegawai Satu',
'username' => 'pegawai',
'email' => 'pegawai@example.com',
'password' => 'password',
'role' => 'pegawai',
]);
}
}

17
package.json Normal file
View File

@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
"scripts": {
"build": "vite build",
"dev": "vite"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
"axios": "^1.11.0",
"concurrently": "^9.0.1",
"laravel-vite-plugin": "^2.0.0",
"tailwindcss": "^4.0.0",
"vite": "^7.0.4"
}
}

34
phpunit.xml Normal file
View File

@ -0,0 +1,34 @@
<?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="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>

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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

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:

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

@ -0,0 +1,16 @@
@import 'tailwindcss';
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';
@theme {
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
}
/* Atur ukuran icon pagination biar tidak kebesaran */
.page-link svg {
@apply w-4 h-4 inline-block;
}

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

@ -0,0 +1 @@
import './bootstrap';

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,135 @@
@extends('layouts.app')
@section('content')
@php
$clockIn = $attendance->clock_in?->timezone(config('app.timezone'));
$clockOut = $attendance->clock_out?->timezone(config('app.timezone'));
@endphp
<div class="card">
<h2 style="margin-top:0; margin-bottom:16px;">Edit Absensi</h2>
@if ($errors->any())
<div style="background: rgba(239, 68, 68, 0.1); border:1px solid rgba(239, 68, 68, 0.4); color:#fecaca; padding:10px 12px; border-radius:10px; margin-bottom:12px; font-size:13px;">
<ul style="margin:0; padding-left:18px;">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ route('absensi.update', $attendance) }}" method="POST" style="display:flex; flex-direction:column; gap:12px;">
@csrf
@method('PUT')
<div>
<label style="display:block; margin-bottom:6px; font-weight:600;">NIK</label>
<input type="text" value="{{ $attendance->user->nik ?? 'N/A' }}" readonly style="width:100%; padding:10px; border-radius:8px; border:1px solid rgba(148,163,184,0.35); background:#111827; color:#9ca3af; cursor:not-allowed; margin-bottom: 12px;">
</div>
<div>
<label style="display:block; margin-bottom:6px; font-weight:600;">Tanggal</label>
<input type="date" value="{{ $clockIn?->format('Y-m-d') }}" readonly style="width:100%; padding:10px; border-radius:8px; border:1px solid rgba(148,163,184,0.35); background:#111827; color:#9ca3af; cursor:not-allowed;">
</div>
<div style="display:flex; gap:12px;">
<div style="flex:1;">
<label style="display:block; margin-bottom:6px; font-weight:600;">Jam Masuk</label>
<input type="time" value="{{ $clockIn?->format('H:i') }}" readonly style="width:100%; padding:10px; border-radius:8px; border:1px solid rgba(148,163,184,0.35); background:#111827; color:#9ca3af; cursor:not-allowed;">
</div>
<div style="flex:1;">
<label style="display:block; margin-bottom:6px; font-weight:600;">Jam Keluar</label>
<input type="time" value="{{ $clockOut?->format('H:i') }}" readonly style="width:100%; padding:10px; border-radius:8px; border:1px solid rgba(148,163,184,0.35); background:#111827; color:#9ca3af; cursor:not-allowed;">
</div>
</div>
<div>
<label style="display:block; margin-bottom:6px; font-weight:600;">Status</label>
<input type="text" value="{{ Str::upper($attendance->status) }}" readonly style="width:100%; padding:10px; border-radius:8px; border:1px solid rgba(148,163,184,0.35); background:#111827; color:#9ca3af; cursor:not-allowed;">
</div>
@if($attendance->selfie_photo)
<div>
<label style="display:block; margin-bottom:6px; font-weight:600;">Foto Selfie</label>
<div style="max-width: 300px; border-radius: 8px; overflow: hidden; margin-bottom: 12px; border: 1px solid rgba(148,163,184,0.35);">
<img src="{{ route('selfie.show', ['filename' => basename($attendance->selfie_photo)]) }}" alt="Foto Selfie" style="width: 100%; height: auto; display: block;">
</div>
</div>
@endif
@if($attendance->clock_in_latitude && $attendance->clock_in_longitude)
<div>
<label style="display:block; margin-bottom:6px; font-weight:600;">📍 Lokasi Absensi Masuk</label>
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px;">
<div style="padding: 10px; border-radius: 8px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(148,163,184,0.2);">
<span style="display: block; font-weight: 600; color: rgba(148,163,184,0.75); font-size: 11px; letter-spacing: 0.05em; margin-bottom: 4px; text-transform: uppercase;">Latitude</span>
<span style="display: block; color: #e2e8f0; word-break: break-all; font-family: 'Monaco', monospace;">{{ number_format($attendance->clock_in_latitude, 8) }}</span>
</div>
<div style="padding: 10px; border-radius: 8px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(148,163,184,0.2);">
<span style="display: block; font-weight: 600; color: rgba(148,163,184,0.75); font-size: 11px; letter-spacing: 0.05em; margin-bottom: 4px; text-transform: uppercase;">Longitude</span>
<span style="display: block; color: #e2e8f0; word-break: break-all; font-family: 'Monaco', monospace;">{{ number_format($attendance->clock_in_longitude, 8) }}</span>
</div>
<div style="padding: 10px; border-radius: 8px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(148,163,184,0.2);">
<span style="display: block; font-weight: 600; color: rgba(148,163,184,0.75); font-size: 11px; letter-spacing: 0.05em; margin-bottom: 4px; text-transform: uppercase;">Akurasi</span>
<span style="display: block; color: #e2e8f0; word-break: break-all;">{{ $attendance->clock_in_accuracy ? round($attendance->clock_in_accuracy) . ' m' : '-' }}</span>
</div>
<div style="padding: 10px; border-radius: 8px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(148,163,184,0.2);">
<span style="display: block; font-weight: 600; color: rgba(148,163,184,0.75); font-size: 11px; letter-spacing: 0.05em; margin-bottom: 4px; text-transform: uppercase;">Nama Lokasi</span>
<span style="display: block; color: #e2e8f0; word-break: break-all;">{{ $attendance->clock_in_location_name ?? 'Tidak tersedia' }}</span>
</div>
</div>
<div id="edit-location-map" style="width: 100%; height: 350px; border-radius: 12px; overflow: hidden; border: 1px solid rgba(148,163,184,0.25);"></div>
</div>
@endif
<div>
<label for="note" style="display:block; margin-bottom:6px; font-weight:600;">Catatan</label>
<textarea id="note" name="note" rows="3" placeholder="Tuliskan keterangan jika diperlukan" style="width:100%; padding:10px; border-radius:8px; border:1px solid rgba(148,163,184,0.35); background:#0b1220; color:#e2e8f0;">{{ old('note', $attendance->note) }}</textarea>
<small style="display:block; margin-top:6px; color:#94a3b8;">Catatan akan tersimpan untuk semua aksi di bawah.</small>
</div>
<div style="display:flex; flex-direction:column; gap:10px;">
<div style="display:flex; gap:12px; flex-wrap:wrap;">
<button type="submit" name="action" value="update_note" style="flex:1; min-width:150px; background:linear-gradient(135deg,#22c55e,#16a34a); border:none; color:white; padding:10px 16px; border-radius:8px; font-weight:600; cursor:pointer;">Simpan Perubahan</button>
<button type="submit" name="action" value="mark_sick" style="flex:1; min-width:150px; background:linear-gradient(135deg,#ef4444,#dc2626); border:none; color:white; padding:10px 16px; border-radius:8px; font-weight:600; cursor:pointer;">Tandai Sakit</button>
<button type="submit" name="action" value="mark_izin" style="flex:1; min-width:150px; background:linear-gradient(135deg,#3b82f6,#2563eb); border:none; color:white; padding:10px 16px; border-radius:8px; font-weight:600; cursor:pointer;">Tandai Izin</button>
</div>
<a href="{{ route('user.absensi') }}" style="display:inline-flex; align-items:center; justify-content:center; padding:10px 16px; border-radius:8px; border:1px solid rgba(148,163,184,0.35); color:#e2e8f0; text-decoration:none;">Batal</a>
<div style="background:rgba(248,113,113,0.12); border:1px solid rgba(248,113,113,0.32); color:#fecaca; padding:10px 12px; border-radius:8px; font-size:12px;">
Menekan tombol <strong>Tandai Sakit</strong> atau <strong>Tandai Izin</strong> akan mengubah status validasi menjadi <em>Tidak Diterima</em> dengan catatan penyebab, namun tanggal serta jam tetap ditampilkan sebagai referensi.
</div>
</div>
</form>
</div>
@if($attendance->clock_in_latitude && $attendance->clock_in_longitude)
<script>
document.addEventListener('DOMContentLoaded', function() {
const lat = {{ $attendance->clock_in_latitude }};
const lon = {{ $attendance->clock_in_longitude }};
const mapContainer = document.getElementById('edit-location-map');
if (mapContainer && window.L) {
const map = L.map(mapContainer).setView([lat, lon], 16);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors',
maxZoom: 19
}).addTo(map);
L.marker([lat, lon], {
icon: L.icon({
iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-icon.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-shadow.png',
iconSize: [25, 41],
shadowSize: [41, 41],
iconAnchor: [12, 41]
})
}).addTo(map).bindPopup('📍 Lokasi Absensi Masuk<br>Lat: ' + lat.toFixed(6) + '<br>Lon: ' + lon.toFixed(6));
}
});
</script>
@endif
@endsection

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,953 @@
@extends('layouts.app')
@php
use Illuminate\Support\Str;
use Illuminate\Support\Carbon;
@endphp
@push('head')
<style>
.absensi-card {
position: relative;
display: flex;
flex-direction: column;
gap: 32px;
padding: 36px 36px 32px;
border-radius: 28px;
background: linear-gradient(150deg, rgba(12, 18, 36, 0.96), rgba(16, 24, 44, 0.88));
border: 1px solid rgba(148, 163, 184, 0.18);
box-shadow: 0 26px 50px rgba(3, 7, 18, 0.62);
overflow: hidden;
}
.absensi-card::before {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
background:
radial-gradient(circle at 12% 20%, rgba(99, 102, 241, 0.32), transparent 55%),
radial-gradient(circle at 85% -10%, rgba(56, 189, 248, 0.28), transparent 60%);
opacity: 0.9;
}
.absensi-card > * {
position: relative;
z-index: 1;
}
.absensi-hero {
display: flex;
justify-content: space-between;
align-items: flex-start;
flex-wrap: wrap;
gap: 24px;
}
.absensi-hero__headline {
display: flex;
flex-direction: column;
gap: 12px;
max-width: 560px;
}
.absensi-hero__tagline {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 6px 14px;
border-radius: 999px;
background: rgba(99, 102, 241, 0.15);
border: 1px solid rgba(99, 102, 241, 0.32);
color: #c7d2fe;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
font-weight: 600;
}
.absensi-hero h2 {
margin: 0;
font-size: 30px;
font-weight: 700;
letter-spacing: -0.02em;
color: #f8fafc;
}
.absensi-hero p {
margin: 0;
color: rgba(226, 232, 240, 0.75);
font-size: 15px;
line-height: 1.6;
}
.absensi-hero__actions {
display: inline-flex;
flex-wrap: wrap;
gap: 12px;
}
.absensi-hero__button {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 10px 20px;
border-radius: 14px;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(99, 102, 241, 0.4));
border: 1px solid rgba(99, 102, 241, 0.46);
color: #e0f2fe;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
text-decoration: none;
box-shadow: 0 20px 34px rgba(6, 15, 38, 0.48);
transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.absensi-hero__button:hover {
transform: translateY(-2px);
border-color: rgba(129, 140, 248, 0.68);
background: linear-gradient(135deg, rgba(56, 189, 248, 0.32), rgba(99, 102, 241, 0.48));
}
.absensi-overview {
display: grid;
gap: 18px;
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}
.absensi-overview__item {
position: relative;
display: flex;
flex-direction: column;
gap: 8px;
padding: 18px 20px;
border-radius: 20px;
background: linear-gradient(145deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.82));
border: 1px solid rgba(148, 163, 184, 0.2);
box-shadow: 0 18px 36px rgba(3, 7, 18, 0.5);
overflow: hidden;
}
.absensi-overview__item::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
background: radial-gradient(circle at 80% 10%, rgba(59, 130, 246, 0.24), transparent 45%);
opacity: 0.7;
}
.absensi-overview__label {
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.12em;
color: rgba(148, 163, 184, 0.78);
font-weight: 600;
}
.absensi-overview__value {
font-size: 30px;
font-weight: 700;
letter-spacing: -0.02em;
color: #f8fafc;
}
.absensi-overview__meta {
font-size: 12px;
color: rgba(203, 213, 225, 0.7);
}
.absensi-filters {
display: flex;
flex-wrap: wrap;
gap: 16px;
align-items: center;
justify-content: space-between;
}
.absensi-filter-group {
display: flex;
flex-wrap: wrap;
gap: 16px;
align-items: flex-end;
}
.absensi-filter-field {
display: flex;
flex-direction: column;
gap: 8px;
}
.absensi-filter-field label {
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.08em;
font-weight: 600;
color: rgba(148, 163, 184, 0.78);
}
.absensi-filter-field input[type="date"] {
appearance: none;
padding: 10px 14px;
border-radius: 14px;
border: 1px solid rgba(148, 163, 184, 0.28);
background: rgba(15, 23, 42, 0.92);
color: #f1f5f9;
font-size: 13px;
letter-spacing: 0.04em;
min-width: 180px;
}
.absensi-filter-field input[type="date"]:focus {
outline: none;
border-color: rgba(99, 102, 241, 0.62);
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}
.absensi-filter-actions {
display: inline-flex;
gap: 10px;
}
.absensi-filter-actions button,
.absensi-filter-actions a {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 9px 18px;
border-radius: 12px;
border: none;
cursor: pointer;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(99, 102, 241, 0.4));
color: #e0f2fe;
text-decoration: none;
box-shadow: 0 16px 30px rgba(6, 15, 38, 0.42);
transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.absensi-filter-actions button:hover,
.absensi-filter-actions a:hover {
transform: translateY(-1px);
opacity: 0.9;
}
.absensi-filter-actions a.reset {
background: linear-gradient(135deg, rgba(100, 116, 139, 0.4), rgba(71, 85, 105, 0.6));
color: #f8fafc;
}
.absensi-meta {
display: flex;
flex-wrap: wrap;
gap: 12px 18px;
align-items: center;
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(148, 163, 184, 0.72);
}
.absensi-meta__divider {
width: 8px;
height: 8px;
border-radius: 50%;
background: rgba(148, 163, 184, 0.4);
}
.absensi-table-container {
display: flex;
flex-direction: column;
gap: 16px;
}
.absensi-table-shell {
border-radius: 22px;
border: 1px solid rgba(148, 163, 184, 0.22);
background: rgba(9, 16, 34, 0.88);
box-shadow: 0 22px 42px rgba(4, 10, 26, 0.55);
overflow: hidden;
}
.absensi-table-scroll {
width: 100%;
overflow-x: auto;
}
.absensi-table {
width: 100%;
min-width: 1080px;
border-collapse: separate;
border-spacing: 0;
}
.absensi-table thead th {
position: sticky;
top: 0;
background: rgba(15, 23, 42, 0.95);
color: #cbd5f5;
padding: 14px 18px;
font-weight: 600;
font-size: 13px;
letter-spacing: 0.05em;
text-transform: uppercase;
border-bottom: 1px solid rgba(148, 163, 184, 0.24);
white-space: nowrap;
}
.absensi-table tbody td {
padding: 14px 18px;
color: #e2e8f0;
font-size: 13px;
border-bottom: 1px solid rgba(148, 163, 184, 0.1);
vertical-align: top;
}
.absensi-table tbody tr:nth-child(even) {
background: rgba(15, 23, 42, 0.32);
}
.absensi-table tbody tr:hover {
background: rgba(30, 41, 59, 0.52);
}
.absensi-table td[data-align="center"],
.absensi-table th[data-align="center"] {
text-align: center;
}
.absensi-note {
display: block;
padding: 8px 12px;
border-radius: 12px;
background: rgba(59, 130, 246, 0.14);
border: 1px solid rgba(59, 130, 246, 0.28);
color: #dbeafe;
font-size: 12px;
line-height: 1.5;
max-width: 280px;
word-break: break-word;
}
.absensi-note.empty {
background: rgba(148, 163, 184, 0.12);
border-style: dashed;
color: #94a3b8;
}
.absensi-selfie,
.absensi-selfie-empty {
display: inline-flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 6px;
text-decoration: none;
color: inherit;
}
.absensi-selfie-thumb {
width: 72px;
height: 72px;
border-radius: 18px;
background: linear-gradient(160deg, rgba(15, 23, 42, 0.95), rgba(37, 99, 235, 0.64));
border: 1px solid rgba(59, 130, 246, 0.32);
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.absensi-selfie-thumb img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.absensi-selfie-thumb.is-empty {
background: rgba(15, 23, 42, 0.78);
border-style: dashed;
border-color: rgba(148, 163, 184, 0.38);
color: #94a3b8;
font-size: 28px;
font-weight: 500;
}
.absensi-selfie:hover .absensi-selfie-thumb {
transform: translateY(-1px) scale(1.03);
border-color: rgba(125, 211, 252, 0.7);
box-shadow: 0 18px 34px rgba(37, 99, 235, 0.34);
}
.absensi-selfie-label {
font-size: 11px;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #60a5fa;
}
.absensi-selfie-empty {
padding: 6px 16px;
border-radius: 999px;
border: 1px dashed rgba(148, 163, 184, 0.32);
background: rgba(148, 163, 184, 0.14);
font-size: 12px;
letter-spacing: 0.06em;
text-transform: uppercase;
color: #94a3b8;
}
.absensi-status,
.absensi-verify,
.absensi-jobdesk-status {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
padding: 6px 14px;
border-radius: 999px;
font-weight: 600;
font-size: 12px;
letter-spacing: 0.05em;
text-transform: uppercase;
border: 1px solid transparent;
white-space: nowrap;
}
.absensi-status.hadir,
.absensi-verify.ok,
.absensi-jobdesk-status.on {
background: rgba(34, 197, 94, 0.22);
color: #bbf7d0;
border-color: rgba(34, 197, 94, 0.36);
}
.absensi-status.sakit,
.absensi-status.izin,
.absensi-verify.fail,
.absensi-jobdesk-status.off {
background: rgba(248, 113, 113, 0.2);
color: #fecaca;
border-color: rgba(248, 113, 113, 0.34);
}
.absensi-status.default {
background: rgba(148, 163, 184, 0.16);
color: #cbd5f5;
border-color: rgba(148, 163, 184, 0.28);
}
.absensi-admin-note-form {
display: flex;
flex-direction: column;
gap: 12px;
}
.absensi-admin-note-form__row {
display: flex;
gap: 14px;
flex-wrap: wrap;
}
.absensi-admin-note-form select,
.absensi-admin-note-form textarea {
border-radius: 14px;
border: 1px solid rgba(148, 163, 184, 0.28);
background: rgba(15, 23, 42, 0.88);
color: #f1f5f9;
font-size: 13px;
padding: 10px 12px;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.absensi-admin-note-form select {
min-width: 160px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.absensi-admin-note-form textarea {
flex: 1 1 220px;
min-height: 72px;
resize: vertical;
}
.absensi-admin-note-form textarea::placeholder {
color: rgba(148, 163, 184, 0.65);
}
.absensi-admin-note-form select:focus,
.absensi-admin-note-form textarea:focus {
outline: none;
border-color: rgba(99, 102, 241, 0.62);
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}
.absensi-admin-note-form__helper {
font-size: 12px;
color: rgba(148, 163, 184, 0.72);
}
.absensi-admin-note-form button {
align-self: flex-end;
padding: 9px 20px;
border-radius: 12px;
border: none;
background: linear-gradient(135deg, #0ea5e9, #2563eb);
color: #f8fafc;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
cursor: pointer;
box-shadow: 0 16px 30px rgba(14, 165, 233, 0.38);
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.absensi-admin-note-form button:hover {
transform: translateY(-1px);
box-shadow: 0 20px 34px rgba(14, 165, 233, 0.42);
}
.absensi-delete button {
padding: 9px 18px;
border-radius: 12px;
border: none;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
cursor: pointer;
background: linear-gradient(135deg, #ef4444, #f97316);
color: #fff7ed;
box-shadow: 0 18px 36px rgba(249, 115, 22, 0.3);
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.absensi-delete button:hover {
transform: translateY(-1px);
box-shadow: 0 22px 38px rgba(249, 115, 22, 0.36);
}
.absensi-empty {
padding: 28px;
text-align: center;
font-size: 14px;
color: rgba(148, 163, 184, 0.7);
}
.absensi-footer {
display: flex;
flex-wrap: wrap;
gap: 16px;
align-items: center;
justify-content: space-between;
}
.absensi-footer__info {
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(148, 163, 184, 0.72);
}
.absensi-footer nav > * {
display: inline-flex;
align-items: center;
padding: 6px 12px;
border-radius: 10px;
background: rgba(15, 23, 42, 0.8);
color: #cbd5f5;
border: 1px solid rgba(148, 163, 184, 0.18);
box-shadow: 0 12px 24px rgba(7, 16, 36, 0.35);
}
@media (max-width: 1280px) {
.absensi-card {
padding: 32px 28px;
}
.absensi-table {
min-width: 960px;
}
}
@media (max-width: 960px) {
.absensi-card {
padding: 28px 24px;
}
.absensi-hero {
flex-direction: column;
}
.absensi-hero__actions {
width: 100%;
justify-content: flex-start;
}
}
@media (max-width: 768px) {
.absensi-card {
padding: 24px 20px;
}
.absensi-overview {
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.absensi-table {
min-width: 720px;
}
.absensi-admin-note-form__row {
flex-direction: column;
align-items: stretch;
}
.absensi-admin-note-form button {
width: 100%;
}
}
@media (max-width: 600px) {
.absensi-card {
padding: 22px 18px;
border-radius: 22px;
}
.absensi-hero__button {
width: 100%;
justify-content: center;
}
.absensi-overview {
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.absensi-meta {
flex-direction: column;
align-items: flex-start;
}
.absensi-meta__divider {
display: none;
}
/* Admin Location Maps */
.admin-location-map {
width: 100%;
height: 120px;
border-radius: 6px;
border: 1px solid rgba(96, 165, 250, 0.3);
background: rgba(15, 23, 42, 0.92);
overflow: hidden;
}
.admin-location-map .leaflet-container {
height: 100%;
}
}
</style>
@endpush
@section('content')
@php
$currentItems = collect($items->items());
$totalRecords = $items->total();
$selectedDate = $filterDate;
$effectiveStatus = function ($row) use ($selectedDate) {
$status = strtolower($row->status ?? '');
if (in_array($status, ['sakit', 'izin'], true)) {
return $status;
}
if ($selectedDate === '2026-04-18') {
return 'hadir';
}
return $status;
};
$hadirCount = $currentItems->filter(fn ($row) => $effectiveStatus($row) === 'hadir')->count();
$izinSakitCount = $currentItems->filter(fn ($row) => in_array($effectiveStatus($row), ['izin', 'sakit'], true))->count();
$unverifiedCount = $currentItems->filter(fn ($row) => ! $row->is_verified)->count();
$completeAdminData = $currentItems->filter(fn ($row) => filled($row->jobdesk) && filled($row->admin_note))->count();
@endphp
<div class="absensi-card">
<div class="absensi-hero">
<div class="absensi-hero__headline">
<span class="absensi-hero__tagline">Dashboard Admin</span>
<h2>Data Absensi</h2>
<p>Pantau rekaman kehadiran, validasi, serta catatan admin dalam satu tampilan yang rapi dan responsif.</p>
</div>
<div class="absensi-hero__actions">
<a href="{{ route('admin.absensi.index') }}" class="absensi-hero__button">Segarkan Data</a>
</div>
</div>
<div class="absensi-overview">
<div class="absensi-overview__item">
<span class="absensi-overview__label">Total Riwayat</span>
<span class="absensi-overview__value">{{ number_format($totalRecords) }}</span>
<span class="absensi-overview__meta">Seluruh data absensi tersimpan</span>
</div>
<div class="absensi-overview__item">
<span class="absensi-overview__label">Hadir (Halaman Ini)</span>
<span class="absensi-overview__value">{{ $hadirCount }}</span>
<span class="absensi-overview__meta">Pegawai berstatus hadir</span>
</div>
<div class="absensi-overview__item">
<span class="absensi-overview__label">Izin / Sakit</span>
<span class="absensi-overview__value">{{ $izinSakitCount }}</span>
<span class="absensi-overview__meta">Perlu perhatian lanjutan</span>
</div>
<div class="absensi-overview__item">
<span class="absensi-overview__label">Catatan Lengkap</span>
<span class="absensi-overview__value">{{ $completeAdminData }}</span>
<span class="absensi-overview__meta">Jobdesk & catatan terisi</span>
</div>
<div class="absensi-overview__item">
<span class="absensi-overview__label">Belum Tervalidasi</span>
<span class="absensi-overview__value">{{ $unverifiedCount }}</span>
<span class="absensi-overview__meta">Menunggu verifikasi admin</span>
</div>
</div>
<div class="absensi-filters">
<form action="{{ route('admin.absensi.index') }}" method="GET" class="absensi-filter-group">
<div class="absensi-filter-field">
<label for="filter-date">Tanggal</label>
<input type="date" id="filter-date" name="date" value="{{ $filterDate }}">
</div>
<div class="absensi-filter-actions">
<button type="submit">Terapkan</button>
<a href="{{ route('admin.absensi.index') }}" class="reset">Reset</a>
</div>
</form>
<div class="absensi-meta">
<span>Menampilkan {{ $items->firstItem() ?? 0 }}{{ $items->lastItem() ?? 0 }}</span>
<span class="absensi-meta__divider"></span>
<span>Total {{ number_format($totalRecords) }} data</span>
<span class="absensi-meta__divider"></span>
<span>Halaman {{ $items->currentPage() }} dari {{ $items->lastPage() }}</span>
</div>
</div>
<div class="absensi-table-container">
<div class="absensi-table-shell">
<div class="absensi-table-scroll">
<table class="absensi-table">
<thead>
<tr>
<th data-align="center">#</th>
<th>Nama</th>
<th>NIK</th>
<th>Keahlian</th>
<th>Tanggal</th>
<th>Masuk</th>
<th>Keluar</th>
<th>Status</th>
<th>Validasi</th>
<th>Catatan Admin</th>
<th data-align="center">Selfie</th>
<th>Jobdesk & Catatan</th>
<th data-align="center">Aksi</th>
</tr>
</thead>
<tbody>
@forelse ($items as $i => $row)
@php
$clockIn = $row->clock_in?->timezone(config('app.timezone'));
$clockOut = $row->clock_out?->timezone(config('app.timezone'));
$selfiePath = null;
if ($row->selfie_photo) {
$selfiePath = route('selfie.show', ['filename' => basename($row->selfie_photo)]);
}
$status = $effectiveStatus($row);
$statusClass = match ($status) {
'hadir' => 'absensi-status hadir',
'sakit', 'izin' => 'absensi-status sakit',
default => 'absensi-status default',
};
$adminNote = $row->admin_note ? trim($row->admin_note) : null;
$hasJobdesk = filled($row->jobdesk);
$hasAdminNote = filled($adminNote);
$hasBoth = $hasJobdesk && $hasAdminNote;
$isVerified = (bool) $row->is_verified;
$displayDate = $clockIn?->format('d M Y') ?? ($row->clock_in?->format('d M Y') ?? '-');
@endphp
<tr>
<td data-label="#" data-align="center">{{ $items->firstItem() + $i }}</td>
<td data-label="Nama">{{ $row->user->name ?? '-' }}</td>
<td data-label="NIK">{{ $row->user->nik ?? '-' }}</td>
<td data-label="Keahlian">
@if(isset($row->user->skill))
@if($row->user->skill === 'mechanic')
<span style="display: inline-flex; align-items: center; gap: 6px; background: rgba(99, 102, 241, 0.1); color: #818cf8; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; border: 1px solid rgba(99, 102, 241, 0.2);">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"></path>
</svg>
<span>Mekanik</span>
</span>
@elseif($row->user->skill === 'welder')
<span style="display: inline-flex; align-items: center; gap: 6px; background: rgba(16, 185, 129, 0.1); color: #34d399; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; border: 1px solid rgba(16, 185, 129, 0.2);">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path>
</svg>
<span>Welder</span>
</span>
@else
<span style="display: inline-flex; align-items: center; gap: 6px; background: rgba(100, 116, 139, 0.1); color: #94a3b8; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; border: 1px solid rgba(100, 116, 139, 0.2);">
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10"></circle>
<line x1="12" y1="8" x2="12" y2="12"></line>
<line x1="12" y1="16" x2="12.01" y2="16"></line>
</svg>
<span>Belum diatur</span>
</span>
@endif
@else
<span style="display: inline-flex; align-items: center; gap: 6px; background: rgba(100, 116, 139, 0.1); color: #94a3b8; padding: 4px 12px; border-radius: 999px; font-size: 0.85rem; font-weight: 500; border: 1px solid rgba(100, 116, 139, 0.2);">
<span>-</span>
</span>
@endif
</td>
<td data-label="Tanggal">{{ $displayDate }}</td>
<td data-label="Masuk">{{ $clockIn?->format('H:i') ?? '-' }}</td>
<td data-label="Keluar">{{ $clockOut?->format('H:i') ?? '-' }}</td>
<td data-label="Status">
<span class="{{ $statusClass }}">{{ strtoupper($status ?: '-') }}</span>
</td>
<td data-label="Validasi">
@php
// Asumsi $absensi->clock_in dan $absensi->clock_out adalah Carbon instance
$durasiJam = ($row->clock_in && $row->clock_out) ? $row->clock_in->diffInHours($row->clock_out) : 0;
@endphp
@if($durasiJam < 12)
<span style="background:#ef4444;color:#fff;padding:4px 14px;border-radius:8px;font-weight:600;">DITOLAK</span>
@else
<span style="background:#22c55e;color:#fff;padding:4px 14px;border-radius:8px;font-weight:600;">BENAR</span>
@endif
</td>
<td data-label="Catatan Admin">
<span class="absensi-note {{ $adminNote ? '' : 'empty' }}" title="{{ $adminNote ?? 'Tidak ada catatan admin' }}">
{{ $adminNote ?? 'Tidak ada catatan admin' }}
</span>
</td>
<td data-label="Selfie" data-align="center">
@php
$hasLocation = $row->clock_in_latitude && $row->clock_in_longitude;
@endphp
<div style="display: flex; gap: 12px; align-items: flex-start;">
@if ($selfiePath)
<a href="{{ $selfiePath }}" target="_blank" rel="noopener" class="absensi-selfie">
<span class="absensi-selfie-thumb">
<img src="{{ $selfiePath }}" alt="Selfie" onerror="this.remove(); this.parentElement.classList.add('is-empty');">
</span>
<span class="absensi-selfie-label">Lihat</span>
</a>
@else
<span class="absensi-selfie-empty">Tidak Ada Selfie</span>
@endif
@if($hasLocation)
<div style="flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 6px; font-size: 11px;">
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 4px;">
<div style="padding: 6px; border-radius: 6px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(96, 165, 250, 0.3);">
<span style="display: block; font-weight: 600; color: rgba(96, 165, 250, 0.9); font-size: 9px; text-transform: uppercase; margin-bottom: 2px;">Lat</span>
<span style="display: block; color: #dbeafe; word-break: break-all; font-size: 10px;">{{ number_format($row->clock_in_latitude, 5) }}</span>
</div>
<div style="padding: 6px; border-radius: 6px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(96, 165, 250, 0.3);">
<span style="display: block; font-weight: 600; color: rgba(96, 165, 250, 0.9); font-size: 9px; text-transform: uppercase; margin-bottom: 2px;">Lon</span>
<span style="display: block; color: #dbeafe; word-break: break-all; font-size: 10px;">{{ number_format($row->clock_in_longitude, 5) }}</span>
</div>
<div style="padding: 6px; border-radius: 6px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(34, 197, 94, 0.3);">
<span style="display: block; font-weight: 600; color: rgba(34, 197, 94, 0.9); font-size: 9px; text-transform: uppercase; margin-bottom: 2px;">Akurasi</span>
<span style="display: block; color: #bbf7d0; font-size: 10px;">{{ $row->clock_in_accuracy ? round($row->clock_in_accuracy) . 'm' : '-' }}</span>
</div>
<div style="padding: 6px; border-radius: 6px; background: rgba(15, 23, 42, 0.92); border: 1px solid rgba(148, 163, 184, 0.3);">
<span style="display: block; font-weight: 600; color: rgba(148, 163, 184, 0.75); font-size: 9px; text-transform: uppercase; margin-bottom: 2px;">Lokasi</span>
<span style="display: block; color: #cbd5e1; word-break: break-word; font-size: 9px;">{{ $row->clock_in_location_name ?? '-' }}</span>
</div>
</div>
<div class="admin-location-map" id="admin-map-{{ $row->id }}" data-lat="{{ $row->clock_in_latitude }}" data-lon="{{ $row->clock_in_longitude }}" style="width: 100%; height: 120px; border-radius: 6px; border: 1px solid rgba(96, 165, 250, 0.3); background: rgba(15, 23, 42, 0.92); overflow: hidden;"></div>
</div>
@endif
</div>
</td>
<td data-label="Jobdesk & Catatan">
<div style="display:flex; flex-direction:column; gap:12px;">
<div style="display:flex; justify-content:flex-end;">
<span class="absensi-jobdesk-status {{ $hasBoth ? 'on' : 'off' }}">
{{ $hasBoth ? 'Lengkap' : 'Belum Lengkap' }}
</span>
</div>
<form action="{{ route('admin.absensi.jobdesk', $row) }}" method="POST" class="absensi-admin-note-form">
@csrf
<div class="absensi-admin-note-form__row">
<div style="display:flex; flex-direction:column; gap:6px; min-width:0;">
@if ($status === 'hadir')
<select name="jobdesk">
<option value="" disabled @selected(! $row->jobdesk)>Pilih Jobdesk</option>
@foreach ($jobdeskOptions as $option)
@php
$count = $jobdeskCounts[$option] ?? 0;
$countText = $count > 0 ? " ($count orang)" : '';
@endphp
<option value="{{ $option }}" @selected($row->jobdesk === $option)>
{{ Str::upper($option) }}{{ $countText }}
</option>
@endforeach
</select>
@else
<input type="hidden" name="jobdesk" value="{{ $row->jobdesk }}">
<span class="absensi-admin-note-form__helper">Jobdesk tersedia saat status HADIR</span>
@endif
</div>
<textarea name="admin_note" placeholder="Catatan untuk pegawai...">{{ old('admin_note', $adminNote) }}</textarea>
</div>
<button type="submit">Simpan</button>
</form>
</div>
</td>
<td data-label="Aksi" data-align="center">
<form action="{{ route('admin.absensi.destroy', $row) }}" method="POST" onsubmit="return confirm('Hapus data absensi ini?');" class="absensi-delete">
@csrf
@method('DELETE')
<button type="submit">Hapus</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="11" class="absensi-empty">Belum ada data absensi.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
</div>
<div class="absensi-footer">
<span class="absensi-footer__info">Terakhir diperbarui {{ now()->timezone(config('app.timezone'))->format('d M Y H:i') }}</span>
<nav>
{{ $items->links() }}
</nav>
</div>
</div>
<script>
/* Initialize maps in admin table */
function initializeAdminMaps() {
if (typeof L === 'undefined') {
console.log('Leaflet not loaded yet, retrying...');
setTimeout(initializeAdminMaps, 500);
return;
}
const mapElements = document.querySelectorAll('[id^="admin-map-"]');
console.log('Found ' + mapElements.length + ' admin map elements to initialize');
mapElements.forEach(mapEl => {
const lat = parseFloat(mapEl.getAttribute('data-lat'));
const lon = parseFloat(mapEl.getAttribute('data-lon'));
if (isNaN(lat) || isNaN(lon)) {
console.warn('Invalid coordinates for map ' + mapEl.id);
return;
}
console.log('Initializing admin map ' + mapEl.id + ' with coordinates: ' + lat + ', ' + lon);
try {
// Clear any existing map instance
if (mapEl._leaflet_id !== undefined) {
mapEl._leaflet = null;
mapEl.innerHTML = '';
}
const map = L.map(mapEl, {
dragging: false,
scrollWheelZoom: false,
zoomControl: false,
touchZoom: false
}).setView([lat, lon], 14);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OSM',
maxZoom: 19
}).addTo(map);
const redIcon = L.icon({
iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-icon.png',
shadowUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/images/marker-shadow.png',
iconSize: [16, 26],
shadowSize: [26, 26],
iconAnchor: [8, 26]
});
L.marker([lat, lon], { icon: redIcon }).addTo(map);
// Invalidate and resize map
setTimeout(() => map.invalidateSize(), 100);
} catch (e) {
console.error('Error initializing admin map ' + mapEl.id + ':', e);
}
});
}
// Wait for Leaflet to load, then initialize maps
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function() {
setTimeout(initializeAdminMaps, 500);
});
} else {
setTimeout(initializeAdminMaps, 500);
}
</script>
@endsection

View File

@ -0,0 +1,766 @@
@extends('layouts.app')
@push('head')
<style>
.report-card {
position: relative;
display: flex;
flex-direction: column;
gap: 28px;
padding: 34px 36px 32px;
border-radius: 28px;
background: linear-gradient(150deg, rgba(14, 21, 44, 0.96), rgba(10, 15, 32, 0.9));
border: 1px solid rgba(148, 163, 184, 0.2);
box-shadow: 0 28px 60px rgba(3, 7, 18, 0.6);
overflow: hidden;
}
.report-card::before,
.report-card::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
}
.report-card::before {
background:
radial-gradient(circle at 12% 16%, rgba(99, 102, 241, 0.32), transparent 55%),
radial-gradient(circle at 86% -6%, rgba(56, 189, 248, 0.28), transparent 60%);
opacity: 0.9;
}
.report-card::after {
background: linear-gradient(135deg, transparent 40%, rgba(59, 130, 246, 0.14));
opacity: 0.8;
}
.report-card > * { position: relative; z-index: 1; }
.report-hero {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
flex-wrap: wrap;
}
.report-hero__title {
display: flex;
flex-direction: column;
gap: 12px;
max-width: 560px;
}
.report-hero__tagline {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 6px 14px;
border-radius: 999px;
background: rgba(129, 140, 248, 0.18);
border: 1px solid rgba(129, 140, 248, 0.38);
color: #e0e7ff;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
font-weight: 600;
}
.report-hero h2 {
margin: 0;
font-size: 30px;
font-weight: 700;
letter-spacing: -0.02em;
color: #f8fafc;
}
.report-hero p {
margin: 0;
color: rgba(226, 232, 240, 0.76);
font-size: 15px;
line-height: 1.6;
}
.report-hero__actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.report-hero__button {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 10px 20px;
border-radius: 14px;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(99, 102, 241, 0.42));
border: 1px solid rgba(129, 140, 248, 0.52);
color: #e0f2fe;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
text-decoration: none;
box-shadow: 0 22px 32px rgba(6, 15, 38, 0.5);
transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.report-hero__button:hover {
transform: translateY(-2px);
border-color: rgba(165, 180, 252, 0.76);
background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(99, 102, 241, 0.48));
}
.report-search {
display: flex;
align-items: center;
gap: 14px;
padding: 12px 18px;
border-radius: 18px;
border: 1px solid rgba(148, 163, 184, 0.24);
background: rgba(8, 16, 36, 0.82);
box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.12);
}
.report-search svg {
width: 18px;
height: 18px;
color: rgba(148, 163, 184, 0.75);
}
.report-search input {
flex: 1 1 auto;
background: transparent;
border: none;
color: #f1f5f9;
font-size: 13px;
outline: none;
}
.report-search input::placeholder {
color: rgba(148, 163, 184, 0.7);
}
.report-search button {
padding: 8px 18px;
border-radius: 12px;
background: linear-gradient(135deg, #38bdf8, #2563eb);
border: none;
color: #f8fafc;
font-weight: 600;
letter-spacing: 0.04em;
cursor: pointer;
box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.report-search button:hover {
transform: translateY(-1px);
box-shadow: 0 18px 32px rgba(37, 99, 235, 0.32);
}
.report-summary {
display: flex;
flex-direction: column;
gap: 16px;
}
.report-summary__subtitle {
margin: 0;
font-size: 13px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(148, 163, 184, 0.72);
}
.report-summary__grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 16px;
}
.summary-card {
position: relative;
display: flex;
flex-direction: column;
gap: 8px;
padding: 18px 20px;
border-radius: 20px;
background: linear-gradient(145deg, rgba(12, 21, 44, 0.9), rgba(19, 35, 70, 0.82));
border: 1px solid rgba(148, 163, 184, 0.24);
box-shadow: 0 18px 36px rgba(5, 12, 28, 0.5);
overflow: hidden;
}
.summary-card::after {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(circle at 80% 18%, rgba(59, 130, 246, 0.24), transparent 50%);
opacity: 0.7;
pointer-events: none;
}
.summary-card__label {
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: rgba(203, 213, 225, 0.78);
font-weight: 600;
}
.summary-card__value {
font-size: 30px;
font-weight: 700;
color: #f8fafc;
letter-spacing: -0.02em;
}
.summary-card__meta {
font-size: 12px;
color: rgba(226, 232, 240, 0.68);
}
.report-alert {
padding: 12px 14px;
border-radius: 12px;
font-size: 13px;
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 12px;
}
.report-alert__message { margin: 0; }
.report-table-shell {
border-radius: 24px;
border: 1px solid rgba(148, 163, 184, 0.2);
background: rgba(8, 16, 34, 0.84);
box-shadow: 0 24px 44px rgba(4, 10, 26, 0.55);
overflow: hidden;
}
.report-table-scroll {
width: 100%;
overflow-x: auto;
}
.report-table {
width: 100%;
min-width: 980px;
border-collapse: separate;
border-spacing: 0;
}
.report-table thead th {
position: sticky;
top: 0;
background: rgba(10, 19, 40, 0.96);
color: #cbd5f5;
padding: 14px 20px;
font-weight: 600;
font-size: 13px;
letter-spacing: 0.04em;
text-transform: uppercase;
border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}
.report-table tbody td {
padding: 16px 20px;
color: #e2e8f0;
font-size: 13px;
border-bottom: 1px solid rgba(148, 163, 184, 0.1);
vertical-align: top;
}
.report-table tbody tr:nth-child(even) {
background: rgba(10, 23, 55, 0.32);
}
.report-table tbody tr:hover {
background: rgba(17, 29, 62, 0.52);
}
.report-table td[data-align="center"],
.report-table th[data-align="center"] {
text-align: center;
}
.report-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.report-tags {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.report-tag {
padding: 4px 10px;
border-radius: 999px;
background: rgba(59, 130, 246, 0.18);
border: 1px solid rgba(59, 130, 246, 0.3);
color: #bfdbfe;
font-size: 12px;
letter-spacing: 0.02em;
}
.report-status {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px 14px;
border-radius: 999px;
font-weight: 600;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.05em;
border: 1px solid transparent;
white-space: nowrap;
}
.report-status.dilaporkan {
background: rgba(59, 130, 246, 0.22);
color: #bfdbfe;
border-color: rgba(59, 130, 246, 0.38);
}
.report-status.diproses {
background: rgba(245, 158, 11, 0.2);
color: #fcd34d;
border-color: rgba(245, 158, 11, 0.38);
}
.report-status.selesai {
background: rgba(34, 197, 94, 0.2);
color: #bbf7d0;
border-color: rgba(34, 197, 94, 0.36);
}
.report-status.dibatalkan {
background: rgba(248, 113, 113, 0.2);
color: #fecaca;
border-color: rgba(248, 113, 113, 0.36);
}
.report-admin-form {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 14px;
padding: 16px;
border-radius: 16px;
background: rgba(6, 14, 32, 0.78);
border: 1px solid rgba(148, 163, 184, 0.24);
box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.12);
}
.report-admin-form label {
font-size: 12px;
font-weight: 600;
color: #cbd5f5;
letter-spacing: 0.02em;
}
.report-admin-form select,
.report-admin-form textarea {
width: 100%;
border-radius: 14px;
border: 1px solid rgba(148, 163, 184, 0.3);
background: rgba(7, 15, 34, 0.92);
color: #f1f5f9;
padding: 10px 12px;
font-size: 13px;
transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.report-admin-form textarea {
min-height: 90px;
resize: vertical;
line-height: 1.5;
grid-column: 1 / -1;
}
.report-admin-form select:focus,
.report-admin-form textarea:focus {
outline: none;
border-color: rgba(99, 102, 241, 0.62);
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.report-admin-form button {
justify-self: flex-end;
padding: 10px 22px;
border-radius: 12px;
border: none;
background: linear-gradient(135deg, #0ea5e9, #2563eb);
color: #f8fafc;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
cursor: pointer;
box-shadow: 0 18px 32px rgba(14, 165, 233, 0.32);
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.report-admin-form button:hover {
transform: translateY(-1px);
box-shadow: 0 22px 36px rgba(14, 165, 233, 0.36);
}
.report-action {
display: flex;
justify-content: center;
align-items: center;
padding: 16px 20px;
}
.report-action form {
margin: 0;
}
.report-action button {
border-radius: 12px;
border: none;
background: rgba(248, 113, 113, 0.16);
color: #fecaca;
padding: 10px 18px;
font-weight: 700;
cursor: pointer;
transition: background 0.2s ease, transform 0.2s ease;
}
.report-action button:hover {
transform: translateY(-1px);
background: rgba(248, 113, 113, 0.28);
}
.report-empty {
padding: 24px;
text-align: center;
color: rgba(148, 163, 184, 0.72);
font-size: 14px;
}
.report-footer {
display: flex;
flex-wrap: wrap;
gap: 16px;
align-items: center;
justify-content: space-between;
}
.report-footer__info {
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(148, 163, 184, 0.72);
}
.report-footer nav > * {
display: inline-flex;
align-items: center;
padding: 6px 12px;
border-radius: 10px;
background: rgba(15, 23, 42, 0.78);
color: #cbd5f5;
border: 1px solid rgba(148, 163, 184, 0.2);
box-shadow: 0 12px 24px rgba(7, 16, 36, 0.35);
}
@media (max-width: 1280px) {
.report-card {
padding: 30px 28px;
}
.report-table {
min-width: 920px;
}
}
@media (max-width: 960px) {
.report-card {
padding: 28px 24px;
}
.report-hero {
flex-direction: column;
}
.report-hero__actions {
width: 100%;
justify-content: flex-start;
}
}
@media (max-width: 768px) {
.report-card {
padding: 24px 20px;
}
.report-summary__grid {
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.report-table {
min-width: 720px;
}
.report-admin-form button {
width: 100%;
justify-self: stretch;
}
}
@media (max-width: 620px) {
.report-card {
padding: 22px 18px;
border-radius: 22px;
}
.report-hero__button,
.report-search {
width: 100%;
}
.report-summary__grid {
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.report-footer {
flex-direction: column;
align-items: flex-start;
}
}
</style>
@endpush
@section('content')
<div class="report-card">
@php
$totalLaporan = $items->total();
$totalDilaporkan = $items->filter(fn ($row) => $row->status === 'dilaporkan')->count();
$totalDiproses = $items->filter(fn ($row) => $row->status === 'diproses')->count();
$totalSelesai = $items->filter(fn ($row) => $row->status === 'selesai')->count();
@endphp
<div class="report-hero">
<div class="report-hero__title">
<span class="report-hero__tagline">Monitoring Aset</span>
<h2>Laporan Barang Rusak</h2>
<p>Kelola perbaikan peralatan pegawai dengan ringkasan status, catatan terbaru, dan pembaruan cepat.</p>
</div>
<div class="report-hero__actions">
<a href="{{ route('admin.barang_rusak.index') }}" class="report-hero__button">Segarkan Data</a>
</div>
</div>
<div class="search-filter-container">
<form method="GET" action="{{ route('admin.barang_rusak.index') }}" class="search-form">
<div class="search-box">
<svg class="search-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5.25 5.25a7.5 7.5 0 0 0 11.4 10.9Z" />
</svg>
<input
type="text"
name="q"
value="{{ $q ?? '' }}"
placeholder="Cari berdasarkan nama user..."
class="search-input"
>
<button type="submit" class="search-button">
<span>Cari</span>
<svg class="search-arrow" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
</svg>
</button>
</div>
</form>
</div>
<style>
.search-filter-container {
margin-bottom: 2rem;
width: 100%;
}
.search-form {
max-width: 500px;
margin: 0;
}
.search-box {
position: relative;
display: flex;
align-items: center;
background: rgba(30, 41, 59, 0.7);
border-radius: 8px;
border: 1px solid rgba(99, 102, 241, 0.3);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
overflow: hidden;
max-width: 100%;
}
.search-box:focus-within {
border-color: #6366f1;
box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
transform: translateY(-1px);
}
.search-icon {
width: 18px;
height: 18px;
margin-left: 16px;
color: #94a3b8;
flex-shrink: 0;
transition: all 0.2s ease;
}
.search-input:focus + .search-button .search-icon {
color: #6366f1;
}
.search-input {
flex: 1;
background: transparent;
border: none;
padding: 12px 16px 12px 12px;
color: #f1f5f9;
font-size: 14px;
outline: none;
min-width: 0;
transition: all 0.2s ease;
}
.search-input::placeholder {
color: #64748b;
opacity: 0.8;
}
.search-button {
display: flex;
align-items: center;
gap: 6px;
background: rgba(99, 102, 241, 0.9);
color: white;
border: none;
padding: 0 16px;
height: 46px;
font-weight: 500;
font-size: 14px;
cursor: pointer;
transition: all 0.2s ease;
white-space: nowrap;
}
.search-button:hover {
background: rgba(79, 70, 229, 0.95);
}
.search-arrow {
width: 16px;
height: 16px;
transition: transform 0.2s ease;
}
.search-button:hover .search-arrow {
transform: translateX(2px);
}
/* Animation */
@keyframes bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-2px); }
}
.search-input:focus ~ .search-icon {
animation: bounce 0.5s ease;
}
@media (max-width: 768px) {
.search-form {
width: 100%;
}
.search-box {
border-radius: 8px;
}
.search-button span {
display: none;
}
.search-button {
padding: 0 12px;
}
}
</style>
<div class="report-summary">
<p class="report-summary__subtitle">Ringkasan Hari Ini</p>
<div class="report-summary__grid">
<div class="summary-card">
<span class="summary-card__label">Total Laporan</span>
<span class="summary-card__value">{{ number_format($totalLaporan) }}</span>
<span class="summary-card__meta">Keseluruhan permintaan perbaikan</span>
</div>
<div class="summary-card">
<span class="summary-card__label">Belum Diproses</span>
<span class="summary-card__value">{{ number_format($totalDilaporkan) }}</span>
<span class="summary-card__meta">Menunggu tindak lanjut admin</span>
</div>
<div class="summary-card">
<span class="summary-card__label">Sedang Ditangani</span>
<span class="summary-card__value">{{ number_format($totalDiproses) }}</span>
<span class="summary-card__meta">Proses perbaikan berjalan</span>
</div>
<div class="summary-card">
<span class="summary-card__label">Selesai</span>
<span class="summary-card__value">{{ number_format($totalSelesai) }}</span>
<span class="summary-card__meta">Perbaikan telah dirampungkan</span>
</div>
</div>
</div>
@if (session('success'))
<div class="report-alert" style="background: rgba(34,197,94,0.14); border: 1px solid rgba(34,197,94,0.38); color:#bbf7d0;">
<p class="report-alert__message">{{ session('success') }}</p>
</div>
@endif
@if ($errors->any())
<div class="report-alert" style="background: rgba(248,113,113,0.14); border: 1px solid rgba(248,113,113,0.4); color:#fecaca; flex-direction: column; align-items: flex-start;">
<p class="report-alert__message" style="font-weight:600;">Periksa kembali input Anda:</p>
<ul style="margin:0 0 0 18px; padding:0;">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="report-table-shell">
<div class="report-table-scroll">
<table class="report-table">
<thead>
<tr>
<th>Pelapor</th>
<th>Tanggal</th>
<th>Lokasi</th>
<th>Kerusakan</th>
<th>Status</th>
<th>Keterangan</th>
<th>Catatan Admin</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@forelse($items as $row)
<tr>
<td data-label="Pelapor" class="report-text" title="{{ $row->user->name ?? 'N/A' }}">{{ $row->user->name ?? 'N/A' }}</td>
<td data-label="Tanggal">{{ date('d/m/Y', strtotime($row->tanggal)) }}</td>
<td data-label="Lokasi" class="report-text" title="{{ $row->lokasi ?? '-' }}">{{ $row->lokasi ?? '-' }}</td>
<td data-label="Kerusakan">
@if(is_array($row->kerusakan) && count($row->kerusakan) > 0)
<div class="report-tags">
@foreach($row->kerusakan as $k)
<span class="report-tag">{{ $k }}</span>
@endforeach
</div>
@else
<span style="color:#94a3b8;">-</span>
@endif
</td>
<td data-label="Status" data-align="center">
<span class="report-status {{ $row->status }}">{{ ucfirst($row->status) }}</span>
</td>
<td data-label="Keterangan" class="report-text" title="{{ $row->keterangan ?? '-' }}">{{ $row->keterangan ?? '-' }}</td>
<td data-label="Catatan Admin">
<form action="{{ route('admin.barang_rusak.update', $row) }}" method="POST" class="report-admin-form">
@csrf
<input type="hidden" name="barang_rusak_id" value="{{ $row->id }}">
<div>
<label for="status-{{ $row->id }}">Status</label>
<select id="status-{{ $row->id }}" name="status">
@foreach($statusOptions as $value => $label)
<option value="{{ $value }}" @selected(old('status', $row->status) === $value)>{{ $label }}</option>
@endforeach
</select>
</div>
<div>
<label for="note-{{ $row->id }}">Catatan Admin</label>
<textarea id="note-{{ $row->id }}" name="admin_note" placeholder="Tambahkan catatan untuk pelapor...">{{ old('barang_rusak_id') == $row->id ? old('admin_note') : ($row->admin_note ?? '') }}</textarea>
</div>
<button type="submit">Simpan</button>
</form>
</td>
<td data-label="Aksi" class="report-action">
<form action="{{ route('admin.barang_rusak.destroy', $row) }}" method="POST" onsubmit="return confirm('Yakin ingin menghapus laporan barang rusak ini?');">
@csrf
@method('DELETE')
<button type="submit">Hapus</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="8" class="report-empty">Belum ada laporan.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<div class="report-footer">
<span class="report-footer__info">Terakhir diperbarui {{ now()->timezone(config('app.timezone'))->format('d M Y H:i') }}</span>
<nav>
{{ $items->links() }}
</nav>
</div>
</div>
@endsection

View File

@ -0,0 +1,551 @@
@extends('layouts.app')
@push('head')
<style>
.leave-card {
position: relative;
display: flex;
flex-direction: column;
gap: 28px;
padding: 34px 36px 32px;
border-radius: 28px;
background: linear-gradient(150deg, rgba(13, 22, 48, 0.95), rgba(8, 16, 36, 0.9));
border: 1px solid rgba(148, 163, 184, 0.22);
box-shadow: 0 28px 58px rgba(3, 7, 18, 0.6);
overflow: hidden;
}
.leave-card::before,
.leave-card::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
}
.leave-card::before {
background:
radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.28), transparent 55%),
radial-gradient(circle at 88% -8%, rgba(129, 140, 248, 0.32), transparent 60%);
opacity: 0.85;
}
.leave-card::after {
background: linear-gradient(135deg, transparent 40%, rgba(79, 70, 229, 0.18));
opacity: 0.75;
}
.leave-card > * { position: relative; z-index: 1; }
.leave-hero {
display: flex;
justify-content: space-between;
align-items: flex-start;
flex-wrap: wrap;
gap: 24px;
}
.leave-hero__info {
display: flex;
flex-direction: column;
gap: 12px;
max-width: 560px;
}
.leave-hero__tagline {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 6px 14px;
border-radius: 999px;
background: rgba(129, 140, 248, 0.18);
border: 1px solid rgba(129, 140, 248, 0.4);
color: #e0e7ff;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
font-weight: 600;
}
.leave-hero h2 {
margin: 0;
font-size: 30px;
font-weight: 700;
letter-spacing: -0.02em;
color: #f8fafc;
}
.leave-hero p {
margin: 0;
color: rgba(226, 232, 240, 0.75);
font-size: 15px;
line-height: 1.6;
}
.leave-hero__actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.leave-hero__button {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 10px 20px;
border-radius: 14px;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(99, 102, 241, 0.4));
border: 1px solid rgba(129, 140, 248, 0.5);
color: #e0f2fe;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
text-decoration: none;
box-shadow: 0 22px 32px rgba(6, 15, 38, 0.52);
transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.leave-hero__button:hover {
transform: translateY(-2px);
border-color: rgba(165, 180, 252, 0.72);
background: linear-gradient(135deg, rgba(56, 189, 248, 0.34), rgba(99, 102, 241, 0.48));
}
.leave-search {
display: flex;
align-items: center;
gap: 14px;
padding: 12px 18px;
border-radius: 18px;
border: 1px solid rgba(148, 163, 184, 0.24);
background: rgba(7, 16, 36, 0.82);
box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.12);
}
.leave-search svg {
width: 18px;
height: 18px;
color: rgba(148, 163, 184, 0.75);
}
.leave-search input {
flex: 1 1 auto;
background: transparent;
border: none;
color: #f1f5f9;
font-size: 13px;
outline: none;
}
.leave-search input::placeholder {
color: rgba(148, 163, 184, 0.7);
}
.leave-search button {
padding: 8px 18px;
border-radius: 12px;
border: none;
background: linear-gradient(135deg, #38bdf8, #2563eb);
color: #f8fafc;
font-weight: 600;
letter-spacing: 0.04em;
cursor: pointer;
box-shadow: 0 14px 28px rgba(37, 99, 235, 0.28);
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.leave-search button:hover {
transform: translateY(-1px);
box-shadow: 0 18px 32px rgba(37, 99, 235, 0.32);
}
.leave-summary {
display: flex;
flex-direction: column;
gap: 16px;
}
.leave-summary__subtitle {
margin: 0;
font-size: 13px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(148, 163, 184, 0.72);
}
.leave-summary__grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 16px;
}
.leave-summary__card {
position: relative;
display: flex;
flex-direction: column;
gap: 8px;
padding: 18px 20px;
border-radius: 20px;
background: linear-gradient(145deg, rgba(12, 21, 44, 0.92), rgba(22, 36, 70, 0.84));
border: 1px solid rgba(148, 163, 184, 0.24);
box-shadow: 0 18px 36px rgba(5, 12, 28, 0.5);
overflow: hidden;
}
.leave-summary__card::after {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(circle at 80% 18%, rgba(59, 130, 246, 0.24), transparent 52%);
opacity: 0.7;
pointer-events: none;
}
.leave-summary__label {
font-size: 12px;
letter-spacing: 0.12em;
text-transform: uppercase;
color: rgba(203, 213, 225, 0.78);
font-weight: 600;
}
.leave-summary__value {
font-size: 30px;
font-weight: 700;
color: #f8fafc;
letter-spacing: -0.02em;
}
.leave-summary__meta {
font-size: 12px;
color: rgba(226, 232, 240, 0.68);
}
.leave-alert {
padding: 12px 14px;
border-radius: 12px;
font-size: 13px;
display: flex;
gap: 12px;
align-items: flex-start;
}
.leave-alert__message { margin: 0; }
.leave-table-shell {
border-radius: 24px;
border: 1px solid rgba(148, 163, 184, 0.2);
background: rgba(7, 16, 34, 0.84);
box-shadow: 0 24px 44px rgba(4, 10, 26, 0.55);
overflow: hidden;
}
.leave-table-scroll {
width: 100%;
overflow-x: auto;
}
.leave-table {
width: 100%;
min-width: 920px;
border-collapse: separate;
border-spacing: 0;
}
.leave-table thead th {
position: sticky;
top: 0;
background: rgba(10, 19, 40, 0.95);
color: #cbd5f5;
padding: 14px 20px;
font-weight: 600;
font-size: 13px;
letter-spacing: 0.04em;
text-transform: uppercase;
border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}
.leave-table tbody td {
padding: 16px 20px;
color: #e2e8f0;
font-size: 13px;
border-bottom: 1px solid rgba(148, 163, 184, 0.1);
vertical-align: top;
}
.leave-table tbody tr:nth-child(even) {
background: rgba(10, 23, 55, 0.3);
}
.leave-table tbody tr:hover {
background: rgba(17, 30, 60, 0.52);
}
.leave-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.leave-status {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px 14px;
border-radius: 999px;
font-weight: 600;
font-size: 12px;
letter-spacing: 0.05em;
text-transform: uppercase;
border: 1px solid transparent;
white-space: nowrap;
}
.leave-status.wait {
background: rgba(148, 163, 184, 0.18);
color: #cbd5f5;
border-color: rgba(148, 163, 184, 0.3);
}
.leave-status.ok {
background: rgba(34, 197, 94, 0.2);
color: #bbf7d0;
border-color: rgba(34, 197, 94, 0.34);
}
.leave-status.no {
background: rgba(248, 113, 113, 0.2);
color: #fecaca;
border-color: rgba(248, 113, 113, 0.34);
}
.leave-actions {
display: inline-flex;
gap: 10px;
}
.leave-actions form {
margin: 0;
}
.leave-actions button {
padding: 9px 18px;
border-radius: 12px;
border: none;
font-weight: 700;
letter-spacing: 0.05em;
text-transform: uppercase;
cursor: pointer;
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.leave-actions .approve {
background: linear-gradient(135deg, #22c55e, #16a34a);
color: #f7fee7;
box-shadow: 0 14px 26px rgba(34, 197, 94, 0.32);
}
.leave-actions .reject {
background: linear-gradient(135deg, #ef4444, #b91c1c);
color: #fee2e2;
box-shadow: 0 14px 26px rgba(239, 68, 68, 0.3);
}
.leave-actions button:hover {
transform: translateY(-1px);
}
.leave-empty {
padding: 24px;
text-align: center;
color: rgba(148, 163, 184, 0.72);
font-size: 14px;
}
.leave-footer {
display: flex;
flex-wrap: wrap;
gap: 16px;
align-items: center;
justify-content: space-between;
}
.leave-footer__info {
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(148, 163, 184, 0.72);
}
.leave-footer nav > * {
display: inline-flex;
align-items: center;
padding: 6px 12px;
border-radius: 10px;
background: rgba(15, 23, 42, 0.8);
color: #cbd5f5;
border: 1px solid rgba(148, 163, 184, 0.2);
box-shadow: 0 12px 24px rgba(7, 16, 36, 0.35);
}
@media (max-width: 1280px) {
.leave-card {
padding: 30px 28px;
}
.leave-table {
min-width: 860px;
}
}
@media (max-width: 960px) {
.leave-card {
padding: 28px 24px;
}
.leave-hero {
flex-direction: column;
}
.leave-hero__actions {
width: 100%;
justify-content: flex-start;
}
}
@media (max-width: 768px) {
.leave-card {
padding: 24px 20px;
}
.leave-summary__grid {
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.leave-table {
min-width: 720px;
}
.leave-actions {
flex-direction: column;
}
.leave-actions button {
width: 100%;
}
}
@media (max-width: 620px) {
.leave-card {
padding: 22px 18px;
border-radius: 22px;
}
.leave-hero__button,
.leave-search {
width: 100%;
}
.leave-summary__grid {
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.leave-footer {
flex-direction: column;
align-items: flex-start;
}
}
</style>
@endpush
@section('content')
<div class="leave-card">
@php
$totalPengajuan = $items->total();
$totalMenunggu = $items->filter(fn ($row) => strtolower($row->status) === 'menunggu')->count();
$totalDisetujui = $items->filter(fn ($row) => strtolower($row->status) === 'disetujui')->count();
$totalDitolak = $items->filter(fn ($row) => strtolower($row->status) === 'ditolak')->count();
@endphp
<div class="leave-hero">
<div class="leave-hero__info">
<span class="leave-hero__tagline">Manajemen Cuti</span>
<h2>Persetujuan Cuti</h2>
<p>Gunakan panel ini untuk memonitor pengajuan cuti dan memberikan keputusan dengan cepat serta terstruktur.</p>
</div>
<div class="leave-hero__actions">
<a href="{{ route('admin.cuti.index') }}" class="leave-hero__button">Segarkan Data</a>
</div>
</div>
<form method="GET" action="{{ route('admin.cuti.index') }}" class="leave-search">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5.25 5.25a7.5 7.5 0 0 0 11.4 10.9Z" /></svg>
<input type="text" name="q" value="{{ $q ?? '' }}" placeholder="Cari nama, tanggal, jenis, atau status cuti">
<button type="submit">Cari</button>
</form>
<div class="leave-summary">
<p class="leave-summary__subtitle">Ringkasan Pengajuan</p>
<div class="leave-summary__grid">
<div class="leave-summary__card">
<span class="leave-summary__label">Total Pengajuan</span>
<span class="leave-summary__value">{{ number_format($totalPengajuan) }}</span>
<span class="leave-summary__meta">Keseluruhan permintaan masuk</span>
</div>
<div class="leave-summary__card">
<span class="leave-summary__label">Menunggu</span>
<span class="leave-summary__value">{{ number_format($totalMenunggu) }}</span>
<span class="leave-summary__meta">Menanti keputusan admin</span>
</div>
<div class="leave-summary__card">
<span class="leave-summary__label">Disetujui</span>
<span class="leave-summary__value">{{ number_format($totalDisetujui) }}</span>
<span class="leave-summary__meta">Cuti telah dikonfirmasi</span>
</div>
<div class="leave-summary__card">
<span class="leave-summary__label">Ditolak</span>
<span class="leave-summary__value">{{ number_format($totalDitolak) }}</span>
<span class="leave-summary__meta">Permintaan tidak disetujui</span>
</div>
</div>
</div>
@if (session('success'))
<div class="leave-alert" style="background: rgba(34,197,94,0.14); border:1px solid rgba(34,197,94,0.38); color:#bbf7d0;">
<p class="leave-alert__message">{{ session('success') }}</p>
</div>
@endif
@if ($errors->any())
<div class="leave-alert" style="background: rgba(248,113,113,0.14); border:1px solid rgba(248,113,113,0.4); color:#fecaca; flex-direction: column; align-items:flex-start;">
<p class="leave-alert__message" style="font-weight:600;">Periksa kembali input Anda:</p>
<ul style="margin:0 0 0 18px; padding:0;">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="leave-table-shell">
<div class="leave-table-scroll">
<table class="leave-table">
<thead>
<tr>
<th>Pemohon</th>
<th>Tanggal</th>
<th>Durasi</th>
<th>Jenis</th>
<th>Alasan</th>
<th>Status</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
@forelse($items as $row)
<tr>
@php
$mulai = \Carbon\Carbon::parse($row->tanggal_mulai);
$selesai = \Carbon\Carbon::parse($row->tanggal_selesai);
$durasi = $mulai->diffInDays($selesai) + 1;
@endphp
<td data-label="Pemohon" class="leave-text" title="{{ $row->user_name }}">
{{ $row->user_name }}
@if($row->username)
<span style="color:#94a3b8;">(@ {{ $row->username }})</span>
@endif
</td>
<td data-label="Tanggal">{{ $mulai->format('d/m/Y') }} - {{ $selesai->format('d/m/Y') }}</td>
<td data-label="Durasi">{{ $durasi }} hari</td>
<td data-label="Jenis">{{ $row->jenis }}</td>
<td data-label="Alasan" class="leave-text" title="{{ $row->alasan }}">{{ $row->alasan }}</td>
<td data-label="Status">
@php $status = strtolower($row->status); @endphp
@if($status === 'menunggu')
<span class="leave-status wait">Menunggu</span>
@elseif($status === 'disetujui')
<span class="leave-status ok">Disetujui</span>
@else
<span class="leave-status no">Ditolak</span>
@endif
</td>
<td data-label="Aksi">
<div class="leave-actions">
<form method="POST" action="{{ route('admin.cuti.update', $row->id) }}">
@csrf
<input type="hidden" name="action" value="setujui" />
<button type="submit" class="approve">Setujui</button>
</form>
<form method="POST" action="{{ route('admin.cuti.update', $row->id) }}">
@csrf
<input type="hidden" name="action" value="tolak" />
<button type="submit" class="reject">Tolak</button>
</form>
</div>
</td>
</tr>
@empty
<tr>
<td colspan="7" class="leave-empty">Belum ada pengajuan.</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<div class="leave-footer">
<span class="leave-footer__info">Terakhir diperbarui {{ now()->timezone(config('app.timezone'))->format('d M Y H:i') }}</span>
<nav>
{{ $items->links() }}
</nav>
</div>
</div>
@endsection

View File

@ -0,0 +1,542 @@
@extends('layouts.app')
@section('title', 'Dashboard Admin')
@push('styles')
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary: #6366f1;
--primary-hover: #4f46e5;
--secondary: #8b5cf6;
--success: #10b981;
--info: #3b82f6;
--warning: #f59e0b;
--danger: #ef4444;
--light: #f8f9fa;
--dark: #0f172a;
--text-secondary: #64748b;
--bg-light: #f8fafc;
--border-color: #e2e8f0;
}
* {
font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}
body {
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
color: var(--dark);
min-height: 100vh;
}
.container {
padding: 2rem 1rem;
}
.breadcrumb {
background: transparent;
padding: 0;
margin-top: 0.5rem;
}
.breadcrumb-item a {
color: var(--primary);
text-decoration: none;
transition: all 0.3s ease;
font-weight: 500;
}
.breadcrumb-item a:hover {
color: var(--secondary);
}
.breadcrumb-item.active {
color: var(--text-secondary);
}
.user-profile-header {
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
position: relative;
overflow: hidden;
border-radius: 20px;
}
.user-profile-header::before {
content: '';
position: absolute;
width: 200px;
height: 200px;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
top: -50px;
right: -50px;
animation: float 6s ease-in-out infinite;
}
.user-profile-header::after {
content: '';
position: absolute;
width: 150px;
height: 150px;
background: rgba(255, 255, 255, 0.05);
border-radius: 50%;
bottom: -30px;
left: 20px;
animation: float 8s ease-in-out infinite reverse;
}
@keyframes float {
0%, 100% { transform: translateY(0px); }
50% { transform: translateY(-20px); }
}
.profile-content {
position: relative;
z-index: 1;
color: white;
}
.user-avatar {
width: 120px;
height: 120px;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
color: white;
font-size: 2.5rem;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
border: 3px solid rgba(255, 255, 255, 0.4);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
margin-bottom: 1rem;
}
.user-profile-header h2 {
font-size: 2rem;
font-weight: 700;
margin: 1rem 0 0.5rem 0;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.badge-container {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
margin-top: 1rem;
}
.badge {
font-weight: 600;
padding: 0.5em 1em;
border-radius: 50px;
font-size: 0.8rem;
display: inline-flex;
align-items: center;
gap: 0.5rem;
backdrop-filter: blur(10px);
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.3);
}
.badge.bg-white {
background: rgba(255, 255, 255, 0.95);
color: var(--primary);
}
.badge.bg-white.text-success {
color: var(--success);
}
.btn-edit {
background: rgba(255, 255, 255, 0.95);
color: var(--primary);
border: none;
font-weight: 600;
transition: all 0.3s ease;
border-radius: 10px;
}
.btn-edit:hover {
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
background: white;
}
.btn-back {
background: linear-gradient(135deg, #6366f1, #8b5cf6);
color: white;
border: none;
font-weight: 600;
border-radius: 10px;
transition: all 0.3s ease;
}
.btn-back:hover {
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}
.card {
border: none;
border-radius: 16px;
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
overflow: hidden;
background: white;
margin-bottom: 2rem;
transition: all 0.3s ease;
}
.card:hover {
box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}
.stat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1.5rem;
margin-bottom: 2rem;
}
.stat-card {
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 1.5rem;
text-align: center;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.stat-card::before {
content: '';
position: absolute;
width: 100px;
height: 100px;
background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
border-radius: 50%;
top: -50px;
right: -50px;
}
.stat-card:hover {
transform: translateY(-8px);
border-color: var(--primary);
box-shadow: 0 12px 24px rgba(99, 102, 241, 0.15);
}
.stat-value {
font-size: 2.5rem;
font-weight: 700;
background: linear-gradient(135deg, #6366f1, #8b5cf6);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 0.5rem;
position: relative;
z-index: 1;
}
.stat-label {
color: var(--text-secondary);
font-size: 0.9rem;
font-weight: 500;
position: relative;
z-index: 1;
}
.info-card {
background: white;
border-radius: 12px;
border: 1px solid var(--border-color);
transition: all 0.3s ease;
height: 100%;
}
.info-card:hover {
border-color: var(--primary);
box-shadow: 0 8px 20px rgba(99, 102, 241, 0.1);
}
.info-card .card-header {
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
border-bottom: 2px solid var(--border-color);
padding: 1.5rem;
font-weight: 700;
color: var(--dark);
display: flex;
justify-content: space-between;
align-items: center;
}
.info-card .card-body {
padding: 1.5rem;
}
.info-row {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding-bottom: 1.25rem;
border-bottom: 1px solid var(--border-color);
}
.info-row:last-child {
border-bottom: none;
padding-bottom: 0;
}
.info-label {
color: var(--text-secondary);
font-size: 0.85rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.03em;
margin-bottom: 0.35rem;
}
.info-value {
color: var(--dark);
font-weight: 500;
font-size: 0.95rem;
}
.table {
margin-bottom: 0;
}
.table thead {
background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 100%);
}
.table th {
font-weight: 700;
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-secondary);
border: none;
padding: 1.25rem;
}
.table tbody tr {
border-bottom: 1px solid var(--border-color);
transition: all 0.3s ease;
}
.table tbody tr:hover {
background: #f8fafc;
}
.table td {
padding: 1.25rem;
vertical-align: middle;
}
.status-badge {
font-size: 0.75rem;
font-weight: 700;
padding: 0.5em 1em;
border-radius: 50px;
text-transform: uppercase;
letter-spacing: 0.05em;
display: inline-block;
}
.status-success {
background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
color: #059669;
border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-warning {
background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
color: #b45309;
border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-danger {
background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(185, 28, 28, 0.1));
color: #b91c1c;
border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-outline-primary {
color: var(--primary);
border: 1.5px solid var(--primary);
border-radius: 8px;
font-weight: 600;
transition: all 0.3s ease;
}
.btn-outline-primary:hover {
background: linear-gradient(135deg, #6366f1, #8b5cf6);
color: white;
border-color: transparent;
transform: translateY(-2px);
box-shadow: 0 8px 12px rgba(99, 102, 241, 0.3);
}
.btn-sm {
font-weight: 600;
border-radius: 8px;
padding: 0.5rem 1rem;
font-size: 0.8rem;
}
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
background: linear-gradient(135deg, #6366f1, #8b5cf6);
border-radius: 10px;
}
@media (max-width: 768px) {
.user-profile-header h2 {
font-size: 1.5rem;
}
.user-avatar {
width: 80px;
height: 80px;
font-size: 1.8rem;
}
.stat-grid {
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 1rem;
}
.stat-value {
font-size: 1.8rem;
}
.info-row {
flex-direction: column;
}
}
</style>
@endpush
@section('content')
<div class="container">
<!-- Header Navigation -->
<div class="d-flex justify-content-between align-items-start mb-4">
<div>
<h1 class="h3 mb-2" style="font-weight: 700; color: var(--dark);">
<i class="fas fa-user-circle me-2" style="background: linear-gradient(135deg, #6366f1, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;"></i>
Dashboard Admin
</h1>
<nav aria-label="breadcrumb">
<ol class="breadcrumb mb-0">
<li class="breadcrumb-item active" aria-current="page">Dashboard</li>
</ol>
</nav>
</div>
</div>
<!-- Welcome Card -->
<div class="card mb-4" style="background: linear-gradient(135deg, #6366f1, #8b5cf6); color: white;">
<div class="card-body p-4">
<h5 class="card-title" style="font-weight: 700;">Selamat Datang, {{ auth()->user()->name }}!</h5>
<p class="card-text" style="margin-bottom: 1.5rem;">Ini adalah dashboard admin. Dari sini, Anda dapat mengelola semua aspek aplikasi.</p>
<a href="{{ route('admin.absensi.index') }}" class="btn btn-light">
<i class="fas fa-tachometer-alt me-2"></i>Ke Halaman Utama
</a>
</div>
</div>
<!-- Quick Actions -->
<div class="row g-4 mb-4">
<div class="col-md-4">
<div class="card text-white" style="background: linear-gradient(135deg, #10b981, #3bbf77);">
<div class="card-body">
<h5 class="card-title">Kehadiran Hari Ini</h5>
<div class="d-flex align-items-center justify-content-between">
<div>
<h2 class="stat-value mb-0">{{ $todayAttendanceCount }}</h2>
<div class="stat-label">Total Kehadiran</div>
</div>
<div class="icon" style="font-size: 2.5rem;">
<i class="fas fa-calendar-check" style="color: rgba(255, 255, 255, 0.8);"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card text-white" style="background: linear-gradient(135deg, #ef4444, #f87171);">
<div class="card-body">
<h5 class="card-title">Kehadiran Tidak Valid</h5>
<div class="d-flex align-items-center justify-content-between">
<div>
<h2 class="stat-value mb-0">{{ $invalidAttendanceCount }}</h2>
<div class="stat-label">Total Tidak Valid</div>
</div>
<div class="icon" style="font-size: 2.5rem;">
<i class="fas fa-times-circle" style="color: rgba(255, 255, 255, 0.8);"></i>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="card text-white" style="background: linear-gradient(135deg, #3b82f6, #60a5fa);">
<div class="card-body">
<h5 class="card-title">Pengguna Terdaftar</h5>
<div class="d-flex align-items-center justify-content-between">
<div>
<h2 class="stat-value mb-0">{{ $userCount }}</h2>
<div class="stat-label">Total Pengguna</div>
</div>
<div class="icon" style="font-size: 2.5rem;">
<i class="fas fa-users" style="color: rgba(255, 255, 255, 0.8);"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Registered Users List -->
<div class="card" style="max-width:700px;margin:auto;margin-top:32px;">
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;">
<h3 style="color:#1e293b;font-size:18px;">Daftar Pengguna Terdaftar</h3>
<a href="{{ route('admin.users.create') }}" class="btn btn-primary btn-sm" style="padding:8px 18px;border-radius:8px;font-weight:600;">
+ Daftarkan Pengguna Baru
</a>
</div>
<ul style="list-style:none;padding:0;margin:0;">
@foreach($users as $user)
<li style="margin-bottom:14px;padding-bottom:10px;border-bottom:1px solid #e5e7eb;">
<div style="font-weight:600;color:#2563eb;">{{ $user->name }}</div>
<div style="font-size:13px;color:#64748b;">{{ $user->email }}</div>
<div style="font-size:12px;color:#0ea5e9;">Role: {{ $user->role ?? '-' }}</div>
</li>
@endforeach
</ul>
</div>
</div>
@endsection
@push('scripts')
<script>
document.addEventListener('DOMContentLoaded', function() {
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
});
</script>
@endpush

View File

@ -0,0 +1,132 @@
@extends('layouts.app')
@push('head')
<style>
.notification-card {
background: var(--card);
border: 1px solid rgba(148, 163, 184, 0.14);
border-radius: 20px;
padding: 30px 34px;
box-shadow: 0 22px 42px rgba(15, 23, 42, 0.4);
max-width: 780px;
margin: 0 auto;
}
.notification-card h2 {
margin: 0 0 18px;
font-weight: 700;
letter-spacing: -0.02em;
}
.notification-form {
display: flex;
flex-direction: column;
gap: 20px;
}
.notification-field label {
display: block;
font-weight: 600;
margin-bottom: 6px;
color: #dbeafe;
letter-spacing: 0.01em;
}
.notification-card .form-control,
.notification-card select {
background: rgba(15, 23, 42, 0.82);
border: 1px solid rgba(148, 163, 184, 0.24);
color: #f1f5f9;
border-radius: 12px;
padding: 10px 12px;
font-size: 14px;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.notification-card .form-control::placeholder,
.notification-card select option {
color: #94a3b8;
}
.notification-card .form-control:focus,
.notification-card select:focus {
outline: none;
border-color: #38bdf8;
box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
background: rgba(15, 23, 42, 0.94);
}
.notification-hint {
font-size: 12px;
color: #94a3b8;
margin-top: 6px;
}
.notification-actions {
margin-top: 6px;
}
.notification-actions .btn-primary {
background: linear-gradient(135deg, #2563eb, #1d4ed8);
color: #e2e8f0;
border: none;
padding: 11px 24px;
border-radius: 12px;
font-weight: 600;
box-shadow: 0 12px 26px rgba(37, 99, 235, 0.28);
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.notification-actions .btn-primary:hover {
transform: translateY(-1px);
box-shadow: 0 14px 28px rgba(37, 99, 235, 0.36);
}
.notification-actions .btn-primary:active {
transform: translateY(0);
box-shadow: 0 10px 20px rgba(37, 99, 235, 0.28);
}
</style>
@endpush
@section('content')
<div class="notification-card">
<h2>Buat Pemberitahuan</h2>
@if (session('success'))
<div style="background:#ecfdf5; color:#065f46; padding:10px 12px; border:1px solid #10b981; border-radius:8px; margin-bottom:12px;">
{{ session('success') }}
</div>
@endif
@if ($errors->any())
<div style="background:#fef2f2; color:#991b1b; padding:10px 12px; border:1px solid #ef4444; border-radius:8px; margin-bottom:12px;">
<div style="font-weight:600; margin-bottom:6px;">Terjadi kesalahan:</div>
<ul style="margin:0 0 0 18px; padding:0;">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form method="POST" action="{{ route('admin.notifications.store') }}" class="notification-form" enctype="multipart/form-data">
@csrf
<div class="notification-field">
<label for="user_id">Pilih User</label>
<select name="user_id" id="user_id" class="form-control" required>
<option value="all">Semua User</option>
@foreach($users as $user)
<option value="{{ $user->id }}">{{ $user->name }} ({{ $user->username }})</option>
@endforeach
</select>
</div>
<div class="notification-field">
<label for="title">Judul</label>
<input type="text" name="title" id="title" class="form-control" placeholder="Masukkan judul pemberitahuan" required>
</div>
<div class="notification-field">
<label for="message">Catatan</label>
<textarea name="message" id="message" class="form-control" rows="3" placeholder="Tulis pesan pemberitahuan" required></textarea>
</div>
<div class="notification-field">
<label for="image">Gambar (opsional)</label>
<input type="file" name="image" id="image" class="form-control" accept="image/*">
<div class="notification-hint">Maks 2MB. Format: JPG/PNG.</div>
</div>
<div class="notification-actions">
<button type="submit" class="btn btn-primary">Kirim Pemberitahuan</button>
</div>
</form>
</div>
@endsection

View File

@ -0,0 +1,375 @@
@extends('layouts.app')
@push('head')
<style>
.admin-notif-card {
position: relative;
display: flex;
flex-direction: column;
gap: 28px;
padding: 34px 36px 32px;
border-radius: 28px;
background: linear-gradient(150deg, rgba(13, 23, 50, 0.95), rgba(8, 16, 36, 0.88));
border: 1px solid rgba(148, 163, 184, 0.18);
box-shadow: 0 28px 56px rgba(3, 7, 18, 0.62);
overflow: hidden;
}
.admin-notif-card::before,
.admin-notif-card::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
}
.admin-notif-card::before {
background:
radial-gradient(circle at 12% 18%, rgba(56, 189, 248, 0.28), transparent 55%),
radial-gradient(circle at 88% -10%, rgba(129, 140, 248, 0.32), transparent 60%);
opacity: 0.85;
}
.admin-notif-card::after {
background: linear-gradient(140deg, transparent 40%, rgba(59, 130, 246, 0.18));
opacity: 0.75;
}
.admin-notif-card > * { position: relative; z-index: 1; }
.admin-notif-hero {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 24px;
flex-wrap: wrap;
}
.admin-notif-hero__info {
display: flex;
flex-direction: column;
gap: 12px;
max-width: 540px;
}
.admin-notif-hero__tagline {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 6px 14px;
border-radius: 999px;
background: rgba(129, 140, 248, 0.18);
border: 1px solid rgba(129, 140, 248, 0.38);
color: #e0e7ff;
font-size: 12px;
letter-spacing: 0.1em;
text-transform: uppercase;
font-weight: 600;
}
.admin-notif-hero h2 {
margin: 0;
font-size: 30px;
font-weight: 700;
letter-spacing: -0.02em;
color: #f8fafc;
}
.admin-notif-hero p {
margin: 0;
color: rgba(226, 232, 240, 0.76);
font-size: 15px;
line-height: 1.6;
}
.admin-notif-hero__actions {
display: inline-flex;
gap: 12px;
}
.admin-notif-add {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 10px 20px;
border-radius: 14px;
background: linear-gradient(135deg, rgba(14, 165, 233, 0.32), rgba(99, 102, 241, 0.48));
border: 1px solid rgba(129, 140, 248, 0.55);
color: #e0f2fe;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
text-decoration: none;
box-shadow: 0 22px 32px rgba(6, 15, 38, 0.5);
transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.admin-notif-add:hover {
transform: translateY(-1px);
border-color: rgba(165, 180, 252, 0.75);
background: linear-gradient(135deg, rgba(56, 189, 248, 0.35), rgba(99, 102, 241, 0.5));
}
.notif-tabs {
display: inline-flex;
gap: 8px;
padding: 8px;
border-radius: 18px;
border: 1px solid rgba(148, 163, 184, 0.24);
background: rgba(7, 16, 36, 0.82);
box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.12);
flex-wrap: wrap;
}
.notif-tab {
padding: 10px 20px;
border-radius: 14px;
border: none;
background: transparent;
color: #94a3b8;
font-weight: 600;
letter-spacing: 0.04em;
cursor: pointer;
transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.notif-tab:hover {
color: #e2e8f0;
transform: translateY(-1px);
}
.notif-tab.is-active {
background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(14, 165, 233, 0.32));
color: #f8fafc;
box-shadow: 0 16px 28px rgba(14, 165, 233, 0.25);
}
.notif-wrapper {
display: flex;
flex-direction: column;
gap: 18px;
}
.notif-section {
animation: fadeIn 0.25s ease;
}
.notif-section.is-hidden {
display: none;
}
.notif-card {
display: grid;
grid-template-columns: minmax(220px, 320px) 1fr;
gap: 20px;
padding: 22px 24px;
border-radius: 20px;
background: rgba(9, 18, 40, 0.9);
border: 1px solid rgba(148, 163, 184, 0.22);
box-shadow: 0 20px 36px rgba(5, 12, 28, 0.45);
}
.notif-image {
border-radius: 16px;
overflow: hidden;
background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(37, 99, 235, 0.48));
border: 1px solid rgba(59, 130, 246, 0.32);
display: flex;
align-items: center;
justify-content: center;
padding: 14px;
color: #94a3b8;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.notif-image img {
width: 100%;
max-height: 260px;
object-fit: cover;
border-radius: 12px;
}
.notif-content {
display: flex;
flex-direction: column;
gap: 12px;
}
.notif-title {
font-size: 20px;
font-weight: 700;
letter-spacing: -0.015em;
color: #38bdf8;
}
.notif-message {
color: #e2e8f0;
line-height: 1.6;
font-size: 15px;
}
.notif-meta {
display: flex;
flex-wrap: wrap;
gap: 16px;
font-size: 13px;
color: rgba(148, 163, 184, 0.8);
}
.notif-empty {
padding: 24px;
text-align: center;
border-radius: 18px;
border: 1px dashed rgba(148, 163, 184, 0.32);
background: rgba(9, 17, 36, 0.75);
color: rgba(148, 163, 184, 0.78);
font-size: 14px;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(6px); }
to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 1200px) {
.admin-notif-card {
padding: 30px 28px;
}
.notif-card {
grid-template-columns: minmax(180px, 260px) 1fr;
}
}
@media (max-width: 960px) {
.admin-notif-card {
padding: 28px 24px;
}
.admin-notif-hero {
flex-direction: column;
}
.admin-notif-hero__actions {
width: 100%;
justify-content: flex-start;
}
.notif-card {
grid-template-columns: 1fr;
}
}
@media (max-width: 768px) {
.admin-notif-card {
padding: 24px 20px;
}
.notif-tabs {
width: 100%;
justify-content: center;
}
.notif-tab {
flex: 1 1 160px;
text-align: center;
}
.notif-card {
padding: 20px;
}
.notif-image {
padding: 12px;
}
}
@media (max-width: 620px) {
.admin-notif-card {
padding: 22px 18px;
border-radius: 22px;
}
.admin-notif-hero__actions,
.notif-tabs {
width: 100%;
}
.notif-tab {
flex: 1 1 140px;
padding: 9px 14px;
}
.notif-meta {
flex-direction: column;
gap: 10px;
}
}
</style>
@endpush
@section('content')
<div class="admin-notif-card">
<div class="admin-notif-hero">
<div class="admin-notif-hero__info">
<span class="admin-notif-hero__tagline">Pusat Informasi</span>
<h2>Daftar Pemberitahuan</h2>
<p>Kelola pembaruan penting untuk pegawai dan admin melalui panel notifikasi yang kaya visual ini.</p>
</div>
<div class="admin-notif-hero__actions">
<a href="{{ route('admin.notifications.create') }}" class="admin-notif-add">+ Kirim Pemberitahuan</a>
</div>
</div>
<div class="notif-tabs" role="tablist">
<button class="notif-tab is-active" data-target="absensi" role="tab" aria-selected="true">Pemberitahuan Absensi</button>
<button class="notif-tab" data-target="admin" role="tab" aria-selected="false">Pemberitahuan Umum</button>
</div>
<div class="notif-section" data-section="absensi">
@if($absensiNotifications->isEmpty())
<div class="notif-empty">Belum ada pemberitahuan absensi.</div>
@else
<div class="notif-wrapper">
@foreach($absensiNotifications as $notif)
<div class="notif-card">
@if($notif->image)
<div class="notif-image">
<img src="{{ asset('storage/'.$notif->image) }}" alt="{{ $notif->title }}">
</div>
@else
<div class="notif-image">Tidak ada gambar</div>
@endif
<div class="notif-content">
<div class="notif-title">{{ $notif->title }}</div>
<div class="notif-message">{{ $notif->message }}</div>
<div class="notif-meta">
<span>Untuk: {{ $notif->user->name }} ({{ $notif->user->username }})</span>
<span>Dikirim: {{ $notif->created_at->format('d/m/Y H:i') }}</span>
</div>
</div>
</div>
@endforeach
</div>
@endif
</div>
<div class="notif-section is-hidden" data-section="admin">
@if($adminNotifications->isEmpty())
<div class="notif-empty">Belum ada pemberitahuan umum.</div>
@else
<div class="notif-wrapper">
@foreach($adminNotifications as $notif)
<div class="notif-card">
@if($notif->image)
<div class="notif-image">
<img src="{{ asset('storage/'.$notif->image) }}" alt="{{ $notif->title }}">
</div>
@else
<div class="notif-image">Tidak ada gambar</div>
@endif
<div class="notif-content">
<div class="notif-title">{{ $notif->title }}</div>
<div class="notif-message">{{ $notif->message }}</div>
<div class="notif-meta">
<span>Untuk: {{ $notif->user->name }} ({{ $notif->user->username }})</span>
<span>Dikirim: {{ $notif->created_at->format('d/m/Y H:i') }}</span>
</div>
</div>
</div>
@endforeach
</div>
@endif
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const tabs = document.querySelectorAll('.notif-tab');
const sections = document.querySelectorAll('.notif-section');
tabs.forEach(tab => {
tab.addEventListener('click', () => {
const target = tab.dataset.target;
tabs.forEach(btn => {
const isActive = btn === tab;
btn.classList.toggle('is-active', isActive);
btn.setAttribute('aria-selected', isActive ? 'true' : 'false');
});
sections.forEach(section => {
section.classList.toggle('is-hidden', section.dataset.section !== target);
});
});
});
});
</script>
@endsection

View File

@ -0,0 +1,218 @@
@extends('layouts.app')
@section('title', 'Daftar Pengguna')
@push('styles')
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #4361ee;
--primary-hover: #3a56d4;
--danger-color: #f43f5e;
--success-color: #10b981;
--warning-color: #f59e0b;
--info-color: #3b82f6;
--light-bg: #f8fafc;
--card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
--transition: all 0.2s ease-in-out;
--border-radius: 12px;
--danger-hover: #dc2626;
--text-primary: #1e293b;
--text-secondary: #64748b;
--bg-light: #f8fafc;
--border-color: #e2e8f0;
}
body {
font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
line-height: 1.5;
color: var(--text-primary);
background-color: #f1f5f9;
}
.table th {
font-weight: 600;
text-transform: uppercase;
font-size: 0.75rem;
letter-spacing: 0.05em;
color: var(--text-secondary);
}
.table > :not(:first-child) {
border-top: 1px solid var(--border-color);
}
.table > :not(caption) > * > * {
padding: 1rem 1.25rem;
}
.table-hover > tbody > tr:hover {
background-color: rgba(15, 23, 42, 0.02);
}
.btn-sm {
padding: 0.35rem 0.75rem;
font-size: 0.825rem;
}
.badge {
font-weight: 600;
padding: 0.35em 0.65em;
}
.form-control:focus {
border-color: var(--primary-color);
box-shadow: 0 0 0 0.25rem rgba(67, 97, 238, 0.15);
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background: #cbd5e1;
border-radius: 10px;
transition: background 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
background: #94a3b8;
}
</style>
@endpush
@section('content')
<div class="container py-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h2 class="mb-0" style="font-weight:700; font-size:1.5rem;">Daftar Pengguna</h2>
<div class="d-flex gap-2 d-none">
<form method="POST" action="{{ route('admin.users.attendance.enable-all') }}" class="mb-0">
@csrf
<button type="submit" class="btn btn-success btn-sm">Aktifkan Semua</button>
</form>
<form method="POST" action="{{ route('admin.users.attendance.disable-all') }}" class="mb-0">
@csrf
<button type="submit" class="btn btn-danger btn-sm">Nonaktifkan Semua</button>
</form>
</div>
</div>
<div class="card shadow-sm">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover align-middle mb-0">
<thead class="bg-light">
<tr>
<th class="ps-4">Nama</th>
<th>Email</th>
<th>NIK</th>
<th>Jabatan</th>
<th>Status</th>
<th>Hadir</th>
<th>Tidak Hadir</th>
<th class="text-end pe-4">Aksi</th>
</tr>
</thead>
<tbody>
@forelse($users as $user)
@php
$initials = collect(explode(' ', trim($user->name)))
->filter()
->map(fn($part) => mb_substr($part, 0, 1))
->take(2)
->implode('');
$initials = mb_strtoupper($initials ?: 'U');
$hadir = $user->attendances()->where('status', 'hadir')->count();
$tidakHadir = $user->attendances()->where('status', '!=', 'hadir')->count();
@endphp
<tr>
<td>
<div class="d-flex align-items-center">
<div class="me-3 d-flex align-items-center justify-content-center rounded-circle" style="width:40px; height:40px; background:linear-gradient(140deg,rgba(99,102,241,0.6),rgba(14,165,233,0.4)); color:white; font-weight:600; font-size:14px;">
{{ $initials }}
</div>
<div>
<div class="fw-semibold">{{ $user->name }}</div>
<small class="text-muted">{{ $user->username ?? 'No Username' }}</small>
</div>
</div>
</td>
<td>{{ $user->email ?? '-' }}</td>
<td>{{ $user->nik ?? '-' }}</td>
<td>
@if($user->role)
<span class="badge bg-primary">{{ ucfirst($user->role) }}</span>
@else
<span class="text-muted">-</span>
@endif
</td>
<td>
<form method="POST" action="{{ route('admin.users.attendance-toggle', $user->id) }}" class="d-inline">
@csrf
@method('PATCH')
<input type="hidden" name="attendance_enabled" value="{{ $user->attendance_enabled ? 0 : 1 }}">
<button type="submit" class="btn btn-sm {{ $user->attendance_enabled ? 'btn-success' : 'btn-danger' }} py-0 px-2">
{{ $user->attendance_enabled ? 'Aktif' : 'Nonaktif' }}
</button>
</form>
</td>
<td>
<span style="background:#22c55e;color:#fff;padding:2px 10px;border-radius:8px;font-weight:600;">{{ $hadir }}</span>
</td>
<td>
<span style="background:#ef4444;color:#fff;padding:2px 10px;border-radius:8px;font-weight:600;">{{ $tidakHadir }}</span>
</td>
<td class="text-end pe-4">
<a href="{{ route('admin.users.show', $user->id) }}" class="btn btn-primary btn-sm" style="margin-right:6px;">Lihat</a>
<form method="POST" action="{{ route('admin.users.destroy', $user->id) }}" style="display:inline;" onsubmit="return confirm('Yakin ingin menghapus pengguna ini?')">
@csrf
@method('DELETE')
<button type="submit" class="btn btn-danger btn-sm">Hapus</button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="8" class="text-center py-4">
<div class="text-muted">Tidak ada data pengguna</div>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>
</div>
<div class="card-footer bg-white">
<div class="d-flex justify-content-between align-items-center">
<div class="text-muted small">
Menampilkan {{ $users->firstItem() ?? 0 }} - {{ $users->lastItem() ?? 0 }} dari {{ $users->total() }} pengguna
</div>
<div>
{{ $users->withQueryString()->links() }}
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script>
document.addEventListener('DOMContentLoaded', function() {
// Inisialisasi tooltips
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl);
});
});
</script>
@endpush

View File

@ -0,0 +1,385 @@
@extends('layouts.app')
@section('title', 'Detail Pengguna - ' . $user->name)
@push('head')
<style>
.profile-shell {
position: relative;
max-width: 980px;
margin: 0 auto;
padding: 32px 36px;
border-radius: 28px;
background: linear-gradient(150deg, rgba(12, 24, 52, 0.96), rgba(7, 15, 36, 0.9));
border: 1px solid rgba(148, 163, 184, 0.22);
box-shadow: 0 40px 80px rgba(3, 7, 18, 0.55);
overflow: hidden;
}
.profile-shell::before,
.profile-shell::after {
content: "";
position: absolute;
inset: 0;
pointer-events: none;
}
.profile-shell::before {
background:
radial-gradient(circle at 12% 16%, rgba(99, 102, 241, 0.32), transparent 55%),
radial-gradient(circle at 86% -6%, rgba(56, 189, 248, 0.28), transparent 60%);
opacity: 0.9;
}
.profile-shell::after {
background: linear-gradient(135deg, transparent 40%, rgba(59, 130, 246, 0.14));
opacity: 0.8;
}
.profile-shell > * { position: relative; z-index: 1; }
.profile-hero {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24px;
flex-wrap: wrap;
}
.profile-hero__info {
display: flex;
flex-direction: column;
gap: 12px;
max-width: 560px;
}
.profile-hero__tagline {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 6px 14px;
border-radius: 999px;
background: rgba(129, 140, 248, 0.18);
border: 1px solid rgba(129, 140, 248, 0.38);
color: #e0e7ff;
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
font-weight: 600;
}
.profile-hero__info h2 {
margin: 0;
font-size: 32px;
font-weight: 700;
letter-spacing: -0.02em;
color: #f8fafc;
}
.profile-hero__info p {
margin: 0;
color: rgba(226, 232, 240, 0.78);
font-size: 15px;
line-height: 1.6;
}
.profile-hero__actions {
display: flex;
flex-wrap: wrap;
gap: 12px;
align-items: center;
}
.profile-hero__actions .btn {
border-radius: 14px;
padding: 10px 18px;
border: none;
cursor: pointer;
font-weight: 700;
letter-spacing: 0.04em;
transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.btn-primary {
background: linear-gradient(135deg, #2563eb, #1d4ed8);
color: #f8fafc;
}
.btn-success {
background: linear-gradient(135deg, #16a34a, #22c55e);
color: #f8fafc;
}
.btn-warning {
background: linear-gradient(135deg, #f59e0b, #d97706);
color: #f8fafc;
}
.btn:hover {
transform: translateY(-1px);
box-shadow: 0 18px 32px rgba(14, 165, 233, 0.22);
}
.profile-summary {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 18px;
margin-top: 32px;
}
.profile-card {
padding: 24px;
border-radius: 24px;
background: rgba(8, 16, 34, 0.82);
border: 1px solid rgba(148, 163, 184, 0.18);
box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.12);
}
.profile-card h3 {
margin: 0 0 18px;
color: #f8fafc;
font-size: 1.05rem;
font-weight: 700;
}
.profile-field {
display: grid;
gap: 10px;
margin-bottom: 18px;
}
.profile-label {
font-size: 12px;
letter-spacing: 0.08em;
text-transform: uppercase;
color: rgba(203, 213, 225, 0.72);
font-weight: 700;
}
.profile-value {
color: #e2e8f0;
font-size: 0.95rem;
font-weight: 600;
background: rgba(7, 15, 34, 0.9);
border: 1px solid rgba(148, 163, 184, 0.16);
border-radius: 14px;
padding: 14px 16px;
}
.status-pill {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 16px;
border-radius: 999px;
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.status-success {
background: rgba(34, 197, 94, 0.18);
color: #bbf7d0;
border: 1px solid rgba(34, 197, 94, 0.3);
}
.status-warning {
background: rgba(245, 158, 11, 0.18);
color: #fde68a;
border: 1px solid rgba(245, 158, 11, 0.3);
}
.status-danger {
background: rgba(248, 113, 113, 0.18);
color: #fecaca;
border: 1px solid rgba(248, 113, 113, 0.3);
}
.profile-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 24px;
margin-top: 32px;
}
.profile-grid-2 {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 18px;
margin-top: 18px;
}
.summary-card {
padding: 18px 20px;
border-radius: 20px;
background: linear-gradient(145deg, rgba(12, 21, 44, 0.9), rgba(19, 35, 70, 0.84));
border: 1px solid rgba(148, 163, 184, 0.18);
}
.summary-card__label {
display: block;
font-size: 12px;
color: rgba(203, 213, 225, 0.72);
margin-bottom: 10px;
letter-spacing: 0.08em;
text-transform: uppercase;
font-weight: 700;
}
.summary-card__value {
font-size: 1.75rem;
font-weight: 700;
color: #f8fafc;
}
.summary-card__meta {
color: rgba(203, 213, 225, 0.72);
margin-top: 10px;
font-size: 12px;
}
@media (max-width: 768px) {
.profile-hero,
.profile-grid,
.profile-grid-2 {
grid-template-columns: 1fr;
}
.profile-hero {
align-items: stretch;
}
}
</style>
@endpush
@section('content')
@php
$createdAt = $user->created_at?->timezone(config('app.timezone'));
$updatedAt = $user->updated_at?->timezone(config('app.timezone'));
@endphp
<div class="profile-shell">
<div class="profile-hero">
<div class="profile-hero__info">
<span class="profile-hero__tagline">Detail Pengguna</span>
<h2>{{ $user->name }}</h2>
<p>Informasi akun pegawai ditampilkan dengan tampilan konsisten seperti profil user. Gunakan halaman ini untuk melihat detail serta menyetujui akun.</p>
</div>
<div class="profile-hero__actions">
<a href="{{ route('admin.users.index') }}" class="btn btn-primary">Kembali</a>
<form method="POST" action="{{ route('admin.users.approval-toggle', $user->id) }}" style="margin:0;">
@csrf
@method('PATCH')
<input type="hidden" name="is_approved" value="{{ $user->is_approved ? 0 : 1 }}">
<button type="submit" class="btn {{ $user->is_approved ? 'btn-warning' : 'btn-success' }}">
{{ $user->is_approved ? 'Batalkan Persetujuan' : 'Setujui Akun' }}
</button>
</form>
</div>
</div>
<div class="profile-grid">
<div class="profile-card">
<h3>Informasi Utama</h3>
<div class="profile-field">
<label>Nama</label>
<div class="profile-value">{{ $user->name }}</div>
</div>
<div class="profile-field">
<label>Username</label>
<div class="profile-value">{{ $user->username ?? '-' }}</div>
</div>
<div class="profile-field">
<label>Email</label>
<div class="profile-value">{{ $user->email }}</div>
</div>
<div class="profile-field">
<label>NIK</label>
<div class="profile-value">{{ $user->nik ?? '-' }}</div>
</div>
<div class="profile-field">
<label>Role</label>
<div class="profile-value">{{ $user->role ? ucfirst($user->role) : '-' }}</div>
</div>
</div>
<div class="profile-card">
<h3>Status & Persetujuan</h3>
<div class="profile-field">
<label>Status Verifikasi Email</label>
<div class="profile-value">
<span class="status-pill {{ $user->email_verified_at ? 'status-success' : 'status-warning' }}">
{{ $user->email_verified_at ? 'Terverifikasi' : 'Belum Verifikasi' }}
</span>
</div>
</div>
<div class="profile-field">
<label>Status Persetujuan</label>
<div class="profile-value">
<span class="status-pill {{ $user->is_approved ? 'status-success' : 'status-danger' }}">
{{ $user->is_approved ? 'Disetujui Admin' : 'Menunggu Persetujuan' }}
</span>
</div>
</div>
<div class="profile-field">
<label>Status Absensi</label>
<div class="profile-value">{{ $user->attendance_enabled ? 'Aktif' : 'Nonaktif' }}</div>
</div>
<div class="profile-field">
<label>Terakhir Login</label>
<div class="profile-value">{{ $user->last_login_at?->timezone(config('app.timezone'))->format('d M Y H:i') ?? '-' }}</div>
</div>
</div>
</div>
<div class="profile-grid-2">
<div class="profile-card">
<h3>Kontak</h3>
<div class="profile-field">
<label>No. HP</label>
<div class="profile-value">{{ $user->phone ?? '-' }}</div>
</div>
<div class="profile-field">
<label>Alamat</label>
<div class="profile-value">{{ $user->address ?? '-' }}</div>
</div>
</div>
<div class="profile-card">
<h3>Ringkasan Akun</h3>
<div class="profile-field">
<label>Terdaftar</label>
<div class="profile-value">{{ $createdAt?->format('d/m/Y H:i') ?? '-' }}</div>
</div>
<div class="profile-field">
<label>Update Terakhir</label>
<div class="profile-value">{{ $updatedAt?->format('d/m/Y H:i') ?? '-' }}</div>
</div>
</div>
</div>
<div class="profile-summary">
<div class="summary-card">
<span class="summary-card__label">Hadir</span>
<span class="summary-card__value">{{ $attendanceRecords->where('status', 'hadir')->count() }}</span>
<span class="summary-card__meta">Jumlah kehadiran</span>
</div>
<div class="summary-card">
<span class="summary-card__label">Tidak Hadir</span>
<span class="summary-card__value">{{ $attendanceRecords->where('status', '!=', 'hadir')->count() }}</span>
<span class="summary-card__meta">Absen, izin, sakit, tidak valid</span>
</div>
<div class="summary-card">
<span class="summary-card__label">Izin / Sakit</span>
<span class="summary-card__value">{{ $attendanceRecords->whereIn('status', ['izin', 'sakit'])->count() }}</span>
<span class="summary-card__meta">Permintaan izin</span>
</div>
<div class="summary-card">
<span class="summary-card__label">Total Data</span>
<span class="summary-card__value">{{ $attendanceRecords->count() }}</span>
<span class="summary-card__meta">Riwayat kehadiran</span>
</div>
</div>
</div>
@endsection

View File

@ -0,0 +1,117 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Admin/Atasan - Absensi</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
<style>
:root { --bg: #0f172a; --card: #111827; --muted: #9ca3af; --text: #e5e7eb; --primary: #3b82f6; }
* { box-sizing: border-box; }
body {
margin: 0;
font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
color: var(--text);
min-height: 100vh;
display: grid;
place-items: center;
background: linear-gradient(180deg, #0b1220, #0f172a);
}
.topbar { position: fixed; top: 20px; left: 20px; display: flex; gap: 10px; }
.link-btn { padding: 10px 14px; border-radius: 10px; background: rgba(17, 24, 39, 0.85); color: #e5e7eb; border: 1px solid rgba(148, 163, 184, 0.25); text-decoration: none; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
.link-btn:hover { filter: brightness(1.05); }
.container { width: 100%; max-width: 460px; padding: 24px; }
.card { width: 100%; background: rgba(17, 24, 39, 0.85); border: 1px solid rgba(148, 163, 184, 0.1); border-radius: 16px; padding: 28px; box-shadow: 0 10px 30px rgba(0,0,0,0.35); backdrop-filter: blur(6px); }
h1 { margin: 0 0 8px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
p.sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 14px; }
label { display: block; font-size: 13px; margin-bottom: 6px; color: #cbd5e1; }
input[type=text], input[type=password] { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(148, 163, 184, 0.22); background: rgba(2,6,23,0.4); color: var(--text); outline: none; transition: border 0.2s, box-shadow 0.2s; }
input[type=text]:focus, input[type=password]:focus { border-color: rgba(59,130,246,0.6); box-shadow: 0 0 0 4px rgba(59,130,246,0.15); }
.actions { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #cbd5e1; }
button { width: 100%; margin-top: 12px; padding: 12px 16px; background: linear-gradient(135deg, #2563eb, #06b6d4); border: none; border-radius: 10px; color: white; font-weight: 600; cursor: pointer; box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35); transition: transform 0.08s ease, filter 0.2s ease; }
button:hover { filter: brightness(1.05); }
button:active { transform: translateY(1px); }
.errors { background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35); color: #fecaca; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 13px; }
.footer { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; }
/* Password toggle */
.input-wrap { position: relative; }
.view-pass { font-size: 13px; color: #93c5fd; cursor: pointer; user-select: none; }
.view-pass:hover { text-decoration: underline; }
</style>
</head>
<body>
<div class="topbar">
<a class="link-btn" href="{{ route('login') }}">Kembali</a>
</div>
<div class="container">
<form class="card" method="POST" action="{{ route('login.post') }}">
@csrf
<h1>Masuk Admin / Atasan</h1>
<p class="sub">Silakan masukkan kredensial Anda.</p>
@if (session('status'))
<div style="background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.35); color: #bbf7d0; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; font-size: 13px;">
{{ session('status') }}
</div>
@endif
@if ($errors->any())
<div class="errors">
<ul style="margin:0; padding-left: 18px;">
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="field">
<label for="username">Username</label>
<input id="username" type="text" name="username" value="{{ old('username', request('prefill')) }}" required autofocus />
</div>
<div class="field">
<label for="password">Password</label>
<div class="input-wrap">
<input id="password" type="password" name="password" required />
</div>
</div>
<div class="actions">
<label class="remember">
<input type="checkbox" name="remember" value="1" /> Ingat saya
</label>
<span class="view-pass" data-target="password">Lihat password</span>
</div>
<button type="submit">Login</button>
<div class="footer">
<div style="margin-top:6px; display:flex; justify-content:center; align-items:center; gap:8px;">
<a href="{{ route('password.request') }}">Lupa password?</a>
<span></span>
<a href="{{ route('register') }}">Daftar</a>
</div>
</div>
</form>
</div>
<script>
document.querySelectorAll('.view-pass').forEach(el => {
el.addEventListener('click', () => {
const id = el.getAttribute('data-target');
const input = document.getElementById(id);
if (!input) return;
const isPass = input.type === 'password';
input.type = isPass ? 'text' : 'password';
el.textContent = isPass ? 'Sembunyikan password' : 'Lihat password';
});
});
</script>
</body>
</html>

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