fix checkbox actions default display

This commit is contained in:
ayntk-ai
2024-08-28 13:11:42 +02:00
parent 73068aaa75
commit 141752b9ad
2 changed files with 12 additions and 9 deletions

View File

@@ -17,7 +17,7 @@
<div x-data="{
modalOpen: false,
step: {{ !empty($checkboxes) ? 1 : 2 }},
selectedActions: [],
selectedActions: @js(collect($checkboxes)->where('model', true)->pluck('id')->toArray()),
deleteText: '',
password: '',
checkboxActions: @js($checkboxActions),
@@ -96,11 +96,14 @@
<div class="px-2">Select the actions you want to perform:</div>
</div>
@foreach($checkboxes as $index => $checkbox)
<x-forms.checkbox :id="$checkbox['id']" :wire:model="$checkbox['model']" :label="$checkbox['label']" x-on:change="$event.target.checked ? selectedActions.push('{{ $checkbox['id'] }}') : selectedActions = selectedActions.filter(a => a !== '{{ $checkbox['id'] }}')"></x-forms.checkbox>
<x-forms.checkbox
:id="$checkbox['id']"
:wire:model="$checkbox['model']"
:label="$checkbox['label']"
x-on:change="$event.target.checked ? (selectedActions.includes('{{ $checkbox['id'] }}') || selectedActions.push('{{ $checkbox['id'] }}')) : selectedActions = selectedActions.filter(a => a !== '{{ $checkbox['id'] }}')"
:checked="$checkbox['model']"
></x-forms.checkbox>
@endforeach
{{-- <x-forms.button isError x-show="step === 1" @click="step = 2; selectedActions = Object.keys(checkboxActions).filter(action => $wire[action])" type="button">
Continue
</x-forms.button> --}}
</div>
@else
<div x-init="step = 2"></div>

View File

@@ -16,10 +16,10 @@
['id' => 'docker_cleanup', 'model' => 'docker_cleanup', 'label' => 'Run Docker cleanup (remove builder cache and unused images)?']
]"
:checkboxActions="[
'delete_volumes' => $delete_volumes ? 'All associated volumes of this resource will be deleted.' : null,
'delete_connected_networks' => $delete_connected_networks ? 'All connected networks of this resource will be deleted (predefined networks are not deleted).' : null,
'delete_configurations' => $delete_configurations ? 'All configuration files of this resource will be deleted on the server.' : null,
'docker_cleanup' => $docker_cleanup ? 'Docker cleanup will be executed which removes builder cache and unused images.' : null
'delete_volumes' => 'All associated volumes of this resource will be deleted.',
'delete_connected_networks' => 'All connected networks of this resource will be deleted (predefined networks are not deleted).',
'delete_configurations' => 'All configuration files of this resource will be deleted on the server.',
'docker_cleanup' => 'Docker cleanup will be executed which removes builder cache and unused images.'
]"
>
This resource will be deleted. It is not reversible. <strong class="text-error">Please think again.</strong><br><br>