File size: 1,668 Bytes
ed0b977
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
    <title>Manage {{ user_type.title() }}</title>
</head>
<body>
    <h1>Manage {{ user_type.title() }}</h1>
    <a href="{{ url_for('admin.add_user', user_type=user_type) }}">Add {{ user_type.title() }}</a>
    <br><br>
    <table border="1">
        <thead>
            <tr>
                <th>ID</th>
                {% if user_type == 'doctors' or user_type == 'patients' %}
                    <th>Name</th>
                {% endif %}
                {% if user_type == 'doctors' %}
                    <th>Specialization</th>
                {% endif %}
                <th>Username</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            {% for user in users %}
                <tr>
                    <td>{{ user.id }}</td>
                    {% if user_type == 'doctors' or user_type == 'patients' %}
                        <td>{{ user.name }}</td>
                    {% endif %}
                    {% if user_type == 'doctors' %}
                        <td>{{ user.specialization }}</td>
                    {% endif %}
                    <td>{{ user.username }}</td>
                    <td>
                        <a href="{{ url_for('admin.edit_user', user_type=user_type, user_id=user.id) }}">Edit</a>
                        <form method="post" action="{{ url_for('admin.delete_user', user_type=user_type, user_id=user.id) }}" style="display:inline;">
                            <button type="submit">Delete</button>
                        </form>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
</body>
</html>