feat: implement MobileInput component for standardized mobile number input and update related forms to use it
This commit is contained in:
@@ -16,14 +16,15 @@ import { api } from '../lib/api';
|
||||
import type { ApiResponse, PaginatedResponse } from '../lib/api';
|
||||
import type { Clinic } from '../types';
|
||||
import { useAuthStore } from '../stores/authStore';
|
||||
import { formatDate, formatNumber } from '../lib/utils';
|
||||
import MobileInput from '../components/ui/MobileInput';
|
||||
import { formatDate, formatNumber, iranMobileSchema } from '../lib/utils';
|
||||
import Pagination from '../components/ui/Pagination';
|
||||
import ConfirmDialog from '../components/ui/ConfirmDialog';
|
||||
|
||||
const HUES_LIST = [256, 205, 162, 295, 272];
|
||||
|
||||
const addSchema = z.object({
|
||||
owner_mobile: z.string().min(10, 'شماره موبایل معتبر نیست'),
|
||||
owner_mobile: iranMobileSchema,
|
||||
name: z.string().min(2, 'نام الزامی است'),
|
||||
telephone: z.string().optional(),
|
||||
});
|
||||
@@ -254,7 +255,7 @@ export default function ClinicsPage() {
|
||||
<label style={{ fontSize: 13, fontWeight: 600, marginBottom: 6, display: 'block' }}>
|
||||
شماره موبایل صاحب کلینیک <span style={{ color: 'var(--red)' }}>*</span>
|
||||
</label>
|
||||
<input className="input" placeholder="09xxxxxxxxx" dir="ltr" {...addForm.register('owner_mobile')} />
|
||||
<MobileInput className="input" hasError={!!addForm.formState.errors.owner_mobile} {...addForm.register('owner_mobile')} />
|
||||
{addForm.formState.errors.owner_mobile && (
|
||||
<div className="err-text">{addForm.formState.errors.owner_mobile.message}</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user