fix: AUTOUPDATE + checkbox opacity

This commit is contained in:
Andras Bacsai
2024-11-15 21:44:02 +01:00
parent 8515a18ead
commit b43d62f51b
3 changed files with 12 additions and 6 deletions

View File

@@ -21,7 +21,9 @@ class Checkbox extends Component
public bool $disabled = false, public bool $disabled = false,
public string $defaultClass = 'dark:border-neutral-700 text-coolgray-400 focus:ring-warning dark:bg-coolgray-100 rounded cursor-pointer dark:disabled:bg-base dark:disabled:cursor-not-allowed', public string $defaultClass = 'dark:border-neutral-700 text-coolgray-400 focus:ring-warning dark:bg-coolgray-100 rounded cursor-pointer dark:disabled:bg-base dark:disabled:cursor-not-allowed',
) { ) {
// if ($this->disabled) {
$this->defaultClass .= ' opacity-40';
}
} }
/** /**

View File

@@ -5,6 +5,7 @@
'disabled' => false, 'disabled' => false,
'instantSave' => false, 'instantSave' => false,
'value' => null, 'value' => null,
'checked' => false,
'hideLabel' => false, 'hideLabel' => false,
'fullWidth' => false, 'fullWidth' => false,
]) ])
@@ -14,7 +15,9 @@
'w-full' => $fullWidth, 'w-full' => $fullWidth,
])> ])>
@if (!$hideLabel) @if (!$hideLabel)
<label @class(['flex gap-4 items-center px-0 min-w-fit label w-full cursor-pointer', 'opacity-40' => $disabled])> <label @class([
'flex gap-4 items-center px-0 min-w-fit label w-full cursor-pointer',
])>
<span class="flex flex-grow gap-2"> <span class="flex flex-grow gap-2">
@if ($label) @if ($label)
{!! $label !!} {!! $label !!}
@@ -28,6 +31,7 @@
@endif @endif
<input @disabled($disabled) type="checkbox" {{ $attributes->merge(['class' => $defaultClass]) }} <input @disabled($disabled) type="checkbox" {{ $attributes->merge(['class' => $defaultClass]) }}
@if ($instantSave) wire:loading.attr="disabled" wire:click='{{ $instantSave === 'instantSave' || $instantSave == '1' ? 'instantSave' : $instantSave }}' @if ($instantSave) wire:loading.attr="disabled" wire:click='{{ $instantSave === 'instantSave' || $instantSave == '1' ? 'instantSave' : $instantSave }}'
@if ($checked) checked @endif
wire:model={{ $id }} @else wire:model={{ $value ?? $id }} @endif /> wire:model={{ $id }} @else wire:model={{ $value ?? $id }} @endif />
@if (!$hideLabel) @if (!$hideLabel)
</label> </label>

View File

@@ -103,7 +103,7 @@
@if (!is_null(config('constants.coolify.autoupdate', null))) @if (!is_null(config('constants.coolify.autoupdate', null)))
<div class="text-right md:w-96"> <div class="text-right md:w-96">
<x-forms.checkbox instantSave helper="AUTOUPDATE is set in .env file, you need to modify it there." <x-forms.checkbox instantSave helper="AUTOUPDATE is set in .env file, you need to modify it there."
disabled id="is_auto_update_enabled" label="Enabled" /> disabled checked="{{ config('constants.coolify.autoupdate') }}" label="Enabled" />
</div> </div>
@else @else
<x-forms.checkbox instantSave id="is_auto_update_enabled" label="Auto Update Enabled" /> <x-forms.checkbox instantSave id="is_auto_update_enabled" label="Auto Update Enabled" />