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
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:
@@ -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'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user