Feat: Create Common Dropdown file

This commit is contained in:
Sallu9007
2025-03-23 18:21:52 +05:30
parent 1ba5f672fb
commit 07932d7194
3 changed files with 42 additions and 11 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View;
class AppServiceProvider extends ServiceProvider
{
@@ -20,5 +21,8 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void
{
//
View::composer('*', function ($view) {
$view->with('dropdowns', config('dropdowns'));
});
}
}

23
config/dropdowns.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
return [
'activity_types' => [
'GL' => 'GL (Guest Lecture)',
'IC' => 'IC (Industry Connect)',
'STTP' => 'STTP (Short Term Training Program)',
],
'categories' => [
'Technical' => 'Technical',
'Social' => 'Social',
'Entrepreneurial' => 'Entrepreneurial',
'Life Skill' => 'Life Skill',
],
'levels' => [
'College' => 'College',
'State' => 'State',
'National' => 'National',
'International' => 'International',
],
];

View File

@@ -75,29 +75,33 @@
<label for="activity_type" class="block text-sm font-medium text-gray-700">Select Activity Type</label>
<select name="activity_type" id="activity_type" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
<option value="">Select</option>
<option value="GL">GL</option>
<option value="IC">IC</option>
<option value="STTP">STTP</option>
@if(isset($dropdowns['activity_types']) && is_array($dropdowns['activity_types']))
@foreach($dropdowns['activity_types'] as $key => $label)
<option value="{{ $key }}">{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<div>
<label for="category" class="block text-sm font-medium text-gray-700">Select Category</label>
<select name="category" id="category" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
<option value="">Select</option>
<option value="Technical">Technical</option>
<option value="Social">Social</option>
<option value="Entrepreneurial">Entrepreneurial</option>
<option value="Life Skill">Life Skill</option>
@if(isset($dropdowns['categories']) && is_array($dropdowns['categories']))
@foreach($dropdowns['categories'] as $key => $label)
<option value="{{ $key }}">{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<div>
<label for="level" class="block text-sm font-medium text-gray-700">Select Level</label>
<select name="level" id="level" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
<option value="">Select</option>
<option value="College">College</option>
<option value="State">State</option>
<option value="National">National</option>
<option value="International">International</option>
@if(isset($dropdowns['levels']) && is_array($dropdowns['levels']))
@foreach($dropdowns['levels'] as $key => $label)
<option value="{{ $key }}">{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<div>