feat(patients): phase D — call-center tab (patient call log)

Add a record-scoped PatientCall entity (subject, summary, outcome
success/missed, called_at, personnel) with its repository and three
owner-gated endpoints on PatientController:

  GET    /patient/{uuid}/calls   — call log, newest first, optional ?outcome
  POST   /patient/{uuid}/call    — log a call (subject required)
  DELETE /patient/call/{uuid}    — delete an entry

Wire the previously-placeholder "کال سنتر" tab as a CallCenterTab: a register
form (date/time/subject/summary + success/missed toggle, personnel taken from
the logged-in user) beside a filterable call history (all / success / missed).
With this every patient-detail tab is now backed by a real endpoint, so the
generic Placeholder is no longer reachable. PatientCallTest covers create/list/
delete, the outcome filter, the invalid-outcome fallback, and ownership scoping.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-13 16:01:16 +03:30
co-authored by Claude Opus 4.8
parent 61981a45d0
commit 665a210ef8
8 changed files with 474 additions and 2 deletions
@@ -59,11 +59,14 @@ describe('PatientDetailPage (پرونده تب‌دار)', () => {
expect(screen.getByText('اینستاگرام')).toBeInTheDocument();
});
it('shows a placeholder for not-yet-built tabs', async () => {
it('renders the call-center tab with a register form and history', async () => {
renderDetail();
await screen.findByText('ساغر صابری');
fireEvent.click(screen.getByText('کال سنتر'));
expect(screen.getByText(/به‌زودی تکمیل می‌شود/)).toBeInTheDocument();
expect(await screen.findByText('ثبت تماس جدید')).toBeInTheDocument();
expect(screen.getByText('تاریخچه تماس‌ها')).toBeInTheDocument();
expect(screen.getByPlaceholderText('موضوع تماس')).toBeInTheDocument();
expect(await screen.findByText('تماسی ثبت نشده است.')).toBeInTheDocument();
});
it('renders the attachments tab with an upload button', async () => {