complete story 11.3 with qa tests
This commit is contained in:
@@ -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;
|
||||
|
||||
new class extends Component
|
||||
@@ -75,8 +78,16 @@ new class extends Component
|
||||
]);
|
||||
}
|
||||
|
||||
// Send notification with .ics attachment
|
||||
if ($this->consultation->user) {
|
||||
// Send appropriate notification/email based on guest/client
|
||||
if ($this->consultation->isGuest()) {
|
||||
Mail::to($this->consultation->guest_email)->queue(
|
||||
new GuestBookingApprovedMail(
|
||||
$this->consultation,
|
||||
app()->getLocale(),
|
||||
$this->paymentInstructions ?: null
|
||||
)
|
||||
);
|
||||
} elseif ($this->consultation->user) {
|
||||
$this->consultation->user->notify(
|
||||
new BookingApproved(
|
||||
$this->consultation,
|
||||
@@ -125,8 +136,16 @@ new class extends Component
|
||||
'status' => ConsultationStatus::Rejected,
|
||||
]);
|
||||
|
||||
// Send rejection notification
|
||||
if ($this->consultation->user) {
|
||||
// Send appropriate notification/email based on guest/client
|
||||
if ($this->consultation->isGuest()) {
|
||||
Mail::to($this->consultation->guest_email)->queue(
|
||||
new GuestBookingRejectedMail(
|
||||
$this->consultation,
|
||||
app()->getLocale(),
|
||||
$this->rejectionReason ?: null
|
||||
)
|
||||
);
|
||||
} elseif ($this->consultation->user) {
|
||||
$this->consultation->user->notify(
|
||||
new BookingRejected($this->consultation, $this->rejectionReason ?: null)
|
||||
);
|
||||
@@ -153,6 +172,11 @@ new class extends Component
|
||||
|
||||
public function with(): array
|
||||
{
|
||||
// Guest bookings don't have consultation history
|
||||
if ($this->consultation->isGuest()) {
|
||||
return ['consultationHistory' => collect()];
|
||||
}
|
||||
|
||||
return [
|
||||
'consultationHistory' => Consultation::query()
|
||||
->where('user_id', $this->consultation->user_id)
|
||||
@@ -185,35 +209,50 @@ new class extends Component
|
||||
</flux:callout>
|
||||
@endif
|
||||
|
||||
<!-- Client Information -->
|
||||
<!-- Client/Guest Information -->
|
||||
<div class="bg-white dark:bg-zinc-800 rounded-lg p-6 border border-zinc-200 dark:border-zinc-700 mb-6">
|
||||
<flux:heading size="lg" class="mb-4">{{ __('admin.client_information') }}</flux:heading>
|
||||
<div class="flex items-center gap-2 mb-4">
|
||||
<flux:heading size="lg">{{ __('admin.client_information') }}</flux:heading>
|
||||
@if($consultation->isGuest())
|
||||
<flux:badge color="amber" size="sm">{{ __('admin.guest') }}</flux:badge>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<p class="text-sm text-zinc-500 dark:text-zinc-400">{{ __('admin.client_name') }}</p>
|
||||
<p class="font-medium text-zinc-900 dark:text-zinc-100">
|
||||
{{ $consultation->user?->full_name ?? __('common.unknown') }}
|
||||
{{ $consultation->getClientName() }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm text-zinc-500 dark:text-zinc-400">{{ __('admin.client_email') }}</p>
|
||||
<p class="font-medium text-zinc-900 dark:text-zinc-100">
|
||||
{{ $consultation->user?->email ?? '-' }}
|
||||
<a href="mailto:{{ $consultation->getClientEmail() }}" class="text-primary hover:underline">
|
||||
{{ $consultation->getClientEmail() }}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-sm text-zinc-500 dark:text-zinc-400">{{ __('admin.client_phone') }}</p>
|
||||
<p class="font-medium text-zinc-900 dark:text-zinc-100">
|
||||
{{ $consultation->user?->phone ?? '-' }}
|
||||
@if($consultation->getClientPhone())
|
||||
<a href="tel:{{ $consultation->getClientPhone() }}" class="text-primary hover:underline">
|
||||
{{ $consultation->getClientPhone() }}
|
||||
</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</p>
|
||||
</div>
|
||||
@unless($consultation->isGuest())
|
||||
<div>
|
||||
<p class="text-sm text-zinc-500 dark:text-zinc-400">{{ __('admin.client_type') }}</p>
|
||||
<p class="font-medium text-zinc-900 dark:text-zinc-100">
|
||||
{{ $consultation->user?->user_type?->value ?? '-' }}
|
||||
{{ ucfirst($consultation->user?->user_type?->value ?? '-') }}
|
||||
</p>
|
||||
</div>
|
||||
@endunless
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -312,7 +351,7 @@ new class extends Component
|
||||
|
||||
<!-- Client Info Summary -->
|
||||
<div class="bg-zinc-50 dark:bg-zinc-700 p-4 rounded-lg">
|
||||
<p><strong>{{ __('admin.client') }}:</strong> {{ $consultation->user?->full_name }}</p>
|
||||
<p><strong>{{ __('admin.client') }}:</strong> {{ $consultation->getClientName() }}</p>
|
||||
<p><strong>{{ __('admin.date') }}:</strong> {{ \Carbon\Carbon::parse($consultation->booking_date)->translatedFormat('l, d M Y') }}</p>
|
||||
<p><strong>{{ __('admin.time') }}:</strong> {{ \Carbon\Carbon::parse($consultation->booking_time)->format('g:i A') }}</p>
|
||||
</div>
|
||||
@@ -367,7 +406,7 @@ new class extends Component
|
||||
|
||||
<!-- Client Info Summary -->
|
||||
<div class="bg-zinc-50 dark:bg-zinc-700 p-4 rounded-lg">
|
||||
<p><strong>{{ __('admin.client') }}:</strong> {{ $consultation->user?->full_name }}</p>
|
||||
<p><strong>{{ __('admin.client') }}:</strong> {{ $consultation->getClientName() }}</p>
|
||||
<p><strong>{{ __('admin.date') }}:</strong> {{ \Carbon\Carbon::parse($consultation->booking_date)->translatedFormat('l, d M Y') }}</p>
|
||||
<p><strong>{{ __('admin.time') }}:</strong> {{ \Carbon\Carbon::parse($consultation->booking_time)->format('g:i A') }}</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user