feat(appointment): ensure existing profile name is used over modal input for patient name

This commit is contained in:
hamed
2026-07-15 20:33:15 +03:30
parent d91867bd63
commit 13bf9453e5
2 changed files with 42 additions and 1 deletions
@@ -123,7 +123,11 @@ class MyAppointmentsController extends BaseController
if (isset($data['deposit_amount_rials'])) {
$appointment->setDepositAmountRials((int) $data['deposit_amount_rials']);
}
$appointment->setPatientName($patientName);
// The resolver returns the patient keyed on national code, so its profile
// name is the real identity. Snapshot that (not the free-typed modal name)
// so the appointment never diverges from an existing profile; fall back to
// the entered name only for a brand-new patient without a stored name.
$appointment->setPatientName($patient->getRealName() ?: $patientName);
$appointment->setPatientMobile($mobile);
if ($isReserve) {