<?php
include 'conexion.php';

$resultado = $conn->query("SELECT * FROM usuarios_sistemas");

echo '<table border="1" class="min-w-full table-auto" cellpadding="8">

        <tr>
        <th class="px-4 py-2 text-left text-sm text-gray-600">Usuario</th><th class="px-4 py-2 text-left text-sm text-gray-600">Nombre</th><th class="px-4 py-2 text-left text-sm text-gray-600">Cargo</th><th class="px-4 py-2 text-left text-sm text-gray-600">Foto</th><th class="px-4 py-2 text-left text-sm text-gray-600">Acción</th>
        </tr>';

while ($fila = $resultado->fetch_assoc()) {
    echo "<tr class='border-t border-gray-200'>
            <td class='px-4 py-2 text-sm'>{$fila['usuario']}</td>
            <td class='px-4 py-2 text-sm'>{$fila['nombre']}</td>
            <td class='px-4 py-2 text-sm'>{$fila['cargo']}</td>
            <td class='px-4 py-2 text-sm'><img src='fotos/{$fila['foto']}' width='50'></td>
            <td class='px-4 py-2 text-sm'><button  class='bg-red-500 text-white py-1 px-4 rounded-full hover:bg-red-700 focus:outline-none ml-2' onclick='editarUsuario(" . json_encode($fila) . ")'>Editar</button></td>
          </tr>";
}
echo '</table>';
?>
