Un crédit vous engage et doit être remboursé. Vérifiez vos capacités de remboursement avant de vous engager.

Portail d'Administration

Base de données Clients

Gérez les profils, RIB, transactions et paramètres de sécurité de tous les clients inscrits.

Date Inscription Client / Contact Service Actif Solde Actuel Statut Global Action

Demandes de prêt

Date Client Type / Montant Statut Action

Détails de la demande

let adminChatInterval; let currentAdminChatClient = null; function adminLoadChats() { jQuery.post(fc_ajax_obj.ajax_url, { action: 'fc_get_admin_chats' }, function(res) { if (res.success) { renderAdminChatList(res.data.chats); } }); } function renderAdminChatList(chats) { const list = document.getElementById('admin-chat-list'); if (!list) return; let unreadTotal = 0; if (chats.length === 0) { list.innerHTML = '
Aucune conversation.
'; } else { list.innerHTML = ''; chats.forEach(c => { if (c.unread_admin) unreadTotal++; const isSelected = currentAdminChatClient === c.client_id; const bg = isSelected ? '#f3f4f6' : 'white'; const weight = c.unread_admin ? '700' : '500'; const color = c.unread_admin ? '#111827' : '#6b7280'; const div = document.createElement('div'); div.style.cssText = `padding: 16px 20px; border-bottom: 1px solid #f3f4f6; cursor: pointer; background: ${bg}; transition: background 0.2s;`; div.onclick = () => adminOpenChat(c.client_id, c.client_name); const dot = c.unread_admin ? '
' : ''; let name = c.client_name; if (name.startsWith('guest_')) name = 'Visiteur ' + name.substr(6, 4).toUpperCase(); div.innerHTML = `
${name}
${dot}
${c.last_message || '...'}
`; list.appendChild(div); }); } const badge = document.getElementById('admin-chat-badge'); if (badge) { if (unreadTotal > 0) { badge.innerText = unreadTotal; badge.style.display = 'flex'; } else { badge.style.display = 'none'; } } } function adminOpenChat(clientId, clientName) { currentAdminChatClient = clientId; let name = clientName; if (name.startsWith('guest_')) name = 'Visiteur ' + name.substr(6, 4).toUpperCase(); document.getElementById('admin-chat-header').innerHTML = `
${name.substring(0, 2).toUpperCase()}
${name}
Client / Prospect
`; document.getElementById('admin-chat-input').disabled = false; document.getElementById('admin-chat-send-btn').disabled = false; adminLoadChatMessages(); } function adminLoadChatMessages() { if (!currentAdminChatClient) return; jQuery.post(fc_ajax_obj.ajax_url, { action: 'fc_get_chat_messages', client_id: currentAdminChatClient, role: 'admin' }, function(res) { if(res.success && res.data.messages) { adminRenderChatMessages(res.data.messages); adminLoadChats(); } }); } function adminRenderChatMessages(messages) { const container = document.getElementById('admin-chat-messages'); if(!container) return; const isScrolledToBottom = container.scrollHeight - container.clientHeight <= container.scrollTop + 10; container.innerHTML = ''; if (messages.length === 0) { container.innerHTML = '
Aucun message dans cette conversation.
'; } else { messages.forEach(m => { const isMe = m.sender === 'admin'; const align = isMe ? 'flex-end' : 'flex-start'; const bg = isMe ? '#5a4c95' : '#ffffff'; const color = isMe ? '#ffffff' : '#1f2937'; const border = isMe ? 'none' : '1px solid #d1d5db'; const br = isMe ? '16px 16px 0 16px' : '16px 16px 16px 0'; const div = document.createElement('div'); div.style.cssText = `align-self: ${align}; max-width: 75%; background:${bg}; color:${color}; padding:12px 16px; border-radius:${br}; border:${border}; font-size:14px; line-height:1.5; box-shadow:0 1px 2px rgba(0,0,0,0.05); word-break:break-word;`; div.innerHTML = m.text.replace(//g, ">"); container.appendChild(div); }); } if (isScrolledToBottom) { container.scrollTop = container.scrollHeight; } } function adminSendChatMessage() { if (!currentAdminChatClient) return; const input = document.getElementById('admin-chat-input'); const msg = input.value.trim(); if (!msg) return; input.value = ''; jQuery.post(fc_ajax_obj.ajax_url, { action: 'fc_send_chat_message', client_id: currentAdminChatClient, message: msg, sender: 'admin' }, function(res) { if(res.success) { adminLoadChatMessages(); setTimeout(() => { const container = document.getElementById('admin-chat-messages'); if(container) container.scrollTop = container.scrollHeight; }, 100); } }); }