@props([ 'title' => 'Form', 'subtitle' => 'Please fill in the required information', 'action' => '#', 'method' => 'POST', 'sections' => [], 'submitText' => 'Submit', 'backUrl' => null, 'showSaveDraft' => false, 'disabled' => false, 'icon' => null ])

@if($icon) {!! $icon !!} @else @endif {{ $title }}

{{ $subtitle }}

@csrf @if($method == 'PUT') @method('PUT') @endif @foreach($sections as $section)
@if($section['title'])

@if($section['icon']) {!! $section['icon'] !!} @endif {{ $section['title'] }}

@endif
@foreach($section['fields'] as $field)
@switch($field['type']) @case('text') @case('email') @case('tel') @case('password')
@if($field['icon'] ?? false) {!! $field['icon'] !!} @endif
@if($field['help'] ?? false)

{{ $field['help'] }}

@endif @break @case('textarea') @if($field['help'] ?? false)

{{ $field['help'] }}

@endif @break @case('select')
@if($field['help'] ?? false)

{{ $field['help'] }}

@endif @break @case('checkbox')
@if($field['help'] ?? false)

{{ $field['help'] }}

@endif @break @case('file') @if($field['help'] ?? false)

{{ $field['help'] }}

@endif @break @endswitch
@endforeach
@endforeach
@if($backUrl) Back @endif
@if($showSaveDraft) @endif
@if($showSaveDraft) @endif