Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demos #138

Merged
merged 3 commits into from
Jan 27, 2025
Merged

demos #138

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ DB_PORT_SKINS=3306
DISCORD_WEBHOOK=''
K4LegacySupport=yes

DEMO_BASE_URL=''
31 changes: 31 additions & 0 deletions app/Http/Controllers/DemoController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Http\Controllers;

use App\Models\Demo;
use Illuminate\Http\Request;

class DemoController extends Controller
{
public function index(Request $request)
{
$query = Demo::query();

if ($request->input('server')) {
$query->where('server_name', $request->input('server'));
}

if ($request->input('map')) {
$query->where('map', $request->input('map'));
}

if ($request->input('date')) {
$query->whereDate('date', $request->input('date'));
}

$demos = $query->orderBy('date', 'desc')->get();
$maps = Demo::distinct()->pluck('map');

return view('demo.demo', compact('demos', 'maps'));
}
}
19 changes: 19 additions & 0 deletions app/Models/Demo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Demo extends Model
{
protected $connection = 'demos';

protected $table = 'dr_demos';

protected $fillable = [
'file',
'server_name',
'map',
'date',
];
}
1 change: 1 addition & 0 deletions lang/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Актуализирай VIP",
"admins.user": "Потребител",
"admins.vipAddedSuccessfully": "VIP добавен успешно",
"admins.demos": "Демота",
"agent.applyAgent": "Приложи агент",
"agent.applyAgentSkin": "Приложи кожата на агент",
"agent.error": "Възникна грешка при прилагането на агента.",
Expand Down
1 change: 1 addition & 0 deletions lang/cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@
"admins.updateVIP": "Aktualizovat VIP",
"admins.user": "Uživatel",
"admins.vipAddedSuccessfully": "VIP úspěšně přidán",
"admins.demos": "Dema",
"agent.applyAgent": "Použít agenta",
"agent.applyAgentSkin": "Použít skin agenta",
"agent.error": "Při aplikaci agenta došlo k chybě.",
Expand Down
1 change: 1 addition & 0 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
"admins.updateVIP": "VIP aktualisieren",
"admins.user": "Benutzer",
"admins.vipAddedSuccessfully": "VIP erfolgreich hinzugefügt",
"admins.demos": "Demo",
"agent.applyAgent": "Agent anwenden",
"agent.applyAgentSkin": "Agent-Skin anwenden",
"agent.error": "Beim Anwenden des Agents ist ein Fehler aufgetreten.",
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Update VIP",
"admins.user": "User",
"admins.vipAddedSuccessfully": "VIP Added Successfully",
"admins.demos": "Demo",
"agent.applyAgent": "Apply Agent",
"agent.applyAgentSkin": "Apply Agent Skin",
"agent.error": "An error occurred while applying the agent.",
Expand Down
1 change: 1 addition & 0 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Actualizar VIP",
"admins.user": "Usuario",
"admins.vipAddedSuccessfully": "VIP agregado con éxito",
"admins.demos": "Demo",
"agent.applyAgent": "Seleccionar Agente",
"agent.applyAgentSkin": "Seleccionar tu skin de Agente",
"agent.error": "Se ha producido un error al seleccionar el agente.",
Expand Down
1 change: 1 addition & 0 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Mettre à jour VIP",
"admins.user": "Utilisateur",
"admins.vipAddedSuccessfully": "VIP ajouté avec succès",
"admins.demos": "Démos",
"agent.applyAgent": "Appliquer l'agent",
"agent.applyAgentSkin": "Appliquer le skin de l'agent",
"agent.error": "Une erreur s'est produite lors de l'application de l'agent.",
Expand Down
1 change: 1 addition & 0 deletions lang/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "VIP frissítése",
"admins.user": "Felhasználó",
"admins.vipAddedSuccessfully": "VIP sikeresen hozzáadva",
"admins.demos": "Bemutatók",
"agent.applyAgent": "Ügynök felszerelése",
"agent.applyAgentSkin": "Ügynök felszerelése",
"agent.error": "Hiba történt az ügynök elmentése közben.",
Expand Down
1 change: 1 addition & 0 deletions lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Aggiorna VIP",
"admins.user": "Utente",
"admins.vipAddedSuccessfully": "VIP aggiunto con successo",
"admins.demos": "Demo",
"agent.applyAgent": "Applica agente",
"agent.applyAgentSkin": "Applica skin all'agente",
"agent.error": "Si è verificato un errore durante l'applicazione dell'agente.",
Expand Down
1 change: 1 addition & 0 deletions lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "VIPを更新",
"admins.user": "ユーザー",
"admins.vipAddedSuccessfully": "VIPが正常に追加されました",
"admins.demos": "デモ",
"agent.applyAgent": "エージェントを適用",
"agent.applyAgentSkin": "エージェントスキンを適用",
"agent.error": "エージェントを適用する際にエラーが発生しました。",
Expand Down
1 change: 1 addition & 0 deletions lang/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "VIP 업데이트",
"admins.user": "사용자",
"admins.vipAddedSuccessfully": "VIP가 성공적으로 추가되었습니다",
"admins.demos": "데모",
"agent.applyAgent": "요원 적용",
"agent.applyAgentSkin": "요원 스킨 적용",
"agent.error": "요원을 적용하는 중에 오류가 발생했습니다.",
Expand Down
1 change: 1 addition & 0 deletions lang/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Atualizar VIP",
"admins.user": "Usuário",
"admins.vipAddedSuccessfully": "VIP adicionado com sucesso",
"admins.demos": "Demos",
"agent.applyAgent": "Aplicar Agente",
"agent.applyAgentSkin": "Aplicar Skin de Agente",
"agent.error": "Ocorreu um erro ao aplicar a skin de agente.",
Expand Down
1 change: 1 addition & 0 deletions lang/pt_PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Atualizar VIP",
"admins.user": "Utilizador",
"admins.vipAddedSuccessfully": "VIP adicionado com sucesso",
"admins.demos": "Demos",
"agent.applyAgent": "Aplicar Agente",
"agent.applyAgentSkin": "Aplicar Skin de Agente",
"agent.error": "Um erro occoreu ao aplicar a skin do agente",
Expand Down
1 change: 1 addition & 0 deletions lang/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Actualizează VIP",
"admins.user": "Utilizator",
"admins.vipAddedSuccessfully": "VIP adăugat cu succes",
"admins.demos": "Demo",
"agent.applyAgent": "Aplică Agent",
"agent.applyAgentSkin": "Aplică Skin Agent",
"agent.error": "A apărut o eroare în timpul aplicării agentului.",
Expand Down
1 change: 1 addition & 0 deletions lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Обновить VIP",
"admins.user": "Пользователь",
"admins.vipAddedSuccessfully": "VIP успешно добавлен",
"admins.demos": "Демки",
"agent.applyAgent": "Применить агента",
"agent.applyAgentSkin": "Применить скин на агента",
"agent.error": "Произошла ошибка при применении агента.",
Expand Down
1 change: 1 addition & 0 deletions lang/se.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Uppdatera VIP",
"admins.user": "Användare",
"admins.vipAddedSuccessfully": "VIP uppdaterat",
"admins.demos": "Demor",
"agent.applyAgent": "Tillämpa Agent",
"agent.applyAgentSkin": "Tillämpa Agent Skin",
"agent.error": "Ett fel uppstod när agent skulle tillämpas.",
Expand Down
1 change: 1 addition & 0 deletions lang/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Aktualizovať VIP",
"admins.user": "Užívateľ",
"admins.vipAddedSuccessfully": "VIP úspešne pridané",
"admins.demos": "Dema",
"agent.applyAgent": "Použiť agenta",
"agent.applyAgentSkin": "Použiť skin agenta",
"agent.error": "Pri aplikácii agenta došlo k chybe.",
Expand Down
1 change: 1 addition & 0 deletions lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "VIP güncelle",
"admins.user": "Kullanıcı",
"admins.vipAddedSuccessfully": "VIP başarıyla eklendi",
"admins.demos": "Demolar",
"agent.applyAgent": "Ajan seç",
"agent.applyAgentSkin": "Ajana kostüm/skin uygula",
"agent.error": "Ajan seçerken bir hata oluştu.",
Expand Down
1 change: 1 addition & 0 deletions lang/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "Оновити VIP",
"admins.user": "Користувач",
"admins.vipAddedSuccessfully": "VIP успішно додано",
"admins.demos": "Демо",
"agent.applyAgent": "Застосувати агента",
"agent.applyAgentSkin": "Застосувати скин агента",
"agent.error": "Сталася помилка під час застосування агента.",
Expand Down
1 change: 1 addition & 0 deletions lang/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"admins.updateVIP": "更新VIP",
"admins.user": "用户",
"admins.vipAddedSuccessfully": "VIP添加成功",
"admins.demos": "演示",
"agent.applyAgent": "应用特工",
"agent.applyAgentSkin": "应用特工皮肤",
"agent.error": "应用特工时出现错误。",
Expand Down
10 changes: 10 additions & 0 deletions resources/views/components/menu/vertical-menu.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,16 @@ class="feather feather-chevron-right">
</li>
@endif
@endif
@if(PermissionsHelper::hasBanPermission() || env('DEMOS') == 'Enabled')
<li class="menu {{ Request::is('*demos*') ? 'active' : '' }}">
<a href="{{getAppSubDirectoryPath()}}/demos" class="dropdown-toggle">
<div class="">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-monitor"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect><line x1="8" y1="21" x2="16" y2="21"></line><line x1="12" y1="17" x2="12" y2="21"></line></svg>
<span>{{ __('admins.demos') }}</span>
</div>
</a>
</li>
@endif
</ul>
</li>
@endif
Expand Down
101 changes: 101 additions & 0 deletions resources/views/demo/demo.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
@php use App\Helpers\PermissionsHelper; @endphp

