refactor(billing): rebuild payments list as flat invoice list (tauri parity)
Align /admin/my-payments with the tauri /payments source (per user): the list
is now a flat, newest-first list of the tenant's recorded invoices — one row
per invoice — instead of the per-patient aggregation built from Figma.
Backend:
- replace InvoiceRepository::patientPaymentSummary aggregation with
tenantInvoices/countTenantInvoices (flat, joins patient name/national code).
- InvoiceService::patientPaymentList → tenantInvoiceList.
- BillingController: GET /api/v1/my/billing/patient-payments →
GET /api/v1/my/billing/payments returning
{ invoice_uuid, patient_uuid, patient_name, national_code, issued_at,
amount_rials, status } rows.
- node-2 patient invoices endpoint unchanged.
Frontend:
- useMyPayments: usePatientPayments → usePayments (flat PaymentRow).
- MyPaymentsPage columns match tauri DetailT: row #, avatar+name, national
code, date-time, amount paid, مشاهده (no status column); 'اضافه کردن بیمار'
links to /admin/patients/new. Filters (national code / status / Jalali date
range) kept.
Tests + docs/api/billing.md updated. Intentionally omitted tauri extras:
mobile Cards view and the advanced ModalFilter.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -157,13 +157,13 @@ class BillingController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* لیست پرداختها — یک ردیف بهازای هر بیمار با جمع صورتحسابها.
|
||||
* فیلترها: national_code، status (paid|unsettled|unpaid)، from/to (unix ثانیه).
|
||||
* پاسخ صفحهبندی: هر ردیف { patient_uuid, patient_name, national_code,
|
||||
* invoice_count, paid_rials, remaining_rials, status }.
|
||||
* لیست پرداختها — یک ردیف بهازای هر صورتحساب ثبتشدهی tenant (flat).
|
||||
* فیلترها: national_code، status (paid|unsettled)، from/to (unix ثانیه).
|
||||
* پاسخ صفحهبندی: هر ردیف { invoice_uuid, patient_uuid, patient_name,
|
||||
* national_code, issued_at, amount_rials, status }.
|
||||
*/
|
||||
#[Route('/api/v1/my/billing/patient-payments', methods: ['GET'])]
|
||||
public function listPatientPayments(Request $request, #[CurrentUser] User $user): JsonResponse
|
||||
#[Route('/api/v1/my/billing/payments', methods: ['GET'])]
|
||||
public function listPayments(Request $request, #[CurrentUser] User $user): JsonResponse
|
||||
{
|
||||
[$entityType, $entityId] = $this->resolveEntity($user);
|
||||
if ($entityId === null) {
|
||||
@@ -179,7 +179,7 @@ class BillingController extends BaseController
|
||||
$page = max(1, (int) $request->query->get('page', 1));
|
||||
$limit = min(100, max(1, (int) $request->query->get('limit', 20)));
|
||||
|
||||
$result = $this->invoiceService->patientPaymentList($entityType, $entityId, $filters, $page, $limit);
|
||||
$result = $this->invoiceService->tenantInvoiceList($entityType, $entityId, $filters, $page, $limit);
|
||||
|
||||
return $this->paginated($result['items'], $result['total'], $page, $limit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user