diff --git a/app/Filament/Pages/Monitoring/Commandocentrum.php b/app/Filament/Pages/Monitoring/Commandocentrum.php
index 33a2fe8..3c67c73 100755
--- a/app/Filament/Pages/Monitoring/Commandocentrum.php
+++ b/app/Filament/Pages/Monitoring/Commandocentrum.php
@@ -12,7 +12,6 @@ use App\Models\StaffActivity;
use App\Services\AutoDetectService;
use App\Services\CatalogService;
use App\Services\Diagnostics\DiagnosticRunner;
-use App\Services\EmulatorUpdateService;
use App\Services\GitHubService;
use App\Services\RconService;
use App\Services\SettingsService;
@@ -152,7 +151,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('server_info')
->label('')
- ->content(fn (): HtmlString => $this->renderServerInfo()),
+ ->content(fn () => $this->renderServerInfoView()),
]),
Section::make('🩺 Systeem Gezondheid')
@@ -177,7 +176,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('hotel_status')
->label('')
- ->content(fn (): HtmlString => $this->renderHotelStatus()),
+ ->content(fn () => $this->renderHotelStatusView()),
]),
Section::make('📢 Hotel Alert')
@@ -186,7 +185,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('alert_form')
->label('')
- ->content(fn (): HtmlString => $this->renderAlertForm()),
+ ->content(fn () => view('filament.components.commandocentrum.alert-form')),
]),
Section::make('📜 Emulator Logs')
@@ -228,7 +227,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('emulator_info')
->label('')
- ->content(fn (): HtmlString => $this->renderEmulatorInfo()),
+ ->content(fn () => $this->renderEmulatorInfoView()),
]),
Section::make('🔄 Emulator Updates')
@@ -255,7 +254,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('emulator_settings')
->label('')
- ->content(fn (): HtmlString => $this->renderEmulatorSettings()),
+ ->content(fn () => $this->renderEmulatorSettingsView()),
]),
Section::make('💾 Emulator Backups')
@@ -264,7 +263,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('backups_list')
->label('')
- ->content(fn (): HtmlString => $this->renderBackupsList()),
+ ->content(fn () => $this->renderBackupsListView()),
]),
Section::make('📦 Nitro Client')
@@ -295,7 +294,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('nitro_settings')
->label('')
- ->content(fn (): HtmlString => $this->renderNitroSettings()),
+ ->content(fn () => $this->renderNitroSettingsView()),
]),
Section::make('⚙️ Automatische Updates')
@@ -329,7 +328,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('clothing_status')
->label('')
- ->content(fn (): HtmlString => $this->renderClothingStatus()),
+ ->content(fn () => $this->renderClothingStatusView()),
]),
Section::make('🔔 Meldingen')
@@ -371,7 +370,7 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('history')
->label('')
- ->content(fn (): HtmlString => $this->getUpdateHistoryHtml()),
+ ->content(fn () => $this->renderUpdateHistoryView()),
]),
Section::make('🔐 Social Login (v1.4)')
@@ -414,11 +413,217 @@ final class Commandocentrum extends Page implements HasForms
->schema([
Placeholder::make('staff_activity')
->label('')
- ->content(fn (): HtmlString => $this->getStaffActivityHtml()),
+ ->content(fn () => $this->renderStaffActivityView()),
]),
]);
}
+ private function renderServerInfoView(): \Illuminate\Contracts\View\View
+ {
+ $load = sys_getloadavg();
+
+ return view('filament.components.commandocentrum.server-info', [
+ 'phpVersion' => phpversion(),
+ 'laravelVersion' => app()->version(),
+ 'memoryUsage' => round(memory_get_usage() / 1024 / 1024, 2),
+ 'memoryLimit' => ini_get('memory_limit'),
+ 'diskUsage' => $this->runCommand("df -h /var/www | tail -1 | awk '{print \$3 \"/\" \$2}'") ?: 'N/B',
+ 'uptime' => $this->runCommand('uptime -p 2>/dev/null') ?: 'N/B',
+ 'load1' => $load ? number_format($load[0], 2) : 'N/A',
+ 'load5' => $load ? number_format($load[1], 2) : 'N/A',
+ 'load15' => $load ? number_format($load[2], 2) : 'N/A',
+ ]);
+ }
+
+ private function renderHotelStatusView(): \Illuminate\Contracts\View\View
+ {
+ $serviceName = $this->getSetting('emulator_service_name', 'emulator');
+ $serviceStatus = $this->runCommand('systemctl is-active ' . escapeshellarg($serviceName) . ' 2>/dev/null') ?: 'inactive';
+ $serviceColor = $serviceStatus === 'active' ? '#22c55e' : '#ef4444';
+
+ $nitroClientPath = $this->getSetting('nitro_client_path', '/var/www/nitro-client');
+ $nitroRendererPath = $this->getSetting('nitro_renderer_path', '/var/www/nitro-renderer');
+ $nitroWebroot = $this->getSetting('nitro_webroot', '/var/www/Client');
+
+ $clientCommit = $this->getGitCommit($nitroClientPath);
+ $rendererCommit = $this->getGitCommit($nitroRendererPath);
+
+ $clientExists = $this->checkPathExists($nitroClientPath);
+ $rendererExists = $this->checkPathExists($nitroRendererPath);
+
+ $clientColor = $clientExists ? '#22c55e' : '#ef4444';
+ $rendererColor = $rendererExists ? '#22c55e' : '#ef4444';
+ $clientText = $clientExists ? '✓ ' . substr($clientCommit, 0, 7) : '✗ Niet gevonden';
+ $rendererText = $rendererExists ? '✓ ' . substr($rendererCommit, 0, 7) : '✗ Niet gevonden';
+ $webrootText = $rendererExists ? '✓ ' . basename($nitroWebroot) : '✗ Niet gevonden';
+ $webrootColor = $rendererExists ? '#22c55e' : '#ef4444';
+
+ return view('filament.components.commandocentrum.hotel-status', [
+ 'serviceStatus' => $serviceStatus,
+ 'serviceColor' => $serviceColor,
+ 'onlineUsers' => $this->getOnlineUsersCount(),
+ 'emulatorStatus' => $this->getEmulatorStatusText(),
+ 'dbStatus' => $this->isDatabaseOnline() ? 'Online' : 'Offline',
+ 'dbColor' => $this->isDatabaseOnline() ? '#22c55e' : '#ef4444',
+ 'clientExists' => $clientExists,
+ 'clientColor' => $clientColor,
+ 'clientText' => $clientText,
+ 'rendererExists' => $rendererExists,
+ 'rendererColor' => $rendererColor,
+ 'rendererText' => $rendererText,
+ 'webrootText' => $webrootText,
+ 'webrootColor' => $webrootColor,
+ ]);
+ }
+
+ private function renderEmulatorInfoView(): \Illuminate\Contracts\View\View
+ {
+ $status = $this->getEmulatorStatusText();
+
+ return view('filament.components.commandocentrum.emulator-info', [
+ 'version' => $this->getSetting('emulator_version', 'Onbekend'),
+ 'serviceName' => $this->getSetting('emulator_service_name', 'arcturus'),
+ 'status' => $status,
+ 'color' => $status === 'Online' ? '#22c55e' : '#ef4444',
+ ]);
+ }
+
+ private function renderEmulatorSettingsView(): \Illuminate\Contracts\View\View
+ {
+ return view('filament.components.commandocentrum.emulator-settings', [
+ 'emulatorBranchesHtml' => $this->getEmulatorBranchesHtml(),
+ 'emulatorStatusHtml' => $this->renderEmulatorStatusView()->render(),
+ ]);
+ }
+
+ private function renderEmulatorStatusView(): \Illuminate\Contracts\View\View
+ {
+ $serviceName = $this->getSetting('emulator_service_name', 'arcturus');
+ $jarPath = $this->getSetting('emulator_jar_path', '/var/www/Emulator');
+ $sourcePath = $this->getSetting('emulator_source_path', '/var/www/emulator-source');
+ $githubUrl = $this->getSetting('emulator_github_url', '');
+ $branch = $this->getSetting('emulator_github_branch', 'main');
+
+ $jarExists = $this->fileExists($jarPath);
+ $sourceExists = $this->fileExists($sourcePath);
+ $sourceCommit = $this->getGitCommit($sourcePath);
+ $remoteVersion = $githubUrl !== '' && $githubUrl !== '0' ? $this->getRemoteCommit($githubUrl, $branch) : 'N/A';
+
+ $canBuild = false;
+ $checkDirs = [
+ $sourcePath,
+ $sourcePath . '/Emulator',
+ $sourcePath . '/Emulator/Emulator',
+ $sourcePath . '/emulator',
+ $sourcePath . '/emulator/emulator',
+ ];
+ foreach ($checkDirs as $dir) {
+ $check = $this->runCommand('test -f ' . escapeshellarg($dir . '/pom.xml') . ' && echo yes');
+ if ($check && trim($check) === 'yes') {
+ $canBuild = true;
+ break;
+ }
+ }
+
+ return view('filament.components.commandocentrum.emulator-status', [
+ 'emulatorOnline' => $this->getEmulatorStatusText() === 'Online',
+ 'jarExists' => $jarExists,
+ 'serviceName' => $serviceName,
+ 'sourceCommit' => $sourceCommit,
+ 'remoteVersion' => $remoteVersion,
+ 'canBuild' => $canBuild,
+ 'jarPath' => $jarPath,
+ 'sourcePath' => $sourcePath,
+ ]);
+ }
+
+ private function renderNitroSettingsView(): \Illuminate\Contracts\View\View
+ {
+ return view('filament.components.commandocentrum.nitro-settings', [
+ 'nitroBranchesHtml' => $this->getNitroBranchesHtml(),
+ 'nitroStatusHtml' => $this->renderNitroStatusView()->render(),
+ ]);
+ }
+
+ private function renderNitroStatusView(): \Illuminate\Contracts\View\View
+ {
+ $clientPath = $this->getSetting('nitro_client_path', '/var/www/nitro-client');
+ $rendererPath = $this->getSetting('nitro_renderer_path', '/var/www/nitro-renderer');
+ $webroot = $this->getSetting('nitro_webroot', '/var/www/Client');
+ $clientGithubUrl = $this->getSetting('nitro_github_url', '');
+ $rendererGithubUrl = $this->getSetting('nitro_renderer_github_url', 'https://github.com/duckietm/Nitro_Render_V3');
+
+ $clientCommit = $this->getGitCommit($clientPath);
+ $rendererCommit = $this->getGitCommit($rendererPath);
+ $clientRemote = $clientGithubUrl !== '' && $clientGithubUrl !== '0' ? $this->getRemoteCommit($clientGithubUrl, $this->getSetting('nitro_github_branch', 'main')) : 'N/A';
+ $rendererRemote = $rendererGithubUrl !== '' && $rendererGithubUrl !== '0' ? $this->getRemoteCommit($rendererGithubUrl, $this->getSetting('nitro_renderer_github_branch', 'main')) : 'N/A';
+
+ return view('filament.components.commandocentrum.nitro-status', [
+ 'clientExists' => $this->checkPathExists($clientPath),
+ 'rendererExists' => $this->checkPathExists($rendererPath),
+ 'webrootExists' => $this->checkPathExists($webroot),
+ 'clientCommit' => $clientCommit,
+ 'rendererCommit' => $rendererCommit,
+ 'clientRemote' => $clientRemote,
+ 'rendererRemote' => $rendererRemote,
+ ]);
+ }
+
+ private function renderBackupsListView(): \Illuminate\Contracts\View\View
+ {
+ try {
+ $backups = app(EmulatorControlAction::class)->getBackups();
+ } catch (Exception) {
+ $backups = [];
+ }
+
+ return view('filament.components.commandocentrum.backups-list', [
+ 'backups' => $backups,
+ ]);
+ }
+
+ private function renderClothingStatusView(): \Illuminate\Contracts\View\View
+ {
+ try {
+ $count = DB::table('catalog_clothing')->count();
+ } catch (Exception) {
+ $count = 0;
+ }
+
+ return view('filament.components.commandocentrum.clothing-status', [
+ 'clothingCount' => $count,
+ ]);
+ }
+
+ private function renderStaffActivityView(): \Illuminate\Contracts\View\View
+ {
+ try {
+ $activities = StaffActivity::with('user:id,username,look')
+ ->orderByDesc('created_at')
+ ->limit(20)
+ ->get();
+ } catch (Exception) {
+ $activities = collect();
+ }
+
+ return view('filament.components.commandocentrum.staff-activity', [
+ 'activities' => $activities,
+ ]);
+ }
+
+ private function renderUpdateHistoryView(): \Illuminate\Contracts\View\View
+ {
+ try {
+ $history = app(UpdateHistoryService::class)->getRecent(10);
+ } catch (Exception) {
+ $history = [];
+ }
+
+ return view('filament.components.commandocentrum.update-history', [
+ 'history' => $history,
+ ]);
+ }
+
private function getSetting(string $key, string $default = ''): string
{
try {
@@ -475,7 +680,7 @@ final class Commandocentrum extends Page implements HasForms
};
return new HtmlString(<<
+
@@ -550,167 +755,6 @@ final class Commandocentrum extends Page implements HasForms
}
}
- private function renderServerInfo(): HtmlString
- {
- $phpVersion = phpversion();
- $laravelVersion = app()->version();
- $memoryUsage = round(memory_get_usage() / 1024 / 1024, 2);
- $memoryLimit = ini_get('memory_limit');
- $diskUsage = $this->runCommand("df -h /var/www | tail -1 | awk '{print \$3 \"/\" \$2}'") ?: 'N/B';
- $uptime = $this->runCommand('uptime -p 2>/dev/null') ?: 'N/B';
-
- $load = sys_getloadavg();
- $load1 = $load ? number_format($load[0], 2) : 'N/A';
- $load5 = $load ? number_format($load[1], 2) : 'N/A';
- $load15 = $load ? number_format($load[2], 2) : 'N/A';
-
- return new HtmlString(<<
-
-
-
- PHP
- {$phpVersion}
-
-
- Laravel
- {$laravelVersion}
-
-
-
-
-
- Memory
- {$memoryUsage}MB / {$memoryLimit}
-
-
- Disk
- {$diskUsage}
-
-
-
-
-
- HTML);
- }
-
- private function renderHotelStatus(): HtmlString
- {
- $serviceName = $this->getSetting('emulator_service_name', 'emulator');
- $serviceStatus = $this->runCommand('systemctl is-active ' . escapeshellarg($serviceName) . ' 2>/dev/null') ?: 'inactive';
- $serviceColor = $serviceStatus === 'active' ? '#22c55e' : '#ef4444';
-
- $nitroClientPath = $this->getSetting('nitro_client_path', '/var/www/nitro-client');
- $nitroRendererPath = $this->getSetting('nitro_renderer_path', '/var/www/nitro-renderer');
- $nitroWebroot = $this->getSetting('nitro_webroot', '/var/www/Client');
-
- $clientCommit = $this->getGitCommit($nitroClientPath);
- $rendererCommit = $this->getGitCommit($nitroRendererPath);
-
- $clientExists = $this->checkPathExists($nitroClientPath);
- $rendererExists = $this->checkPathExists($nitroRendererPath);
-
- $onlineUsers = $this->getOnlineUsersCount();
- $emulatorStatus = $this->getEmulatorStatusText();
- $dbStatus = $this->isDatabaseOnline() ? 'Online' : 'Offline';
- $dbColor = $dbStatus === 'Online' ? '#22c55e' : '#ef4444';
-
- $clientColor = $clientExists ? '#22c55e' : '#ef4444';
- $rendererColor = $rendererExists ? '#22c55e' : '#ef4444';
- $clientText = $clientExists ? '✓ ' . substr($clientCommit, 0, 7) : '✗ Niet gevonden';
- $rendererText = $rendererExists ? '✓ ' . substr($rendererCommit, 0, 7) : '✗ Niet gevonden';
- $webrootText = $rendererExists ? '✓ ' . basename($nitroWebroot) : '✗ Niet gevonden';
- $webrootColor = $rendererExists ? '#22c55e' : '#ef4444';
-
- return new HtmlString(<<
-
-
-
- Status
- {$serviceStatus}
-
-
- Online
- {$emulatorStatus}
-
-
- Gebruikers
- {$onlineUsers}
-
-
- Database
- {$dbStatus}
-
-
-
-
-
- Client
- {$clientText}
-
-
- Renderer
- {$rendererText}
-
-
- Webroot
- {$webrootText}
-
-
-
- HTML);
- }
-
private function getEmulatorBranchesHtml(): string
{
$githubUrl = $this->getSetting('emulator_github_url', '');
@@ -743,230 +787,6 @@ final class Commandocentrum extends Page implements HasForms
return $html;
}
- private function renderAlertForm(): HtmlString
- {
- return new HtmlString(<<<'HTML'
-
-
-
-
- HTML);
- }
-
- private function renderEmulatorInfo(): HtmlString
- {
- $version = $this->getSetting('emulator_version', 'Onbekend');
- $serviceName = $this->getSetting('emulator_service_name', 'arcturus');
- $status = $this->getEmulatorStatusText();
- $color = $status === 'Online' ? '#22c55e' : '#ef4444';
-
- return new HtmlString(<<
-
-
-
Service
-
{$serviceName}
-
-
-
- HTML);
- }
-
- private function renderEmulatorSettings(): HtmlString
- {
- $status = $this->getEmulatorStatusHtml();
-
- return new HtmlString(<<
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {$status}
-
-
- HTML);
- }
-
- private function getEmulatorStatusHtml(): string
- {
- $serviceName = $this->getSetting('emulator_service_name', 'arcturus');
- $jarPath = $this->getSetting('emulator_jar_path', '/var/www/Emulator');
-
- $emulatorOnline = $this->getEmulatorStatusText() === 'Online';
-
- $jarExists = $this->fileExists($jarPath);
-
- $onlineStatus = $emulatorOnline
- ? '✓ Online'
- : '✗ Offline';
- $jarStatus = $jarExists
- ? '✓ JAR OK'
- : '✗ JAR ontbreekt';
- $serviceStatus = 'Service: ' . e($serviceName) . '';
-
- $updateInfo = $this->checkEmulatorUpdatesFromGitHub();
-
- return ''
- . '
' . $onlineStatus . $jarStatus . $serviceStatus . '
'
- . '
' . $updateInfo . '
'
- . '
';
- }
-
- private function checkEmulatorUpdatesFromGitHub(): string
- {
- try {
- $githubUrl = $this->getSetting('emulator_github_url', '');
- $sourcePath = $this->getSetting('emulator_source_path', '/var/www/emulator-source');
- $jarPath = $this->getSetting('emulator_jar_path', '/var/www/Emulator');
-
- $sourceExists = $this->fileExists($sourcePath);
- $jarExists = $this->fileExists($jarPath);
-
- $sourceCommit = $this->getGitCommit($sourcePath);
- $remoteVersion = $githubUrl !== '' && $githubUrl !== '0' ? $this->getRemoteCommit($githubUrl, $this->getSetting('emulator_github_branch', 'main')) : 'N/A';
-
- $canBuild = false;
- $pomPath = '';
- $checkDirs = [
- $sourcePath,
- $sourcePath . '/Emulator',
- $sourcePath . '/Emulator/Emulator',
- $sourcePath . '/emulator',
- $sourcePath . '/emulator/emulator',
- ];
- foreach ($checkDirs as $dir) {
- $check = $this->runCommand('test -f ' . escapeshellarg($dir . '/pom.xml') . ' && echo yes');
- if ($check && trim($check) === 'yes') {
- $canBuild = true;
- $pomPath = $dir;
- break;
- }
- }
-
- $hasUpdate = $sourceCommit !== 'N/A' && $remoteVersion !== 'N/A' && substr($sourceCommit, 0, 7) !== $remoteVersion;
- $updateColor = $hasUpdate ? '#f59e0b' : '#22c55e';
- $updateText = $hasUpdate ? '🔄 Update beschikbaar' : '✓ Up-to-date';
-
- $html = 'GitHub Status:
';
-
- // Update status
- $html .= '';
- $html .= '
';
- $html .= '
';
- $html .= $updateText;
- $html .= '
';
-
- // Always show update button
- $btnColor = $hasUpdate ? '#f59e0b' : '#3b82f6';
- $btnGradient = $hasUpdate ? 'linear-gradient(135deg,#f59e0b,#d97706)' : 'linear-gradient(135deg,#3b82f6,#2563eb)';
- $btnText = $hasUpdate ? '⚡ Updaten' : '🔄 Herbouwen';
- $html .= '
';
-
- $html .= '
';
-
- // Version info - use short hash for comparison
- $sourceCommitShort = substr($sourceCommit, 0, 7);
- $html .= 'Latest:✓ ' . e($remoteVersion) . '
';
- $html .= 'Source:✓ ' . $sourceCommitShort . '
';
-
- // Build method
- if ($jarExists) {
- $jarSize = $this->runCommand('ls -lh ' . escapeshellarg($jarPath) . '/*.jar 2>/dev/null | head -1');
- if ($jarSize) {
- preg_match('/(\S+\.jar)/', $jarSize, $matches);
- if (isset($matches[1])) {
- $html .= 'JAR:✓ ' . basename($matches[1]) . '
';
- }
- }
- }
-
- if ($canBuild) {
- $html .= 'Bouwen:✓ Maven (pom.xml)
';
- } else {
- $html .= 'Bouwen:⚠️ Geen pom.xml
';
- }
-
- // Auto-update method
- $html .= '';
- $html .= '
METHODE:
';
- if ($jarExists) {
- $html .= '
📦 JAR Download & Herstart
';
- } elseif ($canBuild) {
- $html .= '
🔨 Maven Build & Herstart
';
- } else {
- $html .= '
Handmatig: Download JAR van GitHub
';
- }
-
- return $html . '
';
- } catch (Exception) {
- return 'Kon emulator status niet ophalen';
- }
- }
-
private function getRemoteCommit(string $githubUrl, string $branch = 'main'): string
{
$commit = app(GitHubService::class)->getLatestCommit($githubUrl, $branch);
@@ -974,137 +794,6 @@ final class Commandocentrum extends Page implements HasForms
return $commit ?? 'N/A';
}
- private function renderNitroSettings(): HtmlString
- {
- $status = $this->getNitroStatusHtml();
-
- return new HtmlString(<<
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {$status}
-
-
- HTML);
- }
-
- private function getNitroStatusHtml(): string
- {
- $clientPath = $this->getSetting('nitro_client_path', '/var/www/atomcms/nitro-client');
- $rendererPath = $this->getSetting('nitro_renderer_path', '/var/www/atomcms/nitro-renderer');
- $webroot = $this->getSetting('nitro_webroot', '/var/www/Client');
-
- $clientExists = $this->checkPathExists($clientPath);
- $rendererExists = $this->checkPathExists($rendererPath);
- $webrootExists = $this->checkPathExists($webroot);
-
- $clientStatus = $clientExists ? '✓ Client OK' : '✗ Client ontbreekt';
- $rendererStatus = $rendererExists ? '✓ Renderer OK' : '✗ Renderer ontbreekt';
- $webrootStatus = $webrootExists ? '✓ Webroot OK' : '✗ Webroot ontbreekt';
-
- $updateInfo = $this->checkNitroUpdatesFromGitHub();
-
- return ''
- . $clientStatus . $rendererStatus . $webrootStatus
- . '
' . $updateInfo . '
'
- . '
';
- }
-
- private function checkNitroUpdatesFromGitHub(): string
- {
- try {
- $clientPath = $this->getSetting('nitro_client_path', '/var/www/nitro-client');
- $rendererPath = $this->getSetting('nitro_renderer_path', '/var/www/nitro-renderer');
- $clientGithubUrl = $this->getSetting('nitro_github_url', '');
- // Use the renderer-specific repo (defaults to Nitro_Render_V3 if not set)
- $rendererGithubUrl = $this->getSetting('nitro_renderer_github_url', 'https://github.com/duckietm/Nitro_Render_V3');
-
- $clientCommit = $this->getGitCommit($clientPath);
- $rendererCommit = $this->getGitCommit($rendererPath);
-
- $clientRemote = $clientGithubUrl !== '' && $clientGithubUrl !== '0' ? $this->getRemoteCommit($clientGithubUrl, $this->getSetting('nitro_github_branch', 'main')) : 'N/A';
- $rendererRemote = $rendererGithubUrl !== '' && $rendererGithubUrl !== '0' ? $this->getRemoteCommit($rendererGithubUrl, $this->getSetting('nitro_renderer_github_branch', 'main')) : 'N/A';
-
- // Compare only first 7 characters (short hash)
- $clientCommitShort = substr($clientCommit, 0, 7);
- $rendererCommitShort = substr($rendererCommit, 0, 7);
- $hasClientUpdate = $clientCommitShort !== 'N/A' && $clientRemote !== 'N/A' && $clientCommitShort !== $clientRemote;
- $hasRendererUpdate = $rendererCommitShort !== 'N/A' && $rendererRemote !== 'N/A' && $rendererCommitShort !== $rendererRemote;
- $hasUpdate = $hasClientUpdate || $hasRendererUpdate;
-
- $updateColor = $hasUpdate ? '#f59e0b' : '#22c55e';
- $updateText = $hasUpdate ? '🔄 Update beschikbaar' : '✓ Up-to-date';
-
- $html = 'GitHub Status:
';
-
- // Update status
- $html .= '';
- $html .= '
';
- $html .= '
';
- $html .= $updateText;
- $html .= '
';
-
- // Update button if update available
- if ($hasUpdate) {
- $html .= '
';
- }
-
- $html .= '
';
-
- // Client info
- $clientColor = $hasClientUpdate ? '#f59e0b' : '#22c55e';
- $clientIcon = $hasClientUpdate ? '🔄' : '✓';
- $html .= 'Client Remote:✓ ' . e($clientRemote) . '
';
- $html .= 'Client Local:' . $clientIcon . ' ' . $clientCommitShort . '
';
-
- // Renderer info
- $rendererColor = $hasRendererUpdate ? '#f59e0b' : '#22c55e';
- $rendererIcon = $hasRendererUpdate ? '🔄' : '✓';
- $html .= 'Renderer Remote:✓ ' . e($rendererRemote) . '
';
-
- return $html . ('Renderer Local:' . $rendererIcon . ' ' . $rendererCommitShort . '
');
- } catch (Exception) {
- return 'Kon updates niet ophalen';
- }
- }
-
private function getGitCommit(string $path): string
{
if (! $this->fileExists($path)) {
@@ -1143,29 +832,6 @@ final class Commandocentrum extends Page implements HasForms
return $this->fileExists($path);
}
- public function getUpdateHistoryHtml(): HtmlString
- {
- try {
- $history = app(UpdateHistoryService::class)->getRecent(10);
- if (empty($history)) {
- return new HtmlString('Geen updates gevonden
');
- }
- $html = '';
- foreach ($history as $update) {
- $statusColor = $update->status === 'success' ? '#22c55e' : ($update->status === 'pending' ? '#f59e0b' : '#ef4444');
- $html .= '
';
- $html .= '
' . e($update->type) . '' . e($update->message) . '
';
- $html .= '
' . e($update->status) . '' . e($update->created_at) . '
';
- $html .= '
';
- }
- $html .= '
';
-
- return new HtmlString($html);
- } catch (Exception) {
- return new HtmlString('Kon historie niet laden
');
- }
- }
-
public function sendHotelAlert(): void
{
$result = app(EmulatorControlAction::class)->sendAlert($this->data['hotel_alert_message'] ?? '');
@@ -1223,56 +889,6 @@ final class Commandocentrum extends Page implements HasForms
$this->notify($result['success'] ?? false ? 'Success' : 'Error', $result['message'] ?? $result['error'] ?? 'Onbekende fout', ($result['success'] ?? false) ? 'success' : 'danger');
}
- public function renderBackupsList(): HtmlString
- {
- try {
- $backups = app(EmulatorControlAction::class)->getBackups();
-
- if ($backups === []) {
- return new HtmlString(<<<'HTML'
-
-
-
Nog geen backups beschikbaar
-
Backups worden automatisch aangemaakt bij elke emulator update
-
- HTML);
- }
-
- $html = '';
- foreach ($backups as $backup) {
- $dateFormatted = str_replace('_', ' ', $backup['date']);
- $html .= <<
-
-
-
-
{$backup['jar']}
-
-
-
{$dateFormatted}
-
-
- HTML;
- }
- $html .= '';
-
- return new HtmlString($html);
- } catch (Exception $e) {
- return new HtmlString('Kon backups niet laden: ' . e($e->getMessage()) . '
');
- }
- }
-
public function runSqlUpdates(): void
{
$result = app(EmulatorControlAction::class)->runSqlUpdates();
@@ -1337,23 +953,6 @@ final class Commandocentrum extends Page implements HasForms
$this->fillForm();
}
- private function renderClothingStatus(): HtmlString
- {
- try {
- $count = DB::table('catalog_clothing')->count();
- $html = '';
- $html .= '
';
- $html .= '
Kleding Items
';
- $html .= '
' . number_format($count) . '
';
- $html .= '
';
- $html .= '
';
-
- return new HtmlString($html);
- } catch (Exception $e) {
- return new HtmlString('Fout: ' . e($e->getMessage()) . '
');
- }
- }
-
public function syncClothing(): void
{
try {
@@ -1437,92 +1036,6 @@ final class Commandocentrum extends Page implements HasForms
}
}
- private function getStaffActivityHtml(): HtmlString
- {
- try {
- $activities = StaffActivity::with('user:id,username,look')
- ->orderByDesc('created_at')
- ->limit(20)
- ->get();
-
- if ($activities->isEmpty()) {
- return new HtmlString(<<<'HTML'
-
-
-
No staff activities recorded yet.
-
Staff actions will appear here automatically.
-
- HTML);
- }
-
- $itemsHtml = '';
- foreach ($activities as $activity) {
- $icon = StaffActivity::getActionIcon($activity->action);
- $color = StaffActivity::getActionColor($activity->action);
- $timeAgo = $this->getTimeAgo($activity->created_at);
- $username = $activity->user->username ?? 'Unknown';
- $userLook = $activity->user->look ?? '';
-
- $itemsHtml .= <<
-
- {$icon}
-
-
-
{$username}
-
{$activity->description}
-
-
- {$timeAgo}
-
-
- HTML;
- }
-
- return new HtmlString(<<
-
- Recent Staff Activities
- Last 20 actions
-
-
- {$itemsHtml}
-
-
- HTML);
- } catch (Exception $e) {
- return new HtmlString(<<<'HTML'
-
-
Error loading staff activities
-
Make sure to run: php artisan migrate
-
- HTML);
- }
- }
-
- private function getTimeAgo($timestamp): string
- {
- try {
- $carbon = Carbon::parse($timestamp);
- $now = Carbon::now();
- $diff = $now->diffInMinutes($carbon);
-
- if ($diff < 1) {
- return 'Just now';
- } elseif ($diff < 60) {
- return $diff . 'm ago';
- } elseif ($diff < 1440) {
- return floor($diff / 60) . 'h ago';
- } else {
- return floor($diff / 1440) . 'd ago';
- }
- } catch (Exception) {
- return 'Unknown';
- }
- }
-
public function testDiscord(): void
{
try {
diff --git a/resources/views/filament/components/commandocentrum/alert-form.blade.php b/resources/views/filament/components/commandocentrum/alert-form.blade.php
new file mode 100755
index 0000000..7942811
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/alert-form.blade.php
@@ -0,0 +1,18 @@
+
+
+
+
diff --git a/resources/views/filament/components/commandocentrum/backups-list.blade.php b/resources/views/filament/components/commandocentrum/backups-list.blade.php
new file mode 100755
index 0000000..82f7bc7
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/backups-list.blade.php
@@ -0,0 +1,38 @@
+@props(['backups'])
+
+@if (empty($backups))
+
+
+
Nog geen backups beschikbaar
+
Backups worden automatisch aangemaakt bij elke emulator update
+
+@else
+
+ @foreach ($backups as $backup)
+ @php
+ $dateFormatted = str_replace('_', ' ', $backup['date']);
+ @endphp
+
+
+
+
+
{{ $backup['jar'] }}
+
+
+
{{ $dateFormatted }}
+
+
+ @endforeach
+
+@endif
diff --git a/resources/views/filament/components/commandocentrum/clothing-status.blade.php b/resources/views/filament/components/commandocentrum/clothing-status.blade.php
new file mode 100755
index 0000000..dfa2b1c
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/clothing-status.blade.php
@@ -0,0 +1,8 @@
+@props(['clothingCount'])
+
+
+
+
Kleding Items
+
{{ number_format($clothingCount) }}
+
+
diff --git a/resources/views/filament/components/commandocentrum/emulator-info.blade.php b/resources/views/filament/components/commandocentrum/emulator-info.blade.php
new file mode 100755
index 0000000..f592703
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/emulator-info.blade.php
@@ -0,0 +1,21 @@
+@props([
+ 'version',
+ 'serviceName',
+ 'status',
+ 'color',
+])
+
+
+
+
Versie
+
{{ $version }}
+
+
+
Service
+
{{ $serviceName }}
+
+
+
Status
+
● {{ $status }}
+
+
diff --git a/resources/views/filament/components/commandocentrum/emulator-settings.blade.php b/resources/views/filament/components/commandocentrum/emulator-settings.blade.php
new file mode 100755
index 0000000..70f0bc7
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/emulator-settings.blade.php
@@ -0,0 +1,49 @@
+@props([
+ 'emulatorBranchesHtml',
+ 'emulatorStatusHtml',
+])
+
+
diff --git a/resources/views/filament/components/commandocentrum/emulator-status.blade.php b/resources/views/filament/components/commandocentrum/emulator-status.blade.php
new file mode 100755
index 0000000..63a9817
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/emulator-status.blade.php
@@ -0,0 +1,85 @@
+@props([
+ 'emulatorOnline',
+ 'jarExists',
+ 'serviceName',
+ 'sourceCommit',
+ 'remoteVersion',
+ 'canBuild',
+ 'jarPath',
+ 'sourcePath',
+])
+
+@php
+ $sourceCommitShort = substr($sourceCommit, 0, 7);
+ $hasUpdate = $sourceCommit !== 'N/A' && $remoteVersion !== 'N/A' && $sourceCommitShort !== $remoteVersion;
+ $updateColor = $hasUpdate ? '#f59e0b' : '#22c55e';
+ $updateText = $hasUpdate ? '🔄 Update beschikbaar' : '✓ Up-to-date';
+ $btnColor = $hasUpdate ? '#f59e0b' : '#3b82f6';
+ $btnGradient = $hasUpdate ? 'linear-gradient(135deg,#f59e0b,#d97706)' : 'linear-gradient(135deg,#3b82f6,#2563eb)';
+ $btnText = $hasUpdate ? '⚡ Updaten' : '🔄 Herbouwen';
+
+ $jarFileName = '';
+ if ($jarExists) {
+ $jarSize = shell_exec('ls -lh ' . escapeshellarg($jarPath) . '/*.jar 2>/dev/null | head -1');
+ if ($jarSize) {
+ preg_match('/(\S+\.jar)/', $jarSize, $matches);
+ if (isset($matches[1])) {
+ $jarFileName = basename($matches[1]);
+ }
+ }
+ }
+@endphp
+
+
+
+ @if ($emulatorOnline)
+ ✓ Online
+ @else
+ ✗ Offline
+ @endif
+ @if ($jarExists)
+ ✓ JAR OK
+ @else
+ ✗ JAR ontbreekt
+ @endif
+ Service: {{ e($serviceName) }}
+
+
+
GitHub Status:
+
+
+
+ {{ $updateText }}
+
+
+
+
+
Latest:✓ {{ e($remoteVersion) }}
+
Source:✓ {{ $sourceCommitShort }}
+ @if ($jarFileName !== '')
+
JAR:✓ {{ e($jarFileName) }}
+ @endif
+ @if ($canBuild)
+
Bouwen:✓ Maven (pom.xml)
+ @else
+
Bouwen:⚠️ Geen pom.xml
+ @endif
+
+
METHODE:
+ @if ($jarExists)
+
📦 JAR Download & Herstart
+ @elseif ($canBuild)
+
🔨 Maven Build & Herstart
+ @else
+
Handmatig: Download JAR van GitHub
+ @endif
+
+
+
diff --git a/resources/views/filament/components/commandocentrum/hotel-status.blade.php b/resources/views/filament/components/commandocentrum/hotel-status.blade.php
new file mode 100755
index 0000000..a056c77
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/hotel-status.blade.php
@@ -0,0 +1,63 @@
+@props([
+ 'serviceStatus',
+ 'serviceColor',
+ 'onlineUsers',
+ 'emulatorStatus',
+ 'dbStatus',
+ 'dbColor',
+ 'clientExists',
+ 'clientColor',
+ 'clientText',
+ 'rendererExists',
+ 'rendererColor',
+ 'rendererText',
+ 'webrootText',
+ 'webrootColor',
+])
+
+
+
+
+
+ Status
+ {{ $serviceStatus }}
+
+
+ Online
+ {{ $emulatorStatus }}
+
+
+ Gebruikers
+ {{ $onlineUsers }}
+
+
+ Database
+ {{ $dbStatus }}
+
+
+
+
+
+ Client
+ {{ $clientText }}
+
+
+ Renderer
+ {{ $rendererText }}
+
+
+ Webroot
+ {{ $webrootText }}
+
+
+
diff --git a/resources/views/filament/components/commandocentrum/nitro-settings.blade.php b/resources/views/filament/components/commandocentrum/nitro-settings.blade.php
new file mode 100755
index 0000000..beb081c
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/nitro-settings.blade.php
@@ -0,0 +1,41 @@
+@props([
+ 'nitroBranchesHtml',
+ 'nitroStatusHtml',
+])
+
+
diff --git a/resources/views/filament/components/commandocentrum/nitro-status.blade.php b/resources/views/filament/components/commandocentrum/nitro-status.blade.php
new file mode 100755
index 0000000..1d27b90
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/nitro-status.blade.php
@@ -0,0 +1,65 @@
+@props([
+ 'clientExists',
+ 'rendererExists',
+ 'webrootExists',
+ 'clientCommit',
+ 'rendererCommit',
+ 'clientRemote',
+ 'rendererRemote',
+])
+
+@php
+ $clientCommitShort = substr($clientCommit, 0, 7);
+ $rendererCommitShort = substr($rendererCommit, 0, 7);
+ $hasClientUpdate = $clientCommitShort !== 'N/A' && $clientRemote !== 'N/A' && $clientCommitShort !== $clientRemote;
+ $hasRendererUpdate = $rendererCommitShort !== 'N/A' && $rendererRemote !== 'N/A' && $rendererCommitShort !== $rendererRemote;
+ $hasUpdate = $hasClientUpdate || $hasRendererUpdate;
+ $updateColor = $hasUpdate ? '#f59e0b' : '#22c55e';
+ $updateText = $hasUpdate ? '🔄 Update beschikbaar' : '✓ Up-to-date';
+ $clientColor = $hasClientUpdate ? '#f59e0b' : '#22c55e';
+ $clientIcon = $hasClientUpdate ? '🔄' : '✓';
+ $rendererColor = $hasRendererUpdate ? '#f59e0b' : '#22c55e';
+ $rendererIcon = $hasRendererUpdate ? '🔄' : '✓';
+@endphp
+
+
+ @if ($clientExists)
+
✓ Client OK
+ @else
+
✗ Client ontbreekt
+ @endif
+ @if ($rendererExists)
+
✓ Renderer OK
+ @else
+
✗ Renderer ontbreekt
+ @endif
+ @if ($webrootExists)
+
✓ Webroot OK
+ @else
+
✗ Webroot ontbreekt
+ @endif
+
+
GitHub Status:
+
+
+
+ {{ $updateText }}
+
+ @if ($hasUpdate)
+
+ @endif
+
+
+
Client Remote:✓ {{ e($clientRemote) }}
+
Client Local:{{ $clientIcon }} {{ $clientCommitShort }}
+
Renderer Remote:✓ {{ e($rendererRemote) }}
+
Renderer Local:{{ $rendererIcon }} {{ $rendererCommitShort }}
+
+
diff --git a/resources/views/filament/components/commandocentrum/server-info.blade.php b/resources/views/filament/components/commandocentrum/server-info.blade.php
new file mode 100755
index 0000000..fe729aa
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/server-info.blade.php
@@ -0,0 +1,77 @@
+@props([
+ 'phpVersion',
+ 'laravelVersion',
+ 'memoryUsage',
+ 'memoryLimit',
+ 'diskUsage',
+ 'uptime',
+ 'load1',
+ 'load5',
+ 'load15',
+])
+
+
+
+
+
+ PHP
+ {{ $phpVersion }}
+
+
+ Laravel
+ {{ $laravelVersion }}
+
+
+
+
+
+ Memory
+ {{ $memoryUsage }}MB / {{ $memoryLimit }}
+
+
+ Disk
+ {{ $diskUsage }}
+
+
+
+
+
diff --git a/resources/views/filament/components/commandocentrum/staff-activity.blade.php b/resources/views/filament/components/commandocentrum/staff-activity.blade.php
new file mode 100755
index 0000000..7fe4eb2
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/staff-activity.blade.php
@@ -0,0 +1,59 @@
+@props(['activities'])
+
+@php
+ use App\Models\StaffActivity;
+@endphp
+
+@if ($activities->isEmpty())
+
+
+
No staff activities recorded yet.
+
Staff actions will appear here automatically.
+
+@else
+
+
+ Recent Staff Activities
+ Last 20 actions
+
+
+ @foreach ($activities as $activity)
+ @php
+ $icon = StaffActivity::getActionIcon($activity->action);
+ $timeAgo = '';
+ try {
+ $carbon = \Carbon\Carbon::parse($activity->created_at);
+ $now = \Carbon\Carbon::now();
+ $diff = $now->diffInMinutes($carbon);
+ if ($diff < 1) {
+ $timeAgo = 'Just now';
+ } elseif ($diff < 60) {
+ $timeAgo = $diff . 'm ago';
+ } elseif ($diff < 1440) {
+ $timeAgo = floor($diff / 60) . 'h ago';
+ } else {
+ $timeAgo = floor($diff / 1440) . 'd ago';
+ }
+ } catch (\Exception) {
+ $timeAgo = 'Unknown';
+ }
+ $username = $activity->user->username ?? 'Unknown';
+ @endphp
+
+
+ {{ $icon }}
+
+
+
{{ e($username) }}
+
{{ e($activity->description) }}
+
+
+ {{ $timeAgo }}
+
+
+ @endforeach
+
+
+@endif
diff --git a/resources/views/filament/components/commandocentrum/update-history.blade.php b/resources/views/filament/components/commandocentrum/update-history.blade.php
new file mode 100755
index 0000000..798c549
--- /dev/null
+++ b/resources/views/filament/components/commandocentrum/update-history.blade.php
@@ -0,0 +1,23 @@
+@props(['history'])
+
+@if (empty($history))
+ Geen updates gevonden
+@else
+
+ @foreach ($history as $update)
+ @php
+ $statusColor = $update->status === 'success' ? '#22c55e' : ($update->status === 'pending' ? '#f59e0b' : '#ef4444');
+ @endphp
+
+
+ {{ e($update->type) }}
+ {{ e($update->message) }}
+
+
+ {{ e($update->status) }}
+ {{ e($update->created_at) }}
+
+
+ @endforeach
+
+@endif