From f14dfb137ece99348fb0e2fd96faabf2816b5910 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 28 May 2026 10:49:53 +0530 Subject: [PATCH] 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 }} +
+
+ +