refactor: ♻️ Use Switch state instead of elseif
This commit is contained in:
parent
ac5fa6c25c
commit
20f0e1dfc2
1 changed files with 46 additions and 32 deletions
|
@ -83,16 +83,23 @@
|
|||
<i class="fas fa-info-circle mr-4 invisible"></i>
|
||||
@endif
|
||||
|
||||
@if ($value['type'] == 'string')
|
||||
@switch($value)
|
||||
@case($value['type'] == 'string')
|
||||
<input type="text" class="form-control"
|
||||
name="{{ $key }}" value="{{ $value['value'] }}">
|
||||
@elseif ($value['type'] == 'boolean')
|
||||
@break
|
||||
|
||||
@case($value['type'] == 'boolean')
|
||||
<input type="checkbox" name="{{ $key }}"
|
||||
value="{{ $value['value'] }}">
|
||||
@elseif ($value['type'] == 'number')
|
||||
@break
|
||||
|
||||
@case($value['type'] == 'number')
|
||||
<input type="number" class="form-control"
|
||||
name="{{ $key }}" value="{{ $value['value'] }}">
|
||||
@elseif ($value['type'] == 'select')
|
||||
@break
|
||||
|
||||
@case($value['type'] == 'select')
|
||||
<select id="{{ $key }}" class="custom-select w-100"
|
||||
name="{{ $key }}">
|
||||
@foreach ($value['options'] as $option)
|
||||
|
@ -102,9 +109,11 @@
|
|||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif($value['type'] == 'multiselect')
|
||||
<select class="custom-select w-100" name="{{ $key }}"
|
||||
multiple>
|
||||
@break
|
||||
|
||||
@case($value['type'] == 'multiselect')
|
||||
<select id="{{ $key }}" class="custom-select w-100"
|
||||
name="{{ $key }}" multiple>
|
||||
@foreach ($value['options'] as $option)
|
||||
<option value="{{ $option }}"
|
||||
{{ $value['value'] == $option ? 'selected' : '' }}>
|
||||
|
@ -112,9 +121,14 @@
|
|||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@elseif($value['type'] == 'textarea')
|
||||
<textarea class="form-control w-100" name="{{ $key }}" rows="3">{{ $value['value'] }}</textarea>
|
||||
@endif
|
||||
@break
|
||||
|
||||
@case($value['type'] == 'textarea')
|
||||
<textarea class="form-control" name="{{ $key }}" rows="3">{{ $value['value'] }}</textarea>
|
||||
@break
|
||||
|
||||
@default
|
||||
@endswitch
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue