feat: add full i18n support to Commandocentrum

- Replace all hardcoded Dutch/English strings with __() translation calls
- Update 13 Blade components to use translation keys
- Update Commandocentrum.php controller with translation calls
- Add comprehensive Dutch (nl.json) and English (en.json) translations
- 150+ translation keys for UI labels, messages, and notifications
- Supports all 21 languages available in the lang/ directory
This commit is contained in:
root
2026-05-19 21:49:39 +02:00
parent c6246615bc
commit 2f30a058a4
16 changed files with 585 additions and 3003 deletions
+126 -124
View File
@@ -38,6 +38,8 @@ use Illuminate\Support\Facades\Process;
use Illuminate\Support\HtmlString;
use UnitEnum;
use function __;
final class Commandocentrum extends Page implements HasForms
{
use InteractsWithForms;
@@ -126,27 +128,27 @@ final class Commandocentrum extends Page implements HasForms
{
return $schema
->components([
Section::make('🎯 Live Status')
->description('Real-time hotel statistieken')
Section::make(__('commandocentrum.live_status'))
->description(__('commandocentrum.live_status_desc'))
->icon('heroicon-o-heart')
->columns(4)
->schema([
Placeholder::make('online_users')
->label('Online')
->content(fn (): HtmlString => $this->getCardHtml('Online', $this->getOnlineUsersCount(), '#22c55e', 'heroicon-o-users')),
->label(__('commandocentrum.online'))
->content(fn (): HtmlString => $this->getCardHtml(__('commandocentrum.online'), $this->getOnlineUsersCount(), '#22c55e', 'heroicon-o-users')),
Placeholder::make('emulator_status')
->label('Emulator')
->content(fn (): HtmlString => $this->getCardHtml('Emulator', $this->getEmulatorStatusText(), $this->getEmulatorStatusColor(), 'heroicon-o-server')),
->label(__('commandocentrum.emulator'))
->content(fn (): HtmlString => $this->getCardHtml(__('commandocentrum.emulator'), $this->getEmulatorStatusText(), $this->getEmulatorStatusColor(), 'heroicon-o-server')),
Placeholder::make('database_status')
->label('Database')
->content(fn (): HtmlString => $this->getCardHtml('Database', $this->isDatabaseOnline() ? 'Online' : 'Offline', $this->isDatabaseOnline() ? '#22c55e' : '#ef4444', 'heroicon-o-circle-stack')),
->label(__('commandocentrum.database'))
->content(fn (): HtmlString => $this->getCardHtml(__('commandocentrum.database'), $this->isDatabaseOnline() ? __('commandocentrum.online') : __('commandocentrum.offline'), $this->isDatabaseOnline() ? '#22c55e' : '#ef4444', 'heroicon-o-circle-stack')),
Placeholder::make('server_load')
->label('Load')
->content(fn (): HtmlString => $this->getCardHtml('Load', $this->getServerLoad(), '#3b82f6', 'heroicon-o-cpu-chip')),
->label(__('commandocentrum.load'))
->content(fn (): HtmlString => $this->getCardHtml(__('commandocentrum.load'), $this->getServerLoad(), '#3b82f6', 'heroicon-o-cpu-chip')),
]),
Section::make('📊 Server Informatie')
->description('Gedetailleerde server status')
Section::make(__('commandocentrum.server_info'))
->description(__('commandocentrum.server_info_desc'))
->icon('heroicon-o-information-circle')
->schema([
Placeholder::make('server_info')
@@ -154,12 +156,12 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderServerInfoView()),
]),
Section::make('🩺 Systeem Gezondheid')
->description('Automatische systeem diagnostiek')
Section::make(__('commandocentrum.system_health'))
->description(__('commandocentrum.system_health_desc'))
->icon('heroicon-o-heart')
->afterHeader([
Action::make('refresh_diagnostics')
->label('Vernieuwen')
->label(__('commandocentrum.refresh'))
->icon('heroicon-o-arrow-path')
->color('info')
->action('refreshDiagnostics'),
@@ -170,8 +172,8 @@ final class Commandocentrum extends Page implements HasForms
->content(fn (): HtmlString => $this->renderDiagnostics()),
]),
Section::make('🏨 Hotel Status')
->description('Emulator en Nitro status')
Section::make(__('commandocentrum.hotel_status'))
->description(__('commandocentrum.hotel_status_desc'))
->icon('heroicon-o-building-office')
->schema([
Placeholder::make('hotel_status')
@@ -179,8 +181,8 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderHotelStatusView()),
]),
Section::make('📢 Hotel Alert')
->description('Stuur een bericht naar alle online gebruikers')
Section::make(__('commandocentrum.hotel_alert'))
->description(__('commandocentrum.hotel_alert_desc'))
->icon('heroicon-o-megaphone')
->schema([
Placeholder::make('alert_form')
@@ -188,8 +190,8 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => view('filament.components.commandocentrum.alert-form')),
]),
Section::make('📜 Emulator Logs')
->description('Live emulator log viewer')
Section::make(__('commandocentrum.emulator_logs'))
->description(__('commandocentrum.emulator_logs_desc'))
->icon('heroicon-o-document-text')
->columnSpanFull()
->schema([
@@ -198,28 +200,28 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => view('filament.components.emulator-log-viewer')),
]),
Section::make('🖥️ Emulator Control')
->description('Volledige emulator controle')
Section::make(__('commandocentrum.emulator_control'))
->description(__('commandocentrum.emulator_control_desc'))
->icon('heroicon-o-server')
->columns(3)
->afterHeader([
Action::make('start_emulator')
->label('Start')
->label(__('commandocentrum.start'))
->icon('heroicon-o-play')
->color('success')
->action('startEmulator'),
Action::make('stop_emulator')
->label('Stop')
->label(__('commandocentrum.stop'))
->icon('heroicon-o-stop')
->color('danger')
->action('stopEmulator'),
Action::make('restart_emulator')
->label('Restart')
->label(__('commandocentrum.restart'))
->icon('heroicon-o-arrow-path')
->color('warning')
->action('restartEmulator'),
Action::make('check_emulator')
->label('Check')
->label(__('commandocentrum.check'))
->icon('heroicon-o-check-circle')
->color('info')
->action('checkEmulator'),
@@ -230,24 +232,24 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderEmulatorInfoView()),
]),
Section::make('🔄 Emulator Updates')
->description('Configureer en update de emulator')
Section::make(__('commandocentrum.emulator_updates'))
->description(__('commandocentrum.emulator_updates_desc'))
->icon('heroicon-o-arrow-down-circle')
->afterHeader([
Action::make('check_updates')
->label('Check Updates')
->label(__('commandocentrum.check_updates'))
->color('info')
->action('checkEmulatorUpdates'),
Action::make('build_emulator')
->label('🔨 Build')
->label('🔨 ' . __('commandocentrum.build'))
->color('success')
->action('buildEmulator'),
Action::make('run_sql')
->label('SQL Updates')
->label(__('commandocentrum.sql_updates'))
->color('purple')
->action('runSqlUpdates'),
Action::make('save_emulator')
->label('Opslaan')
->label(__('commandocentrum.save'))
->color('primary')
->action('saveEmulator'),
])
@@ -257,8 +259,8 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderEmulatorSettingsView()),
]),
Section::make('💾 Emulator Backups')
->description('Bekijk en herstel emulator backups')
Section::make(__('commandocentrum.emulator_backups'))
->description(__('commandocentrum.emulator_backups_desc'))
->icon('heroicon-s-archive-box')
->schema([
Placeholder::make('backups_list')
@@ -266,28 +268,28 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderBackupsListView()),
]),
Section::make('📦 Nitro Client')
->description('Configureer en update Nitro')
Section::make(__('commandocentrum.nitro_client'))
->description(__('commandocentrum.nitro_client_desc'))
->icon('heroicon-o-cloud-arrow-down')
->afterHeader([
Action::make('detect_paths')
->label('🔍 Auto Detect')
->label('🔍 ' . __('commandocentrum.auto_detect'))
->color('success')
->action('detectAndSavePaths'),
Action::make('check_nitro')
->label('Check')
->label(__('commandocentrum.check'))
->color('info')
->action('checkNitroUpdates'),
Action::make('build_nitro')
->label('Build')
->label(__('commandocentrum.build'))
->color('pink')
->action('buildNitro'),
Action::make('generate_configs')
->label('Genereer Configs')
->label(__('commandocentrum.generate_configs'))
->color('indigo')
->action('generateNitroConfigs'),
Action::make('save_nitro')
->label('Opslaan')
->label(__('commandocentrum.save'))
->color('primary')
->action('saveNitro'),
])
@@ -297,31 +299,31 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderNitroSettingsView()),
]),
Section::make('⚙️ Automatische Updates')
->description('Configureer automatische updates')
Section::make(__('commandocentrum.auto_updates'))
->description(__('commandocentrum.auto_updates_desc'))
->icon('heroicon-o-clock')
->columns(2)
->afterHeader([
Action::make('save_auto')
->label('Opslaan')
->label(__('commandocentrum.save'))
->color('primary')
->action('saveAutoUpdate'),
])
->schema([
Toggle::make('auto_update_enabled')
->label('Automatische Updates Inschakelen'),
->label(__('commandocentrum.enable_auto_updates')),
TextInput::make('auto_update_schedule')
->label('Schema (HH:MM)'),
->label(__('commandocentrum.schedule')),
TextInput::make('auto_update_days')
->label('Dagen (0-6)'),
->label(__('commandocentrum.days')),
]),
Section::make('👔 Kleding Sync')
->description('Sync catalogus kleding uit FigureMap')
Section::make(__('commandocentrum.clothing_sync'))
->description(__('commandocentrum.clothing_sync_desc'))
->icon('heroicon-o-user')
->afterHeader([
Action::make('sync_clothing')
->label('🔄 Sync')
->label('🔄 ' . __('commandocentrum.sync'))
->color('success')
->action('syncClothing'),
])
@@ -331,41 +333,41 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderClothingStatusView()),
]),
Section::make('🔔 Meldingen')
->description('E-mail en Discord alerts')
Section::make(__('commandocentrum.notifications'))
->description(__('commandocentrum.notifications_desc'))
->icon('heroicon-o-bell')
->columns(2)
->afterHeader([
Action::make('save_alerts')
->label('Opslaan')
->label(__('commandocentrum.save'))
->color('primary')
->action('saveAlerts'),
Action::make('test_discord')
->label('Test Discord')
->label(__('commandocentrum.test_discord'))
->color('info')
->action('testDiscord'),
])
->schema([
Toggle::make('alert_email_enabled')
->label('E-mail Meldingen'),
->label(__('commandocentrum.email_notifications')),
TextInput::make('alert_email_address')
->label('E-mail Adres')
->label(__('commandocentrum.email_address'))
->email()
->columnSpanFull(),
Toggle::make('alert_discord_enabled')
->label('Discord Meldingen'),
->label(__('commandocentrum.discord_notifications')),
TextInput::make('alert_discord_webhook_url')
->label('Webhook URL')
->label(__('commandocentrum.webhook_url'))
->columnSpanFull(),
Select::make('discord_webhook_ranks')
->label('Ranks die Discord notificatie krijgen')
->label(__('commandocentrum.discord_ranks'))
->multiple()
->options(fn () => WebsitePermission::query()->pluck('permission', 'min_rank')->mapWithKeys(fn ($perm, $rank) => [$rank => "Rank {$rank} ({$perm})"])->toArray())
->helperText('Laat leeg voor alleen staff (min_staff_rank)'),
->helperText(__('commandocentrum.discord_ranks_helper')),
]),
Section::make('📊 Update Geschiedenis')
->description('Laatste systeem updates')
Section::make(__('commandocentrum.update_history'))
->description(__('commandocentrum.update_history_desc'))
->icon('heroicon-o-clock')
->schema([
Placeholder::make('history')
@@ -373,42 +375,42 @@ final class Commandocentrum extends Page implements HasForms
->content(fn () => $this->renderUpdateHistoryView()),
]),
Section::make('🔐 Social Login (v1.4)')
->description('Enable social login providers')
Section::make(__('commandocentrum.social_login'))
->description(__('commandocentrum.social_login_desc'))
->icon('heroicon-o-user-circle')
->schema([
Toggle::make('social_login_google_enabled')
->label('Google Login')
->helperText('Allow users to login with Google'),
->label(__('commandocentrum.google_login'))
->helperText(__('commandocentrum.google_login_helper')),
TextInput::make('social_login_google_client_id')
->label('Google Client ID')
->helperText('From Google Cloud Console'),
->label(__('commandocentrum.google_client_id'))
->helperText(__('commandocentrum.google_client_id_helper')),
TextInput::make('social_login_google_client_secret')
->label('Google Client Secret')
->label(__('commandocentrum.google_client_secret'))
->type('password'),
Toggle::make('social_login_discord_enabled')
->label('Discord Login')
->helperText('Allow users to login with Discord'),
->label(__('commandocentrum.discord_login'))
->helperText(__('commandocentrum.discord_login_helper')),
TextInput::make('social_login_discord_client_id')
->label('Discord Client ID')
->helperText('From Discord Developer Portal'),
->label(__('commandocentrum.discord_client_id'))
->helperText(__('commandocentrum.discord_client_id_helper')),
TextInput::make('social_login_discord_client_secret')
->label('Discord Client Secret')
->label(__('commandocentrum.discord_client_secret'))
->type('password'),
Toggle::make('social_login_github_enabled')
->label('GitHub Login')
->helperText('Allow users to login with GitHub'),
->label(__('commandocentrum.github_login'))
->helperText(__('commandocentrum.github_login_helper')),
TextInput::make('social_login_github_client_id')
->label('GitHub Client ID')
->helperText('From GitHub Developer Settings'),
->label(__('commandocentrum.github_client_id'))
->helperText(__('commandocentrum.github_client_id_helper')),
TextInput::make('social_login_github_client_secret')
->label('GitHub Client Secret')
->label(__('commandocentrum.github_client_secret'))
->type('password'),
])
->columns(2),
Section::make('👔 Staff Activity Log')
->description('Recent staff activities in the housekeeping (v1.2)')
Section::make(__('commandocentrum.staff_activity'))
->description(__('commandocentrum.staff_activity_desc'))
->icon('heroicon-o-user-group')
->schema([
Placeholder::make('staff_activity')
@@ -453,9 +455,9 @@ final class Commandocentrum extends Page implements HasForms
$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';
$clientText = $clientExists ? '✓ ' . substr($clientCommit, 0, 7) : '✗ ' . __('commandocentrum.not_found');
$rendererText = $rendererExists ? '✓ ' . substr($rendererCommit, 0, 7) : '✗ ' . __('commandocentrum.not_found');
$webrootText = $rendererExists ? '✓ ' . basename($nitroWebroot) : '✗ ' . __('commandocentrum.not_found');
$webrootColor = $rendererExists ? '#22c55e' : '#ef4444';
return view('filament.components.commandocentrum.hotel-status', [
@@ -463,7 +465,7 @@ final class Commandocentrum extends Page implements HasForms
'serviceColor' => $serviceColor,
'onlineUsers' => $this->getOnlineUsersCount(),
'emulatorStatus' => $this->getEmulatorStatusText(),
'dbStatus' => $this->isDatabaseOnline() ? 'Online' : 'Offline',
'dbStatus' => $this->isDatabaseOnline() ? __('commandocentrum.online') : __('commandocentrum.offline'),
'dbColor' => $this->isDatabaseOnline() ? '#22c55e' : '#ef4444',
'clientExists' => $clientExists,
'clientColor' => $clientColor,
@@ -835,7 +837,7 @@ final class Commandocentrum extends Page implements HasForms
public function sendHotelAlert(): void
{
$result = app(EmulatorControlAction::class)->sendAlert($this->data['hotel_alert_message'] ?? '');
$this->notify($result['success'] ? 'Success' : 'Error', $result['message'], $result['success'] ? 'success' : 'danger');
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'], $result['success'] ? 'success' : 'danger');
if ($result['success']) {
$this->data['hotel_alert_message'] = '';
}
@@ -844,19 +846,19 @@ final class Commandocentrum extends Page implements HasForms
public function startEmulator(): void
{
$result = app(EmulatorControlAction::class)->start();
$this->notify($result['success'] ? 'Success' : 'Error', $result['message'], $result['success'] ? 'success' : 'danger');
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'], $result['success'] ? 'success' : 'danger');
}
public function stopEmulator(): void
{
$result = app(EmulatorControlAction::class)->stop();
$this->notify($result['success'] ? 'Success' : 'Error', $result['message'], $result['success'] ? 'success' : 'danger');
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'], $result['success'] ? 'success' : 'danger');
}
public function restartEmulator(): void
{
$result = app(EmulatorControlAction::class)->restart();
$this->notify($result['success'] ? 'Success' : 'Error', $result['message'], $result['success'] ? 'success' : 'danger');
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'], $result['success'] ? 'success' : 'danger');
}
public function checkEmulator(): void
@@ -865,20 +867,20 @@ final class Commandocentrum extends Page implements HasForms
Artisan::call('monitor:emulator', ['--notify-online' => true]);
$rconService = new RconService;
if ($rconService->isConnected()) {
$this->notify('Success', 'Emulator is online en reageert!', 'success');
$this->notify(__('commandocentrum.success'), __('commandocentrum.emulator_online'), 'success');
} else {
$this->notify('Warning', 'Emulator is niet bereikbaar via RCON', 'warning');
$this->notify(__('commandocentrum.warning'), __('commandocentrum.emulator_unreachable'), 'warning');
}
$this->fillForm();
} catch (Exception $e) {
$this->notify('Error', $e->getMessage(), 'danger');
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
public function checkEmulatorUpdates(): void
{
$result = app(EmulatorControlAction::class)->update();
$this->notify($result['success'] ?? false ? 'Success' : 'Error', $result['message'] ?? $result['error'] ?? 'Onbekende fout', ($result['success'] ?? false) ? 'success' : 'danger');
$this->notify($result['success'] ?? false ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'] ?? $result['error'] ?? __('commandocentrum.unknown'), ($result['success'] ?? false) ? 'success' : 'danger');
Cache::forget('all_updates_check');
$this->fillForm();
}
@@ -886,19 +888,19 @@ final class Commandocentrum extends Page implements HasForms
public function buildEmulator(): void
{
$result = app(EmulatorControlAction::class)->build();
$this->notify($result['success'] ?? false ? 'Success' : 'Error', $result['message'] ?? $result['error'] ?? 'Onbekende fout', ($result['success'] ?? false) ? 'success' : 'danger');
$this->notify($result['success'] ?? false ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'] ?? $result['error'] ?? __('commandocentrum.unknown'), ($result['success'] ?? false) ? 'success' : 'danger');
}
public function runSqlUpdates(): void
{
$result = app(EmulatorControlAction::class)->runSqlUpdates();
$this->notify($result['success'] ?? false ? 'Success' : 'Error', $result['message'] ?? 'Onbekende fout', ($result['success'] ?? false) ? 'success' : 'danger');
$this->notify($result['success'] ?? false ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'] ?? __('commandocentrum.unknown'), ($result['success'] ?? false) ? 'success' : 'danger');
}
public function restoreBackup(string $backupName): void
{
$result = app(EmulatorControlAction::class)->restoreBackup($backupName);
$this->notify($result['success'] ? 'Success' : 'Error', $result['message'] ?? $result['error'] ?? 'Onbekende fout', $result['success'] ? 'success' : 'danger');
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'] ?? $result['error'] ?? __('commandocentrum.unknown'), $result['success'] ? 'success' : 'danger');
$this->fillForm();
}
@@ -915,9 +917,9 @@ final class Commandocentrum extends Page implements HasForms
$settings->set('emulator_database_host', $this->data['emulator_database_host'] ?? '127.0.0.1');
$settings->set('emulator_database_name', $this->data['emulator_database_name'] ?? '');
$settings->set('emulator_service_name', $this->data['emulator_service_name'] ?? 'arcturus');
$this->notify('Success', 'Emulator instellingen opgeslagen!', 'success');
$this->notify(__('commandocentrum.success'), __('commandocentrum.emulator_settings_saved'), 'success');
} catch (Exception $e) {
$this->notify('Error', $e->getMessage(), 'danger');
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
@@ -928,7 +930,7 @@ final class Commandocentrum extends Page implements HasForms
$branch = $this->getSetting('nitro_github_branch', 'main');
$result = app(NitroControlAction::class)->pullUpdates($clientPath, $rendererPath, $branch);
$this->notify('Success', $result['message'], 'success');
$this->notify(__('commandocentrum.success'), $result['message'], 'success');
$this->fillForm();
}
@@ -939,7 +941,7 @@ final class Commandocentrum extends Page implements HasForms
$branch = $this->getSetting('nitro_github_branch', 'main');
$result = app(NitroControlAction::class)->build($clientPath, $rendererPath, $branch);
$this->notify($result['success'] ? 'Success' : 'Warning', $result['message'], $result['success'] ? 'success' : 'warning');
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.warning'), $result['message'], $result['success'] ? 'success' : 'warning');
}
public function generateNitroConfigs(): void
@@ -949,7 +951,7 @@ final class Commandocentrum extends Page implements HasForms
$gamedataPath = $this->getSetting('gamedata_path', '/var/www/Gamedata');
$result = app(NitroControlAction::class)->generateConfigs($siteUrl, $webroot, $gamedataPath);
$this->notify($result['success'] ? 'Success' : 'Error', $result['message'], $result['success'] ? 'success' : 'danger');
$this->notify($result['success'] ? __('commandocentrum.success') : __('commandocentrum.error'), $result['message'], $result['success'] ? 'success' : 'danger');
$this->fillForm();
}
@@ -959,13 +961,13 @@ final class Commandocentrum extends Page implements HasForms
$catalogService = app(CatalogService::class);
$result = $catalogService->syncCatalogClothing();
$message = '👔 Kleding Sync Resultaat:' . PHP_EOL;
$message = '👔 ' . __('commandocentrum.clothing_items') . ':' . PHP_EOL;
$message .= '• Toegevoegd: ' . $result['inserted'] . PHP_EOL;
$message .= '• Totaal: ' . $result['total'];
$this->notify('Success', $message, 'success');
$this->notify(__('commandocentrum.success'), $message, 'success');
} catch (Exception $e) {
$this->notify('Error', $e->getMessage(), 'danger');
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
@@ -984,9 +986,9 @@ final class Commandocentrum extends Page implements HasForms
$settings->set('emulator_source_path', $paths['emulator_source_path']);
$this->fillForm();
$this->notify('Success', 'Paths gedetecteerd en opgeslagen!', 'success');
$this->notify(__('commandocentrum.success'), __('commandocentrum.paths_detected'), 'success');
} catch (Exception $e) {
$this->notify('Error', $e->getMessage(), 'danger');
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
@@ -1002,9 +1004,9 @@ final class Commandocentrum extends Page implements HasForms
$settings->set('nitro_github_url', $this->data['nitro_github_url'] ?? '');
$settings->set('nitro_github_branch', $this->data['nitro_github_branch'] ?? 'main');
$settings->set('nitro_site_url', $this->data['nitro_site_url'] ?? '');
$this->notify('Success', 'Nitro instellingen opgeslagen!', 'success');
$this->notify(__('commandocentrum.success'), __('commandocentrum.nitro_settings_saved'), 'success');
} catch (Exception $e) {
$this->notify('Error', $e->getMessage(), 'danger');
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
@@ -1015,9 +1017,9 @@ final class Commandocentrum extends Page implements HasForms
$settings->set('auto_update_enabled', ($this->data['auto_update_enabled'] ?? false) ? '1' : '0');
$settings->set('auto_update_schedule', $this->data['auto_update_schedule'] ?? '03:00');
$settings->set('auto_update_days', $this->data['auto_update_days'] ?? '0,6');
$this->notify('Success', 'Auto update instellingen opgeslagen!', 'success');
$this->notify(__('commandocentrum.success'), __('commandocentrum.auto_update_saved'), 'success');
} catch (Exception $e) {
$this->notify('Error', $e->getMessage(), 'danger');
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
@@ -1030,9 +1032,9 @@ final class Commandocentrum extends Page implements HasForms
$settings->set('alert_discord_enabled', ($this->data['alert_discord_enabled'] ?? false) ? '1' : '0');
$settings->set('alert_discord_webhook_url', $this->data['alert_discord_webhook_url'] ?? '');
$settings->set('discord_webhook_ranks', json_encode($this->data['discord_webhook_ranks'] ?? []));
$this->notify('Success', 'Meldingen opgeslagen!', 'success');
$this->notify(__('commandocentrum.success'), __('commandocentrum.alerts_saved'), 'success');
} catch (Exception $e) {
$this->notify('Error', $e->getMessage(), 'danger');
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
@@ -1041,14 +1043,14 @@ final class Commandocentrum extends Page implements HasForms
try {
$webhookUrl = $this->data['alert_discord_webhook_url'] ?? '';
if (empty($webhookUrl)) {
$this->notify('Error', 'Webhook URL is leeg', 'danger');
$this->notify(__('commandocentrum.error'), __('commandocentrum.webhook_empty'), 'danger');
return;
}
Http::post($webhookUrl, ['content' => '✅ Test van Atom CMS Commandocentrum']);
$this->notify('Success', 'Test bericht verzonden!', 'success');
$this->notify(__('commandocentrum.success'), __('commandocentrum.test_sent'), 'success');
} catch (Exception $e) {
$this->notify('Error', $e->getMessage(), 'danger');
$this->notify(__('commandocentrum.error'), $e->getMessage(), 'danger');
}
}
@@ -1064,7 +1066,7 @@ final class Commandocentrum extends Page implements HasForms
public function refreshDiagnostics(): void
{
$this->runDiagnostics();
$this->notify('Success', 'Diagnostiek vernieuwd', 'success');
$this->notify(__('commandocentrum.success'), __('commandocentrum.diagnostics_refreshed'), 'success');
}
private function runDiagnostics(): void
@@ -1094,24 +1096,24 @@ final class Commandocentrum extends Page implements HasForms
default => '#22c55e',
};
$overallLabel = match ($overallStatus) {
'error' => 'Kritieke Problemen',
'warning' => 'Waarschuwingen',
default => 'Gezond',
'error' => __('commandocentrum.critical_issues'),
'warning' => __('commandocentrum.warnings'),
default => __('commandocentrum.healthy'),
};
$html = '<div style="display:flex;flex-direction:column;gap:16px;">';
// Summary cards
$html .= '<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:12px;">';
$html .= $this->getSummaryCardHtml('Gezond', $okCount, '#22c55e', 'heroicon-o-check-circle');
$html .= $this->getSummaryCardHtml('Waarschuwingen', $warningCount, '#f59e0b', 'heroicon-o-exclamation-triangle');
$html .= $this->getSummaryCardHtml('Fouten', $errorCount, '#ef4444', 'heroicon-o-x-circle');
$html .= $this->getSummaryCardHtml(__('commandocentrum.healthy'), $okCount, '#22c55e', 'heroicon-o-check-circle');
$html .= $this->getSummaryCardHtml(__('commandocentrum.warnings'), $warningCount, '#f59e0b', 'heroicon-o-exclamation-triangle');
$html .= $this->getSummaryCardHtml(__('commandocentrum.errors'), $errorCount, '#ef4444', 'heroicon-o-x-circle');
$html .= '</div>';
// Overall status banner
$html .= '<div style="background:{$overallColor}15;border:1px solid {$overallColor}30;border-radius:12px;padding:16px;display:flex;align-items:center;gap:12px;">';
$html .= '<div style="width:12px;height:12px;border-radius:50%;background:{$overallColor};"></div>';
$html .= '<span style="font-weight:700;color:{$overallColor};font-size:16px;">Systeem Status: {$overallLabel}</span>';
$html .= '<span style="font-weight:700;color:{$overallColor};font-size:16px;">' . __('commandocentrum.system_status') . ': {$overallLabel}</span>';
$html .= '</div>';
// Detailed results