🐛 Backend Database Improvement: Added shm and wal files for myp.db & updated debug_guest_requests.py & admin_guest_requests_overview.html 🎉
This commit is contained in:
@@ -572,10 +572,26 @@ const userIsAdmin = adminConfig.dataset.isAdmin === 'true';
|
||||
const userCanApprove = adminConfig.dataset.canApprove === 'true';
|
||||
const showInlineActions = userIsAdmin || userCanApprove;
|
||||
|
||||
console.log('Admin-Berechtigungen:', { userIsAdmin, userCanApprove, showInlineActions });
|
||||
console.log('🔍 DEBUG: Admin-Berechtigungen:', {
|
||||
userIsAdmin,
|
||||
userCanApprove,
|
||||
showInlineActions,
|
||||
adminConfigElement: adminConfig,
|
||||
dataIsAdmin: adminConfig.dataset.isAdmin,
|
||||
dataCanApprove: adminConfig.dataset.canApprove
|
||||
});
|
||||
|
||||
// Debug: Zeige alle Data-Attribute
|
||||
console.log('🔍 DEBUG: Alle Data-Attribute:', adminConfig.dataset);
|
||||
|
||||
// Debug: Prüfe HTML-Inhalt
|
||||
console.log('🔍 DEBUG: AdminConfig HTML:', adminConfig.outerHTML);
|
||||
|
||||
// Initialisierung
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
console.log('🚀 DEBUG: DOMContentLoaded - Initialisierung startet');
|
||||
console.log('🔍 DEBUG: showInlineActions beim Laden:', showInlineActions);
|
||||
|
||||
initializeEventListeners();
|
||||
loadAvailablePrinters();
|
||||
loadGuestRequests();
|
||||
@@ -764,10 +780,82 @@ function createRequestRow(request) {
|
||||
const hoursOld = (now - createdAt) / (1000 * 60 * 60);
|
||||
const isUrgent = hoursOld > 24 && request.status === 'pending';
|
||||
|
||||
// DEBUG: Zeige Request-Details
|
||||
console.log('🔍 DEBUG: createRequestRow für Request:', {
|
||||
id: request.id,
|
||||
name: request.name,
|
||||
status: request.status,
|
||||
isPending: request.status === 'pending',
|
||||
showInlineActions: showInlineActions,
|
||||
shouldShowButtons: request.status === 'pending' && showInlineActions
|
||||
});
|
||||
|
||||
if (isUrgent) {
|
||||
row.classList.add('urgent-request');
|
||||
}
|
||||
|
||||
// DEBUG: Button-HTML generieren
|
||||
const buttonHtml = request.status === 'pending' && showInlineActions ? `
|
||||
<div id="inline-actions-${request.id}" class="mt-2 space-y-2">
|
||||
<div class="flex space-x-2">
|
||||
<button onclick="showInlineApproval(${request.id})"
|
||||
class="inline-flex items-center px-2 py-1 border border-green-300 rounded text-xs text-green-700 bg-green-50 hover:bg-green-100 transition-colors">
|
||||
<i class="fas fa-check mr-1"></i>Genehmigen
|
||||
</button>
|
||||
<button onclick="showInlineRejection(${request.id})"
|
||||
class="inline-flex items-center px-2 py-1 border border-red-300 rounded text-xs text-red-700 bg-red-50 hover:bg-red-100 transition-colors">
|
||||
<i class="fas fa-times mr-1"></i>Ablehnen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Inline Approval Form -->
|
||||
<div id="approval-form-${request.id}" class="hidden inline-approval-form form-section">
|
||||
<h5 class="text-sm font-medium text-green-800 mb-2">
|
||||
<i class="fas fa-check-circle mr-1"></i>Antrag genehmigen
|
||||
</h5>
|
||||
<textarea id="approval-notes-${request.id}" rows="2"
|
||||
class="w-full text-xs border border-green-300 rounded px-2 py-1 focus:outline-none focus:ring-1 focus:ring-green-400"
|
||||
placeholder="Optionale Genehmigungsnotizen..."></textarea>
|
||||
<select id="approval-printer-${request.id}"
|
||||
class="w-full mt-1 text-xs border border-green-300 rounded px-2 py-1 focus:outline-none focus:ring-1 focus:ring-green-400">
|
||||
<option value="">Drucker auswählen (optional)</option>
|
||||
</select>
|
||||
<div class="form-actions">
|
||||
<button onclick="hideInlineApproval(${request.id})"
|
||||
class="btn-cancel inline-action-btn">
|
||||
<i class="fas fa-times mr-1"></i>Abbrechen
|
||||
</button>
|
||||
<button onclick="submitInlineApproval(${request.id})"
|
||||
class="btn-submit inline-action-btn inline-approve-btn">
|
||||
<i class="fas fa-check mr-1"></i>Genehmigen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Inline Rejection Form -->
|
||||
<div id="rejection-form-${request.id}" class="hidden inline-rejection-form form-section">
|
||||
<h5 class="text-sm font-medium text-red-800 mb-2">
|
||||
<i class="fas fa-times-circle mr-1"></i>Antrag ablehnen
|
||||
</h5>
|
||||
<textarea id="rejection-reason-${request.id}" rows="2" required
|
||||
class="w-full text-xs border border-red-300 rounded px-2 py-1 focus:outline-none focus:ring-1 focus:ring-red-400"
|
||||
placeholder="Ablehnungsgrund (erforderlich)..."></textarea>
|
||||
<div class="form-actions">
|
||||
<button onclick="hideInlineRejection(${request.id})"
|
||||
class="btn-cancel inline-action-btn">
|
||||
<i class="fas fa-times mr-1"></i>Abbrechen
|
||||
</button>
|
||||
<button onclick="submitInlineRejection(${request.id})"
|
||||
class="btn-submit inline-action-btn inline-reject-btn">
|
||||
<i class="fas fa-times mr-1"></i>Ablehnen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
` : '';
|
||||
|
||||
console.log('🔍 DEBUG: Button-HTML für Request', request.id, ':', buttonHtml ? 'GENERIERT' : 'LEER');
|
||||
|
||||
row.innerHTML = `
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
@@ -794,64 +882,7 @@ function createRequestRow(request) {
|
||||
<span class="status-badge status-${request.status}">
|
||||
${getStatusIcon(request.status)} ${getStatusText(request.status)}
|
||||
</span>
|
||||
${request.status === 'pending' && showInlineActions ? `
|
||||
<div id="inline-actions-${request.id}" class="mt-2 space-y-2">
|
||||
<div class="flex space-x-2">
|
||||
<button onclick="showInlineApproval(${request.id})"
|
||||
class="inline-flex items-center px-2 py-1 border border-green-300 rounded text-xs text-green-700 bg-green-50 hover:bg-green-100 transition-colors">
|
||||
<i class="fas fa-check mr-1"></i>Genehmigen
|
||||
</button>
|
||||
<button onclick="showInlineRejection(${request.id})"
|
||||
class="inline-flex items-center px-2 py-1 border border-red-300 rounded text-xs text-red-700 bg-red-50 hover:bg-red-100 transition-colors">
|
||||
<i class="fas fa-times mr-1"></i>Ablehnen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Inline Approval Form -->
|
||||
<div id="approval-form-${request.id}" class="hidden inline-approval-form form-section">
|
||||
<h5 class="text-sm font-medium text-green-800 mb-2">
|
||||
<i class="fas fa-check-circle mr-1"></i>Antrag genehmigen
|
||||
</h5>
|
||||
<textarea id="approval-notes-${request.id}" rows="2"
|
||||
class="w-full text-xs border border-green-300 rounded px-2 py-1 focus:outline-none focus:ring-1 focus:ring-green-400"
|
||||
placeholder="Optionale Genehmigungsnotizen..."></textarea>
|
||||
<select id="approval-printer-${request.id}"
|
||||
class="w-full mt-1 text-xs border border-green-300 rounded px-2 py-1 focus:outline-none focus:ring-1 focus:ring-green-400">
|
||||
<option value="">Drucker auswählen (optional)</option>
|
||||
</select>
|
||||
<div class="form-actions">
|
||||
<button onclick="hideInlineApproval(${request.id})"
|
||||
class="btn-cancel inline-action-btn">
|
||||
<i class="fas fa-times mr-1"></i>Abbrechen
|
||||
</button>
|
||||
<button onclick="submitInlineApproval(${request.id})"
|
||||
class="btn-submit inline-action-btn inline-approve-btn">
|
||||
<i class="fas fa-check mr-1"></i>Genehmigen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Inline Rejection Form -->
|
||||
<div id="rejection-form-${request.id}" class="hidden inline-rejection-form form-section">
|
||||
<h5 class="text-sm font-medium text-red-800 mb-2">
|
||||
<i class="fas fa-times-circle mr-1"></i>Antrag ablehnen
|
||||
</h5>
|
||||
<textarea id="rejection-reason-${request.id}" rows="2" required
|
||||
class="w-full text-xs border border-red-300 rounded px-2 py-1 focus:outline-none focus:ring-1 focus:ring-red-400"
|
||||
placeholder="Ablehnungsgrund (erforderlich)..."></textarea>
|
||||
<div class="form-actions">
|
||||
<button onclick="hideInlineRejection(${request.id})"
|
||||
class="btn-cancel inline-action-btn">
|
||||
<i class="fas fa-times mr-1"></i>Abbrechen
|
||||
</button>
|
||||
<button onclick="submitInlineRejection(${request.id})"
|
||||
class="btn-submit inline-action-btn inline-reject-btn">
|
||||
<i class="fas fa-times mr-1"></i>Ablehnen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
` : ''}
|
||||
${buttonHtml}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
<div>${formatDate(request.created_at)}</div>
|
||||
|
Reference in New Issue
Block a user