feat(admin): finish the screens that were stopping one step short

Five places where the data existed and the screen did not use it.

Booking a whole course had no button because it needs a doctor and the course
does not carry one — each session can be with a different doctor. The page now
asks for the doctor the same way the resource booking page does, and the button
explains that it is all-or-nothing before it is pressed.

A course whose package does not cover the remaining sessions is still valid —
the rest is simply charged normally — but nobody was told. The course response
carries package_balance and the shortfall, and the page warns. Before session
six, not during it.

The credit ledger already returned who recorded a row and which appointment it
belonged to, and showed neither. An adjustable ledger without the name of the
person who adjusted it is half an audit trail.

Version history printed a JSON blob of each version's effects, which does not
answer the question anyone actually has: what changed? It now diffs each
version against the previous one, field by field, and says so plainly when a
version changed nothing meaningful.

A resource with no calendar showed "—" for utilization. Null means undefined,
not zero, and the next step is always the same: set up the calendar. It is a
link now. The report range also accepts a custom from/to, kept in the URL like
the rest.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-08-01 15:07:27 +03:30
co-authored by Claude Opus 5
parent fe48b10fb5
commit 5c754244f2
10 changed files with 314 additions and 27 deletions
+10
View File
@@ -126,6 +126,8 @@
"patient_package_uuid": null,
"preferred_resource_uuid": null,
"preferred_resource_name": null,
"package_balance": 4,
"package_shortfall": 2,
"status": "active",
"abandon_reason": null,
"started_at": 1785484481,
@@ -306,3 +308,11 @@ ddev exec php bin/phpunit tests/Course # ۱۴ تست
مهم‌ترین‌ها: `testChangingTheProtocolLeavesRunningCoursesAlone` (snapshot)،
`testTheSuggestionAnchorsOnTheLastCompletedSession` (لنگر متحرک) و
`testCancellingOneSessionOnlyResetsThatSession`.
## اعتبار پکیج در برابر جلسات باقی‌مانده
`package_balance` مانده و `package_shortfall` کسری آن نسبت به جلسات **انجام‌نشده** است
(`null` وقتی دوره پکیجی ندارد).
کسری، دوره را باطل نمی‌کند و خطا هم نیست: بقیهٔ جلسات با قیمت عادی حساب می‌شوند. ولی
باید پیش از جلسهٔ ششم دانسته شود نه سرِ آن، پس صفحهٔ دوره آن را به‌صورت هشدار نشان می‌دهد.
+9
View File
@@ -156,3 +156,12 @@ ddev exec php bin/phpunit tests/Report # ۱۶ تست
پیش از این هر منبع پنج کوئری اضافه می‌آورد و گزارشِ یک کلینیک چهل‌منبعی دویست کوئری
می‌شد. تست `testQueryCountDoesNotGrowWithTheNumberOfResources` همین را نگه می‌دارد —
عددِ دقیق را پین نمی‌کند، فقط رشدِ خطی را رد می‌کند.
## `utilization = null` در UI
به‌جای «۰٪»، لینک **«تنظیم تقویم»** به تقویم همان منبع نمایش داده می‌شود. `null` یعنی
تعریف‌نشده نه صفر، و کار بعدی کاربر همان ساختن تقویم است — عددِ تنها او را به آنجا
نمی‌رساند.
بازهٔ گزارش علاوه بر هفته/ماه/سه‌ماه، حالت **دلخواه** هم دارد (`from`/`to` شمسی در URL)
برای وقتی که کاربر دقیقاً می‌داند چه بازه‌ای می‌خواهد.