aboutsummaryrefslogtreecommitdiffhomepage
path: root/main/app/sprinkles/admin/templates/pages/dashboard.html.twig
blob: f9c85a34b69ad20aaf68e28d5ad19d1ae72bac09 (plain) (blame)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
{% extends "pages/abstract/dashboard.html.twig" %}

{# Overrides blocks in head of base template #}
{% block page_title %}{{ translate("DASHBOARD") }}{% endblock %}
{% block page_description %}{% endblock %}

{% block body_matter %}
    <!-- Info boxes -->
    {% if checkAccess('uri_users') %}
    <div class="row">
        <div class="col-md-4 col-sm-6 col-xs-12">
          <a href="{{site.uri.public}}/users">
            <div class="info-box">
              <span class="info-box-icon bg-aqua"><i class="fa fa-user fa-fw"></i></span>
              <div class="info-box-content">
                <span class="info-box-text">{{ translate("USER", 2) }}</span>
                <span class="info-box-number">{{counter.users}}</span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </a>
        </div>
        <!-- /.col -->

        <div class="col-md-4 col-sm-6 col-xs-12">
          <a href="{{site.uri.public}}/roles">
            <div class="info-box">
              <span class="info-box-icon bg-red"><i class="fa fa-drivers-license"></i></span>
              <div class="info-box-content">
                <span class="info-box-text">{{ translate("ROLE", 2) }}</span>
                <span class="info-box-number">{{counter.roles}}</span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </a>
        </div>
        <!-- /.col -->

        <div class="col-md-4 col-sm-6 col-xs-12">
          <a href="{{site.uri.public}}/groups">
            <div class="info-box">
              <span class="info-box-icon bg-green"><i class="fa fa-users"></i></span>
              <div class="info-box-content">
                <span class="info-box-text">{{ translate("GROUP", 2) }}</span>
                <span class="info-box-number">{{counter.groups}}</span>
              </div>
              <!-- /.info-box-content -->
            </div>
            <!-- /.info-box -->
          </a>
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->

    {% elseif checkAccess('uri_group', {
        'group': current_user.group
    }) %}
    <div class="row">
        <div class="col-sm-6 col-xs-12">
          <div class="info-box">
            <span class="info-box-icon bg-aqua"><i class="{{current_user.group.icon}}"></i></span>
            <div class="info-box-content">
              <h1>{{current_user.group.name}}</h1>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->
        <div class="col-sm-6 col-xs-12">
          <div class="info-box">
            <span class="info-box-icon bg-aqua"><i class="fa fa-user fa-fw"></i></span>
            <div class="info-box-content">
              <span class="info-box-text">{{ translate("USER", 2) }}</span>
              <span class="info-box-number">{{current_user.group.users.count}}</span>
            </div>
            <!-- /.info-box-content -->
          </div>
          <!-- /.info-box -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
    {% endif %}

    <!-- Main panels -->
    <div class="row">
        {% if checkAccess('uri_users') or checkAccess('view_system_info') %}
        <div class="col-md-6 col-sm-12 col-xs-12">
            {% if checkAccess('uri_users') %}
            <div class="row">
                <div class="col-sm-12">
                  <!-- USERS LIST -->
                  <div class="box box-info">
                    <div class="box-header with-border">
                      <h3 class="box-title">{{translate("USER.LATEST")}}</h3>
                    </div>
                    <!-- /.box-header -->
                    <div class="box-body no-padding">
                      <ul class="users-list clearfix">
                        {% for user in users %}
                        <li>
                          <img src="{{ user.avatar }}" alt="User Image">
                          <a class="users-list-name" href="{{site.uri.public}}/users/u/{{user.user_name}}">{{user.first_name}} {{user.last_name}}</a>
                          <span class="users-list-date">{{ user.registered }}</span>
                        </li>
                        {% endfor %}
                      </ul>
                      <!-- /.users-list -->
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer text-center">
                      <a href="{{site.uri.public}}/users" class="uppercase">{{translate("USER.VIEW_ALL")}}</a>
                    </div>
                    <!-- /.box-footer -->
                  </div>
                  <!--/.box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
            {% endif %}

            {% if checkAccess('view_system_info') %}
            <div class="row">
                <div class="col-sm-12">
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">{{translate("SYSTEM_INFO")}}</h3>
                        </div>
                        <!-- /.box-header -->
                        <div class="box-body">
                          <dl class="dl-horizontal">
                            <dt>{{translate("SYSTEM_INFO.UF_VERSION")}}</dt>
                            <dd>{{info.version.UF}}</dd>

                            <dt>{{translate("SYSTEM_INFO.PHP_VERSION")}}</dt>
                            <dd>{{info.version.php}}</dd>

                            <dt>{{translate("SYSTEM_INFO.SERVER")}}</dt>
                            <dd>{{info.environment.SERVER_SOFTWARE}}</dd>

                            <dt>{{translate("SYSTEM_INFO.DB_VERSION")}}</dt>
                            <dd>{{info.version.database.type}} {{info.version.database.version}}</dd>

                            <dt>{{translate("SYSTEM_INFO.DB_NAME")}}</dt>
                            <dd>{{info.database.name}}</dd>

                            <dt>{{translate("SYSTEM_INFO.DIRECTORY")}}</dt>
                            <dd>{{info.path.project}}</dd>

                            <dt>{{translate("SYSTEM_INFO.URL")}}</dt>
                            <dd>{{site.uri.public}}</dd>

                            <dt>{{translate("SYSTEM_INFO.SPRINKLES")}}</dt>
                            <dd>
                                <ul class="list-unstyled">
                                {% for sprinkle in sprinkles %}
                                <li>
                                    {{sprinkle}}
                                </li>
                                {% endfor %}
                                </ul>
                            </dd>
                          </dl>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer text-center">
                          <a href="javascript:void(0)" class="js-clear-cache uppercase">{{ translate("CACHE.CLEAR") }}</a>
                        </div>
                        <!-- /.box-footer -->
                    </div>
                    <!--/.box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
            {% endif %}
        </div>
        <!-- /.col -->
        {% endif %}

        {% if checkAccess('uri_activities') %}
        <div class="col-md-6 col-sm-12 col-xs-12">
            <div id="widget-activities" class="box box-primary">
                <div class="box-header">
                    <h3 class="box-title"><i class="fa fa-tasks fa-fw"></i> {{translate('ACTIVITY', 2)}}</h3>
                    {% include "tables/table-tool-menu.html.twig" %}
                </div>
                <div class="box-body">
                    {% include "tables/activities.html.twig" with {
                            "table" : {
                                "id" : "table-activities",
                                "columns" : ["user"]
                            }
                        }
                    %}
                </div>
            </div>
        </div>
        {% elseif checkAccess('view_group_field', {
            'group': current_user.group,
            'property': 'users'
        }) %}
        <div class="col-md-6 col-sm-12 col-xs-12">
            <div id="widget-group-users" class="box box-primary">
                <div class="box-header">
                    <h3 class="box-title"><i class="fa fa-fw fa-user"></i> {{translate('USER', 2)}}</h3>
                    {% include "tables/table-tool-menu.html.twig" %}
                </div>
                <div class="box-body">
                    {% include "tables/users.html.twig" with {
                            "table" : {
                                "id" : "table-group-users"
                            }
                        }
                    %}
                </div>
                <div class="box-footer">
                    <button type="button" class="btn btn-success js-user-create">
                        <i class="fa fa-plus-square"></i>  {{translate("USER.CREATE")}}
                    </button>
                </div>
            </div>
        </div>
        {% else %}
        <div class="col-sm-4 col-sm-offset-4 col-xs-12">
            <div class="box box-widget widget-user">
                <!-- Add the bg color to the header using any of the bg-* classes -->
                <div class="widget-user-header bg-black-active">
                  <h3 class="widget-user-username">
                    {{translate("WELCOME", {
                          'first_name': current_user.first_name
                    })}}
                  </h3>
                </div>
                <div class="widget-user-image">
                  <img class="img-circle" src="{{assets.url('assets://userfrosting/images/cupcake.png')}}" alt="User Avatar">
                </div>
                <div class="box-footer">
                    <h4>
                        {{translate("WELCOME_TO", {
                            'title': site.title
                        })}}
                    </h4>
                    <p>
                        {{translate("NO_FEATURES_YET")}}
                    </p>
                </div>
            </div>
            <!-- /.widget-user -->


        </div>
        <!-- /.row -->
        {% endif %}
    </div>
    <!-- /.row -->
{% endblock %}

{% block scripts_page %}
    <!-- Include page variables -->
    <script>
    {% include "pages/partials/page.js.twig" %}

    // Add user name
    page = $.extend(
        true,               // deep extend
        {
            "group_slug": "{{current_user.group.slug}}"
        },
        page
    );
    </script>

    <!-- Include page-specific JS -->
    {{ assets.js('js/pages/dashboard') | raw }}

{% endblock %}