68 lines
2.3 KiB
PHP
68 lines
2.3 KiB
PHP
<?php
|
|
|
|
use App\Models\Consultation;
|
|
use Livewire\Volt\Component;
|
|
|
|
new class extends Component
|
|
{
|
|
public function with(): array
|
|
{
|
|
return [
|
|
'todaySchedule' => Consultation::approved()
|
|
->whereDate('booking_date', today())
|
|
->with('user:id,full_name')
|
|
->orderBy('booking_time')
|
|
->get(),
|
|
];
|
|
}
|
|
|
|
public function markComplete(int $consultationId): void
|
|
{
|
|
$consultation = Consultation::findOrFail($consultationId);
|
|
$consultation->markAsCompleted();
|
|
}
|
|
|
|
public function markNoShow(int $consultationId): void
|
|
{
|
|
$consultation = Consultation::findOrFail($consultationId);
|
|
$consultation->markAsNoShow();
|
|
}
|
|
}; ?>
|
|
|
|
<div wire:poll.30s>
|
|
<flux:heading size="sm" class="mb-4">{{ __('widgets.todays_schedule') }}</flux:heading>
|
|
|
|
@forelse ($todaySchedule as $consultation)
|
|
<div wire:key="schedule-{{ $consultation->id }}" class="flex items-center justify-between border-b border-zinc-100 py-2 last:border-0">
|
|
<div>
|
|
<div class="font-medium text-zinc-900">
|
|
{{ \Carbon\Carbon::parse($consultation->booking_time)->format('g:i A') }}
|
|
</div>
|
|
<div class="flex items-center gap-2 text-sm text-zinc-500">
|
|
<span>{{ $consultation->user?->full_name ?? __('widgets.unknown_client') }}</span>
|
|
<flux:badge size="sm">{{ $consultation->consultation_type->label() }}</flux:badge>
|
|
</div>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
<flux:button
|
|
size="xs"
|
|
wire:click="markComplete({{ $consultation->id }})"
|
|
wire:loading.attr="disabled"
|
|
>
|
|
{{ __('widgets.complete') }}
|
|
</flux:button>
|
|
<flux:button
|
|
size="xs"
|
|
variant="danger"
|
|
wire:click="markNoShow({{ $consultation->id }})"
|
|
wire:loading.attr="disabled"
|
|
>
|
|
{{ __('widgets.no_show') }}
|
|
</flux:button>
|
|
</div>
|
|
</div>
|
|
@empty
|
|
<flux:text class="text-zinc-500">{{ __('widgets.no_consultations_today') }}</flux:text>
|
|
@endforelse
|
|
</div>
|