add superadmin dashboard. subscriptions

This commit is contained in:
root
2026-01-13 20:03:16 +03:00
parent 3c24c250e5
commit edb4df7e37
36 changed files with 3329 additions and 100 deletions
+87 -32
View File
@@ -5,7 +5,9 @@ use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
# Публичные маршруты (без фильтра org)
# =============================================================================
# ПУБЛИЧНЫЕ МАРШРУТЫ (без фильтров)
# =============================================================================
$routes->get('/', 'Home::index');
$routes->get('login', 'Auth::login');
$routes->post('login', 'Auth::login');
@@ -17,7 +19,13 @@ $routes->get('auth/verify/(:any)', 'Auth::verify/$1');
$routes->get('auth/resend-verification', 'Auth::resendVerification');
$routes->post('auth/resend-verification', 'Auth::resendVerification');
# Маршруты для приглашений (публичные, без фильтра org)
# Маршруты для восстановления пароля
$routes->get('forgot-password', 'ForgotPassword::index');
$routes->post('forgot-password/send', 'ForgotPassword::sendResetLink');
$routes->get('forgot-password/reset/(:any)', 'ForgotPassword::reset/$1');
$routes->post('forgot-password/update', 'ForgotPassword::updatePassword');
# Маршруты для приглашений (публичные)
$routes->group('invitation', static function ($routes) {
$routes->get('accept/(:any)', 'InvitationController::accept/$1');
$routes->post('accept/(:any)', 'InvitationController::processAccept');
@@ -25,40 +33,87 @@ $routes->group('invitation', static function ($routes) {
$routes->match(['GET', 'POST'], 'complete/(:any)', 'InvitationController::complete/$1');
});
# Защищённые маршруты (с фильтром org)
$routes->group('', ['filter' => 'org'], static function ($routes) {
# =============================================================================
# АВТОРИЗОВАННЫЕ МАРШРУТЫ (требуется auth, НЕ требуется org)
# =============================================================================
$routes->group('', ['filter' => 'auth'], static function ($routes) {
# Профиль (доступен без выбора организации)
$routes->get('profile', 'Profile::index');
$routes->get('profile/organizations', 'Profile::organizations');
$routes->get('profile/security', 'Profile::security');
$routes->post('profile/update-name', 'Profile::updateName');
$routes->post('profile/upload-avatar', 'Profile::uploadAvatar');
$routes->post('profile/change-password', 'Profile::changePassword');
$routes->post('profile/session/revoke', 'Profile::revokeSession');
$routes->post('profile/sessions/revoke-all', 'Profile::revokeAllSessions');
$routes->post('profile/leave-org/(:num)', 'Profile::leaveOrganization/$1');
# Выбор организации (доступен без выбора организации)
$routes->get('organizations', 'Organizations::index');
$routes->get('organizations/(:num)/dashboard', 'Organizations::dashboard/$1');
$routes->get('organizations/create', 'Organizations::create');
$routes->post('organizations/create', 'Organizations::create');
$routes->get('organizations/edit/(:num)', 'Organizations::edit/$1');
$routes->post('organizations/edit/(:num)', 'Organizations::edit/$1');
$routes->get('organizations/delete/(:num)', 'Organizations::delete/$1');
$routes->post('organizations/delete/(:num)', 'Organizations::delete/$1');
$routes->get('organizations/switch/(:num)', 'Organizations::switch/$1');
# Управление пользователями организации
$routes->get('organizations/(:num)/users', 'Organizations::users/$1');
$routes->get('organizations/(:num)/users/table', 'Organizations::usersTable/$1');
$routes->post('organizations/(:num)/users/invite', 'Organizations::inviteUser/$1');
$routes->post('organizations/(:num)/users/role', 'Organizations::updateUserRole/$1');
$routes->post('organizations/(:num)/users/(:num)/block', 'Organizations::blockUser/$1/$2');
$routes->post('organizations/(:num)/users/(:num)/unblock', 'Organizations::unblockUser/$1/$2');
$routes->post('organizations/(:num)/users/(:num)/remove', 'Organizations::removeUser/$1/$2');
$routes->post('organizations/(:num)/leave', 'Organizations::leaveOrganization/$1');
$routes->post('organizations/(:num)/users/leave', 'Organizations::leaveOrganization/$1');
$routes->post('organizations/(:num)/users/(:num)/resend', 'Organizations::resendInvite/$1/$2');
$routes->post('organizations/(:num)/users/(:num)/cancel', 'Organizations::cancelInvite/$1/$2');
});
# Маршруты профиля
$routes->get('profile', 'Profile::index');
$routes->get('profile/organizations', 'Profile::organizations');
$routes->get('profile/security', 'Profile::security');
$routes->post('profile/update-name', 'Profile::updateName');
$routes->post('profile/upload-avatar', 'Profile::uploadAvatar');
$routes->post('profile/change-password', 'Profile::changePassword');
$routes->post('profile/leave-org/(:num)', 'Profile::leaveOrganization/$1');
# =============================================================================
# ЗАЩИЩЁННЫЕ МАРШУТЫ (требуется auth И org)
# =============================================================================
$routes->group('', ['filter' => 'auth'], static function ($routes) {
$routes->group('', ['filter' => 'org'], static function ($routes) {
$routes->get('organizations/(:num)/dashboard', 'Organizations::dashboard/$1');
$routes->get('organizations/edit/(:num)', 'Organizations::edit/$1');
$routes->post('organizations/edit/(:num)', 'Organizations::edit/$1');
$routes->get('organizations/delete/(:num)', 'Organizations::delete/$1');
$routes->post('organizations/delete/(:num)', 'Organizations::delete/$1');
# Подключение роутов модулей
require_once APPPATH . 'Modules/Clients/Config/Routes.php';
# Управление пользователями организации
$routes->get('organizations/(:num)/users', 'Organizations::users/$1');
$routes->get('organizations/(:num)/users/table', 'Organizations::usersTable/$1');
$routes->post('organizations/(:num)/users/invite', 'Organizations::inviteUser/$1');
$routes->post('organizations/(:num)/users/role', 'Organizations::updateUserRole/$1');
$routes->post('organizations/(:num)/users/(:num)/block', 'Organizations::blockUser/$1/$2');
$routes->post('organizations/(:num)/users/(:num)/unblock', 'Organizations::unblockUser/$1/$2');
$routes->post('organizations/(:num)/users/(:num)/remove', 'Organizations::removeUser/$1/$2');
$routes->post('organizations/(:num)/leave', 'Organizations::leaveOrganization/$1');
$routes->post('organizations/(:num)/users/leave', 'Organizations::leaveOrganization/$1');
$routes->post('organizations/(:num)/users/(:num)/resend', 'Organizations::resendInvite/$1/$2');
$routes->post('organizations/(:num)/users/(:num)/cancel', 'Organizations::cancelInvite/$1/$2');
});
});
# =============================================================================
# ПОДКЛЮЧЕНИЕ РОУТОВ МОДУЛЕЙ (требуется auth)
# =============================================================================
$routes->group('', ['filter' => 'auth'], static function ($routes) {
require_once APPPATH . 'Modules/Clients/Config/Routes.php';
});
# =============================================================================
# СУПЕРАДМИН ПАНЕЛЬ (требуется system_role: superadmin)
# =============================================================================
$routes->group('superadmin', ['filter' => 'role:system:superadmin'], static function ($routes) {
$routes->get('/', 'Superadmin::index');
$routes->get('plans', 'Superadmin::plans');
$routes->get('plans/create', 'Superadmin::createPlan');
$routes->post('plans/store', 'Superadmin::storePlan');
$routes->get('plans/edit/(:num)', 'Superadmin::editPlan/$1');
$routes->post('plans/update/(:num)', 'Superadmin::updatePlan/$1');
$routes->get('plans/delete/(:num)', 'Superadmin::deletePlan/$1');
$routes->get('organizations', 'Superadmin::organizations');
$routes->get('organizations/table', 'Superadmin::organizationsTable');
$routes->get('organizations/view/(:num)', 'Superadmin::viewOrganization/$1');
$routes->post('organizations/set-plan/(:num)', 'Superadmin::setOrganizationPlan/$1');
$routes->get('organizations/block/(:num)', 'Superadmin::blockOrganization/$1');
$routes->get('organizations/unblock/(:num)', 'Superadmin::unblockOrganization/$1');
$routes->get('organizations/delete/(:num)', 'Superadmin::deleteOrganization/$1');
$routes->get('users', 'Superadmin::users');
$routes->get('users/table', 'Superadmin::usersTable');
$routes->post('users/update-role/(:num)', 'Superadmin::updateUserRole/$1');
$routes->get('users/block/(:num)', 'Superadmin::blockUser/$1');
$routes->get('users/unblock/(:num)', 'Superadmin::unblockUser/$1');
$routes->get('users/delete/(:num)', 'Superadmin::deleteUser/$1');
$routes->get('statistics', 'Superadmin::statistics');
});