Add policy, intake, and payment history to the admin student detail view
CI / Coding Standards (pull_request) Successful in 2m47s
CI / PHPStan (pull_request) Successful in 2m56s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m39s
CI / Build Plugin Zip (pull_request) Skipped
CI / Tests (PHP 8.2) (pull_request) Successful in 43s
CI / Tests (PHP 8.1) (pull_request) Successful in 44s
CI / No Debug Code (pull_request) Successful in 2s

The student-administration spec deferred three detail-view sections until
Payments landed. Adds them now: policy-acceptance history (title, version,
context, date), intake answers (label, answer, context), and — gated on
manage_billing — payment history with HST breakdown and receipt numbers.

New Auth\StudentHistory builds the display rows from per-student queries
added to AcceptanceRepository, AnswerRepository, and PaymentRepository;
the Payment model now carries created_at so unpaid rows still have a date.

Closes #69

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
2026-07-18 18:17:20 -03:00
co-authored by Claude Fable 5
parent 05d1728248
commit c49171695a
15 changed files with 540 additions and 6 deletions
+3
View File
@@ -49,6 +49,7 @@ class Payment {
public readonly ?string $receiptNumber = null,
public readonly ?string $receiptSentAt = null,
public readonly ?string $paidAt = null,
public readonly ?string $createdAt = null,
public readonly ?int $id = null,
) {}
@@ -69,6 +70,7 @@ class Payment {
receiptNumber: Val::stringOrNull( $row->receipt_number ),
receiptSentAt: Val::stringOrNull( $row->receipt_sent_at ),
paidAt: Val::stringOrNull( $row->paid_at ),
createdAt: Val::stringOrNull( $row->created_at ),
id: Val::int( $row->id ),
);
}
@@ -120,6 +122,7 @@ class Payment {
'status' => $this->status,
'receipt_number' => $this->receiptNumber,
'paid_at' => $this->paidAt,
'created_at' => $this->createdAt,
];
}
}
+17
View File
@@ -132,6 +132,23 @@ class PaymentRepository {
return $row ? Payment::fromRow( $row ) : null;
}
/**
* Every payment for a student, newest first (admin payment history).
*
* @return list<Payment>
*/
public function findByStudent( int $studentId ): array {
$rows = $this->db->get_results(
$this->db->prepare(
'SELECT * FROM %i WHERE student_id = %d ORDER BY created_at DESC, id DESC',
$this->table,
$studentId
)
);
return array_map( Payment::fromRow( ... ), $rows ?? [] );
}
/**
* Pending payments, newest first (studio-admin confirmation queue).
*