Spaces:
Running
Running
Bintang Fajar Julio
commited on
Commit
•
78bf9c7
1
Parent(s):
4b28b5a
update
Browse files- static/js/app.js +0 -76
- templates/auth/sign_up.html +2 -2
- templates/dashboard/base.html +0 -2
- templates/dashboard/classifier.html +3 -32
- views/auth.py +4 -0
static/js/app.js
CHANGED
@@ -49,79 +49,3 @@ sidePanelClose.addEventListener("click", (e) => {
|
|
49 |
sidePanelDrop.addEventListener("click", (e) => {
|
50 |
sidePanelToggler.click();
|
51 |
});
|
52 |
-
|
53 |
-
window.chartColors = {
|
54 |
-
green: "#75c181",
|
55 |
-
blue: "#5b99ea",
|
56 |
-
gray: "#a9b5c9",
|
57 |
-
yellow: "#f1c40f",
|
58 |
-
text: "#252930",
|
59 |
-
border: "#e7e9ed",
|
60 |
-
};
|
61 |
-
|
62 |
-
function initChart(keys, values) {
|
63 |
-
var doughnutChartConfig = {
|
64 |
-
type: "doughnut",
|
65 |
-
data: {
|
66 |
-
datasets: [
|
67 |
-
{
|
68 |
-
data: values,
|
69 |
-
backgroundColor: [
|
70 |
-
window.chartColors.green,
|
71 |
-
window.chartColors.blue,
|
72 |
-
window.chartColors.grey,
|
73 |
-
window.chartColors.yellow,
|
74 |
-
],
|
75 |
-
label: "Hasil",
|
76 |
-
},
|
77 |
-
],
|
78 |
-
labels: keys,
|
79 |
-
},
|
80 |
-
options: {
|
81 |
-
responsive: true,
|
82 |
-
legend: {
|
83 |
-
display: true,
|
84 |
-
position: "bottom",
|
85 |
-
align: "center",
|
86 |
-
},
|
87 |
-
|
88 |
-
tooltips: {
|
89 |
-
titleMarginBottom: 10,
|
90 |
-
bodySpacing: 10,
|
91 |
-
xPadding: 16,
|
92 |
-
yPadding: 16,
|
93 |
-
borderColor: window.chartColors.border,
|
94 |
-
borderWidth: 1,
|
95 |
-
backgroundColor: "#fff",
|
96 |
-
bodyFontColor: window.chartColors.text,
|
97 |
-
titleFontColor: window.chartColors.text,
|
98 |
-
|
99 |
-
animation: {
|
100 |
-
animateScale: true,
|
101 |
-
animateRotate: true,
|
102 |
-
},
|
103 |
-
|
104 |
-
callbacks: {
|
105 |
-
label: function (tooltipItem, data) {
|
106 |
-
var dataset = data.datasets[tooltipItem.datasetIndex];
|
107 |
-
var total = dataset.data.reduce(function (
|
108 |
-
previousValue,
|
109 |
-
currentValue,
|
110 |
-
currentIndex,
|
111 |
-
array
|
112 |
-
) {
|
113 |
-
return previousValue + currentValue;
|
114 |
-
});
|
115 |
-
|
116 |
-
var currentValue = dataset.data[tooltipItem.index];
|
117 |
-
var percentage = Math.floor((currentValue / total) * 100 + 0.5);
|
118 |
-
|
119 |
-
return percentage + "%";
|
120 |
-
},
|
121 |
-
},
|
122 |
-
},
|
123 |
-
},
|
124 |
-
};
|
125 |
-
|
126 |
-
return doughnutChartConfig;
|
127 |
-
}
|
|
|
49 |
sidePanelDrop.addEventListener("click", (e) => {
|
50 |
sidePanelToggler.click();
|
51 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
templates/auth/sign_up.html
CHANGED
@@ -14,13 +14,13 @@ block content %}
|
|
14 |
</div>
|
15 |
|
16 |
<div class="email mb-3">
|
17 |
-
<label class="sr-only" for="email">Email</label>
|
18 |
<input
|
19 |
id="email"
|
20 |
name="email"
|
21 |
type="email"
|
22 |
class="form-control email"
|
23 |
-
placeholder="Masukkan email
|
24 |
required="required"
|
25 |
/>
|
26 |
</div>
|
|
|
14 |
</div>
|
15 |
|
16 |
<div class="email mb-3">
|
17 |
+
<label class="sr-only" for="email">Email Politeknik Negeri Jakarta</label>
|
18 |
<input
|
19 |
id="email"
|
20 |
name="email"
|
21 |
type="email"
|
22 |
class="form-control email"
|
23 |
+
placeholder="Masukkan email Politeknik Negeri Jakarta"
|
24 |
required="required"
|
25 |
/>
|
26 |
</div>
|
templates/dashboard/base.html
CHANGED
@@ -320,9 +320,7 @@
|
|
320 |
}
|
321 |
</script>
|
322 |
|
323 |
-
<script src="{{ url_for('static', filename='plugins/chart.js/chart.min.js') }}"></script>
|
324 |
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
|
325 |
-
|
326 |
{% block script %}{% endblock script %}
|
327 |
</body>
|
328 |
</html>
|
|
|
320 |
}
|
321 |
</script>
|
322 |
|
|
|
323 |
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
|
|
|
324 |
{% block script %}{% endblock script %}
|
325 |
</body>
|
326 |
</html>
|
templates/dashboard/classifier.html
CHANGED
@@ -247,7 +247,7 @@ title %} {% block content %}
|
|
247 |
|
248 |
<hr class="my-4" />
|
249 |
|
250 |
-
<div class="row g-
|
251 |
<div class="col-12">
|
252 |
<h3 class="section-title">Hasil</h3>
|
253 |
</div>
|
@@ -256,7 +256,7 @@ title %} {% block content %}
|
|
256 |
<div class="app-card-header p-3">
|
257 |
<div class="row justify-content-between align-items-center">
|
258 |
<div class="col-auto">
|
259 |
-
<h4 class="app-card-title">Skor</h4>
|
260 |
</div>
|
261 |
</div>
|
262 |
<!--//row-->
|
@@ -280,28 +280,6 @@ title %} {% block content %}
|
|
280 |
</div>
|
281 |
<!--//app-card-->
|
282 |
</div>
|
283 |
-
<div class="col-12 col-lg-6">
|
284 |
-
<div class="app-card app-card-chart h-100 shadow-sm">
|
285 |
-
<div class="app-card-header p-3 border-0">
|
286 |
-
<h4 class="app-card-title">Grafik</h4>
|
287 |
-
</div>
|
288 |
-
<div class="app-card-body pb-2">
|
289 |
-
<div class="chart-container">
|
290 |
-
<div class="chartjs-size-monitor">
|
291 |
-
<div class="chartjs-size-monitor-expand"><div class=""></div></div>
|
292 |
-
<div class="chartjs-size-monitor-shrink"><div class=""></div></div>
|
293 |
-
</div>
|
294 |
-
<canvas
|
295 |
-
id="chart-doughnut"
|
296 |
-
style="display: block; width: 454px; height: 227px"
|
297 |
-
width="384"
|
298 |
-
height="157"
|
299 |
-
class="chartjs-render-monitor"
|
300 |
-
></canvas>
|
301 |
-
</div>
|
302 |
-
</div>
|
303 |
-
</div>
|
304 |
-
</div>
|
305 |
|
306 |
<div class="col-12 mt-5 text-center">
|
307 |
<h3 class="section-title">
|
@@ -440,13 +418,6 @@ title %} {% block content %}
|
|
440 |
isFirstRow = false;
|
441 |
});
|
442 |
|
443 |
-
var doughnutChart = $("#chart-doughnut")[0].getContext("2d");
|
444 |
-
|
445 |
-
window.myDoughnut = new Chart(
|
446 |
-
doughnutChart,
|
447 |
-
initChart(Object.keys(probs), Object.values(probs))
|
448 |
-
);
|
449 |
-
|
450 |
$("#kbk").text(response["message"]["kbk"]);
|
451 |
|
452 |
$("#lecturers").empty();
|
@@ -494,7 +465,7 @@ title %} {% block content %}
|
|
494 |
`<div class="app-card app-card-notification shadow-sm mb-4">
|
495 |
<div class="app-card-header px-4 py-3">
|
496 |
<div class="row g-3 align-items-center">
|
497 |
-
<div class="col-12 col-lg-auto text-
|
498 |
<div class="notification-type mb-3">
|
499 |
<span class="badge" style="background-color: #128c9b"
|
500 |
>Rank #${topSimilarity[index]["rank"]}</span
|
|
|
247 |
|
248 |
<hr class="my-4" />
|
249 |
|
250 |
+
<div class="row g-3 settings-section justify-content-center d-none" id="hasil">
|
251 |
<div class="col-12">
|
252 |
<h3 class="section-title">Hasil</h3>
|
253 |
</div>
|
|
|
256 |
<div class="app-card-header p-3">
|
257 |
<div class="row justify-content-between align-items-center">
|
258 |
<div class="col-auto">
|
259 |
+
<h4 class="app-card-title">Skor Klasifikasi</h4>
|
260 |
</div>
|
261 |
</div>
|
262 |
<!--//row-->
|
|
|
280 |
</div>
|
281 |
<!--//app-card-->
|
282 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
|
284 |
<div class="col-12 mt-5 text-center">
|
285 |
<h3 class="section-title">
|
|
|
418 |
isFirstRow = false;
|
419 |
});
|
420 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
421 |
$("#kbk").text(response["message"]["kbk"]);
|
422 |
|
423 |
$("#lecturers").empty();
|
|
|
465 |
`<div class="app-card app-card-notification shadow-sm mb-4">
|
466 |
<div class="app-card-header px-4 py-3">
|
467 |
<div class="row g-3 align-items-center">
|
468 |
+
<div class="col-12 col-lg-auto text-start">
|
469 |
<div class="notification-type mb-3">
|
470 |
<span class="badge" style="background-color: #128c9b"
|
471 |
>Rank #${topSimilarity[index]["rank"]}</span
|
views/auth.py
CHANGED
@@ -24,6 +24,10 @@ def sign_up():
|
|
24 |
flash(('Pendaftaran Gagal', 'Semua isian harus diisi'), 'error')
|
25 |
return render_template('auth/sign_up.html')
|
26 |
|
|
|
|
|
|
|
|
|
27 |
if password != confirm_password:
|
28 |
flash(('Pendaftaran Gagal', 'Password dan konfirmasi password tidak sama'), 'error')
|
29 |
return render_template('auth/sign_up.html')
|
|
|
24 |
flash(('Pendaftaran Gagal', 'Semua isian harus diisi'), 'error')
|
25 |
return render_template('auth/sign_up.html')
|
26 |
|
27 |
+
if not email.endswith('pnj.ac.id'):
|
28 |
+
flash(('Pendaftaran Gagal', 'Harus menggunakan email Politeknik Negeri Jakarta'), 'error')
|
29 |
+
return render_template('auth/sign_up.html')
|
30 |
+
|
31 |
if password != confirm_password:
|
32 |
flash(('Pendaftaran Gagal', 'Password dan konfirmasi password tidak sama'), 'error')
|
33 |
return render_template('auth/sign_up.html')
|