Fix: Traducir todos los textos y modal en admin/users.php

This commit is contained in:
2026-02-20 15:47:09 -06:00
parent f3e9c26338
commit 65de04209f

View File

@@ -25,7 +25,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
header('Location: users.php');
exit;
} else {
$error = 'El usuario ya existe';
$error = t('El usuario ya existe');
}
}
@@ -37,7 +37,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
header('Location: users.php');
exit;
} else {
$error = 'No puedes eliminarte a ti mismo';
$error = t('No puedes eliminarte a ti mismo');
}
}
}
@@ -46,9 +46,9 @@ require_once __DIR__ . '/../templates/header.php';
?>
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-people"></i> Gestión de Usuarios</h2>
<h2><i class="bi bi-people"></i> <?= t('Gestión de Usuarios') ?></h2>
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#userModal">
<i class="bi bi-plus-circle"></i> Nuevo Usuario
<i class="bi bi-plus-circle"></i> <?= t('Nuevo Usuario') ?>
</button>
</div>
@@ -62,12 +62,12 @@ require_once __DIR__ . '/../templates/header.php';
<table class="table table-hover">
<thead>
<tr>
<th>ID</th>
<th>Usuario</th>
<th>Rol</th>
<th><?= t('ID') ?></th>
<th><?= t('Usuario') ?></th>
<th><?= t('Rol') ?></th>
<th>Telegram</th>
<th>Creado</th>
<th>Acciones</th>
<th><?= t('Creado') ?></th>
<th><?= t('Acciones') ?></th>
</tr>
</thead>
<tbody>
@@ -77,14 +77,14 @@ require_once __DIR__ . '/../templates/header.php';
<td><?= htmlspecialchars($user['username']) ?></td>
<td>
<span class="badge bg-<?= $user['role'] === 'admin' ? 'danger' : 'primary' ?>">
<?= $user['role'] ?>
<?= $user['role'] === 'admin' ? t('Administrador') : t('Usuario') ?>
</span>
</td>
<td><?= $user['telegram_chat_id'] ? htmlspecialchars($user['telegram_chat_id']) : '-' ?></td>
<td><?= date('d/m/Y', strtotime($user['created_at'])) ?></td>
<td>
<?php if ($user['id'] !== getCurrentUserId()): ?>
<form method="POST" onsubmit="return confirm('¿Eliminar este usuario?');" class="d-inline">
<form method="POST" onsubmit="return confirm('<?= t('¿Eliminar este usuario?') ?>');" class="d-inline">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="user_id" value="<?= $user['id'] ?>">
<button type="submit" class="btn btn-outline-danger btn-sm">
@@ -107,28 +107,28 @@ require_once __DIR__ . '/../templates/header.php';
<form method="POST">
<input type="hidden" name="action" value="create">
<div class="modal-header">
<h5 class="modal-title">Nuevo Usuario</h5>
<h5 class="modal-title"><?= t('Nuevo Usuario') ?></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<div class="mb-3">
<label class="form-label">Usuario</label>
<label class="form-label"><?= t('Usuario') ?></label>
<input type="text" name="username" class="form-control" required>
</div>
<div class="mb-3">
<label class="form-label">Contraseña</label>
<label class="form-label"><?= t('Contraseña') ?></label>
<input type="password" name="password" class="form-control" required minlength="6">
</div>
<div class="mb-3">
<label class="form-label">Rol</label>
<label class="form-label"><?= t('Rol') ?></label>
<select name="role" class="form-select">
<option value="user">Usuario</option>
<option value="admin">Administrador</option>
<option value="user"><?= t('Usuario') ?></option>
<option value="admin"><?= t('Administrador') ?></option>
</select>
</div>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Crear</button>
<button type="submit" class="btn btn-primary"><?= t('Crear') ?></button>
</div>
</form>
</div>