summaryrefslogtreecommitdiffstats
path: root/ogcp/templates/auth/user_form.html
blob: ae34490dbe0fdeea29f55f77df7976921a6bf3aa (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{% extends 'users.html' %}
{% import "bootstrap/wtf.html" as wtf %}

{% set sidebar_state = 'disabled' %}
{% set btn_back = true %}

{% block nav_user_add %}active{% endblock %}
{% block content %}

<h2 class="mx-5 subhead-heading">{% block subhead_heading %}{% endblock %}</h2>

<form action="{% block form_action %}{% endblock %}" method="post" class="form mx-5">
    {{ form.hidden_tag() }}

    <div class="form-group">
        {{ form.username.label(class_='form-label') }}
        {{ form.username(class_='form-control') }}
    </div>

    <div class="form-group">
        {{ form.pwd.label(class_='form-label') }}
        {% block pwd_field %}{{ form.pwd(class_='form-control') }}{% endblock %}
    </div>

    <div class="form-group">
        {{ form.pwd_confirm.label(class_='form-label') }}
        {% block pwd_confirm_field %}{{ form.pwd_confirm(class_='form-control') }}{% endblock %}
    </div>

    <div class="form-group">
        <div class="custom-control custom-switch">
            {{ form.admin(class_="custom-control-input", id="adminToggle") }}
            <label class="custom-control-label" for="adminToggle">{{ form.admin.label.text }}</label>
        </div>
    </div>

    <!-- jQuery -->
    <script src="{{ url_for('static', filename='AdminLTE/plugins/jquery/jquery.min.js') }}"></script>
    <script>
        $(document).ready(function(){

            var isAdminEnabled = $('#adminToggle').is(':checked');
            if(isAdminEnabled) {
                $('#PermissionSection').hide();
            }

            $('#adminToggle').change(function() {
                isAdminEnabled = $(this).is(':checked');
                $('#PermissionSection').toggle(!isAdminEnabled);
            });
        });
    </script>

    <div id="PermissionSection">
        <div class="form-group">
            <label class="form-label">{{ _('Permissions') }}</label>
            <table class="text-center table">
                <thead>
                    <tr>
                        <th></th>
                        <th>{{ form.client_permissions.add.label.text }}</th>
                        <th>{{ form.client_permissions.update.label.text }}</th>
                        <th>{{ form.client_permissions.delete.label.text }}</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <th>{{ form.client_permissions.label }}</th>
                        <td>{{ form.client_permissions.add() }}</td>
                        <td>{{ form.client_permissions.update() }}</td>
                        <td>{{ form.client_permissions.delete() }}</td>
                    </tr>
                    <tr>
                        <th>{{ form.center_permissions.label }}</th>
                        <td>{{ form.center_permissions.add() }}</td>
                        <td>{{ form.center_permissions.update() }}</td>
                        <td>{{ form.center_permissions.delete() }}</td>
                    </tr>
                    <tr>
                        <th>{{ form.room_permissions.label }}</th>
                        <td>{{ form.room_permissions.add() }}</td>
                        <td>{{ form.room_permissions.update() }}</td>
                        <td>{{ form.room_permissions.delete() }}</td>
                    </tr>
                    <tr>
                        <th>{{ form.folder_permissions.label }}</th>
                        <td>{{ form.folder_permissions.add() }}</td>
                        <td>{{ form.folder_permissions.update() }}</td>
                        <td>{{ form.folder_permissions.delete() }}</td>
                    </tr>
                    <tr>
                        <th>{{ form.image_permissions.label }}</th>
                        <td>{{ form.image_permissions.add() }}</td>
                        <td>{{ form.image_permissions.update() }}</td>
                        <td>{{ form.image_permissions.delete() }}</td>
                    </tr>
                    <tr>
                        <th>{{ form.repository_permissions.label }}</th>
                        <td>{{ form.repository_permissions.add() }}</td>
                        <td>{{ form.repository_permissions.update() }}</td>
                        <td>{{ form.repository_permissions.delete() }}</td>
                    </tr>
                </tbody>
            </table>
        </div>

        {% include 'scopes_checkbox_group.html' %}
    </div>

    <div class="form-group">
        {{ form.submit_btn(class_='btn btn-primary') }}
    </div>
</form>

{% endblock %}