From a7b7dd7bd1e09761f3d58868933f4ad0ef569089 Mon Sep 17 00:00:00 2001 From: Arya Dwi Putra Date: Tue, 2 Dec 2025 08:38:46 +0700 Subject: [PATCH] Add scheduled due reminders, readonly middleware, and landing help/changelog --- .../Commands/SendAssetDueNotifications.php | 52 +++++++++++++++++++ bootstrap/app.php | 4 ++ .../views/pages/landing/changelog.blade.php | 23 ++++++++ resources/views/pages/landing/help.blade.php | 40 ++++++++++++++ routes/web.php | 2 + 5 files changed, 121 insertions(+) create mode 100644 app/Console/Commands/SendAssetDueNotifications.php create mode 100644 resources/views/pages/landing/changelog.blade.php create mode 100644 resources/views/pages/landing/help.blade.php diff --git a/app/Console/Commands/SendAssetDueNotifications.php b/app/Console/Commands/SendAssetDueNotifications.php new file mode 100644 index 0000000..d72311d --- /dev/null +++ b/app/Console/Commands/SendAssetDueNotifications.php @@ -0,0 +1,52 @@ +whereBetween('warranty_end', [$today, $today->clone()->addDays($warrantyDays)]) + ->count(); + + $maintenanceDue = AssetMaintenance::whereIn('status', ['planned', 'in_progress']) + ->whereDate('performed_at', '<=', $today) + ->count(); + + $auditThresholdDays = 90; + $auditOverdue = Asset::whereDoesntHave('audits', function ($q) use ($today, $auditThresholdDays) { + $q->whereDate('audited_at', '>=', $today->clone()->subDays($auditThresholdDays)); + })->count(); + + $message = sprintf( + 'Reminder: warranty due %d, maintenance due %d, audit overdue %d', + $warrantyDue, + $maintenanceDue, + $auditOverdue + ); + + Log::channel('asset_activity')->info($message, [ + 'warranty_due_in_days' => $warrantyDays, + 'audit_threshold_days' => $auditThresholdDays, + ]); + + $this->info($message); + + return self::SUCCESS; + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 3cf82f2..a7c44df 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -7,6 +7,7 @@ use Spatie\Permission\Middleware\PermissionMiddleware; use Spatie\Permission\Middleware\RoleMiddleware; use Spatie\Permission\Middleware\RoleOrPermissionMiddleware; use App\Http\Middleware\MaintenanceReadOnly; +use Illuminate\Console\Scheduling\Schedule; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( @@ -22,6 +23,9 @@ return Application::configure(basePath: dirname(__DIR__)) 'maintenance.readonly' => MaintenanceReadOnly::class, ]); }) + ->withSchedule(function (Schedule $schedule) { + $schedule->command('asset:notify-due')->daily(); + }) ->withExceptions(function (Exceptions $exceptions) { // })->create(); diff --git a/resources/views/pages/landing/changelog.blade.php b/resources/views/pages/landing/changelog.blade.php new file mode 100644 index 0000000..2330cb7 --- /dev/null +++ b/resources/views/pages/landing/changelog.blade.php @@ -0,0 +1,23 @@ +@extends('layouts.landing-master') + +@section('content') +
+
+
+
Changelog
+
Ringkasan perubahan
+
+
+
+
    +
  • QR publik untuk setiap aset, galeri foto, dan aksi transaksi di dashboard.
  • +
  • Fitur movement, disposal, reverse, maintenance, audit, serta laporan Excel/PDF multi-sheet.
  • +
  • RBAC lengkap (super-admin, asset-manager, auditor, maintenance, viewer).
  • +
  • Setting sistem: prefix kode aset, batas upload, audit log toggle, read-only mode.
  • +
  • Landing diperbarui dengan CTA login/dashboard dan halaman bantuan.
  • +
+
+
+
+
+@endsection diff --git a/resources/views/pages/landing/help.blade.php b/resources/views/pages/landing/help.blade.php new file mode 100644 index 0000000..d7c463c --- /dev/null +++ b/resources/views/pages/landing/help.blade.php @@ -0,0 +1,40 @@ +@extends('layouts.landing-master') + +@section('content') +
+
+
+
Help & FAQ
+
Panduan singkat penggunaan sistem
+
Cara cepat menjalankan modul utama.
+
+
+
+
+
+
Registrasi & QR
+

Tambah aset dari dashboard, QR otomatis mengarah ke halaman publik untuk scan.

+
Movement/Disposal/Maintenance
+

Gunakan tombol aksi di detail aset (login & izin diperlukan).

+
Audit
+

Catat hasil audit matched/missing/damaged, lihat laporan di menu laporan audit.

+
+
+
+
+
+
+
FAQ Singkat
+
    +
  • Bagaimana mengganti batas upload? Ubah `asset.attachment_max_size_mb` di setting.
  • +
  • Bagaimana mengaktifkan QR? Pastikan `asset.qr_enabled` = true di setting.
  • +
  • Mode read-only? Set `maintenance.readonly_mode` = true agar semua write ditolak.
  • +
  • Laporan? Menu Laporan menyediakan export Excel/PDF multi-sheet.
  • +
+
+
+
+
+
+
+@endsection diff --git a/routes/web.php b/routes/web.php index e04c922..3488ae1 100644 --- a/routes/web.php +++ b/routes/web.php @@ -30,6 +30,8 @@ use App\Http\Controllers\Controller; Route::view('/', 'pages.landing.index')->name('landing'); Route::view('/landing', 'pages.landing.index'); Route::get('asset-view/{asset}', [PublicAssetController::class, 'show'])->name('assets.public.show'); +Route::view('help', 'pages.landing.help')->name('landing.help'); +Route::view('changelog', 'pages.landing.changelog')->name('landing.changelog'); Route::middleware(['auth','maintenance.readonly'])->prefix('dashboard')->group(function () { Route::get('index', [DashboardsController::class, 'index'])->name('index');