This commit is contained in:
199
api/resources/views/impressoes/components/campo.blade.php
Normal file
199
api/resources/views/impressoes/components/campo.blade.php
Normal file
@@ -0,0 +1,199 @@
|
||||
|
||||
<!--
|
||||
|
||||
[
|
||||
'props' => [
|
||||
'class' => ''
|
||||
],
|
||||
'data' => [
|
||||
'campos' => [
|
||||
[
|
||||
'label' => 'Nome',
|
||||
'value' => 'Décio Stenico'
|
||||
],
|
||||
[
|
||||
'label' => 'Nome',
|
||||
'value' => '',
|
||||
'value_class' => 'manual-line',
|
||||
],
|
||||
[
|
||||
'label' => 'Nome',
|
||||
'value' => '',
|
||||
'value_class' => 'manual-area',
|
||||
'value_style' => 'height: 100px',
|
||||
],
|
||||
[
|
||||
'label' => 'Sexo',
|
||||
'value' => [
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['Masculino', true],
|
||||
['Feminino'],
|
||||
]
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => 'Sexo',
|
||||
'value' => [
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['Masculino', true],
|
||||
['Feminino'],
|
||||
],
|
||||
'options_outro' => 'Teste' // Label default: 'Outro'
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => 'Sexo',
|
||||
'value' => [
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['Masculino', true],
|
||||
['Feminino'],
|
||||
],
|
||||
'options_outro' => '', // Label default: 'Outro'
|
||||
'options_outro_value_class' => 'manual-line',
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => 'Sexo',
|
||||
'value' => [
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['Masculino', true],
|
||||
['Feminino'],
|
||||
],
|
||||
'options_outro' => [
|
||||
'label' => 'Outra',
|
||||
'value' => 'Teste'
|
||||
]
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => 'Sexo',
|
||||
'value' => [
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['Masculino', true],
|
||||
['Feminino'],
|
||||
],
|
||||
'options_outro' => [
|
||||
'label' => 'Outra',
|
||||
'value' => '',
|
||||
'value_class' => 'manual-line',
|
||||
]
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => 'Sexo',
|
||||
'value' => [
|
||||
'type' => 'radio',
|
||||
'options' => [
|
||||
['Masculino', true],
|
||||
['Feminino'],
|
||||
]
|
||||
],
|
||||
'class' => 'campo-option-inline'
|
||||
],
|
||||
[
|
||||
'label' => 'Comidas favoritas',
|
||||
'value' => [
|
||||
'type' => 'checkbox',
|
||||
'options' => [
|
||||
['Lasanha', true],
|
||||
['Feijoada', true],
|
||||
['Tofu']
|
||||
]
|
||||
],
|
||||
],
|
||||
[
|
||||
'label' => 'Comidas favoritas',
|
||||
'value' => [
|
||||
'type' => 'checkbox',
|
||||
'per_column' => 2,
|
||||
'options' => [
|
||||
['Lasanha', true],
|
||||
['Feijoada', true],
|
||||
['Tofu']
|
||||
]
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
-->
|
||||
|
||||
<table class="campo grid {{ $props['class'] ?? '' }}" style="{{ $props['style'] ?? '' }}">
|
||||
<tr>
|
||||
@foreach($data['campos'] as $campo)
|
||||
<td class="{{ $campo['class'] ?? '' }}" style="{{ $campo['style'] ?? '' }}">
|
||||
<div class="label">
|
||||
<strong>{{ $campo['label'] ?? '' }}</strong>
|
||||
</div>
|
||||
|
||||
@if(is_array($campo['value']))
|
||||
@if(isset($campo['value']['per_column']))
|
||||
<table>
|
||||
<tr>
|
||||
@for($i = 0; $i < count($campo['value']['options']); $i++)
|
||||
@if($i === 0 || $i % $campo['value']['per_column'] === 0)
|
||||
<td>
|
||||
@endif
|
||||
|
||||
<div class="campo-option {{ $campo['value']['type'] }}">
|
||||
<div class="option {{ isset($campo['value']['options'][$i][1]) && $campo['value']['options'][$i][1] ? 'checked' : '' }}">
|
||||
<i></i> <span>{{ $campo['value']['options'][$i][0] }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($i === (count($campo['value']['options']) - 1) || ($i + 1) % $campo['value']['per_column'] === 0)
|
||||
</td>
|
||||
@endif
|
||||
@endfor
|
||||
</tr>
|
||||
</table>
|
||||
@else
|
||||
<div class="campo-option {{ $campo['value']['type'] }}">
|
||||
@foreach($campo['value']['options'] as $option)
|
||||
<div class="option {{ isset($option[1]) && $option[1] ? 'checked' : '' }}">
|
||||
<i></i> <span>{{ $option[0] }}</span>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(isset($campo['value']['options_outro']))
|
||||
<table>
|
||||
<tr>
|
||||
@if(is_array($campo['value']['options_outro']))
|
||||
<td class="col-min">{{ $campo['value']['options_outro']['label'] }}:</td>
|
||||
<td>
|
||||
<div class="{{ $campo['value']['options_outro']['value_class'] ?? '' }}">
|
||||
{{ $campo['value']['options_outro']['value'] }}
|
||||
</div>
|
||||
</td>
|
||||
@else
|
||||
<td class="col-min">Outro:</td>
|
||||
<td>
|
||||
<div class="{{ $campo['value']['options_outro_value_class'] ?? '' }}">
|
||||
{{ $campo['value']['options_outro'] }}
|
||||
</div>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
</table>
|
||||
@endif
|
||||
@else
|
||||
<div class="value {{ $campo['value_class'] ?? '' }}" style="{{ $campo['value_style'] ?? '' }}">
|
||||
@if($campo['is_html'] ?? false)
|
||||
{!! $campo['value'] ?? '' !!}
|
||||
@else
|
||||
{{ $campo['value'] ?? '' }}
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
@endforeach
|
||||
</tr>
|
||||
</table>
|
||||
Reference in New Issue
Block a user