refactor: rename phone field to telephone in ClinicsPage and update related types

- Updated the form schema in ClinicsPage to change the field name from 'phone' to 'telephone'.
- Adjusted the input registration to reflect the new field name.
- Added a new interface ClinicDetail to define detailed clinic information including phone and other attributes.
- Modified the ClinicController to use null-safe access for province ID retrieval.
This commit is contained in:
hamed
2026-06-10 21:49:16 +03:30
parent c41d03b5c5
commit 9ef94043c8
4 changed files with 799 additions and 160 deletions
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -23,7 +23,7 @@ const HUES_LIST = [256, 205, 162, 295, 272];
const addSchema = z.object({
name: z.string().min(2, 'نام الزامی است'),
phone: z.string().optional(),
telephone: z.string().optional(),
});
type AddForm = z.infer<typeof addSchema>;
@@ -248,7 +248,7 @@ export default function ClinicsPage() {
<label style={{ fontSize: 13, fontWeight: 600, marginBottom: 6, display: 'block' }}>
تلفن (اختیاری)
</label>
<input className="input" placeholder="مثال: 021-12345678" dir="ltr" {...addForm.register('phone')} />
<input className="input" placeholder="مثال: 021-12345678" dir="ltr" {...addForm.register('telephone')} />
</div>
</div>
<div className="modal-foot">
+24
View File
@@ -47,6 +47,30 @@ export interface Clinic {
created_at: number;
}
export interface ClinicDetail {
id: string;
uuid: string;
name: string | null;
title: string | null;
is_active: boolean;
phone: string | null;
phone_number: string | null;
logo: string | null;
clinic_logo: string | null;
caption: string | null;
images_clinic: { url: string; fid?: number }[];
specialties: { id: string; uuid: string; name: string }[];
services: { id: string; uuid: string; name: string }[];
list_bime: { id: string; uuid: string; name: string }[];
doctors: number;
city: { id: string; name: string }[];
state: { id: string; name: string }[];
location: string | null;
map: { latitude: string | null; longitude: string | null };
'24_7': boolean;
field_working_days: string | null;
}
export type AppointmentStatus =
| 'waiting_for_payment'
| 'reserved'
+1 -1
View File
@@ -491,7 +491,7 @@ class ClinicController extends BaseController
'uuid' => $city->getUuid(),
'id' => (string) $city->getId(),
'name' => $city->getName(),
'parent' => $city->getProvinceId() !== null ? (string) $city->getProvinceId() : null,
'parent' => $city->getProvince()?->getId() !== null ? (string) $city->getProvince()->getId() : null,
];
}
}