chore(outlet): menghapus key yang tidak digunakan, menghapus operator ternary dan menyesuaikan can() di view
This commit is contained in:
parent
898659b256
commit
70b28b335c
@ -47,15 +47,10 @@ public function mount()
|
||||
'facilities' => $outlet->facilities->pluck('name')->toArray(),
|
||||
'opened_date' => formatDate($outlet->opened_date),
|
||||
'opened_ago' => timeAgo($outlet->opened_date),
|
||||
'closed_date' => $outlet->closed_date ? formatDate($outlet->closed_date) : null,
|
||||
'closed_ago' => $outlet->closed_date ? timeAgo($outlet->closed_date) : null,
|
||||
'edit_route' => route('studio.master.outlet.edit', $outlet->hash),
|
||||
'delete_route' => route('studio.master.outlet.delete', $outlet->hash),
|
||||
'closed_date' => formatDate($outlet->closed_date),
|
||||
'closed_ago' => timeAgo($outlet->closed_date),
|
||||
'image' => data_get($this->mapMediaCollection($outlet->getMedia('featured_image'))[0] ?? null, 'temporaryUrl', asset('images/placeholder.jpg')),
|
||||
'images' => collect($this->mapMediaCollection($outlet->getMedia('images')))
|
||||
->pluck('temporaryUrl')
|
||||
->filter()
|
||||
->values(),
|
||||
'images' => collect($this->mapMediaCollection($outlet->getMedia('images')))->pluck('temporaryUrl')->filter()->values(),
|
||||
])
|
||||
->toArray();
|
||||
}
|
||||
|
||||
@ -3,14 +3,14 @@
|
||||
<div>
|
||||
<flux:heading size="xl">{{ $pageTitle }}</flux:heading>
|
||||
</div>
|
||||
@if (auth()->user()->can('create outlet'))
|
||||
@can('create outlet')
|
||||
<div>
|
||||
<flux:button href="{{ route('studio.master.outlet.create') }}" variant="primary" wire:navigate.hover
|
||||
class="text-sm">
|
||||
Tambah
|
||||
</flux:button>
|
||||
</div>
|
||||
@endif
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
<div class="mt-6">
|
||||
@ -106,26 +106,29 @@ class="font-medium text-gray-700 dark:text-gray-300">{{ $day }}:</span>
|
||||
</flux:avatar.group>
|
||||
</div>
|
||||
|
||||
<flux:separator></flux:separator>
|
||||
|
||||
<div class="flex gap-2 pt-2 border-gray-200 dark:border-gray-700">
|
||||
@if (auth()->user()->can('update outlet'))
|
||||
<flux:tooltip content="Ubah">
|
||||
<flux:button href="{{ $outlet['edit_route'] }}" wire:navigate.hover variant="primary"
|
||||
color="yellow" icon="pencil-square" size="sm"></flux:button>
|
||||
</flux:tooltip>
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->can('delete outlet'))
|
||||
<flux:modal.trigger name="delete">
|
||||
<flux:tooltip content="Hapus">
|
||||
<flux:button variant="danger" icon="trash" size="sm"
|
||||
wire:click="$dispatch('fn:confirmDelete', {id: '{{ $outlet['hash'] }}'})">
|
||||
@canany(['update outlet', 'delete outlet'])
|
||||
<flux:separator></flux:separator>
|
||||
<div class="flex gap-2 pt-2 border-gray-200 dark:border-gray-700">
|
||||
@can('update outlet')
|
||||
<flux:tooltip content="Ubah">
|
||||
<flux:button href="{{ route('studio.master.outlet.edit', $outlet['hash']) }}"
|
||||
wire:navigate.hover variant="primary" color="yellow" icon="pencil-square"
|
||||
size="sm">
|
||||
</flux:button>
|
||||
</flux:tooltip>
|
||||
</flux:modal.trigger>
|
||||
@endif
|
||||
</div>
|
||||
@endcan
|
||||
|
||||
@can('delete outlet')
|
||||
<flux:modal.trigger name="delete">
|
||||
<flux:tooltip content="Hapus">
|
||||
<flux:button variant="danger" icon="trash" size="sm"
|
||||
wire:click="$dispatch('fn:confirmDelete', {id: '{{ $outlet['hash'] }}'})">
|
||||
</flux:button>
|
||||
</flux:tooltip>
|
||||
</flux:modal.trigger>
|
||||
@endcan
|
||||
</div>
|
||||
@endcanany
|
||||
</flux:card>
|
||||
@endforeach
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user