libra/resources/views/livewire/admin/widgets/recent-updates.blade.php

46 lines
1.5 KiB
PHP

<?php
use App\Models\TimelineUpdate;
use Livewire\Volt\Component;
new class extends Component
{
public function with(): array
{
return [
'recentUpdates' => TimelineUpdate::query()
->with(['timeline:id,case_name,user_id', 'timeline.user:id,full_name'])
->latest()
->take(5)
->get(),
];
}
}; ?>
<div wire:poll.30s>
<flux:heading size="sm" class="mb-4">{{ __('widgets.recent_timeline_updates') }}</flux:heading>
@forelse ($recentUpdates as $update)
<a
wire:key="update-{{ $update->id }}"
href="{{ route('admin.timelines.show', $update->timeline_id) }}"
class="block border-b border-zinc-100 py-2 last:border-0 hover:bg-zinc-50"
wire:navigate
>
<div class="text-sm text-zinc-900">
{{ Str::limit($update->update_text, 50) }}
</div>
<div class="mt-1 flex items-center gap-2 text-xs text-zinc-500">
<span>{{ $update->timeline?->case_name ?? __('widgets.unknown_case') }}</span>
<span>&bull;</span>
<span>{{ $update->timeline?->user?->full_name ?? __('widgets.unknown_client') }}</span>
</div>
<div class="mt-1 text-xs text-zinc-400">
{{ $update->created_at->diffForHumans() }}
</div>
</a>
@empty
<flux:text class="text-zinc-500">{{ __('widgets.no_recent_updates') }}</flux:text>
@endforelse
</div>