Added other type option in filter #697
@@ -335,10 +335,15 @@ class VisitorEntryResource extends Resource
|
|||||||
'GovermentOfficials' => 'Government Officials',
|
'GovermentOfficials' => 'Government Officials',
|
||||||
'Other' => 'Other',
|
'Other' => 'Other',
|
||||||
])
|
])
|
||||||
->placeholder('Enter Type')
|
->placeholder('Choose Type')
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->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')
|
TextInput::make('name')
|
||||||
->label('Visitor Name')
|
->label('Visitor Name')
|
||||||
->reactive()
|
->reactive()
|
||||||
@@ -386,7 +391,12 @@ class VisitorEntryResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['type'])) {
|
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'])) {
|
if (! empty($data['name'])) {
|
||||||
@@ -421,6 +431,10 @@ class VisitorEntryResource extends Resource
|
|||||||
$indicators[] = 'Type: '.$data['type'];
|
$indicators[] = 'Type: '.$data['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($data['other_type'])) {
|
||||||
|
$indicators[] = 'Specify Type: '.$data['other_type'];
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($data['name'])) {
|
if (! empty($data['name'])) {
|
||||||
$indicators[] = 'Name: '.$data['name'];
|
$indicators[] = 'Name: '.$data['name'];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user