feat(templates): importar CSV/Excel con group, question y help
El importador de plantillas solo parseaba name/label/type/required/options/ min/max/step, dejando fuera group (sección), question (pregunta corta) y help (ayuda) que el builder manual sí soporta. - Nuevo orden de columnas: group,name,label,question,type,required,options,min,max,step,help - parseRows() rellena las 11 claves (coincide con addField()). - readFileRows() ya no descarta filas por la 1ª columna (ahora es `group`, que puede ir vacía); filtra por "fila con algún contenido" y parseRows descarta las que no tengan `name`. - CSV de ejemplo actualizado (con BOM UTF-8) y con filas que muestran group/ question/help/select. - Modal de importación: texto de columnas y tabla de preview muestran Grupo y Pregunta. Tests: nuevo test csv_import_parses_group_question_and_help. Suite 95 passing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -122,7 +122,7 @@
|
||||
</div>
|
||||
<div class="p-4 space-y-3">
|
||||
<p class="text-xs text-base-content/60">
|
||||
{{ __('Columns: name, label, type, required, options, min, max, step') }}.
|
||||
{{ __('Columns') }}: <code class="text-[11px]">group, name, label, question, type, required, options, min, max, step, help</code>.
|
||||
<button type="button" wire:click="downloadExampleCsv" class="link link-primary">{{ __('Download example CSV') }}</button>
|
||||
</p>
|
||||
<div class="form-control">
|
||||
@@ -144,10 +144,17 @@
|
||||
<p class="text-sm font-medium mb-2">{{ count($importPreviewFields) }} {{ __('fields detected') }}:</p>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table table-xs">
|
||||
<thead><tr><th>{{ __('Label') }}</th><th>{{ __('Name') }}</th><th>{{ __('Type') }}</th><th>{{ __('Required') }}</th></tr></thead>
|
||||
<thead><tr><th>{{ __('Group') }}</th><th>{{ __('Label') }}</th><th>{{ __('Question') }}</th><th>{{ __('Name') }}</th><th>{{ __('Type') }}</th><th>{{ __('Required') }}</th></tr></thead>
|
||||
<tbody>
|
||||
@foreach($importPreviewFields as $f)
|
||||
<tr><td>{{ $f['label'] }}</td><td class="font-mono text-xs">{{ $f['name'] }}</td><td><span class="badge badge-ghost badge-sm">{{ $f['type'] }}</span></td><td>{{ !empty($f['required']) ? '✓' : '' }}</td></tr>
|
||||
<tr>
|
||||
<td>{{ $f['group'] ?? '' }}</td>
|
||||
<td>{{ $f['label'] }}</td>
|
||||
<td class="text-xs text-base-content/70">{{ $f['question'] ?? '' }}</td>
|
||||
<td class="font-mono text-xs">{{ $f['name'] }}</td>
|
||||
<td><span class="badge badge-ghost badge-sm">{{ $f['type'] }}</span></td>
|
||||
<td>{{ !empty($f['required']) ? '✓' : '' }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user