up
This commit is contained in:
+103
-1
@@ -1155,4 +1155,106 @@ body {
|
||||
color: white;
|
||||
box-shadow: none;
|
||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== Ajustes para modo nocturno (dark mode) ===== */
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--light-bg: #071322;
|
||||
--text-primary: #e6eef1;
|
||||
--text-secondary: #9ca3af;
|
||||
--border-color: #163240;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--light-bg);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* Encabezados y títulos */
|
||||
.content-header h1,
|
||||
.card-header h5,
|
||||
.sidebar-header h4,
|
||||
.status-text,
|
||||
.status-indicator,
|
||||
.conversation-empty {
|
||||
color: var(--text-primary) !important;
|
||||
}
|
||||
|
||||
/* Contenedores */
|
||||
.content-header,
|
||||
.card,
|
||||
.chat-container {
|
||||
background: #071322;
|
||||
color: var(--text-primary);
|
||||
border-color: var(--border-color);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.card-header {
|
||||
background: transparent;
|
||||
border-bottom-color: rgba(255,255,255,0.04);
|
||||
}
|
||||
|
||||
/* Formularios y botones */
|
||||
.form-control {
|
||||
background: #072033;
|
||||
color: var(--text-primary);
|
||||
border-color: #163240;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* Sidebar */
|
||||
.sidebar {
|
||||
background: linear-gradient(135deg,#08131a,#0b2221);
|
||||
color: #e6eef1;
|
||||
}
|
||||
|
||||
.conversation-actions .btn {
|
||||
background: #0b1220;
|
||||
border-color: #1f2937;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* Chat específico */
|
||||
.chat-header {
|
||||
background: linear-gradient(135deg, #1f5a3f 0%, #0f513e 100%);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.message-bubble {
|
||||
color: #e6eef1;
|
||||
}
|
||||
|
||||
.message-incoming {
|
||||
background: #0b1220;
|
||||
color: #e6eef1;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.message-outgoing {
|
||||
background: #0f513e;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.message-document,
|
||||
.media-preview {
|
||||
background: rgba(255,255,255,0.03);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.conversation-search {
|
||||
background: rgba(255,255,255,0.04);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
a, .nav-link {
|
||||
color: #a6f3c9;
|
||||
}
|
||||
|
||||
/* Placeholders visibles */
|
||||
::placeholder { color: #9ca3af !important; opacity: 1; }
|
||||
}
|
||||
|
||||
+58
-1
@@ -561,8 +561,16 @@ if (empty($user_id)) {
|
||||
const displayName = currentUser.name || 'Usuario';
|
||||
const phoneNumber = currentUser.phone_number || '';
|
||||
document.getElementById('userName').innerHTML = `
|
||||
${escapeHtml(displayName)}
|
||||
<span id="userNameText">${escapeHtml(displayName)}</span>
|
||||
<button id="editNameBtn" class="btn btn-sm btn-light ms-2" onclick="editUserName()" title="Editar nombre">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
${phoneNumber ? `<br><small class="opacity-75">${escapeHtml(phoneNumber)}</small>` : ''}
|
||||
<div id="editNameContainer" style="display:none; margin-top:6px;">
|
||||
<input id="editNameInput" class="form-control form-control-sm" type="text" value="${escapeHtml(displayName)}" style="display:inline-block; width:70%;">
|
||||
<button id="saveNameBtn" class="btn btn-sm btn-success ms-2" onclick="saveUserName()">Guardar</button>
|
||||
<button id="cancelNameBtn" class="btn btn-sm btn-secondary ms-1" onclick="cancelEditUserName()">Cancelar</button>
|
||||
</div>
|
||||
`;
|
||||
document.getElementById('userAvatar').innerHTML =
|
||||
`<span>${(currentUser.name || 'U').charAt(0).toUpperCase()}</span>`;
|
||||
@@ -1112,6 +1120,55 @@ if (empty($user_id)) {
|
||||
showAlert('Error al cambiar estado de atención: ' + err.message, 'danger');
|
||||
}
|
||||
}
|
||||
|
||||
// ===== Edición de nombre de usuario =====
|
||||
function editUserName() {
|
||||
const container = document.getElementById('editNameContainer');
|
||||
const input = document.getElementById('editNameInput');
|
||||
if (!container || !input) return;
|
||||
input.value = currentUser.name || '';
|
||||
container.style.display = 'block';
|
||||
document.getElementById('editNameBtn').style.display = 'none';
|
||||
input.focus();
|
||||
}
|
||||
|
||||
function cancelEditUserName() {
|
||||
const container = document.getElementById('editNameContainer');
|
||||
if (!container) return;
|
||||
container.style.display = 'none';
|
||||
document.getElementById('editNameBtn').style.display = 'inline-block';
|
||||
}
|
||||
|
||||
async function saveUserName() {
|
||||
const input = document.getElementById('editNameInput');
|
||||
const saveBtn = document.getElementById('saveNameBtn');
|
||||
if (!input || !saveBtn) return;
|
||||
|
||||
const newName = input.value.trim();
|
||||
if (newName.length === 0) {
|
||||
showAlert('El nombre no puede estar vacío', 'warning');
|
||||
return;
|
||||
}
|
||||
|
||||
saveBtn.disabled = true;
|
||||
try {
|
||||
const resp = await whatsappManager.apiCall('update_user.php', { body: { user_id: userId, name: newName } });
|
||||
if (resp && resp.success) {
|
||||
currentUser.name = newName;
|
||||
document.getElementById('userNameText').innerHTML = escapeHtml(newName);
|
||||
document.getElementById('userAvatar').innerHTML = `<span>${escapeHtml(newName.charAt(0).toUpperCase() || 'U')}</span>`;
|
||||
cancelEditUserName();
|
||||
showAlert('Nombre actualizado', 'success');
|
||||
} else {
|
||||
throw new Error(resp.error || 'Error actualizando nombre');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error saving user name:', err);
|
||||
showAlert('Error al actualizar nombre: ' + err.message, 'danger');
|
||||
} finally {
|
||||
saveBtn.disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function showError(message) {
|
||||
showAlert(message, 'danger');
|
||||
|
||||
Reference in New Issue
Block a user