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