feat(appointment): real for-another-patient form and booking payload

Replace the mock for-another button with a real toggle: switching keeps
the user's own data, clears the form to editable patient fields (phone
becomes an input, adds علت مراجعه), and can switch back. SubmitData now
sends for_self plus patient_* only when booking for someone else, skips
the self-profile PATCH/POST in that case, stores the booking expires_at,
and surfaces a clearer 409 message. Thread appointmentExpiresAt through
the wizard to the payment step.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-15 18:07:10 +03:30
co-authored by Claude Opus 4.8
parent 969e915815
commit 08107d6ef2
6 changed files with 238 additions and 28 deletions
+14 -5
View File
@@ -24,11 +24,15 @@ function Form({ changeData, insurance, supplementaryInsurance, data, isForAnothe
className="grid mt-[12px] sm:mt-[14px] md:mt-[17px] lg:mt-[20px] items-start
justify-center gap-x-[24px] gap-y-[12px] md:gap-y-[14px] lg:gap-y-[16px] grid-cols-1 sm:grid-cols-2"
>
<Content title="شماره موبایل" isConfirmed={true}>
<div className="flex items-center justify-between px-[14px] py-[12.5px] border border-[#D7D7D7] rounded-lg bg-[#F5F5F5]">
<span className="text-[#3B3B3B]">{data?.phone?.value}</span>
<span className="text-[#4CAF50] text-[14px]">تایید شده</span>
</div>
<Content title="شماره موبایل">
{isForAnother ? (
<EditField changeData={changeData} data={data?.phone} name="phone" error={errors?.phone} />
) : (
<div className="flex items-center justify-between px-[14px] py-[12.5px] border border-[#D7D7D7] rounded-lg bg-[#F5F5F5]">
<span className="text-[#3B3B3B]">{data?.phone?.value}</span>
<span className="text-[#4CAF50] text-[14px]">تایید شده</span>
</div>
)}
</Content>
<Content title="کد ملی">
<EditField
@@ -61,6 +65,11 @@ function Form({ changeData, insurance, supplementaryInsurance, data, isForAnothe
error={errors?.gender}
/>
</Content>
{isForAnother && (
<Content title="علت مراجعه (اختیاری)">
<EditField changeData={changeData} data={data?.patient_reason} name="patient_reason" error={errors?.patient_reason} />
</Content>
)}
<Content title="شماره بیمه (اختیاری)">
<EditField changeData={changeData} data={data?.insurance_id} name="insurance_id" error={errors?.insurance_id} />
</Content>