mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-30 10:34:21 +00:00
WIP
This commit is contained in:
@@ -6,12 +6,13 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="characters-container">
|
||||
<div class="table-card">
|
||||
<div class="table-header">
|
||||
<h2 class="mb-0">Characters</h2>
|
||||
<p class="text-muted">View and manage player characters</p>
|
||||
</div>
|
||||
<div class="table-body">
|
||||
<div class="container-fluid">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Characters</h2>
|
||||
<p class="text-muted">View and manage player characters - <span class="character-count">0</span> total</p>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="charactersTable" class="table table-dark table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -26,16 +27,18 @@
|
||||
<!-- Data populated by DataTables -->
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block scripts %}
|
||||
<script src="/js/realtime.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Initialize DataTable with server-side processing
|
||||
$('#charactersTable').DataTable({
|
||||
const table = $('#charactersTable').DataTable({
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
pageLength: 25,
|
||||
@@ -75,6 +78,25 @@
|
||||
order: [[0, 'asc']],
|
||||
stateSave: false
|
||||
});
|
||||
|
||||
// Register table for real-time updates
|
||||
realtimeManager.RegisterTable('character', table);
|
||||
|
||||
// Update character count when DataTable loads
|
||||
table.on('draw.dt', function() {
|
||||
const info = table.page.info();
|
||||
const countEl = document.querySelector('.character-count');
|
||||
if (countEl && info) {
|
||||
countEl.textContent = info.recordsTotal;
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize WebSocket realtime updates
|
||||
const waitForWS = setInterval(() => {
|
||||
if (typeof realtimeManager !== 'undefined' && wsConnectionReady) {
|
||||
clearInterval(waitForWS);
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
|
||||
function viewCharacter(id) {
|
||||
|
||||
Reference in New Issue
Block a user