feat: update appointment management API and frontend components
- Added new endpoint to get today's appointment statistics with optional date filter. - Enhanced appointment listing API to support filtering by date and doctor UUID. - Updated Appointment model to include new fields and modified status values. - Implemented AppointmentStatusDropdown component for status management with visual feedback. - Created PersianCalendar component for date selection in Jalali format. - Updated API documentation to reflect changes in appointment management.
This commit is contained in:
+84
-7
@@ -424,9 +424,35 @@ Delete a clinic.
|
||||
|
||||
## Appointment Management
|
||||
|
||||
### GET `/api/v1/admin/appointments/today-stats`
|
||||
|
||||
Get appointment statistics for a specific date (defaults to today).
|
||||
|
||||
**Permission:** `ROLE_ADMIN`
|
||||
|
||||
### Query Parameters
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `date` | string (YYYY-MM-DD) | ❌ | Default: today |
|
||||
|
||||
### Response `200`
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"total": 47,
|
||||
"completed": 20,
|
||||
"waiting": 18,
|
||||
"cancelled": 9
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### GET `/api/v1/admin/appointments`
|
||||
|
||||
List all appointments.
|
||||
List appointments filtered by date and/or doctor. Sorted by `slot_start ASC`.
|
||||
|
||||
**Permission:** `ROLE_ADMIN`
|
||||
|
||||
@@ -434,9 +460,11 @@ List all appointments.
|
||||
| Param | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `page` | integer | ❌ | Default: 1 |
|
||||
| `limit` | integer | ❌ | Default: 20 |
|
||||
| `search` | string | ❌ | Search by doctor/patient name |
|
||||
| `limit` | integer | ❌ | Default: 15, max: 500 |
|
||||
| `search` | string | ❌ | Search by patient name/mobile or doctor name |
|
||||
| `status` | string | ❌ | Filter by status |
|
||||
| `date` | string (YYYY-MM-DD) | ❌ | Filter by slot date |
|
||||
| `doctor_uuid` | string | ❌ | Filter by doctor UUID |
|
||||
|
||||
### Response `200`
|
||||
```json
|
||||
@@ -444,18 +472,67 @@ List all appointments.
|
||||
"success": true,
|
||||
"data": [
|
||||
{
|
||||
"uuid": "...",
|
||||
"doctor_title": "دکتر علی احمدی",
|
||||
"uuid": "appt-uuid",
|
||||
"patient_name": "محمد رضایی",
|
||||
"patient_mobile": "09123456789",
|
||||
"doctor_uuid": "doctor-uuid",
|
||||
"doctor_name": "دکتر علی احمدی",
|
||||
"slot_start": 1718438400,
|
||||
"slot_end": 1718439600,
|
||||
"appointment_date": "2025-06-15",
|
||||
"appointment_time": "09:00",
|
||||
"end_time": "09:20",
|
||||
"status": "confirmed",
|
||||
"price": 500000
|
||||
"version": 1,
|
||||
"created_at": "2025-06-14T10:30:00+03:30"
|
||||
}
|
||||
],
|
||||
"meta": { "totalRecords": 8540, "totalPages": 427, "currentPage": 1 }
|
||||
"meta": { "totalRecords": 47, "totalPages": 1, "currentPage": 1 }
|
||||
}
|
||||
```
|
||||
|
||||
**Status values:** `pending` | `confirmed` | `completed` | `cancelled_by_doctor` | `cancelled_by_user` | `no_show` | `expired`
|
||||
|
||||
---
|
||||
|
||||
### POST `/api/v1/admin/appointment`
|
||||
|
||||
Create a new appointment for a patient identified by mobile number.
|
||||
|
||||
**Permission:** `ROLE_ADMIN`
|
||||
|
||||
### Request Body
|
||||
```json
|
||||
{
|
||||
"doctor_uuid": "doctor-uuid",
|
||||
"slot_start": 1718438400,
|
||||
"slot_end": 1718439600,
|
||||
"patient_mobile": "09123456789",
|
||||
"note": "optional note"
|
||||
}
|
||||
```
|
||||
|
||||
### Response `201`
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"uuid": "appt-uuid",
|
||||
"slot_start": 1718438400,
|
||||
"slot_end": 1718439600,
|
||||
"status": "pending"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Error Responses
|
||||
| Code | HTTP | Description |
|
||||
|------|------|-------------|
|
||||
| `VALIDATION` | 422 | Missing required fields |
|
||||
| `DOCTOR_NOT_FOUND` | 404 | Doctor UUID not found |
|
||||
| `USER_NOT_FOUND` | 404 | No user with that mobile number |
|
||||
| `SLOT_TAKEN` | 409 | Slot already booked |
|
||||
|
||||
---
|
||||
|
||||
## Payment Management
|
||||
|
||||
Reference in New Issue
Block a user