other scenario fixed
This commit is contained in:
parent
819f6587bd
commit
4a5858f724
@ -282,7 +282,7 @@ class DeleteLink extends Component
|
|||||||
|
|
||||||
protected function getClass($class)
|
protected function getClass($class)
|
||||||
{
|
{
|
||||||
$default_class = 'w-full flex items-center text-purple px-2 h-9 leading-9 whitespace-nowrap';
|
$default_class = 'w-full flex items-center text-red sm:text-purple px-2 h-9 leading-9 whitespace-nowrap';
|
||||||
|
|
||||||
$explode = explode(',', $this->override);
|
$explode = explode(',', $this->override);
|
||||||
|
|
||||||
|
7
public/akaunting-js/generalAction.js
vendored
7
public/akaunting-js/generalAction.js
vendored
@ -28,7 +28,12 @@ document.querySelectorAll("[data-table-body]").forEach((table) => {
|
|||||||
for (let i = first_selector; i < td.length - 1; i++) {
|
for (let i = first_selector; i < td.length - 1; i++) {
|
||||||
let td_item = td[i];
|
let td_item = td[i];
|
||||||
|
|
||||||
td_item.addEventListener("click", () => {
|
td_item.addEventListener("click", (event) => {
|
||||||
|
// click disabled when preview dialog is open
|
||||||
|
if (event.target.closest('[data-tooltip-target]')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// click disabled when preview dialog is open
|
||||||
window.location.href = row_href;
|
window.location.href = row_href;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
5
public/css/app.css
vendored
5
public/css/app.css
vendored
@ -57052,6 +57052,11 @@ body{
|
|||||||
line-height: 2.75rem;
|
line-height: 2.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sm\:text-purple{
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(85 88 139 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
[dir="ltr"] .sm\:ltr\:right-4{
|
[dir="ltr"] .sm\:ltr\:right-4{
|
||||||
right: 1rem;
|
right: 1rem;
|
||||||
}
|
}
|
||||||
|
@ -1,28 +1,55 @@
|
|||||||
<x-button
|
@mobile
|
||||||
type="button"
|
<x-button
|
||||||
class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer group/tooltip index-actions"
|
type="button"
|
||||||
@click="onDeleteViaConfirmation('delete-{{ $modelTable }}-{{ $id }}')"
|
class="w-full flex items-center text-red sm:text-purple px-2 h-9 leading-9"
|
||||||
override="class"
|
@click="onDeleteViaConfirmation('delete-{{ $modelTable }}-{{ $id }}')"
|
||||||
{{ $attributes }}
|
override="class"
|
||||||
>
|
{{ $attributes }}
|
||||||
@if ($slot->isNotEmpty())
|
>
|
||||||
{!! $slot !!}
|
@if ($slot->isNotEmpty())
|
||||||
@else
|
{!! $slot !!}
|
||||||
<span class="material-icons-outlined text-purple text-lg pointer-events-none">delete</span>
|
@else
|
||||||
<div class="inline-block absolute invisible z-10 py-1 px-2 text-sm font-medium text-gray-900 bg-white rounded-lg border border-gray-200 shadow-sm opacity-0 whitespace-nowrap -top-10 -left-2 group-hover/tooltip:opacity-100 group-hover/tooltip:visible" data-tooltip-placement="top">
|
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">{!! $label !!}</span>
|
||||||
<span>{!! $label !!}</span>
|
@endif
|
||||||
<div class="absolute w-2 h-2 -bottom-1 before:content-[' '] before:absolute before:w-2 before:h-2 before:bg-white before:border-gray-200 before:transform before:rotate-45 before:border before:border-t-0 before:border-l-0" data-popper-arrow></div>
|
|
||||||
</div>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<x-form.input.hidden
|
<x-form.input.hidden
|
||||||
name="delete-{{ $modelTable }}-{{ $id }}"
|
name="delete-{{ $modelTable }}-{{ $id }}"
|
||||||
id="delete-{{ $modelTable }}-{{ $id }}"
|
id="delete-{{ $modelTable }}-{{ $id }}"
|
||||||
data-field="delete"
|
data-field="delete"
|
||||||
data-action="{{ $action }}"
|
data-action="{{ $action }}"
|
||||||
data-title="{!! $title !!}"
|
data-title="{!! $title !!}"
|
||||||
data-message="{!! $message !!}"
|
data-message="{!! $message !!}"
|
||||||
data-cancel="{!! $cancelText !!}"
|
data-cancel="{!! $cancelText !!}"
|
||||||
data-delete="{!! $deleteText !!}"
|
data-delete="{!! $deleteText !!}"
|
||||||
/>
|
/>
|
||||||
</x-button>
|
</x-button>
|
||||||
|
@else
|
||||||
|
<x-button
|
||||||
|
type="button"
|
||||||
|
class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer group/tooltip index-actions"
|
||||||
|
@click="onDeleteViaConfirmation('delete-{{ $modelTable }}-{{ $id }}')"
|
||||||
|
override="class"
|
||||||
|
{{ $attributes }}
|
||||||
|
>
|
||||||
|
@if ($slot->isNotEmpty())
|
||||||
|
{!! $slot !!}
|
||||||
|
@else
|
||||||
|
<span class="material-icons-outlined text-purple text-lg pointer-events-none">delete</span>
|
||||||
|
<div class="inline-block absolute invisible z-10 py-1 px-2 text-sm font-medium text-gray-900 bg-white rounded-lg border border-gray-200 shadow-sm opacity-0 whitespace-nowrap -top-10 -left-2 group-hover/tooltip:opacity-100 group-hover/tooltip:visible" data-tooltip-placement="top">
|
||||||
|
<span>{!! $label !!}</span>
|
||||||
|
<div class="absolute w-2 h-2 -bottom-1 before:content-[' '] before:absolute before:w-2 before:h-2 before:bg-white before:border-gray-200 before:transform before:rotate-45 before:border before:border-t-0 before:border-l-0" data-popper-arrow></div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<x-form.input.hidden
|
||||||
|
name="delete-{{ $modelTable }}-{{ $id }}"
|
||||||
|
id="delete-{{ $modelTable }}-{{ $id }}"
|
||||||
|
data-field="delete"
|
||||||
|
data-action="{{ $action }}"
|
||||||
|
data-title="{!! $title !!}"
|
||||||
|
data-message="{!! $message !!}"
|
||||||
|
data-cancel="{!! $cancelText !!}"
|
||||||
|
data-delete="{!! $deleteText !!}"
|
||||||
|
/>
|
||||||
|
</x-button>
|
||||||
|
@endmobile
|
||||||
|
134
resources/views/components/table/actions-mobile.blade.php
Normal file
134
resources/views/components/table/actions-mobile.blade.php
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
@php
|
||||||
|
$count_buttons = 1;
|
||||||
|
$more_actions = [];
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<div
|
||||||
|
data-mobile-actions
|
||||||
|
class="absolute w-6 h-6 flex items-center justify-center ltr:right-0 rtl:left-0 -top-3 py-0.5 px-1 bg-white border rounded-full cursor-pointer hover:bg-gray-100"
|
||||||
|
>
|
||||||
|
<span class="material-icons-outlined text-lg">
|
||||||
|
more_horiz
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
data-mobile-actions-modal
|
||||||
|
class="modal w-full h-full fixed top-0 left-0 right-0 justify-center items-center flex-wrap overflow-y-auto overflow-hidden z-50 hidden modal-background"
|
||||||
|
>
|
||||||
|
<div class="w-full my-10 m-auto flex flex-col px-2 sm:px-0 max-w-md">
|
||||||
|
<div class="p-2 bg-body rounded-lg">
|
||||||
|
@foreach ($actions as $action)
|
||||||
|
@if (! empty($action['permission']))
|
||||||
|
@can($action['permission'])
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@if ($count_buttons > 3 && $loop->count > 4)
|
||||||
|
@break
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@php
|
||||||
|
$type = ! empty($action['type']) ? $action['type'] : 'link';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@switch($type)
|
||||||
|
@case('button')
|
||||||
|
<button type="button" class="w-full flex items-center text-purple px-2 h-9 leading-9" {!! $action['attributes'] ?? null !!}>
|
||||||
|
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
||||||
|
{{ $action['title'] }}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
@break
|
||||||
|
|
||||||
|
@case('delete')
|
||||||
|
@php
|
||||||
|
$title = $action['title'] ?? null;
|
||||||
|
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
|
||||||
|
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
<x-delete-button :model="$action['model']" :route="$action['route']" :text="$title" :model-id="$modelId" :model-name="$modelName" />
|
||||||
|
@break
|
||||||
|
|
||||||
|
@default
|
||||||
|
<a href="{{ $action['url'] }}" class="w-full flex items-center text-purple px-2 h-9 leading-9" {!! $action['attributes'] ?? null !!}>
|
||||||
|
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
||||||
|
{{ $action['title'] }}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
@endswitch
|
||||||
|
|
||||||
|
@php
|
||||||
|
array_shift($actions);
|
||||||
|
|
||||||
|
$count_buttons++;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if (! empty($action['permission']))
|
||||||
|
@endcan
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@foreach ($actions as $action)
|
||||||
|
@if (! empty($action['permission']))
|
||||||
|
@can($action['permission'])
|
||||||
|
@php $more_actions[] = $action; @endphp
|
||||||
|
@endcan
|
||||||
|
@else
|
||||||
|
@php $more_actions[] = $action; @endphp
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@if ($more_actions)
|
||||||
|
@php $divider = false; @endphp
|
||||||
|
|
||||||
|
@foreach ($more_actions as $action)
|
||||||
|
@php
|
||||||
|
$type = ! empty($action['type']) ? $action['type'] : 'link';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@switch($type)
|
||||||
|
@case('button')
|
||||||
|
@php $divider = false; @endphp
|
||||||
|
|
||||||
|
<button type="button" class="w-full flex items-center text-purple px-2 h-9 leading-9" {!! $action['attributes'] ?? null !!}>
|
||||||
|
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
||||||
|
{{ $action['title'] }}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
@break
|
||||||
|
|
||||||
|
@case('delete')
|
||||||
|
@php $divider = false; @endphp
|
||||||
|
|
||||||
|
@php
|
||||||
|
$title = $action['title'] ?? null;
|
||||||
|
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
|
||||||
|
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
|
||||||
|
@endphp
|
||||||
|
<x-delete-link :model="$action['model']" :route="$action['route']" :text="$title" :model-id="$modelId" :model-name="$modelName" />
|
||||||
|
@break
|
||||||
|
|
||||||
|
@case('divider')
|
||||||
|
@if (! $divider)
|
||||||
|
@php $divider = true; @endphp
|
||||||
|
<div class="py-2 px-2">
|
||||||
|
<div class="w-full border-t border-gray-200"></div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
@break
|
||||||
|
|
||||||
|
@default
|
||||||
|
@php $divider = false; @endphp
|
||||||
|
|
||||||
|
<a href="{{ $action['url'] }}" class="w-full flex items-center text-purple px-2 h-9 leading-9" {!! $action['attributes'] ?? null !!}>
|
||||||
|
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
||||||
|
{{ $action['title'] }}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
@endswitch
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -4,264 +4,135 @@
|
|||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@mobile
|
@mobile
|
||||||
<div
|
<x-table.actions-mobile :actions="$actions" :model="$model" />
|
||||||
data-mobile-actions
|
@else
|
||||||
class="absolute w-7 h-7 flex items-center justify-center ltr:right-0 rtl:left-0 -top-4 py-0.5 px-1 bg-white border rounded-full cursor-pointer hover:bg-gray-100"
|
<div class="absolute ltr:right-12 rtl:left-12 -top-4 hidden items-center group-hover:flex">
|
||||||
>
|
@foreach ($actions as $action)
|
||||||
<span class="material-icons-outlined text-lg">
|
@if (! empty($action['permission']))
|
||||||
arrow_drop_up
|
@can($action['permission'])
|
||||||
</span>
|
@endif
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
@if ($count_buttons > 3 && $loop->count > 4)
|
||||||
data-mobile-actions-modal
|
@break
|
||||||
class="modal w-full h-full fixed top-0 left-0 right-0 justify-center items-center flex-wrap overflow-y-auto overflow-hidden z-50 hidden modal-background"
|
@endif
|
||||||
>
|
|
||||||
<div class="w-full my-10 m-auto flex flex-col px-2 sm:px-0 max-w-md">
|
|
||||||
<div class="p-5 bg-body rounded-lg">
|
|
||||||
@foreach ($actions as $action)
|
|
||||||
@if (! empty($action['permission']))
|
|
||||||
@can($action['permission'])
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if ($count_buttons > 3 && $loop->count > 4)
|
@php
|
||||||
|
$type = ! empty($action['type']) ? $action['type'] : 'link';
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@switch($type)
|
||||||
|
@case('button')
|
||||||
|
<button type="button" class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer index-actions group/tooltip" {!! $action['attributes'] ?? null !!}>
|
||||||
|
<span class="material-icons-outlined text-purple text-lg pointer-events-none">
|
||||||
|
{{ $action['icon'] }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="inline-block absolute invisible z-20 py-1 px-2 text-sm font-medium text-gray-900 bg-white rounded-lg border border-gray-200 shadow-sm whitespace-nowrap opacity-0 -top-10 -left-2 group-hover/tooltip:opacity-100 group-hover/tooltip:visible" data-tooltip-placement="top">
|
||||||
|
<span>{{ $action['title'] }}</span>
|
||||||
|
<div class="absolute w-2 h-2 -bottom-1 before:content-[' '] before:absolute before:w-2 before:h-2 before:bg-white before:border-gray-200 before:transform before:rotate-45 before:border before:border-t-0 before:border-l-0" data-popper-arrow></div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
@break
|
@break
|
||||||
@endif
|
|
||||||
|
|
||||||
@php
|
@case('delete')
|
||||||
$type = ! empty($action['type']) ? $action['type'] : 'link';
|
@php
|
||||||
@endphp
|
$title = $action['title'] ?? null;
|
||||||
|
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
|
||||||
|
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
|
||||||
|
@endphp
|
||||||
|
|
||||||
@switch($type)
|
<x-delete-button :model="$action['model']" :route="$action['route']" :text="$title" :model-id="$modelId" :model-name="$modelName" />
|
||||||
@case('button')
|
@break
|
||||||
<button type="button" class="w-full flex items-center text-purple px-2 h-9 leading-9" {!! $action['attributes'] ?? null !!}>
|
|
||||||
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
|
||||||
{{ $action['title'] }}
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
@break
|
|
||||||
|
|
||||||
@case('delete')
|
@default
|
||||||
|
<a href="{{ $action['url'] }}" class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer index-actions group/tooltip" {!! $action['attributes'] ?? null !!}>
|
||||||
|
<span class="material-icons-outlined text-purple text-lg pointer-events-none">
|
||||||
|
{{ $action['icon'] }}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="inline-block absolute invisible z-20 py-1 px-2 text-sm font-medium text-gray-900 bg-white rounded-lg border border-gray-200 shadow-sm whitespace-nowrap opacity-0 -top-10 -left-2 group-hover/tooltip:opacity-100 group-hover/tooltip:visible" data-tooltip-placement="top">
|
||||||
|
<span>{{ $action['title'] }}</span>
|
||||||
|
<div class="absolute w-2 h-2 -bottom-1 before:content-[' '] before:absolute before:w-2 before:h-2 before:bg-white before:border-gray-200 before:transform before:rotate-45 before:border before:border-t-0 before:border-l-0" data-popper-arrow></div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
@endswitch
|
||||||
|
|
||||||
|
@php
|
||||||
|
array_shift($actions);
|
||||||
|
|
||||||
|
$count_buttons++;
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
@if (! empty($action['permission']))
|
||||||
|
@endcan
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@foreach ($actions as $action)
|
||||||
|
@if (! empty($action['permission']))
|
||||||
|
@can($action['permission'])
|
||||||
|
@php $more_actions[] = $action; @endphp
|
||||||
|
@endcan
|
||||||
|
@else
|
||||||
|
@php $more_actions[] = $action; @endphp
|
||||||
|
@endif
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@if ($more_actions)
|
||||||
|
@php $divider = false; @endphp
|
||||||
|
|
||||||
|
<div class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer index-actions">
|
||||||
|
<button type="button" data-dropdown-toggle="dropdown-actions-{{ $loop->index }}" data-dropdown-placement="left" class="material-icons-outlined text-purple text-lg">more_horiz</button>
|
||||||
|
|
||||||
|
<div id="dropdown-actions-{{ $loop->index }}" data-dropdown-actions class="absolute py-2 bg-white rounded-md border border-gray-200 shadow-xl z-20 hidden !mt-[50px]" style="left:auto; min-width:10rem;">
|
||||||
|
@foreach ($more_actions as $action)
|
||||||
@php
|
@php
|
||||||
$title = $action['title'] ?? null;
|
$type = ! empty($action['type']) ? $action['type'] : 'link';
|
||||||
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
|
|
||||||
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<x-delete-button :model="$action['model']" :route="$action['route']" :text="$title" :model-id="$modelId" :model-name="$modelName" />
|
@switch($type)
|
||||||
@break
|
@case('button')
|
||||||
|
@php $divider = false; @endphp
|
||||||
|
|
||||||
@default
|
<div class="w-full flex items-center text-purple px-2 h-9 leading-9 whitespace-nowrap" {!! $action['attributes'] ?? null !!}>
|
||||||
<a href="{{ $action['url'] }}" class="w-full flex items-center text-purple px-2 h-9 leading-9" {!! $action['attributes'] ?? null !!}>
|
<button type="button" class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
||||||
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
{{ $action['title'] }}
|
||||||
{{ $action['title'] }}
|
</button>
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
@endswitch
|
|
||||||
|
|
||||||
@php
|
|
||||||
array_shift($actions);
|
|
||||||
|
|
||||||
$count_buttons++;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (! empty($action['permission']))
|
|
||||||
@endcan
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@foreach ($actions as $action)
|
|
||||||
@if (! empty($action['permission']))
|
|
||||||
@can($action['permission'])
|
|
||||||
@php $more_actions[] = $action; @endphp
|
|
||||||
@endcan
|
|
||||||
@else
|
|
||||||
@php $more_actions[] = $action; @endphp
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@if ($more_actions)
|
|
||||||
@php $divider = false; @endphp
|
|
||||||
|
|
||||||
@foreach ($more_actions as $action)
|
|
||||||
@php
|
|
||||||
$type = ! empty($action['type']) ? $action['type'] : 'link';
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@switch($type)
|
|
||||||
@case('button')
|
|
||||||
@php $divider = false; @endphp
|
|
||||||
|
|
||||||
<button type="button" class="w-full flex items-center text-purple px-2 h-9 leading-9" {!! $action['attributes'] ?? null !!}>
|
|
||||||
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
|
||||||
{{ $action['title'] }}
|
|
||||||
</span>
|
|
||||||
</button>
|
|
||||||
@break
|
|
||||||
|
|
||||||
@case('delete')
|
|
||||||
@php $divider = false; @endphp
|
|
||||||
|
|
||||||
@php
|
|
||||||
$title = $action['title'] ?? null;
|
|
||||||
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
|
|
||||||
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
|
|
||||||
@endphp
|
|
||||||
<x-delete-link :model="$action['model']" :route="$action['route']" :text="$title" :model-id="$modelId" :model-name="$modelName" />
|
|
||||||
@break
|
|
||||||
|
|
||||||
@case('divider')
|
|
||||||
@if (! $divider)
|
|
||||||
@php $divider = true; @endphp
|
|
||||||
<div class="py-2 px-2">
|
|
||||||
<div class="w-full border-t border-gray-200"></div>
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@break
|
||||||
@break
|
|
||||||
|
|
||||||
@default
|
@case('delete')
|
||||||
@php $divider = false; @endphp
|
@php $divider = false; @endphp
|
||||||
|
|
||||||
<a href="{{ $action['url'] }}" class="w-full flex items-center text-purple px-2 h-9 leading-9" {!! $action['attributes'] ?? null !!}>
|
@php
|
||||||
<span class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
$title = $action['title'] ?? null;
|
||||||
{{ $action['title'] }}
|
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
|
||||||
</span>
|
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
|
||||||
</a>
|
@endphp
|
||||||
@endswitch
|
<x-delete-link :model="$action['model']" :route="$action['route']" :text="$title" :model-id="$modelId" :model-name="$modelName" />
|
||||||
@endforeach
|
@break
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@else
|
@case('divider')
|
||||||
<div class="absolute ltr:right-12 rtl:left-12 -top-4 hidden items-center group-hover:flex">
|
@if (! $divider)
|
||||||
@foreach ($actions as $action)
|
@php $divider = true; @endphp
|
||||||
@if (! empty($action['permission']))
|
<div class="py-2 px-2">
|
||||||
@can($action['permission'])
|
<div class="w-full border-t border-gray-200"></div>
|
||||||
@endif
|
</div>
|
||||||
|
@endif
|
||||||
|
@break
|
||||||
|
|
||||||
@if ($count_buttons > 3 && $loop->count > 4)
|
@default
|
||||||
@break
|
@php $divider = false; @endphp
|
||||||
@endif
|
|
||||||
|
|
||||||
@php
|
<div class="w-full flex items-center text-purple px-2 h-9 leading-9 whitespace-nowrap" {!! $action['attributes'] ?? null !!}>
|
||||||
$type = ! empty($action['type']) ? $action['type'] : 'link';
|
<a href="{{ $action['url'] }}" class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
||||||
@endphp
|
{{ $action['title'] }}
|
||||||
|
</a>
|
||||||
@switch($type)
|
|
||||||
@case('button')
|
|
||||||
<button type="button" class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer index-actions group/tooltip" {!! $action['attributes'] ?? null !!}>
|
|
||||||
<span class="material-icons-outlined text-purple text-lg pointer-events-none">
|
|
||||||
{{ $action['icon'] }}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="inline-block absolute invisible z-20 py-1 px-2 text-sm font-medium text-gray-900 bg-white rounded-lg border border-gray-200 shadow-sm whitespace-nowrap opacity-0 -top-10 -left-2 group-hover/tooltip:opacity-100 group-hover/tooltip:visible" data-tooltip-placement="top">
|
|
||||||
<span>{{ $action['title'] }}</span>
|
|
||||||
<div class="absolute w-2 h-2 -bottom-1 before:content-[' '] before:absolute before:w-2 before:h-2 before:bg-white before:border-gray-200 before:transform before:rotate-45 before:border before:border-t-0 before:border-l-0" data-popper-arrow></div>
|
|
||||||
</div>
|
|
||||||
</button>
|
|
||||||
@break
|
|
||||||
|
|
||||||
@case('delete')
|
|
||||||
@php
|
|
||||||
$title = $action['title'] ?? null;
|
|
||||||
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
|
|
||||||
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
<x-delete-button :model="$action['model']" :route="$action['route']" :text="$title" :model-id="$modelId" :model-name="$modelName" />
|
|
||||||
@break
|
|
||||||
|
|
||||||
@default
|
|
||||||
<a href="{{ $action['url'] }}" class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer index-actions group/tooltip" {!! $action['attributes'] ?? null !!}>
|
|
||||||
<span class="material-icons-outlined text-purple text-lg pointer-events-none">
|
|
||||||
{{ $action['icon'] }}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<div class="inline-block absolute invisible z-20 py-1 px-2 text-sm font-medium text-gray-900 bg-white rounded-lg border border-gray-200 shadow-sm whitespace-nowrap opacity-0 -top-10 -left-2 group-hover/tooltip:opacity-100 group-hover/tooltip:visible" data-tooltip-placement="top">
|
|
||||||
<span>{{ $action['title'] }}</span>
|
|
||||||
<div class="absolute w-2 h-2 -bottom-1 before:content-[' '] before:absolute before:w-2 before:h-2 before:bg-white before:border-gray-200 before:transform before:rotate-45 before:border before:border-t-0 before:border-l-0" data-popper-arrow></div>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
@endswitch
|
|
||||||
|
|
||||||
@php
|
|
||||||
array_shift($actions);
|
|
||||||
|
|
||||||
$count_buttons++;
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@if (! empty($action['permission']))
|
|
||||||
@endcan
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@foreach ($actions as $action)
|
|
||||||
@if (! empty($action['permission']))
|
|
||||||
@can($action['permission'])
|
|
||||||
@php $more_actions[] = $action; @endphp
|
|
||||||
@endcan
|
|
||||||
@else
|
|
||||||
@php $more_actions[] = $action; @endphp
|
|
||||||
@endif
|
|
||||||
@endforeach
|
|
||||||
|
|
||||||
@if ($more_actions)
|
|
||||||
@php $divider = false; @endphp
|
|
||||||
|
|
||||||
<div class="relative bg-white hover:bg-gray-100 border py-0.5 px-1 cursor-pointer index-actions">
|
|
||||||
<button type="button" data-dropdown-toggle="dropdown-actions-{{ $loop->index }}" data-dropdown-placement="left" class="material-icons-outlined text-purple text-lg">more_horiz</button>
|
|
||||||
|
|
||||||
<div id="dropdown-actions-{{ $loop->index }}" data-dropdown-actions class="absolute py-2 bg-white rounded-md border border-gray-200 shadow-xl z-20 hidden !mt-[50px]" style="left:auto; min-width:10rem;">
|
|
||||||
@foreach ($more_actions as $action)
|
|
||||||
@php
|
|
||||||
$type = ! empty($action['type']) ? $action['type'] : 'link';
|
|
||||||
@endphp
|
|
||||||
|
|
||||||
@switch($type)
|
|
||||||
@case('button')
|
|
||||||
@php $divider = false; @endphp
|
|
||||||
|
|
||||||
<div class="w-full flex items-center text-purple px-2 h-9 leading-9 whitespace-nowrap" {!! $action['attributes'] ?? null !!}>
|
|
||||||
<button type="button" class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
|
||||||
{{ $action['title'] }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
@break
|
|
||||||
|
|
||||||
@case('delete')
|
|
||||||
@php $divider = false; @endphp
|
|
||||||
|
|
||||||
@php
|
|
||||||
$title = $action['title'] ?? null;
|
|
||||||
$modelId = ! empty($action['model-id']) ? $action['model-id'] : 'id';
|
|
||||||
$modelName = ! empty($action['model-name']) ? $action['model-name'] : 'name';
|
|
||||||
@endphp
|
|
||||||
<x-delete-link :model="$action['model']" :route="$action['route']" :text="$title" :model-id="$modelId" :model-name="$modelName" />
|
|
||||||
@break
|
|
||||||
|
|
||||||
@case('divider')
|
|
||||||
@if (! $divider)
|
|
||||||
@php $divider = true; @endphp
|
|
||||||
<div class="py-2 px-2">
|
|
||||||
<div class="w-full border-t border-gray-200"></div>
|
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endswitch
|
||||||
@break
|
@endforeach
|
||||||
|
</div>
|
||||||
@default
|
|
||||||
@php $divider = false; @endphp
|
|
||||||
|
|
||||||
<div class="w-full flex items-center text-purple px-2 h-9 leading-9 whitespace-nowrap" {!! $action['attributes'] ?? null !!}>
|
|
||||||
<a href="{{ $action['url'] }}" class="w-full h-full flex items-center rounded-md px-2 text-sm hover:bg-lilac-100">
|
|
||||||
{{ $action['title'] }}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
@endswitch
|
|
||||||
@endforeach
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
@endif
|
||||||
@endif
|
</div>
|
||||||
</div>
|
|
||||||
@endmobile
|
@endmobile
|
||||||
|
@ -16,6 +16,7 @@ sm:rtl:left-4
|
|||||||
sm:w-500
|
sm:w-500
|
||||||
sm:min-h-500
|
sm:min-h-500
|
||||||
sm:max-w-4xl
|
sm:max-w-4xl
|
||||||
|
sm:text-purple
|
||||||
md:grid-cols-2
|
md:grid-cols-2
|
||||||
lg:mt-2
|
lg:mt-2
|
||||||
lg:pl-24
|
lg:pl-24
|
||||||
|
Loading…
x
Reference in New Issue
Block a user