<x-base-layout :scrollspy="false">
<x-slot:pageTitle>
Demos List
</x-slot>

<x-slot:headerFiles>
<link rel="stylesheet" href="{{asset('plugins/apex/apexcharts.css')}}">
@vite(['resources/scss/light/assets/components/modal.scss'])
@vite(['resources/scss/dark/assets/components/modal.scss'])
@vite(['resources/scss/dark/plugins/apex/custom-apexcharts.scss'])
<style>
.apexcharts-gridline {
stroke: transparent !important;
}
.apexcharts-legend-text {
display: none;
}
.interval-container {
padding: 19px;
}
.chart-section {
background: #191e3a;
}
</style>
</x-slot>

<div class="container mt-5">
<div class="card">
<div class="card-header">
<!-- <h5>Demos List</h5> -->
</div>
<div class="card-body">
<div class="table-responsive">
<!-- Filter Section -->
<div class="mb-4">
<form method="GET" action="" class="row g-3">
<div class="col-md-3">
<select name="server" class="form-select">
<option value="">All Servers</option>
</select>
</div>
<div class="col-md-3">
<select name="map" class="form-select">
<option value="">All Maps</option>
@foreach($maps as $map)
<option value="{{ $map }}" {{ request('map') == $map ? 'selected' : '' }}>{{ $map }}</option>
@endforeach
</select>
</div>
<div class="col-md-3">
<input type="date" name="date" class="form-control" value="{{ request('date') }}">
</div>
<div class="col-md-3">
<button type="submit" class="btn btn-primary">Filter</button>
<a href="{{ url()->current() }}" class="btn btn-secondary">Reset</a>
</div>
</form>
</div>

