add toggle to startup-variable view

This commit is contained in:
Boy132 2025-09-02 11:17:53 +02:00
parent 9a8c7e651c
commit b70b8e477d
2 changed files with 16 additions and 2 deletions

View File

@ -6,5 +6,5 @@ enum StartupVariableType: string
{ {
case Text = 'text'; case Text = 'text';
case Select = 'select'; case Select = 'select';
case Toggle = 'toggle'; // TODO: add toggle to blade view case Toggle = 'toggle';
} }

View File

@ -19,7 +19,8 @@
:valid="! $errors->has($statePath)" :valid="! $errors->has($statePath)"
:attributes="\Filament\Support\prepare_inherited_attributes($getExtraAttributeBag())->class([ :attributes="\Filament\Support\prepare_inherited_attributes($getExtraAttributeBag())->class([
'fi-fo-text-input overflow-hidden' => $type === \App\Enums\StartupVariableType::Text, 'fi-fo-text-input overflow-hidden' => $type === \App\Enums\StartupVariableType::Text,
'fi-fo-select' => $type === \App\Enums\StartupVariableType::Select 'fi-fo-select' => $type === \App\Enums\StartupVariableType::Select,
'fi-fo-toggle p-1' => $type === \App\Enums\StartupVariableType::Toggle
])" ])"
> >
@if ($type === \App\Enums\StartupVariableType::Select) @if ($type === \App\Enums\StartupVariableType::Select)
@ -48,6 +49,19 @@
</option> </option>
@endforeach @endforeach
</x-filament::input.select> </x-filament::input.select>
@elseif($type === \App\Enums\StartupVariableType::Toggle)
<x-filament::toggle
:id="$getId()"
:required="$isRequired"
:disabled="$isDisabled"
:attributes="
$getExtraInputAttributeBag()
->class(['ml-2'])
->merge([
'state' => '$wire.' . $applyStateBindingModifiers('$entangle(\'' . $statePath . '\')'),
], escape: false)
"
/>
@else @else
<x-filament::input <x-filament::input
:id="$getId()" :id="$getId()"