Add tests and implementation for ServiceDetailPage and PriceInput components

- Implement PriceInput component tests to validate Persian and Arabic numeral handling, input formatting, and controlled behavior.
- Create ServiceDetailPage component with detailed service information, including pricing, insurance coverage, and editing capabilities.
- Add API tests for service item detail retrieval and coverage synchronization with insurance contracts.
- Ensure proper error handling and user feedback for service item retrieval and coverage management.
This commit is contained in:
hamed
2026-07-18 12:10:49 +03:30
parent f1d58e1604
commit 42d9ad26c5
27 changed files with 1758 additions and 284 deletions
@@ -3,7 +3,7 @@ import { createPortal } from 'react-dom';
import { XMarkIcon } from '@heroicons/react/24/outline';
import SearchableSelect from './ui/SearchableSelect';
import { useBankAccounts, usePosDevices } from '../hooks/usePaymentMethods';
import { formatRial, formatNumber, tomanToRial } from '../lib/utils';
import { formatRial, formatNumber, tomanToRial, digitsOnly } from '../lib/utils';
export type WalletMode = 'charge' | 'withdraw';
@@ -154,7 +154,7 @@ export default function WalletTransactionModal({ open, balanceRials, submitting,
inputMode="numeric"
value={amountToman > 0 ? formatNumber(amountToman) : ''}
onChange={(e) => {
const raw = e.target.value.replace(/[۰-۹]/g, (d) => String(d.charCodeAt(0) - 0x06f0)).replace(/[^\d]/g, '');
const raw = digitsOnly(e.target.value);
setAmountToman(raw ? parseInt(raw, 10) : 0);
}}
placeholder="مبلغ دلخواه (تومان)"