Skip to content

Commit

Permalink
Tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
darrencoutts118 committed Jul 2, 2024
1 parent f248464 commit da55f0c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
31 changes: 17 additions & 14 deletions resources/views/components/checkables.blade.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<fieldset class="mb-4">
<legend class="{!! $labelAttributes !!}">{{ $label }}</legend>
{{-- {{ $type == 'checkbox' ? '[]' : '' }} --}}

@foreach ($options as $value => $title)
@php
app(\AppKit\Formulate\Id::class)->startBlock($name);
@endphp
<fieldset>
<legend class="font-medium text-gray-900 leading-6 dark:text-white">{{ $label }}</legend>

<div class="{{ $loop->last ? '' : 'mb-2 ' }}flex items-center">
<x-formulate-input type="{{ $type }}" name="{{ $name }}{{ $type == 'checkbox' ? '[]' : '' }}" :label="$title" :value="$value" ignoreFieldGroup />
<label for="" class="ml-2">{{ $title }}</label>
<div class="space-y-2">
@foreach ($options as $value => $label)
@php
app(\AppKit\Formulate\Id::class)->startBlock($label);
$id = app(\AppKit\Formulate\Id::class)->get($label);
@endphp
<div class="flex items-center">
<x-formulate-input :$type :$name :$id :$label :$value ignoreFieldGroup />
<x-appkit::label :for="$id" :$label class="ml-2" />
</div>
@endforeach
@php
app(\AppKit\Formulate\Id::class)->endBlock();
@endphp
</div>

@endforeach
@php
app(\AppKit\Formulate\Id::class)->endBlock();
@endphp

@if (isset($errors) && $errors->has($name))
<div class="{{ config('formulate.classes.field_error') }}">{{ $errors->first($name) }}</div>
@endif
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
<div class="{{ config('formulate.classes.form_error') }}">{{ config('formulate.form_error_message') }}</div>
@endif

<div class="space-y-4">{{ $slot }}</div>
<div class="space-y-6">{{ $slot }}</div>
</form>
4 changes: 1 addition & 3 deletions resources/views/components/input.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<x-dynamic-component component="{{ !$field->ignoreFieldGroup ? 'formulate-field-group' : 'formulate-blank' }}" :$field>
{{-- <input type="{{ $type }}" name="{{ $name }}{{ $multiple ? '[]' : '' }}" id="{{ $id }}" value="{{ is_string($value) ? $value: '' }}" {!! (($type == 'checkbox' || $type == 'radio') && $checked) ? 'checked="checked"' : '' !!} {!! ($required) ? 'required="required"' : '' !!} {!! $attributes !!} /> --}}

<x-appkit::input type="{{ $type }}" name="{{ $name }}" value="{{ is_string($value) ? $value: '' }}" {{ $attributes }} />
<x-appkit::input :$type :$name value="{{ is_string($value) ? $value : '' }}" {{ $attributes }} />
</x-dynamic-component>

0 comments on commit da55f0c

Please sign in to comment.