feat: convert deposit amounts from toman to rials in appointment handling

This commit is contained in:
hamed
2026-07-17 10:21:52 +03:30
parent a0ddb4c0d1
commit fcd7a0596d
9 changed files with 468 additions and 17 deletions
@@ -9,7 +9,7 @@ import PersianDateInput from './ui/PersianDateInput';
import PriceInput from './ui/PriceInput';
import SearchableSelect from './ui/SearchableSelect';
import { WalletChargeLink } from './AppointmentActions';
import { tehranWallClockToUnix } from '../lib/utils';
import { tehranWallClockToUnix, tomanToRial } from '../lib/utils';
interface Option { uuid: string; name?: string; full_name?: string }
interface PatientRow { uuid: string; user_name?: string; user_mobile?: string; user_national_code?: string }
@@ -104,7 +104,7 @@ export default function NewAppointmentDrawer({ doctorUuid, defaultDate, queryKey
// ── deposit / status / notes ───────────────────────────────────────────────
const [depositRequired, setDepositRequired] = useState(false);
const [depositRials, setDepositRials] = useState(0);
const [depositToman, setDepositToman] = useState(0);
const [status, setStatus] = useState('pending');
const [note, setNote] = useState('');
@@ -135,7 +135,7 @@ export default function NewAppointmentDrawer({ doctorUuid, defaultDate, queryKey
// حالت سرویس: چند سرویس؛ حالت اسلاتی: تک سرویسِ workflow (اختیاری).
...(serviceMode ? { service_item_uuids: serviceUuids } : itemUuid ? { service_item_uuid: itemUuid } : {}),
...(staffUuid ? { staff_uuid: staffUuid } : {}),
...(depositRequired ? { deposit_required: true, deposit_amount_rials: depositRials } : {}),
...(depositRequired ? { deposit_required: true, deposit_amount_rials: tomanToRial(depositToman) } : {}),
...(note.trim() ? { note: note.trim() } : {}),
};
const res: any = await api.post('/api/v1/my/appointment', payload);
@@ -331,7 +331,7 @@ export default function NewAppointmentDrawer({ doctorUuid, defaultDate, queryKey
<div style={{ flex: 1 }}>
<label style={label}>مبلغ بیعانه (تومان)</label>
<div style={{ marginTop: 6 }}>
<PriceInput value={depositRials} onChange={setDepositRials} />
<PriceInput value={depositToman} onChange={setDepositToman} />
</div>
</div>
<WalletChargeLink mobile={effectiveMobile} />