<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Server</th>
<th>Map</th>
<th>Date</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach ($demos as $demo)
<tr>
<td>{{ $demo->file }}</td>
<td>{{ $demo->server_name }}</td>
<td>{{ $demo->map }}</td>
<td>{{ \Carbon\Carbon::parse($demo->date)->format('d.m.Y H:i') }}</td>
<td>
<div class="btn-group" role="group">
<a href="{{ env('DEMO_BASE_URL') }}/download/{{ $demo->file }}.zip"
class="btn btn-success btn-sm">
Download
</a>
</div>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>

<x-slot:footerFiles>
<x-modal :title="''" :body="''"/>
@vite(['resources/js/dashboard/recent.ts'])
@vite(['resources/js/dashboard/servers.ts'])
</x-slot>
</x-base-layout>
2 changes: 1 addition & 1 deletion resources/views/settings/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@foreach($group as $key => $value)
<div class="col-md-6 mb-3">
<label for="{{ $key }}" class="form-label">{{ $key }}</label>
@if(in_array($key, ['RANKS', 'VIP', 'SKINS', 'REPORTS', 'APPEALS']))
@if(in_array($key, ['RANKS', 'VIP', 'SKINS', 'DEMOS', 'REPORTS', 'APPEALS']))
<select class="form-select" id="{{ $key }}" name="{{ $key }}">
<option value="Enabled" {{ $value == 'Enabled' ? 'selected' : '' }}>Enabled</option>
<option value="Disabled" {{ $value == 'Disabled' ? 'selected' : '' }}>Disabled</option>
Expand Down
Loading