This commit is contained in:
Aaron Kimbrell
2026-03-26 09:56:29 -05:00
parent 8372202d8f
commit f658da19a3
27 changed files with 1669 additions and 685 deletions

View File

@@ -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) {