feat: update ClinicDetailPage and ClinicsPage for address handling and UI improvements

This commit is contained in:
hamed
2026-06-12 22:39:11 +03:30
parent 960ff1ab29
commit 87966a90fa
5 changed files with 235 additions and 174 deletions
+12 -2
View File
@@ -22,6 +22,7 @@ import ConfirmDialog from '../components/ui/ConfirmDialog';
const HUES_LIST = [256, 205, 162, 295, 272];
const addSchema = z.object({
owner_mobile: z.string().min(10, 'شماره موبایل معتبر نیست'),
name: z.string().min(2, 'نام الزامی است'),
telephone: z.string().optional(),
});
@@ -69,7 +70,7 @@ export default function ClinicsPage() {
const addForm = useForm<AddForm>({ resolver: zodResolver(addSchema) });
const addMutation = useMutation({
mutationFn: (d: AddForm) => api.post<ApiResponse<{ uuid: string }>>('/api/v1/clinic', d),
mutationFn: (d: AddForm) => api.post<ApiResponse<{ uuid: string }>>('/api/v1/admin/clinic', d),
onSuccess: (res) => {
toast.success('کلینیک اضافه شد');
setAddOpen(false);
@@ -237,7 +238,16 @@ export default function ClinicsPage() {
<div className="modal-body" style={{ display: 'flex', flexDirection: 'column', gap: 14 }}>
<div>
<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')} />
{addForm.formState.errors.owner_mobile && (
<div className="err-text">{addForm.formState.errors.owner_mobile.message}</div>
)}
</div>
<div>
<label style={{ fontSize: 13, fontWeight: 600, marginBottom: 6, display: 'block' }}>
نام کلینیک <span style={{ color: 'var(--red)' }}>*</span>
</label>
<input className="input" placeholder="نام کلینیک را وارد کنید" {...addForm.register('name')} />
{addForm.formState.errors.name && (