fix : SurgeryAppointment

This commit is contained in:
SajjadMahmoody
2026-04-19 00:57:40 +03:30
parent a02631a3fc
commit e807773403
2 changed files with 27 additions and 60 deletions
+10 -19
View File
@@ -662,11 +662,20 @@ public static function table(Table $table): Table
'surgeryDateFull' => $surgeryDateTime->toDateTimeString(),
];
$appointment = SurgeryAppointment::updateOrCreate(
['patient_id' => $record->id],
[
'surgery_date' => $surgeryDateTime,
'surgery_center_id' => $data['surgery_center_id'],
]
);
try {
$response = \Illuminate\Support\Facades\Http::timeout(30)
->withHeader('X-API-Key', $apiKey)
->asJson()
->post($apiUrl . '/surgery-reminder', $smsPayload);
->post($apiUrl . '/surgery-reminder', array_merge($smsPayload, [
'appointmentId' => $appointment->id,
]));
if (! ($response->json('success') ?? false)) {
\Filament\Notifications\Notification::make()
@@ -689,24 +698,6 @@ public static function table(Table $table): Table
return;
}
$appointment = SurgeryAppointment::updateOrCreate(
['patient_id' => $record->id],
[
'surgery_date' => $surgeryDateTime,
'surgery_center_id' => $data['surgery_center_id'],
]
);
try {
\Illuminate\Support\Facades\Http::timeout(30)
->withHeader('X-API-Key', $apiKey)
->asJson()
->post($apiUrl . '/surgery-reminder', array_merge($smsPayload, [
'appointmentId' => $appointment->id,
]));
} catch (\Throwable) {
}
\Filament\Notifications\Notification::make()
->title(__('patients.actions.appointment_saved'))
->body(__('patients.actions.sms_sent'))