Added other type option in filter
Some checks failed
Gemini PR Review / Gemini PR Review (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Waiting to run
Laravel Larastan / larastan (pull_request) Waiting to run
Laravel Pint / pint (pull_request) Waiting to run
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

This commit is contained in:
dhanabalan
2026-06-02 09:26:22 +05:30
parent 207d52a443
commit b83f005512

View File

@@ -335,10 +335,15 @@ class VisitorEntryResource extends Resource
'GovermentOfficials' => 'Government Officials',
'Other' => 'Other',
])
->placeholder('Enter Type')
->placeholder('Choose Type')
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Rework', null);
$set('name', null);
}),
TextInput::make('other_type')
->label('Specify Type')
->placeholder('Enter Type')
->visible(fn (callable $get) => $get('type') == 'Other')
->required(fn (callable $get) => $get('type') == 'Other'),
TextInput::make('name')
->label('Visitor Name')
->reactive()
@@ -386,7 +391,12 @@ class VisitorEntryResource extends Resource
}
if (! empty($data['type'])) {
$query->where('type', $data['type']);
if ($data['type'] == 'Other') {
$query->where('type', 'like', '%'.$data['other_type'].'%');
}
else{
$query->where('type', $data['type']);
}
}
if (! empty($data['name'])) {
@@ -421,6 +431,10 @@ class VisitorEntryResource extends Resource
$indicators[] = 'Type: '.$data['type'];
}
if (! empty($data['other_type'])) {
$indicators[] = 'Specify Type: '.$data['other_type'];
}
if (! empty($data['name'])) {
$indicators[] = 'Name: '.$data['name'];
}