feat: add owner mobile information to ClinicsPage and update API to fetch owner mobile
This commit is contained in:
@@ -130,6 +130,7 @@ export default function ClinicsPage() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th>کلینیک</th>
|
||||
<th>مالک</th>
|
||||
<th>تلفن</th>
|
||||
<th>پزشکان</th>
|
||||
<th>وضعیت</th>
|
||||
@@ -149,7 +150,7 @@ export default function ClinicsPage() {
|
||||
: items.length === 0
|
||||
? (
|
||||
<tr>
|
||||
<td colSpan={6}>
|
||||
<td colSpan={7}>
|
||||
<div className="empty">
|
||||
<BuildingOffice2Icon style={{ width: 36, height: 36 }} />
|
||||
<p>هیچ کلینیکی یافت نشد</p>
|
||||
@@ -177,6 +178,11 @@ export default function ClinicsPage() {
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
{c.owner_mobile
|
||||
? <span dir="ltr" style={{ fontSize: 13 }}>{c.owner_mobile}</span>
|
||||
: <span style={{ color: 'var(--text-3)' }}>—</span>}
|
||||
</td>
|
||||
<td>{c.phone ? <span dir="ltr">{c.phone}</span> : '—'}</td>
|
||||
<td>
|
||||
<span className="badge blue">
|
||||
|
||||
@@ -45,6 +45,7 @@ export interface Clinic {
|
||||
is_active: boolean;
|
||||
doctors_count: number;
|
||||
created_at: number;
|
||||
owner_mobile: string | null;
|
||||
}
|
||||
|
||||
export interface ClinicDetail {
|
||||
|
||||
@@ -461,11 +461,13 @@ class AdminApiController extends BaseController
|
||||
$offset = ($page - 1) * $limit;
|
||||
$rows = $conn->fetchAllAssociative(
|
||||
"SELECT c.uuid, c.name, c.telephone, c.clinic_logo, c.is_active, c.created_at,
|
||||
COUNT(DISTINCT cd.doctor_id) as doctors_count
|
||||
COUNT(DISTINCT cd.doctor_id) as doctors_count,
|
||||
u.mobile_number as owner_mobile
|
||||
FROM clinics c
|
||||
LEFT JOIN clinic_doctors cd ON cd.clinic_id = c.id
|
||||
LEFT JOIN users u ON u.id = c.user_id
|
||||
WHERE $whereStr
|
||||
GROUP BY c.id
|
||||
GROUP BY c.id, u.mobile_number
|
||||
ORDER BY c.created_at DESC
|
||||
LIMIT $limit OFFSET $offset",
|
||||
$params
|
||||
@@ -479,6 +481,7 @@ class AdminApiController extends BaseController
|
||||
'is_active' => (bool) $c['is_active'],
|
||||
'doctors_count' => (int) $c['doctors_count'],
|
||||
'created_at' => (int) $c['created_at'],
|
||||
'owner_mobile' => $c['owner_mobile'],
|
||||
], $rows);
|
||||
|
||||
return $this->paginated($items, $total, $page, $limit);
|
||||
|
||||
Reference in New Issue
Block a user