94 lines
3.6 KiB
PHP
94 lines
3.6 KiB
PHP
{{--
|
|
Variables esperadas:
|
|
$pregunta - Pregunta model
|
|
$tipoSlug - string (slug del tipo)
|
|
$fieldName - string (name del input, ej: "resp[1]" o "resp[1][5]")
|
|
$fieldId - string (id único del input)
|
|
--}}
|
|
|
|
@if($tipoSlug === 'texto_libre')
|
|
<textarea name="{{ $fieldName }}"
|
|
id="{{ $fieldId }}"
|
|
class="form-control"
|
|
rows="4"
|
|
placeholder="Escribe tu respuesta aquí…"
|
|
{{ $pregunta->requerida ? 'required' : '' }}></textarea>
|
|
|
|
@elseif($tipoSlug === 'opcion_multiple')
|
|
<div>
|
|
@foreach($pregunta->opciones as $opcion)
|
|
<div class="form-check mb-2">
|
|
<input type="radio"
|
|
name="{{ $fieldName }}"
|
|
id="{{ $fieldId }}_{{ $opcion->id }}"
|
|
value="{{ $opcion->id }}"
|
|
class="form-check-input"
|
|
{{ $pregunta->requerida ? 'required' : '' }}>
|
|
<label class="form-check-label" for="{{ $fieldId }}_{{ $opcion->id }}">
|
|
{{ $opcion->texto }}
|
|
</label>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
|
|
@elseif($tipoSlug === 'si_no')
|
|
<div class="d-flex">
|
|
<div class="form-check mr-4">
|
|
<input type="radio"
|
|
name="{{ $fieldName }}"
|
|
id="{{ $fieldId }}_si"
|
|
value="si"
|
|
class="form-check-input"
|
|
{{ $pregunta->requerida ? 'required' : '' }}>
|
|
<label class="form-check-label font-weight-bold text-success" for="{{ $fieldId }}_si">
|
|
Sí
|
|
</label>
|
|
</div>
|
|
<div class="form-check">
|
|
<input type="radio"
|
|
name="{{ $fieldName }}"
|
|
id="{{ $fieldId }}_no"
|
|
value="no"
|
|
class="form-check-input"
|
|
{{ $pregunta->requerida ? 'required' : '' }}>
|
|
<label class="form-check-label font-weight-bold text-danger" for="{{ $fieldId }}_no">
|
|
No
|
|
</label>
|
|
</div>
|
|
</div>
|
|
|
|
@elseif($tipoSlug === 'escala_5')
|
|
<div class="d-flex flex-wrap" style="gap:.5rem;">
|
|
@for($k = 1; $k <= 5; $k++)
|
|
<div class="form-check form-check-inline mr-0">
|
|
<input type="radio"
|
|
name="{{ $fieldName }}"
|
|
id="{{ $fieldId }}_{{ $k }}"
|
|
value="{{ $k }}"
|
|
class="form-check-input d-none escala-input"
|
|
{{ $pregunta->requerida ? 'required' : '' }}>
|
|
<label class="btn btn-outline-primary px-3 py-2"
|
|
for="{{ $fieldId }}_{{ $k }}">{{ $k }}</label>
|
|
</div>
|
|
@endfor
|
|
<small class="text-muted align-self-center ml-2">1 = Muy malo 5 = Excelente</small>
|
|
</div>
|
|
|
|
@elseif($tipoSlug === 'escala_10')
|
|
<div class="d-flex flex-wrap" style="gap:.5rem;">
|
|
@for($k = 1; $k <= 10; $k++)
|
|
<div class="form-check form-check-inline mr-0">
|
|
<input type="radio"
|
|
name="{{ $fieldName }}"
|
|
id="{{ $fieldId }}_{{ $k }}"
|
|
value="{{ $k }}"
|
|
class="form-check-input d-none escala-input"
|
|
{{ $pregunta->requerida ? 'required' : '' }}>
|
|
<label class="btn btn-outline-primary px-3 py-2"
|
|
for="{{ $fieldId }}_{{ $k }}">{{ $k }}</label>
|
|
</div>
|
|
@endfor
|
|
<small class="text-muted align-self-center ml-2">1 = Muy malo 10 = Excelente</small>
|
|
</div>
|
|
@endif
|