From f14dfb137ece99348fb0e2fd96faabf2816b5910 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 28 May 2026 10:49:53 +0530 Subject: [PATCH 1/2] Added gate entry page --- app/Filament/Pages/GateOutEntry.php | 79 +++++++++++++++++++ .../filament/pages/gate-out-entry.blade.php | 10 +++ 2 files changed, 89 insertions(+) create mode 100644 app/Filament/Pages/GateOutEntry.php create mode 100644 resources/views/filament/pages/gate-out-entry.blade.php diff --git a/app/Filament/Pages/GateOutEntry.php b/app/Filament/Pages/GateOutEntry.php new file mode 100644 index 0000000..ed37b84 --- /dev/null +++ b/app/Filament/Pages/GateOutEntry.php @@ -0,0 +1,79 @@ +statePath('filters') + ->schema([ + Section::make('') // You can give your section a title or leave it blank + ->schema([ + TextInput::make('scan_out_gate_pass') + ->label('Scan Out Gate Pass') + ->required() + ->reactive() + ->extraAttributes([ + 'wire:keydown.enter' => 'processGatePass($event.target.value)', + ]), + ]) + ->columns(5) + ]); + } + + public function processGatePass($gatePass) + { + $entry = VisitorEntry::where('register_id', $gatePass)->first(); + + if ($entry) { + $entry->out_time = now(); + $entry->save(); + + Notification::make() + ->title('Gate Pass Processed') + ->body('Gate pass has been successfully processed. Visitor marked as exited.') + ->success() + ->send(); + $this->filters['scan_out_gate_pass'] = ''; + } else { + Notification::make() + ->title('Invalid Gate Pass') + ->body('The scanned gate pass is not valid. Please try again.') + ->danger() + ->send(); + } + } + + public static function canAccess(): bool + { + return Auth::check() && Auth::user()->can('view gate entry page'); + } +} diff --git a/resources/views/filament/pages/gate-out-entry.blade.php b/resources/views/filament/pages/gate-out-entry.blade.php new file mode 100644 index 0000000..7014a78 --- /dev/null +++ b/resources/views/filament/pages/gate-out-entry.blade.php @@ -0,0 +1,10 @@ + + +
+ {{-- Render the Select form fields --}} +
+ {{ $this->form }} +
+
+ +
-- 2.49.1 From e044e8f39d48e41fc757ec3d23caca822942ab60 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 28 May 2026 10:51:05 +0530 Subject: [PATCH 2/2] Added view gate entry permission --- database/seeders/PermissionSeeder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/database/seeders/PermissionSeeder.php b/database/seeders/PermissionSeeder.php index 407b74d..c310554 100644 --- a/database/seeders/PermissionSeeder.php +++ b/database/seeders/PermissionSeeder.php @@ -228,6 +228,7 @@ class PermissionSeeder extends Seeder Permission::updateOrCreate(['name' => 'view import asrs item validation']); Permission::updateOrCreate(['name' => 'view export asrs item validation']); + Permission::updateOrCreate(['name' => 'view gate entry page']); } } -- 2.49.1