demo/resources/views/components/atomic/button.blade.php
2023-03-23 18:50:47 +01:00

87 lines
4.3 KiB
PHP

@if(!$btn->getPermission())
{{-- Gebe NICHTS aus wenn Berechtigung (boolean) auf false --}}
@else
@if($btn->hasDropdown())
<div class="btn-group{{ $btn->getDropDirection() ? ' drop' . $btn->getDropDirection() : ''}}">
@endif
@if(in_array($btn->getType(), ['button', 'submit', 'reset']))
<button
{!! $btn->getId() ? 'id="' . $btn->getId() . '"' : '' !!}
{!! $btn->getClass() ? 'class="' . $btn->getClass() . '"' : '' !!}
{!! $btn->getData() !!}
{!! $btn->getName() ? 'name="' . $btn->getName() . '"' : '' !!}
{!! $btn->getValue() ? 'value="' . $btn->getValue() . '"' : '' !!}
{!! in_array($btn->getType(), ['button', 'reset']) ? 'type="' . $btn->getType() . '"' : '' !!}
{!! $btn->getForm() ? 'form="' . $btn->getForm() . '"' : '' !!}
{!! $btn->getFormAction() ? 'formaction="' . $btn->getFormAction() . '"' : '' !!}
{!! $btn->getFormEnctype() ? 'formenctype="' . $btn->getFormEnctype() . '"' : '' !!}
{!! $btn->getFormMethod() ? 'formmethod="' . $btn->getFormMethod() . '"' : '' !!}
{!! $btn->getFormTarget() ? 'formtarget="' . $btn->getFormTarget() . '"' : '' !!}
{!! $btn->getDisabled() ? 'disabled' : '' !!}
{!! $btn->getAutoFocus() ? 'autofocus' : '' !!}
{!! $btn->getFormNoValidate() ? 'formnovalidate' : '' !!}>
{!! $btn->getIcon() ? '<span class="fa-fw ' . $btn->getIcon() . '"></span>' : '' !!}
@lang($btn->getText())
</button>
@else
<a href="{!! $btn->getHref() !!}"
{!! $btn->getId() ? 'id="' . $btn->getId() . '"' : '' !!}
{!! $btn->getClass() ? 'class="' . $btn->getClass() . '"' : '' !!}
{!! $btn->getData() !!}
{!! $btn->getTarget() ? ('target="' . $btn->getTarget() . '"') : '' !!}
{!! $btn->getName() ? 'name="' . $btn->getName() . '"' : '' !!}>
{!! $btn->getIcon() ? '<span class="fa-fw ' . $btn->getIcon() . '"></span>' : '' !!}
@lang($btn->getText())
</a>
@endif
@if($btn->hasDropdown())
<button type="button"
class="dropdown-toggle dropdown-toggle-split{{ $btn->getClass() ? ' ' . $btn->getClass() : ''}}"
data-bs-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
@foreach($btn->getDropdownItems() as $subBtn)
@if(in_array($subBtn->getType(), ['button', 'submit', 'reset']))
<button
{!! $subBtn->getId() ? 'id="' . $subBtn->getId() . '"' : '' !!}
class="dropdown-item{{ $subBtn->getClass() ? ' ' . $subBtn->getClass() : '' }}"
{!! $subBtn->getName() ? 'name="' . $subBtn->getName() . '"' : '' !!}
{!! $subBtn->getValue() ? 'name="' . $subBtn->getValue() . '"' : '' !!}
{!! in_array($subBtn->getType(), ['button', 'reset']) ? 'type="' . $subBtn->getType() . '"' : '' !!}
{!! $subBtn->getForm() ? 'form="' . $subBtn->getForm() . '"' : '' !!}
{!! $subBtn->getData() !!}
{!! $subBtn->getFormAction() ? 'formaction="' . $subBtn->getFormAction() . '"' : '' !!}
{!! $subBtn->getFormEnctype() ? 'formenctype="' . $subBtn->getFormEnctype() . '"' : '' !!}
{!! $subBtn->getFormMethod() ? 'formmethod="' . $subBtn->getFormMethod() . '"' : '' !!}
{!! $subBtn->getFormTarget() ? 'formtarget="' . $subBtn->getFormTarget() . '"' : '' !!}
{!! $subBtn->getDisabled() ? 'disabled' : '' !!}
{!! $subBtn->getAutoFocus() ? 'autofocus' : '' !!}
{!! $subBtn->getFormNoValidate() ? 'formnovalidate' : '' !!}>
{!! $subBtn->getIcon() ? '<span class="fa-fw ' . $subBtn->getIcon() . '"></span>' : '' !!}
@lang($btn->getText())
</button>
@else
<a href="{{ $subBtn->getHref() }}"
{!! $subBtn->getId() ? 'id="' . $subBtn->getId() . '"' : '' !!}
class="dropdown-item{{ $subBtn->getClass() ? ' ' . $subBtn->getClass() : '' }}"
{!! $subBtn->getName() ? 'name="' . $subBtn->getName() . '"' : '' !!}>
{!! $subBtn->getIcon() ? '<span class="fa-fw ' . $subBtn->getIcon() . '"></span>' : '' !!}
@lang($btn->getText())
</a>
@endif
@endforeach
</div>
@endif
@if($btn->hasDropdown())
</div>
@endif
@endif