Alert on Homepage

This commit is contained in:
1day2die 2023-01-10 19:45:19 +01:00
parent 16a48cd2aa
commit 94fe7d245c
5 changed files with 78 additions and 2 deletions

View file

@ -51,6 +51,9 @@ class System
'show-imprint' => 'string',
'show-privacy' => 'string',
'show-tos' => 'string',
'alert-enabled' => 'string',
'alter-type' => 'string',
'alert-message' => 'string',
]);
$validator->after(function ($validator) use ($request) {
@ -96,6 +99,9 @@ class System
"SETTINGS::SYSTEM:SHOW_IMPRINT" => "show-imprint",
"SETTINGS::SYSTEM:SHOW_PRIVACY" => "show-privacy",
"SETTINGS::SYSTEM:SHOW_TOS" => "show-tos",
"SETTINGS::SYSTEM:ALERT_ENABLED" => "alert-enabled",
"SETTINGS::SYSTEM:ALERT_TYPE" => "alert-type",
"SETTINGS::SYSTEM:ALERT_MESSAGE" => "alert-message",
];
foreach ($values as $key => $value) {

View file

@ -298,7 +298,7 @@ class User extends Authenticatable implements MustVerifyEmail
public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()
-> logOnly(['*'])
-> logOnly(['role', 'name', 'server_limit', 'pterodactyl_id', 'email'])
-> logOnlyDirty()
-> dontSubmitEmptyLogs();
}

View file

@ -574,5 +574,28 @@ class SettingsSeeder extends Seeder
'type' => 'boolean',
'description' => 'Enable/disable Terms of Service in footer',
]);
Settings::firstOrCreate([
'key' => 'SETTINGS::SYSTEM:ALERT_ENABLED',
], [
'value' => 'false',
'type' => 'boolean',
'description' => 'Enable/disable Alerts on Homepage',
]);
Settings::firstOrCreate([
'key' => 'SETTINGS::SYSTEM:ALERT_TYPE',
], [
'value' => 'dark',
'type' => 'text',
'description' => 'Changes the Color of the Alert',
]);
Settings::firstOrCreate([
'key' => 'SETTINGS::SYSTEM:ALERT_MESSAGE',
], [
'value' => '',
'type' => 'text',
'description' => 'Changes the Content the Alert',
]);
}
}

View file

@ -195,7 +195,7 @@
</div>
<div class="custom-control mb-3 p-0">
<label for="initial-server-limit">{{ __('Initial Server Limit') }}</label>
<input x-model="initial-server-limit" id="initial-server-limit" name="initial-server-limit" type="number" min="0" max="99999999"
<input x-model="initial-server-limit" id="initial-server-limit" name="initial-server-limit" type="number" min="0" max="99999999"
value="{{ config('SETTINGS::USER:INITIAL_SERVER_LIMIT') }}"
class="form-control @error('initial-server-limit') is-invalid @enderror" required>
</div>
@ -299,8 +299,49 @@
class="form-control @error('minimum-credits') is-invalid @enderror" required>
</div>
</div>
{{-- ALERT --}}
<div class="row mb-2">
<div class="col text-center">
<h1>Alert</h1>
</div>
</div>
<div class="custom-control mb-3 p-0">
<input value="true" id="alert-enabled" name="alert-enabled"
{{ config('SETTINGS::SYSTEM:ALERT_ENABLED') == 'true' ? 'checked' : '' }} type="checkbox">
<label for="enable-login-logo">{{ __('Enable the Alert Message on Homepage') }} </label>
</div>
<div class="custom-control mb-3 p-0">
<label for="alert-type">{{ __('Alert Color') }}</label>
<select id="alert-type" style="width:100%" class="custom-select" name="alert-type" required
autocomplete="off" @error('alert-type') is-invalid @enderror>
<option value="primary" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "primary") selected
@endif>{{ __("Blue") }}</option>
<option value="secondary" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "secondary") selected
@endif>{{ __("Grey") }}</option>
<option value="success" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "success") selected
@endif>{{ __("Green") }}</option>
<option value="danger" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "danger") selected
@endif>{{ __("Red") }}</option>
<option value="warning" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "warning") selected
@endif>{{ __("Orange") }}</option>
<option value="info" @if (config('SETTINGS::SYSTEM:ALERT_TYPE') == "info") selected
@endif>{{ __("Cyan") }}</option>
</select>
</div>
<div class="custom-control mb-3 p-0">
<label for="alert-message">{{ __('Alert Message (HTML might be used)') }}</label>
<textarea x-model="alert-message" id="alert-message" name="alert-message"
class="form-control @error('alert-message') is-invalid @enderror">
{{ config('SETTINGS::SYSTEM:ALERT_MESSAGE', '') }}
</textarea>
</div>
</div>
{{-- Design --}}
<div class="col-md-3 px-3">
<div class="row mb-2">

View file

@ -26,6 +26,12 @@
</div>
@endif
@if(config("SETTINGS::SYSTEM:ALERT_ENABLED") && !empty(config("SETTINGS::SYSTEM:ALERT_MESSAGE")))
<div class="alert mt-4 alert-{{config("SETTINGS::SYSTEM:ALERT_TYPE")}}" role="alert">
{!! config("SETTINGS::SYSTEM:ALERT_MESSAGE") !!}
</div>
@endif
<!-- MAIN CONTENT -->
<section class="content">
<div class="container-fluid">