Feat: Add target group selection dropdown in activities form
This commit is contained in:
@@ -20,4 +20,13 @@ return [
|
|||||||
'National' => 'National',
|
'National' => 'National',
|
||||||
'International' => 'International',
|
'International' => 'International',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'target_groups' => [
|
||||||
|
'Undergraduate Students' => 'Undergraduate Students',
|
||||||
|
'Postgraduate Students' => 'Postgraduate Students',
|
||||||
|
'PhD Students' => 'PhD Students',
|
||||||
|
'Faculty Members' => 'Faculty Members',
|
||||||
|
'Industry Professionals' => 'Industry Professionals',
|
||||||
|
'Alumni' => 'Alumni',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
@@ -40,7 +40,14 @@
|
|||||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label for="target_audience" class="block text-sm font-medium text-gray-700">Target Audience</label>
|
<label for="target_audience" class="block text-sm font-medium text-gray-700">Target Audience</label>
|
||||||
<input type="text" name="target_audience" id="target_audience" 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>
|
<select name="target_audience" id="target_audience" 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>
|
||||||
|
@if(isset($dropdowns['target_groups']) && is_array($dropdowns['target_groups']))
|
||||||
|
@foreach($dropdowns['target_groups'] as $key => $label)
|
||||||
|
<option value="{{ $key }}">{{ $label }}</option>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="number_of_participants" class="block text-sm font-medium text-gray-700">Number of Participants</label>
|
<label for="number_of_participants" class="block text-sm font-medium text-gray-700">Number of Participants</label>
|
||||||
@@ -185,7 +192,10 @@
|
|||||||
delay: 250,
|
delay: 250,
|
||||||
processResults: function(data) {
|
processResults: function(data) {
|
||||||
return {
|
return {
|
||||||
results: data.map(user => ({ id: user.name, text: user.name }))
|
results: data.map(user => ({
|
||||||
|
id: user.name,
|
||||||
|
text: user.name
|
||||||
|
}))
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
cache: true
|
cache: true
|
||||||
@@ -198,6 +208,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Initialize Select2 for activity_type, category, and level
|
// Initialize Select2 for activity_type, category, and level
|
||||||
|
$('#target_audience').select2({
|
||||||
|
placeholder: 'Select Target Audience',
|
||||||
|
allowClear: true
|
||||||
|
});
|
||||||
$('#activity_type').select2({
|
$('#activity_type').select2({
|
||||||
tags: true,
|
tags: true,
|
||||||
placeholder: 'Select Activity Type',
|
placeholder: 'Select Activity Type',
|
||||||
|
|||||||
@@ -47,8 +47,19 @@
|
|||||||
<!-- Target Audience -->
|
<!-- Target Audience -->
|
||||||
<div>
|
<div>
|
||||||
<label for="target_audience" class="block text-sm font-medium text-gray-700">Target Audience</label>
|
<label for="target_audience" class="block text-sm font-medium text-gray-700">Target Audience</label>
|
||||||
<input type="text" name="target_audience" id="target_audience" value="{{ old('target_audience', $response->target_audience) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
|
<select name="target_audience" id="target_audience" 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>
|
||||||
|
@if(isset($dropdowns['target_groups']) && is_array($dropdowns['target_groups']))
|
||||||
|
@foreach($dropdowns['target_groups'] as $key => $label)
|
||||||
|
<option value="{{ $key }}" {{ old('target_audience', $response->target_audience ?? '') == $key ? 'selected' : '' }}>{{ $label }}</option>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div>
|
||||||
|
<label for="target_audience" class="block text-sm font-medium text-gray-700">Target Audience</label>
|
||||||
|
<input type="text" name="target_audience" id="target_audience" value="{{ old('target_audience', $response->target_audience) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
<!-- Number of Participants -->
|
<!-- Number of Participants -->
|
||||||
<div>
|
<div>
|
||||||
@@ -245,6 +256,10 @@
|
|||||||
endDateField.addEventListener('change', calculateDays);
|
endDateField.addEventListener('change', calculateDays);
|
||||||
|
|
||||||
// Initialize Select2 for activity_type, category, and level
|
// Initialize Select2 for activity_type, category, and level
|
||||||
|
$('#target_audience').select2({
|
||||||
|
placeholder: 'Select Target Audience',
|
||||||
|
allowClear: true
|
||||||
|
});
|
||||||
$('#activity_type').select2({
|
$('#activity_type').select2({
|
||||||
tags: true,
|
tags: true,
|
||||||
placeholder: 'Select Activity Type',
|
placeholder: 'Select Activity Type',
|
||||||
|
|||||||
Reference in New Issue
Block a user