complete story 11.3 with qa tests

This commit is contained in:
Naser Mansour
2026-01-03 19:27:23 +02:00
parent 06ece9f4b2
commit b1e51e085a
17 changed files with 1062 additions and 38 deletions
@@ -3,12 +3,15 @@
use App\Enums\ConsultationStatus;
use App\Enums\ConsultationType;
use App\Enums\PaymentStatus;
use App\Mail\GuestBookingApprovedMail;
use App\Mail\GuestBookingRejectedMail;
use App\Models\AdminLog;
use App\Models\Consultation;
use App\Notifications\BookingApproved;
use App\Notifications\BookingRejected;
use App\Services\CalendarService;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Livewire\Volt\Component;
use Livewire\WithPagination;
@@ -55,6 +58,7 @@ new class extends Component
]);
// Generate calendar file and send notification
$icsContent = null;
try {
$calendarService = app(CalendarService::class);
$icsContent = $calendarService->generateIcs($consultation);
@@ -63,10 +67,17 @@ new class extends Component
'consultation_id' => $consultation->id,
'error' => $e->getMessage(),
]);
$icsContent = null;
}
if ($consultation->user) {
// Send appropriate notification/email based on guest/client
if ($consultation->isGuest()) {
Mail::to($consultation->guest_email)->queue(
new GuestBookingApprovedMail(
$consultation,
app()->getLocale()
)
);
} elseif ($consultation->user) {
$consultation->user->notify(
new BookingApproved($consultation, $icsContent ?? '', null)
);
@@ -106,8 +117,16 @@ new class extends Component
'status' => ConsultationStatus::Rejected,
]);
// Send rejection notification
if ($consultation->user) {
// Send appropriate notification/email based on guest/client
if ($consultation->isGuest()) {
Mail::to($consultation->guest_email)->queue(
new GuestBookingRejectedMail(
$consultation,
app()->getLocale(),
null
)
);
} elseif ($consultation->user) {
$consultation->user->notify(
new BookingRejected($consultation, null)
);
@@ -191,8 +210,11 @@ new class extends Component
<!-- Booking Info -->
<div class="flex-1">
<div class="flex items-center gap-3 mb-2">
@if($booking->isGuest())
<flux:badge color="amber" size="sm">{{ __('admin.guest') }}</flux:badge>
@endif
<span class="font-semibold text-zinc-900 dark:text-zinc-100">
{{ $booking->user?->full_name ?? __('common.unknown') }}
{{ $booking->getClientName() }}
</span>
<flux:badge variant="warning" size="sm">
{{ $booking->status->label() }}
@@ -210,7 +232,9 @@ new class extends Component
</div>
<div class="flex items-center gap-2">
<flux:icon name="envelope" class="w-4 h-4" />
{{ $booking->user?->email ?? '-' }}
<a href="mailto:{{ $booking->getClientEmail() }}" class="hover:underline">
{{ $booking->getClientEmail() }}
</a>
</div>
<div class="flex items-center gap-2">
<flux:icon name="document-text" class="w-4 h-4" />