@php
$value = $response[$field->name] ?? null;
@endphp
@switch($field->type)
@case('text')
required) required @endif>
@error('responses.' . $field->name)
{{ $message }}
@enderror
@break
@case('textarea')
@break
@case('checkbox')
@if (!empty($field->options))
@php $selected = $response[$field->name] ?? []; @endphp
@foreach (explode(',', $field->options) as $option)
@endforeach
@endif
@break
@case('dropdown')
@break
@case('radio')
@if (!empty($field->options))
@foreach (explode(',', $field->options) as $option)
name, $value) == $option) ? 'checked' : '' }}>
@endforeach
@endif
@break
@case('date')
@break
@case('time')
@break
@case('number')
required) required @endif>
@error('responses.' . $field->name)
{{ $message }}
@enderror
@break
@case('file')
@if (!empty($value))
{{ __('Existing file:') }} {{ $value }}
@endif
@break
@case('business_hours')
@php
$days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
$times = [];
for ($i = 0; $i < 24; $i++) {
for ($j = 0; $j < 2; $j++) {
$hour = str_pad($i % 12 == 0 ? 12 : $i % 12, 2, '0', STR_PAD_LEFT);
$minutes = $j == 0 ? '00' : '30';
$suffix = $i < 12 ? 'am' : 'pm';
$times[] = "$hour:$minutes $suffix";
}
}
@endphp
@foreach ($days as $day)
@php
$openingKey = strtolower($day) . '_opening';
$closingKey = strtolower($day) . '_closing';
$opening = $response[$openingKey] ?? '';
$closing = $response[$closingKey] ?? '';
@endphp
{{ __($day) }}
@endforeach
@break
@case('amenities')
@php
$amenities = App\Models\Amenity::all();
$selected = $response['amenities'] ?? [];
$selectedAmenities = isset($response['amenities']) ? explode(',', $response['amenities']) : [];
@endphp
@foreach ($amenities as $index => $amenity)
@if (($index + 1) % 4 == 0)
@endif
@endforeach
@break
@case('department')
@php
$departments = App\Models\Department::all();
$selected = $response['departments'] ?? [];
@endphp
@foreach ($departments as $index => $department)
@if (($index + 1) % 4 == 0)
@endif
@endforeach
@break
@case('degree')
@php
$degrees = App\Models\Degree::all();
$selected = $response['degrees'] ?? [];
@endphp
@foreach ($degrees as $index => $degree)
@if (($index + 1) % 4 == 0)
@endif
@endforeach
@break
@default
{{ __('Unsupported field type:') }} {{ $field->type }}
@endswitch