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

if user is not admin, dont show IP and action columns, added ukrainian into selection #50

Merged
merged 10 commits into from
Jun 13, 2024
2 changes: 1 addition & 1 deletion lang/cz.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "Použít",
"skins.applySkin": "Použít skin",
"skins.battleScarred": "Bojově zničený",
"skins.close": "Zavřít",
"Close": "Zavřít",
"skins.error": "Při aplikaci skinu došlo k chybě.",
"skins.factoryNew": "Zcela nový",
"skins.fieldTested": "Terénní test",
Expand Down
2 changes: 1 addition & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"skins.apply": "Anwenden",
"skins.applySkin": "Skin anwenden",
"skins.battleScarred": "Kampfspuren",
"skins.close": "Schließen",
"Close": "Schließen",
"skins.error": "Beim Anwenden des Skins ist ein Fehler aufgetreten.",
"skins.factoryNew": "Fabrikneu",
"skins.fieldTested": "Feldgetestet",
Expand Down
2 changes: 1 addition & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
"skins.apply": "Apply",
"skins.applySkin": "Apply Skin",
"skins.battleScarred": "Battle-Scarred",
"skins.close": "Close",
"Close": "Close",
"skins.error": "An error occurred while applying the skin.",
"skins.factoryNew": "Factory New",
"skins.fieldTested": "Field-Tested",
Expand Down
2 changes: 1 addition & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "Aplicar",
"skins.applySkin": "Aplicar Skin",
"skins.battleScarred": "Muy Desgastado",
"skins.close": "Cerrar",
"Close": "Cerrar",
"skins.error": "Se produjo un error al aplicar la skin.",
"skins.factoryNew": "De Fábrica",
"skins.fieldTested": "Probado en Campo",
Expand Down
2 changes: 1 addition & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "Appliquer",
"skins.applySkin": "Appliquer le skin",
"skins.battleScarred": "Marqué par les combats",
"skins.close": "Fermer",
"Close": "Fermer",
"skins.error": "Une erreur s'est produite lors de l'application du skin.",
"skins.factoryNew": "Comme neuf",
"skins.fieldTested": "Testé sur le terrain",
Expand Down
2 changes: 1 addition & 1 deletion lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "Applica",
"skins.applySkin": "Applica skin",
"skins.battleScarred": "Segni di battaglia",
"skins.close": "Chiudi",
"Close": "Chiudi",
"skins.error": "Si è verificato un errore durante l'applicazione della skin.",
"skins.factoryNew": "Nuovo di fabbrica",
"skins.fieldTested": "Testato sul campo",
Expand Down
2 changes: 1 addition & 1 deletion lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "適用",
"skins.applySkin": "スキンを適用",
"skins.battleScarred": "戦闘の傷跡",
"skins.close": "閉じる",
"Close": "閉じる",
"skins.error": "スキンを適用する際にエラーが発生しました。",
"skins.factoryNew": "工場新品",
"skins.fieldTested": "フィールドテスト済み",
Expand Down
2 changes: 1 addition & 1 deletion lang/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "적용",
"skins.applySkin": "스킨 적용",
"skins.battleScarred": "전투 스크래치",
"skins.close": "닫기",
"Close": "닫기",
"skins.error": "스킨을 적용하는 중에 오류가 발생했습니다.",
"skins.factoryNew": "공장 신제품",
"skins.fieldTested": "현장 시험된",
Expand Down
2 changes: 1 addition & 1 deletion lang/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "Aplicar",
"skins.applySkin": "Aplicar Skin",
"skins.battleScarred": "Muy Desgastado",
"skins.close": "Cerrar",
"Close": "Cerrar",
"skins.error": "Se produjo un error al aplicar la skin.",
"skins.factoryNew": "De Fábrica",
"skins.fieldTested": "Probado en Campo",
Expand Down
2 changes: 1 addition & 1 deletion lang/pt_PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"skins.apply": "Aplicar",
"skins.applySkin": "Aplicar Skin",
"skins.battleScarred": "Gasto",
"skins.close": "Fechar",
"Close": "Fechar",
"skins.error": "Um erro occoreu ao aplicar a skin!",
"skins.factoryNew": "Novo de Fábrica",
"skins.fieldTested": "Testado no Terreno",
Expand Down
2 changes: 1 addition & 1 deletion lang/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "Aplică",
"skins.applySkin": "Aplică Skin",
"skins.battleScarred": "Rănit de Bătălie",
"skins.close": "Închide",
"Close": "Închide",
"skins.error": "A apărut o eroare în timpul aplicării skinului.",
"skins.factoryNew": "Nou de Fabrică",
"skins.fieldTested": "Testat pe Teren",
Expand Down
2 changes: 1 addition & 1 deletion lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"dashboard.unmuted": "Голос включен",
"dashboard.expired": "Истек срок",
"skins.select": "Выберите тип оружия",
"skins.close": "Закрыть",
"Close": "Закрыть",
"skins.applySkin": "Применить скин",
"skins.selectWear": "Выберите износ",
"skins.factoryNew": "Заводское новое",
Expand Down
2 changes: 1 addition & 1 deletion lang/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"skins.apply": "应用",
"skins.applySkin": "应用皮肤",
"skins.battleScarred": "战斗痕迹",
"skins.close": "关闭",
"Close": "关闭",
"skins.error": "应用皮肤时出现错误。",
"skins.factoryNew": "工厂新",
"skins.fieldTested": "实战测试",
Expand Down
File renamed without changes
135 changes: 71 additions & 64 deletions resources/js/bans/bans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,72 @@ import 'datatables.net-fixedcolumns';
import 'datatables.net-responsive';
let dataTable = null;
function loadBans() {
dataTable = new DataTable("#bansList", {
let columns = [
{"data": "id"},
{
"data": "player_name", "render": function (data, type, row, meta) {
return `<span class="list-profile"><img src="${row.avatar}" /><a href="https://steamcommunity.com/profiles/${row.player_steamid}">${data}</a></span>`;
}
},
{"data": "player_ip"},
{
"data": "admin_steamid", "render": function (data, type, row, meta) {
if (data !== 'Console') {
return `<a href="https://steamcommunity.com/profiles/${data}">${row.admin_name}</a>`;
} else {
return data;
}
}
},
{"data": "reason"},
{"data": "duration"},
{"data": "ends"},
{
"data": "created", "render": function (data, type, row, meta) {
return formatDuration(data);
}
},
{"data": "server_id"},
{"data": "status"},
{
"data": "action", "render": function (data, type, row, meta) {
return '<div class="action-container">' + data + '</div>';
}
},
{
"data": "duration", "render": function (data, type, row, meta) {
let progress = calculateProgress(row.created, row.ends);

let progressBarClass = 'bg-warning';
if (row.status.includes("badge badge-primary")) {
progressBarClass = 'bg-primary';
progress = 100;
} else if (row.duration.includes("badge badge-danger")) {
progressBarClass = 'bg-danger';
} else if (progress === 100) {
progressBarClass = 'bg-success';
}
return `
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated custom-progress ${progressBarClass}"
role="progressbar" style="width: ${progress}%" aria-valuenow="${progress}"
aria-valuemin="0" aria-valuemax="100">
</div>
</div>`;
}
}
];

if (!isSuperAdmin) {
columns = columns.filter(column => column.data !== "player_ip");
}
if (!hasBanPermission) {
columns = columns.filter(column => column.data !== "action");
}

dataTable = new DataTable("#bansList", {
"processing": true,
responsive: true,
responsive: true,
"serverSide": true,
"ajax": {
"url": bansListUrl,
Expand All @@ -19,72 +82,17 @@ function loadBans() {
"language": {
"search": "Search by player steamid:",
'processing': '<div class="spinner"></div>'

},
order: [[0, 'desc']],
"columns": [
{"data": "id"},
{
"data": "player_name", "render": function (data, type, row, meta) {
return `<span class="list-profile"><img src="${row.avatar}" /><a href="https://steamcommunity.com/profiles/${row.player_steamid}">${data}</a></span>`;
}
},
{"data": "player_ip"},
{
"data": "admin_steamid", "render": function (data, type, row, meta) {
if(data != 'Console')
return `<a href="https://steamcommunity.com/profiles/${data}">${row.admin_name}</a>`;
else
return data;
}
},
{"data": "reason"},
{"data": "duration"},
{"data": "ends"},
{
"data": "created", "render": function (data, type, row, meta) {
return formatDuration(data);
}
},
{"data": "server_id"},
{"data": "status"},
{
"data": "action", "render": function (data, type, row, meta) {
return '<div class="action-container">' + data + '</div>';
}
},
{
"data": "duration", "render": function (data, type, row, meta) {
let progress = calculateProgress(row.created, row.ends);

let progressBarClass = 'bg-warning';
if (row.status.includes("badge badge-primary")) {
progressBarClass = 'bg-primary';
progress = 100;
}
else if (row.duration.includes("badge badge-danger")) {
progressBarClass = 'bg-danger';
}
else if (progress == 100) {
progressBarClass = 'bg-success';
}
return `
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated custom-progress ${progressBarClass}"
role="progressbar" style="width: ${progress}%" aria-valuenow="${progress}"
aria-valuemin="0" aria-valuemax="100">
</div>
</div>`
}
}
]
order: [[0, 'desc']],
"columns": columns
});
}

loadBans();

$(document).on('click', '.unban-btn', function() {
let playerSteamid = $(this).data('player-steamid');
$.ajax({
$(document).on('click', '.unban-btn', function () {
let playerSteamid = $(this).data('player-steamid');
$.ajax({
url: getPlayerUnBanUrl(playerSteamid),
type: 'PUT',
dataType: 'json',
Expand Down Expand Up @@ -113,4 +121,3 @@ $(document).on('click', '.unban-btn', function() {
}
});
});

45 changes: 25 additions & 20 deletions resources/js/mutes/mutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,7 @@ let dataTable = null;

loadMutes();
function loadMutes() {
dataTable = new DataTable("#mutesList", {
"responsive": true,
"processing": true,
"serverSide": true,
"ajax": {
"url": mutesListUrl,
"headers": {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},
"type": "POST",
"dataType": "json"
},
"language": {
"search": "Search by player steamid:",
'processing': '<div class="spinner"></div>'

},
order: [[0, 'desc']],
"columns": [
let columns = [
{"data": "id"},
{
"data": "player_name", "render": function (data, type, row, meta) {
Expand Down Expand Up @@ -78,7 +60,30 @@ function loadMutes() {
</div>`
}
}
]
];

if (!hasMutePermission) {
columns = columns.filter(column => column.data !== "action");
}

dataTable = new DataTable("#mutesList", {
"responsive": true,
"processing": true,
"serverSide": true,
"ajax": {
"url": mutesListUrl,
"headers": {
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content')
},
"type": "POST",
"dataType": "json"
},
"language": {
"search": "Search by player steamid:",
'processing': '<div class="spinner"></div>'

},
"columns": columns
});
}
$(document).on('click', '.unmute-btn', function() {
Expand Down
10 changes: 8 additions & 2 deletions resources/views/admin/bans/list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@
<tr>
<th scope="col">{{ __('admins.id') }}</th>
<th scope="col">{{ __('dashboard.player') }}</th>
<th scope="col">{{ __('dashboard.ip') }}</th>
@if(PermissionsHelper::isSuperAdmin())
<th scope="col">{{ __('dashboard.ip') }}</th>
@endif
<th scope="col">{{ __('admins.bannedBy') }}</th>
<th scope="col">{{ __('admins.banReason') }}</th>
<th scope="col">{{ __('admins.banDuration') }}</th>
<th scope="col">{{ __('admins.ends') }}</th>
<th scope="col">{{ __('admins.banned') }}</th>
<th scope="col">{{ __('dashboard.server') }}</th>
<th scope="col">{{ __('admins.status') }}</th>
<th scope="col">{{ __('admins.action') }}</th>
@if(PermissionsHelper::hasBanPermission())
<th scope="col">{{ __('admins.action') }}</th>
@endif
<th scope="col">{{ __('admins.progress') }}</th>
</tr>
</thead>
Expand All @@ -70,6 +74,8 @@ function getPlayerUnBanUrl(playerSteamid) {
return "{!! env('VITE_SITE_DIR') !!}/players/"+playerSteamid+"/unban";
}
const bansListUrl = '{!! env('VITE_SITE_DIR') !!}/list/bans';
const isSuperAdmin = <?php echo json_encode(PermissionsHelper::isSuperAdmin()); ?>;
const hasBanPermission = <?php echo json_encode(PermissionsHelper::hasBanPermission()); ?>;
</script>
@vite(['resources/js/bans/bans.ts'])
<script src="{{asset('plugins/notification/snackbar/snackbar.min.js')}}"></script>
Expand Down
5 changes: 4 additions & 1 deletion resources/views/admin/mutes/list.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
<th scope="col">{{ __('admins.muted') }}</th>
<th scope="col">{{ __('dashboard.server') }}</th>
<th scope="col">{{ __('admins.status') }}</th>
<th scope="col">{{ __('admins.action') }}</th>
@if(PermissionsHelper::hasMutePermission())
<th scope="col">{{ __('admins.action') }}</th>
@endif
<th scope="col">{{ __('admins.progress') }}</th>
</tr>
</thead>
Expand All @@ -70,6 +72,7 @@ function getPlayerUnMuteUrl(playerSteamid) {
return "{!! env('VITE_SITE_DIR') !!}/players/"+playerSteamid+"/unmute";
}
const mutesListUrl = '{!! env('VITE_SITE_DIR') !!}/list/mutes';
const hasMutePermission = <?php echo json_encode(PermissionsHelper::hasMutePermission()); ?>;
</script>
@vite(['resources/js/mutes/mutes.ts'])
<script src="{{asset('plugins/notification/snackbar/snackbar.min.js')}}"></script>
Expand Down
4 changes: 3 additions & 1 deletion resources/views/admin/servers/players.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
<th width="20">{{ __('admins.serverListPlayerName') }}</th>
<th>{{ __('admins.playerFrags') }}</th>
<th>{{ __('admins.playerPlayTime') }}</th>
<th>{{ __('admins.actions') }}</th>
@if(PermissionsHelper::hasKickPermission() || PermissionsHelper::hasMutePermission() || PermissionsHelper::hasBanPermission())
<th>{{ __('admins.actions') }}</th>
@endif
</tr>
</thead>
<tbody>
Expand Down
Loading
Loading