-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathloop-students.php
108 lines (102 loc) · 3.93 KB
/
loop-students.php
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
<?php defined('BASEPATH') OR exit('No direct script access allowed') ?>
<script type="text/javascript">
$( document ).ready(function() {
var values = get_values();
if (values['academic_year_id'] && values['class_group_id']) {
get_students();
}
});
function get_values() {
var values = {
academic_year_id: $('#academic_year_id').val(),
class_group_id: $('#class_group_id').val()
};
return values;
}
function get_students() {
const values = get_values();
if (values['academic_year_id'] && values['class_group_id']) {
_H.Loading(true);
$.post( _BASE_URL + 'public/student_directory/get_students', values, function( response ) {
_H.Loading(false);
const res = response;
const rows = res.rows;
let html = '';
let no = parseInt($('.number:last').text()) + 1;
for (var z in rows) {
const row = rows[ z ];
const template = `
<div class="profile-student">
<div class="shadow bg-white flex flex-col lg:flex-row lg:items-center justify-between py-2 px-3">
<div class="lg:w-1/4"><img src="${row.photo}" class="thumbnail w-full text-center mx-auto"/></div>
<div class="lg:w-3/4">
<div class="py-2 px-3">
<dl class="block flex-wrap text-gray-500 divide-y">
<div class="flex justify-between">
<dt>Nama Lengkap</dt>
<dd>${row.full_name}</dd>
</div>
<div class="flex justify-between">
<dt>${_IDENTITY_NUMBER}</dt>
<dd>${row.identity_number}</dd>
</div>
<div class="flex justify-between">
<dt>Jenis Kelamin</dt>
<dd>${row.gender}</dd>
</div>
<div class="flex justify-between">
<dt>Tempat Lahir</dt>
<dd>${row.birth_place}</dd>
</div>
<div class="flex justify-between">
<dt>Tanggal Lahir</dt>
<dd>${row.birth_date}</dd>
</div>
</dl>
</div>
</div>
</div>
</div>
`;
html += template;
}
const elementId = $(".student-directory");
$(elementId).html(html);
});
}
}
</script>
<style>
.thumbnail {
height: 6rem;
width: auto;
}
@media screen and (min-width: 1024px) {
.thumbnail {
width: 100%;
height: auto;
}
}
</style>
<main class="container space-y-5 my-5 flex-1">
<div class="space-y-4">
<h3 class="font-heading text-2xl font-black text-title"><span class="fa fa-student"></span> <?= ucwords($page_title) ?></h3>
<form onsubmit="return false;" class="mb-3">
<div class="grid gap-4 lg:grid-cols-3 items-center lg:w-3/4">
<div class="w-full">
<label class="mr-sm-2 sr-only" for="academic_year_id"><?= __session('_academic_year') ?></label>
<?= form_dropdown('academic_year_id', $academic_years, __session('current_academic_year_id'), 'class="form-select w-full" id="academic_year_id"') ?>
</div>
<div class="w-full">
<label class="mr-sm-2 sr-only" for="class_group_id">Kelas</label>
<?= form_dropdown('class_group_id', $class_groups, '', 'class="form-select w-full" id="class_group_id"') ?>
</div>
<div class="w-full">
<button type="button" onclick="get_students()" class="bg-secondary opacity-80 transition duration-100 hover:opacity-100 text-white rounded py-2 px-5 text-center"><i class="fa fa-search mr-2"></i> CARI</button>
</div>
</div>
</form>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 student-directory"></div>
<div class="loading-area"></div>
</div>
</main>