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:
@@ -14,6 +14,7 @@ import {
|
||||
} from '@heroicons/react/24/outline';
|
||||
import ConfirmDialog from '../components/ui/ConfirmDialog';
|
||||
import Switch from '../components/ui/Switch';
|
||||
import PriceInput from '../components/ui/PriceInput';
|
||||
|
||||
interface TaxHistoryRow {
|
||||
tax_percent: number;
|
||||
@@ -436,13 +437,27 @@ export default function SettingsPage() {
|
||||
<div className="settings-grid" style={{ marginTop: 18 }}>
|
||||
<Field label="مبلغ هر نوبت" hint="مبلغی که بیمار هنگام رزرو آنلاین پرداخت میکند (تومان).">
|
||||
<div className="input-suffix">
|
||||
<input {...numericField(register('appointment_fee_rials'))} className="input" style={{ maxWidth: 200 }} placeholder="15000" />
|
||||
<PriceInput
|
||||
className="input"
|
||||
style={{ maxWidth: 200 }}
|
||||
ariaLabel="مبلغ هر نوبت (تومان)"
|
||||
placeholder="۱۵,۰۰۰"
|
||||
value={watch('appointment_fee_rials') ? Number(watch('appointment_fee_rials')) : ''}
|
||||
onChange={(v) => setValue('appointment_fee_rials', String(v), { shouldDirty: true })}
|
||||
/>
|
||||
<span className="suf">تومان</span>
|
||||
</div>
|
||||
</Field>
|
||||
<Field label="هزینه ثابت پنل پیامک" hint="از مبلغ هر تراکنش کسر میشود (تومان).">
|
||||
<div className="input-suffix">
|
||||
<input {...numericField(register('sms_panel_fee_rials'))} className="input" style={{ maxWidth: 200 }} placeholder="150000" />
|
||||
<PriceInput
|
||||
className="input"
|
||||
style={{ maxWidth: 200 }}
|
||||
ariaLabel="هزینه ثابت پنل پیامک (تومان)"
|
||||
placeholder="۱۵۰,۰۰۰"
|
||||
value={watch('sms_panel_fee_rials') ? Number(watch('sms_panel_fee_rials')) : ''}
|
||||
onChange={(v) => setValue('sms_panel_fee_rials', String(v), { shouldDirty: true })}
|
||||
/>
|
||||
<span className="suf">تومان</span>
|
||||
</div>
|
||||
</Field>
|
||||
@@ -532,7 +547,14 @@ export default function SettingsPage() {
|
||||
</div>
|
||||
</Field>
|
||||
<Field label="هزینه هر پیامک" hint="مبلغ کسرشده از کیف پول به ازای هر پیامک ارسالی (تومان). مبنای محاسبهٔ تعداد پیامک از موجودی.">
|
||||
<input {...numericField(register('sms_price_rials'))} className="input" style={{ maxWidth: 200 }} placeholder="50" />
|
||||
<PriceInput
|
||||
className="input"
|
||||
style={{ maxWidth: 200 }}
|
||||
ariaLabel="هزینه هر پیامک (تومان)"
|
||||
placeholder="۵۰"
|
||||
value={watch('sms_price_rials') ? Number(watch('sms_price_rials')) : ''}
|
||||
onChange={(v) => setValue('sms_price_rials', String(v), { shouldDirty: true })}
|
||||
/>
|
||||
</Field>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user