feat(branch): admin UI for branch working hours and rooms, plus real API docs
Three pages, all on the existing design system: BranchesPage lists the current environment's booking locations with their working-hours and active-room counts, and two subpages edit the week and the rooms. The list page deliberately does not create or rename a branch — clinic and doctor detail pages already do that, and duplicating it would give one physical place two edit surfaces. Route permission reuses `appointment_settings` rather than inventing a new one. Two real bugs fell out of exercising this end to end: `days` was serialising as a JSON *array*, not an object keyed "0".."6" — keys 0..6 are sequential so json_encode collapses them to a list. The client reads days["0"] either way, so nothing looked broken, but the response shape was unstable: one missing day would flip the same field to an object. The controller now casts to stdClass and WorkingHoursTest::testDaysIsAJsonObjectNotAnArray pins it. Found by curling the endpoint for the docs, not by any test. `<input type="time">` caps at 23:59, so it can neither display nor produce the legal end value 1440. An all-day range would have vanished from the form and been corrupted by the first save. Ranges now carry an explicit end-of-day flag, with a round-trip test proving 1440 survives. docs/api/branch.md documents all eight endpoints with responses captured from real curl runs against ddev, including the 422 and 404 bodies. doctor.md records that active/timezone now appear on all nine existing address endpoints (additive), and tenancy.md gains the two lessons this task taught: an aggregate child whose root is itself declared global inherits no environment and needs a real pair, and TenantFilter is not a substitute for an explicit ownership check because hard isolation only applies to a *chosen* context. Verified: phpunit 1067 tests / 2974 assertions green; slot-mode frozen contract green; phpstan 14 errors before and after, none in touched files; tsc clean; vitest 87 files / 612 tests green. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -445,6 +445,8 @@ Get all practice addresses for a doctor, including addresses of clinics the doct
|
||||
"name": "مطب تهران",
|
||||
"address": "تهران، خیابان...",
|
||||
"telephone": "02112345678",
|
||||
"active": true,
|
||||
"timezone": "Asia/Tehran",
|
||||
"map": { "latitude": "35.6892", "longitude": "51.3890" },
|
||||
"city": { "id": "1", "name": "تهران" },
|
||||
"province": { "id": "1", "name": "تهران" }
|
||||
@@ -458,6 +460,8 @@ Get all practice addresses for a doctor, including addresses of clinics the doct
|
||||
"name": null,
|
||||
"address": "اصفهان، خیابان...",
|
||||
"telephone": "03112345678",
|
||||
"active": true,
|
||||
"timezone": "Asia/Tehran",
|
||||
"map": { "latitude": null, "longitude": null },
|
||||
"city": { "id": "3", "name": "اصفهان" },
|
||||
"province": { "id": "2", "name": "اصفهان" }
|
||||
@@ -468,6 +472,16 @@ Get all practice addresses for a doctor, including addresses of clinics the doct
|
||||
|
||||
> **نکته:** آدرسهای با `type: "clinic"` از کلینیکهایی که پزشک عضو آنهاست میآیند و `clinic_name` نام کلینیک را نشان میدهد.
|
||||
|
||||
> **`active` و `timezone` (افزودهشده در تسک شعبه):** هر آدرس یک «شعبه» است و این دو
|
||||
> ویژگی روی خروجی **همهٔ** اندپوینتهای آدرس ظاهر میشوند، چون از
|
||||
> `DoctorAddress::toArray()` میآیند. هر دو ستون `NOT NULL DEFAULT` دارند، پس ردیفهای
|
||||
> قدیمی هم `active: true` و `timezone: "Asia/Tehran"` میدهند؛ تغییر additive است.
|
||||
>
|
||||
> `active` در فاز فعلی **فقط ذخیره میشود** و هیچ اثری بر محاسبهٔ اسلات ندارد. نوشتن
|
||||
> این دو فیلد از راه اندپوینتهای همین سند انجام نمیشود؛ برای آن
|
||||
> `PATCH /api/v1/branch/{addressUuid}` است — همراه با ساعت کاری هفتگی و اتاقها در
|
||||
> [branch.md](branch.md).
|
||||
|
||||
---
|
||||
|
||||
## POST `/api/v1/clinic-pro/doctor-address`
|
||||
|
||||
Reference in New Issue
Block a user