refactor: update pricing input handling to use PriceInput component
- Replaced raw input fields for pricing with PriceInput component across various forms and modals to ensure consistent formatting and accessibility. - Updated tests to reflect changes in pricing input handling, ensuring values are displayed in toman with proper formatting. - Enhanced accessibility by adding aria-labels and aria-invalid attributes to PriceInput components. - Adjusted UI elements to improve layout and user experience, particularly in forms related to service items and scheduling. - Changed labels from "نمایش در نوبتدهی" to "نمایش در نوبتدهی آنلاین" for clarity.
This commit is contained in:
@@ -3,7 +3,7 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { toast } from 'sonner';
|
||||
import { api } from '../lib/api';
|
||||
import { formatRial, rialToToman, tomanToRial } from '../lib/utils';
|
||||
import { digitsOnly } from '../lib/utils';
|
||||
import PriceInput from './ui/PriceInput';
|
||||
import Switch from './ui/Switch';
|
||||
|
||||
interface Pricing { free_visit_price_rials: number; require_visit_price: boolean }
|
||||
@@ -63,10 +63,11 @@ export default function FreeVisitPrice({ doctorUuid, readOnly = false }: { docto
|
||||
<label style={{ fontSize: 11.5, fontWeight: 600 }}>
|
||||
قیمت (تومان){required && <span style={{ color: 'var(--danger)' }}> *</span>}
|
||||
</label>
|
||||
<input
|
||||
type="text" inputMode="numeric" dir="ltr" className="input" style={{ width: 200 }}
|
||||
aria-invalid={!!error}
|
||||
value={value} onChange={(e) => { setValue(digitsOnly(e.target.value)); setError(''); }}
|
||||
<PriceInput
|
||||
className="input"
|
||||
style={{ width: 200 }}
|
||||
value={value === '' ? '' : Number(value)}
|
||||
onChange={(v) => { setValue(String(v)); setError(''); }}
|
||||
/>
|
||||
</div>
|
||||
{value !== '' && (
|
||||
|
||||
Reference in New Issue
Block a user