Many fixes
This commit is contained in:
@@ -47,6 +47,10 @@ class TwigGlobalsExtension extends AbstractExtension
|
||||
new TwigFunction('is_superadmin', [$this, 'isSuperadmin'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('is_system_admin', [$this, 'isSystemAdmin'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('get_system_role', [$this, 'getSystemRole'], ['is_safe' => ['html']]),
|
||||
|
||||
// Module subscription functions
|
||||
new TwigFunction('is_module_active', [$this, 'isModuleActive'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('is_module_available', [$this, 'isModuleAvailable'], ['is_safe' => ['html']]),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -161,6 +165,30 @@ class TwigGlobalsExtension extends AbstractExtension
|
||||
return service('access')->getSystemRole();
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// Module Subscription Functions
|
||||
// ========================================
|
||||
|
||||
public function isModuleActive(string $moduleCode): bool
|
||||
{
|
||||
$orgId = session()->get('active_org_id');
|
||||
if (!$orgId) {
|
||||
return false;
|
||||
}
|
||||
$subscriptionService = new \App\Services\ModuleSubscriptionService();
|
||||
return $subscriptionService->isModuleActive($moduleCode, $orgId);
|
||||
}
|
||||
|
||||
public function isModuleAvailable(string $moduleCode): bool
|
||||
{
|
||||
$orgId = session()->get('active_org_id');
|
||||
if (!$orgId) {
|
||||
return false;
|
||||
}
|
||||
$subscriptionService = new \App\Services\ModuleSubscriptionService();
|
||||
return $subscriptionService->isModuleAvailable($moduleCode, $orgId);
|
||||
}
|
||||
|
||||
|
||||
public function statusBadge(string $status): string
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user