Add Offerings domain and studio-admin capabilities
CI / Coding Standards (pull_request) Successful in 55s
CI / PHPStan (pull_request) Successful in 1m0s
CI / Tests (PHP 8.1) (pull_request) Successful in 50s
CI / Tests (PHP 8.2) (pull_request) Successful in 46s
CI / Tests (PHP 8.3) (pull_request) Successful in 50s
CI / No Debug Code (pull_request) Successful in 2s

Implements the offerings catalog (#1): private-lesson types and group
classes carrying pricing, billing mode (one_time/full_term), duration,
capacity, and term details. Adds the src/Offering/ domain (value object,
repository, REST endpoint, admin controller + template), the us_offerings
table, and an Offerings admin page.

Also lands the capability slice of #9: registers the us_studio_admin role
and the new capability strings (manage_instructors, manage_offerings,
manage_questions, manage_policies, manage_billing, view_all_payments,
view_own_payments, export_payments) so offering management gates correctly.

Tests: tests/Unit/Offering/ (value object + repository) and a studio-admin
case in RoleManagerTest. composer test, cs, and PHPStan level 6 all pass.

Refs #1 #9

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 10:33:02 -03:00
parent d3a2767976
commit 36331388d1
13 changed files with 969 additions and 6 deletions
+16 -1
View File
@@ -8,15 +8,19 @@ use Unsupervised\Schedular\Availability\AvailabilityRepository;
use Unsupervised\Schedular\Auth\RoleManager;
use Unsupervised\Schedular\Booking\BookingRepository;
use Unsupervised\Schedular\Booking\LessonController;
use Unsupervised\Schedular\Offering\OfferingController;
use Unsupervised\Schedular\Offering\OfferingRepository;
class AdminMenu {
private AvailabilityController $availabilityController;
private LessonController $lessonController;
private OfferingController $offeringController;
public function __construct( AvailabilityRepository $availability, BookingRepository $bookings ) {
public function __construct( AvailabilityRepository $availability, BookingRepository $bookings, OfferingRepository $offerings ) {
$this->availabilityController = new AvailabilityController( $availability );
$this->lessonController = new LessonController( $bookings );
$this->offeringController = new OfferingController( $offerings );
}
public function register(): void {
@@ -46,6 +50,17 @@ class AdminMenu {
31
);
// Studio admin / instructor: manage offerings.
add_menu_page(
__( 'Offerings', 'unsupervised-schedular' ),
__( 'Offerings', 'unsupervised-schedular' ),
RoleManager::CAP_MANAGE_OFFERINGS,
'us-offerings',
[ $this->offeringController, 'renderPage' ],
'dashicons-tag',
33
);
// Instructor: view their upcoming lessons.
add_menu_page(
__( 'My Lessons', 'unsupervised-schedular' ),