feat: convert deposit amounts from toman to rials in appointment handling
This commit is contained in:
@@ -100,7 +100,7 @@ export default function AppointmentCreatePage() {
|
||||
|
||||
// ── بیعانه / وضعیت / توضیحات
|
||||
const [depositRequired, setDepositRequired] = useState(false);
|
||||
const [depositRials, setDepositRials] = useState(0);
|
||||
const [depositToman, setDepositToman] = useState(0);
|
||||
const [status, setStatus] = useState('pending');
|
||||
const [note, setNote] = useState('');
|
||||
|
||||
@@ -145,7 +145,7 @@ export default function AppointmentCreatePage() {
|
||||
...(selectedServices.length ? { service_item_uuids: selectedServices.map(s => s.uuid) } : {}),
|
||||
}),
|
||||
...(staffUuid ? { staff_uuid: staffUuid } : {}),
|
||||
...(depositRequired ? { deposit_required: true, deposit_amount_rials: depositRials } : {}),
|
||||
...(depositRequired ? { deposit_required: true, deposit_amount_rials: tomanToRial(depositToman) } : {}),
|
||||
...(visitPriceToman > 0 ? { visit_price_rials: tomanToRial(visitPriceToman) } : {}),
|
||||
...(note.trim() ? { note: note.trim() } : {}),
|
||||
};
|
||||
@@ -468,7 +468,7 @@ export default function AppointmentCreatePage() {
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'flex-end', gap: 12, margin: '12px 0' }}>
|
||||
<div style={{ width: 300, maxWidth: '100%' }}>
|
||||
<label style={label}>مبلغ بیعانه (تومان)</label>
|
||||
<div className="field" style={{ marginTop: 6, height: 44 }}><PriceInput value={depositRials} onChange={setDepositRials} /></div>
|
||||
<div className="field" style={{ marginTop: 6, height: 44 }}><PriceInput value={depositToman} onChange={setDepositToman} /></div>
|
||||
</div>
|
||||
<WalletChargeLink mobile={effectiveMobile} />
|
||||
</div>
|
||||
|
||||
@@ -9,6 +9,7 @@ import PersianDateInput from '../components/ui/PersianDateInput';
|
||||
import PriceInput from '../components/ui/PriceInput';
|
||||
import SearchableSelect from '../components/ui/SearchableSelect';
|
||||
import { WalletChargeLink } from '../components/AppointmentActions';
|
||||
import { rialToToman, tomanToRial } from '../lib/utils';
|
||||
|
||||
interface Option { uuid: string; name?: string; full_name?: string }
|
||||
|
||||
@@ -51,7 +52,7 @@ export default function AppointmentEditPage() {
|
||||
const [start, setStart] = useState('');
|
||||
const [end, setEnd] = useState('');
|
||||
const [depositRequired, setDepositRequired] = useState(false);
|
||||
const [depositRials, setDepositRials] = useState(0);
|
||||
const [depositToman, setDepositToman] = useState(0);
|
||||
const [status, setStatus] = useState('');
|
||||
const [note, setNote] = useState('');
|
||||
|
||||
@@ -65,7 +66,7 @@ export default function AppointmentEditPage() {
|
||||
setStart(isoTime(a.slot_start));
|
||||
setEnd(isoTime(a.slot_end));
|
||||
setDepositRequired(!!a.deposit_required);
|
||||
setDepositRials(a.deposit_amount_rials ?? 0);
|
||||
setDepositToman(rialToToman(a.deposit_amount_rials ?? 0));
|
||||
setStatus(a.status);
|
||||
setNote(a.note ?? '');
|
||||
}, [a]);
|
||||
@@ -86,7 +87,7 @@ export default function AppointmentEditPage() {
|
||||
service_item_uuid: itemUuid,
|
||||
staff_uuid: staffUuid,
|
||||
deposit_required: depositRequired,
|
||||
deposit_amount_rials: depositRequired ? depositRials : null,
|
||||
deposit_amount_rials: depositRequired ? tomanToRial(depositToman) : null,
|
||||
note,
|
||||
...(status !== a?.status ? { status } : {}),
|
||||
version: a?.version,
|
||||
@@ -191,7 +192,7 @@ export default function AppointmentEditPage() {
|
||||
<>
|
||||
<div style={{ minWidth: 220 }}>
|
||||
<label style={label}>مبلغ بیعانه (تومان)</label>
|
||||
<div style={{ marginTop: 6 }}><PriceInput value={depositRials} onChange={setDepositRials} /></div>
|
||||
<div style={{ marginTop: 6 }}><PriceInput value={depositToman} onChange={setDepositToman} /></div>
|
||||
</div>
|
||||
<WalletChargeLink mobile={a.patient_mobile || a.user?.mobile || ''} />
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user