<!DOCTYPE html>
<html>

<head>
    <title>User Details</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>

<body>
    <nav class="navbar navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/users">User Management System</a>
        </div>
    </nav>

    <div class="container mt-4">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header">
                        <h4 class="mb-0">User Details</h4>
                    </div>
                    <div class="card-body">
                        <div class="row mb-3">
                            <label class="col-sm-3 col-form-label"><strong>ID:</strong></label>
                            <div class="col-sm-9">
                                <p class="form-control-plaintext">
                                    <%= user.id %>
                                </p>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <label class="col-sm-3 col-form-label"><strong>Name:</strong></label>
                            <div class="col-sm-9">
                                <p class="form-control-plaintext">
                                    <%= user.name %>
                                </p>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <label class="col-sm-3 col-form-label"><strong>Email:</strong></label>
                            <div class="col-sm-9">
                                <p class="form-control-plaintext">
                                    <%= user.email %>
                                </p>
                            </div>
                        </div>

                        <div class="row mb-3">
                            <label class="col-sm-3 col-form-label"><strong>Created At:</strong></label>
                            <div class="col-sm-9">
                                <p class="form-control-plaintext">
                                    <%= new Date(user.created_at).toLocaleString() %>
                                </p>
                            </div>
                        </div>

                        <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                            <a href="/users" class="btn btn-secondary me-md-2">
                                <i class="fas fa-arrow-left"></i> Back to List
                            </a>
                            <a href="/users/<%= user.id %>/edit" class="btn btn-warning me-md-2">
                                <i class="fas fa-edit"></i> Edit
                            </a>
                            <form action="/users/<%= user.id %>/delete" method="POST" style="display: inline;">
                                <button type="submit" class="btn btn-danger"
                                    onclick="return confirm('Are you sure you want to delete this user?')">
                                    <i class="fas fa-trash"></i> Delete
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>

</html>