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(),
|
'facilities' => $outlet->facilities->pluck('name')->toArray(),
|
||||||
'opened_date' => formatDate($outlet->opened_date),
|
'opened_date' => formatDate($outlet->opened_date),
|
||||||
'opened_ago' => timeAgo($outlet->opened_date),
|
'opened_ago' => timeAgo($outlet->opened_date),
|
||||||
'closed_date' => $outlet->closed_date ? formatDate($outlet->closed_date) : null,
|
'closed_date' => formatDate($outlet->closed_date),
|
||||||
'closed_ago' => $outlet->closed_date ? timeAgo($outlet->closed_date) : null,
|
'closed_ago' => timeAgo($outlet->closed_date),
|
||||||
'edit_route' => route('studio.master.outlet.edit', $outlet->hash),
|
|
||||||
'delete_route' => route('studio.master.outlet.delete', $outlet->hash),
|
|
||||||
'image' => data_get($this->mapMediaCollection($outlet->getMedia('featured_image'))[0] ?? null, 'temporaryUrl', asset('images/placeholder.jpg')),
|
'image' => data_get($this->mapMediaCollection($outlet->getMedia('featured_image'))[0] ?? null, 'temporaryUrl', asset('images/placeholder.jpg')),
|
||||||
'images' => collect($this->mapMediaCollection($outlet->getMedia('images')))
|
'images' => collect($this->mapMediaCollection($outlet->getMedia('images')))->pluck('temporaryUrl')->filter()->values(),
|
||||||
->pluck('temporaryUrl')
|
|
||||||
->filter()
|
|
||||||
->values(),
|
|
||||||
])
|
])
|
||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,14 +3,14 @@
|
|||||||
<div>
|
<div>
|
||||||
<flux:heading size="xl">{{ $pageTitle }}</flux:heading>
|
<flux:heading size="xl">{{ $pageTitle }}</flux:heading>
|
||||||
</div>
|
</div>
|
||||||
@if (auth()->user()->can('create outlet'))
|
@can('create outlet')
|
||||||
<div>
|
<div>
|
||||||
<flux:button href="{{ route('studio.master.outlet.create') }}" variant="primary" wire:navigate.hover
|
<flux:button href="{{ route('studio.master.outlet.create') }}" variant="primary" wire:navigate.hover
|
||||||
class="text-sm">
|
class="text-sm">
|
||||||
Tambah
|
Tambah
|
||||||
</flux:button>
|
</flux:button>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endcan
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-6">
|
<div class="mt-6">
|
||||||
@ -106,26 +106,29 @@ class="font-medium text-gray-700 dark:text-gray-300">{{ $day }}:</span>
|
|||||||
</flux:avatar.group>
|
</flux:avatar.group>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<flux:separator></flux:separator>
|
@canany(['update outlet', 'delete outlet'])
|
||||||
|
<flux:separator></flux:separator>
|
||||||
<div class="flex gap-2 pt-2 border-gray-200 dark:border-gray-700">
|
<div class="flex gap-2 pt-2 border-gray-200 dark:border-gray-700">
|
||||||
@if (auth()->user()->can('update outlet'))
|
@can('update outlet')
|
||||||
<flux:tooltip content="Ubah">
|
<flux:tooltip content="Ubah">
|
||||||
<flux:button href="{{ $outlet['edit_route'] }}" wire:navigate.hover variant="primary"
|
<flux:button href="{{ route('studio.master.outlet.edit', $outlet['hash']) }}"
|
||||||
color="yellow" icon="pencil-square" size="sm"></flux:button>
|
wire:navigate.hover variant="primary" color="yellow" icon="pencil-square"
|
||||||
</flux:tooltip>
|
size="sm">
|
||||||
@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'] }}'})">
|
|
||||||
</flux:button>
|
</flux:button>
|
||||||
</flux:tooltip>
|
</flux:tooltip>
|
||||||
</flux:modal.trigger>
|
@endcan
|
||||||
@endif
|
|
||||||
</div>
|
@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>
|
</flux:card>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user