Fakultas Ilmu Komputer UI

data_statistik.html 7.49 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{% extends "administration/base_administrasi.html" %}
{% load static %}
{% load crispy_forms_tags %}

{% block stylesheets %}
<link rel="stylesheet" href="{% static 'administration/statistic.css' %}">
{% endblock stylesheets %}
{% block content %}

<!-- DataTales Example -->
<div class="row container p-3">
    <div class="panel panel-default">
        <div class="panel-body">
            {% crispy periodForm %}
        </div>
    </div>
</div>
<hr>
19
<h1>Statistik Materi</h1>
20
21
22
23
24
25
26
<div class="row">

    <div class="col-xl-3 col-md-6 mb-4">
        <div class="card border-left-primary shadow h-100 py-2">
            <div class="card-body">
                <div class="row no-gutters align-items-center">
                    <div class="col mr-2">
27
28
                        <div class="text-xs font-weight-bold text-success text-uppercase mb-1">Dilihat</div>
                        <div class="h5 mb-0 font-weight-bold text-gray-800">{{chart_data.total.0}}</div>
29
30
                    </div>
                    <div class="col-auto">
31
                        <em class="fas fa-eye" aria-hidden="true"></em>
32
33
34
35
36
37
38
39
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Earnings (Monthly) Card Example -->
    <div class="col-xl-3 col-md-6 mb-4">
40
        <div class="card border-left-danger shadow h-100 py-2">
41
42
43
            <div class="card-body">
                <div class="row no-gutters align-items-center">
                    <div class="col mr-2">
44
45
                        <div class="text-xs font-weight-bold text-success text-uppercase mb-1">Diunduh</div>
                        <div class="h5 mb-0 font-weight-bold text-gray-800">{{chart_data.total.1}}</div>
46
47
                    </div>
                    <div class="col-auto">
48
                        <em class="fas fa-download" aria-hidden="true"></em>
49
50
51
52
53
54
55
56
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Earnings (Monthly) Card Example -->
    <div class="col-xl-3 col-md-6 mb-4">
57
        <div class="card border-left-success shadow h-100 py-2">
58
59
60
            <div class="card-body">
                <div class="row no-gutters align-items-center">
                    <div class="col mr-2">
61
62
                        <div class="text-xs font-weight-bold text-success text-uppercase mb-1">Disukai</div>
                        <div class="h5 mb-0 font-weight-bold text-gray-800">{{chart_data.total.2}}</div>
63
64
                    </div>
                    <div class="col-auto">
65
                        <em class="fas fa-thumbs-up" aria-hidden="true"></em>
66
67
68
69
70
71
72
73
74
75
76
77
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Pending Requests Card Example -->
    <div class="col-xl-3 col-md-6 mb-4">
        <div class="card border-left-warning shadow h-100 py-2">
            <div class="card-body">
                <div class="row no-gutters align-items-center">
                    <div class="col mr-2">
78
79
                        <div class="text-xs font-weight-bold text-warning text-uppercase mb-1">Komentar</div>
                        <div class="h5 mb-0 font-weight-bold text-gray-800">{{chart_data.total.3}}</div>
80
81
                    </div>
                    <div class="col-auto">
82
                        <em class="fas fa-comments fa-2x text-gray-300"></em>
83
84
85
86
87
88
89
90
91
92
93
94
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Content Row -->

<div class="row">

    <!-- Area Chart -->
95
    <div class="col-12">
96
97
98
        <div class="card shadow mb-4">
            <!-- Card Header - Dropdown -->
            <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between">
99
                <h6 class="m-0 font-weight-bold text-primary">Statistik</h6>
100
101
            </div>
            <!-- Card Body -->
102
            <div class="card-body" style="overflow:auto!important; display:inline-block!important; height: 750px;">
103
                <div class="chart-area">
104
                    <canvas id="primaryChart" class="canvas"></canvas>
105
106
107
108
109
                </div>
            </div>
        </div>
    </div>
</div>
110
111
112
113
<div class="row p-3">
    <div class="card shadow mb-4">
        <div class="card-header py-3">
            <h6 class="m-0 font-weight-bold text-primary" id="titleTable">Tabel Materi</h6>
114
        </div>
115
116
        <div class="card-body">
            <div class="table-responsive">
117
                <table class="table table-bordered" id="dataTableRiwayat"
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
                    aria-describedby="titleTabelRiwayat">
                    <thead>
                        <tr>
                            <th scope="col">Judul Materi</th>
                            <th scope="col">Nama Kontributor</th>
                            <th scope="col">Status</th>
                            <th scope="col">Tombol</th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th scope="col">Judul Materi</th>
                            <th scope="col">Nama Kontributor</th>
                            <th scope="col">Status</th>
                            <th scope="col">Tombol</th>
                        </tr>
                    </tfoot>
                    <tbody>
                        {% for materi in materi_list_history %}
                        <tr>
                            <td>{{ materi.title }}</td>
                            <td>{{ materi.uploader.name }}</td>
                            <td>{{ materi.get_status_display }}</td>
                            <td class="verif-buttons">
                                <a href="/administration/detail-verif/{{materi.id}}/" class="accept-button"
                                    style="background-color:#4e73df">Detail</a>

                        </tr>
                        {% endfor %}
                    </tbody>
                </table>
149
150
151
            </div>
        </div>
    </div>
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
</div>
{% endblock %}

{% block javascripts %}
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
    integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.3/dist/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="{% static 'administration/statistic-loader.js'%}"></script>
<script type="text/javascript">
    $(function () {
        $("#button-id-reset_form").bind("click", function () {
            $('form[name="filter-form"]')
                .find(':radio, :checkbox').removeAttr('checked').end()
                .find('textarea, :text, select').val('')
            $('form[name="filter-form"]').find('input[type="date"]').val('')
        });
    });
</script>
<script>
    var datasets = {{ chart_data.charts | safe }};
    var labels = {{ chart_data.label | safe }};
    var barChartData = {
        labels: labels,
        datasets: datasets
    };

    var chartOptions = {
        responsive: true,
        legend: {
            position: "top"
        },
        title: {
            display: true,
            text: "Statistik"
        },
        scales: {
            yAxes: [{
                ticks: {
                    beginAtZero: true
                }
            }]
        }
    }

    window.onload = function () {
        var ctx = document.getElementById("primaryChart").getContext("2d");
        window.myBar = new Chart(ctx, {
            type: "bar",
            data: barChartData,
            options: chartOptions
        });
    };

</script>
{% endblock %}