Abschnitte, Medienkarten, Einordnung und Auswahl folgen der vorgegebenen Form. Datenmodell und Fassungen bleiben unverändert.
37 lines
1.6 KiB
PHP
37 lines
1.6 KiB
PHP
@php
|
|
$kind = $kind ?? 'text';
|
|
$rows = $rows ?? 3;
|
|
$origin = $origin ?? null;
|
|
$placeholder = $placeholder ?? '';
|
|
$disabled = $disabled ?? false;
|
|
$hint = $hint ?? null;
|
|
$value = $value ?? '';
|
|
$required = $required ?? false;
|
|
$offen = trim((string) $value) === '' && $origin === null;
|
|
@endphp
|
|
<section class="vw-abschnitt" x-data="{ offen: {{ $offen ? 'true' : 'false' }} }">
|
|
<header>
|
|
<h3>{{ $label }}</h3>
|
|
@if (filled($origin))
|
|
<span @class(['vw-herkunft', 'is-eigen' => str_starts_with((string) $origin, 'Eigene')])>{{ $origin }}</span>
|
|
@endif
|
|
@unless ($disabled)
|
|
<button type="button" class="vw-textaktion" @click="offen = !offen">
|
|
<span x-text="offen ? 'Schließen' : 'Bearbeiten'">Bearbeiten</span>
|
|
</button>
|
|
@endunless
|
|
</header>
|
|
<p class="vw-lesetext" x-show="!offen">{{ trim((string) $value) !== '' ? $value : 'Keine Angabe' }}</p>
|
|
<div class="luf-field" x-show="offen" @unless ($offen) x-cloak @endunless>
|
|
<label class="luf-sr" for="{{ $id }}">{{ $label }}</label>
|
|
@if ($kind === 'textarea')
|
|
<textarea id="{{ $id }}" rows="{{ $rows }}" wire:model="{{ $model }}" placeholder="{{ $placeholder }}" @disabled($disabled)></textarea>
|
|
@else
|
|
<input id="{{ $id }}" type="text" wire:model="{{ $model }}" placeholder="{{ $placeholder }}" @disabled($disabled) @if ($required) required @endif>
|
|
@endif
|
|
@if (filled($hint))
|
|
<span class="luf-meta">{{ $hint }}</span>
|
|
@endif
|
|
</div>
|
|
</section>
|