Fakultas Ilmu Komputer UI

kelola_admin.html 5.99 KB
Newer Older
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
1
{% extends 'administration/base_administrasi2.html' %}
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
2

Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{% block title %}
<title>Kelola Admin | Digipus</title>
{% endblock %}

{% block content %}
<!-- Page Heading -->
<h1 class="h3 mb-2 text-gray-800">Kelola Admin</h1>
<p class="mb-4">Tekan tombol detail untuk informasi lebih lanjut tentang admin</ehp>

<!-- DataTales Example -->
<div class="card shadow mb-4">
  <div class="card-header py-3">
    <div class="d-flex">
      <div class="mr-auto p-2">
17
        <h6 id="table-description" class="m-0 font-weight-bold text-primary">Tabel Daftar Admin</h6>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
18
19
20
      </div>
      <div class="p-2">
        <a href="/administration/kelola-admin/tambah/" class="accept-button button-decoration button-header">Buat Akun Baru</a>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
21
22
23
      </div>
    </div>
  </div>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
24
25
  <div class="card-body">
    <div class="table-responsive">
26
      <table aria-describedby="table-description" class="table table-bordered" id="dataTable">
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
27
28
        <thead>
          <tr>
Rizkhi PH's avatar
Rizkhi PH committed
29
30
31
32
33
            <th scope="col">Nama</th>
            <th scope="col">NIK</th>
            <th scope="col">Instansi</th>
            <th scope="col">Status</th>
            <th scope="col">Pilihan</th>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
34
35
36
37
          </tr>
        </thead>
        <tfoot>
          <tr>
Rizkhi PH's avatar
Rizkhi PH committed
38
39
40
41
42
            <th scope="col">Nama</th>
            <th scope="col">NIK</th>
            <th scope="col">Instansi</th>
            <th scope="col">Status</th>
            <th scope="col">Pilihan</th>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
43
44
45
46
47
48
          </tr>
          </tr>
        </tfoot>
        <tbody>
          {% for current in users_list %}
          <tr>
Rizkhi PH's avatar
Rizkhi PH committed
49
            <td>{% if current.name %} {{ current.name }} {% else %} Superadmin {% endif %}</td>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
50
51
            <td>{{ current.nik }}</td>
            <td>{{ current.instansi }}</td>
Rizkhi PH's avatar
Rizkhi PH committed
52
            <td>{% if current.is_active %} Active {% else %} Inactive {% endif %}</td>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
53
54
            <td class="verif-buttons">
              <span>
Rizkhi PH's avatar
Rizkhi PH committed
55
56
57
58
59
                {% if user.is_superuser %}
                  {% if not current.is_superuser %}
                    <a href="/administration/setting/admin/{{ current.id }}/edit" class="accept-button button-decoration" role="button">Edit</a>
                  {% endif %}
                {% endif %}
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
60
                <a href="/administration/profil-admin/{{ current.id }}/" class="accept-button button-decoration">Detail</a>
Rizkhi PH's avatar
Rizkhi PH committed
61
                {% if not current.is_superuser %}
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
62
63
64
65
66
67
68
69
70
71
72
                <button type="button" class="reject-button button-decoration" data-toggle="modal" data-target="#confirmModal{{ current.id }}">Hapus</button>
                <div class="modal fade" id="confirmModal{{ current.id }}" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                  <div class="modal-dialog" role="document">
                    <div class="modal-content">
                      <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabel">Konfirmasi Penghapusan Akun</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                          <span aria-hidden="true">&times;</span>
                        </button>
                      </div>
                      <div class="modal-body">
73
74
75
76
                        <p>Anda akan menghapus akun admin dengan email 
                          <span class="bg-danger pr-1 pl-1 text-white" style="text-transform: lowercase">{{current.email}}</span>
                          . Lakukan konfirmasi penghapusan dengan mengetik: </p>
                        <p class="bg-danger text-white p-1"> {{current.email}} </p>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
77
                      </div>
78
79
80
81
82
83
84
85
86
87
                      <form/>
                        {% csrf_token %}
                        <div class="form-group pl-3 pr-3">
                          <input name="{{ current.email }}" class="form-control" id="{{ current.id }}"required pattern="{{current.email}}" oninput="checkValue(this)">
                        </div>
                        <div class="modal-footer">
                          <button type="button" class="btn btn-secondary" data-dismiss="modal">Batal</button>
                          <a href="/administration/hapus-admin/{{current.id}}/" id="btn-hapus-{{current.id}}" type="button" class="btn btn-danger disabled">Hapus</a>
                        </div>
                      </form>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
88
89
90
                    </div>
                  </div>
                </div>
Rizkhi PH's avatar
Rizkhi PH committed
91
                {% endif %}
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
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
              </span>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
  </div>
</div>
<div class="card shadow mb-4">
  <div class="card-header py-3">
    <h6 class="m-0 font-weight-bold text-primary" id="titleTabelPending">Aktivitas Penghapusan Akun Admin</h6>
  </div>
  <div class="card-body">
    <div class="table-responsive">
      <table class="table table-bordered" id="dataTablePending" aria-describedby="titleTabelPending">
        {% if not deletion_history %}
          Tidak ada aktivitas penghapusan akun admin
        {% else %}
          <thead>
            <tr>
              <th scope="col">Admin yang Dihapus</th>
              <th scope="col">Waktu Penghapusan</th>
              <th scope="col">Admin Penghapus</th>
            </tr>
          </thead>
          <tfoot>
            <tr>
              <th scope="col">Admin yang Dihapus</th>
              <th scope="col">Waktu Penghapusan</th>
              <th scope="col">Admin Penghapus</th>
            </tr>
          </tfoot>
          <tbody>
            {% for history in deletion_history %}
            <tr>
              <td>{{ history.deleted_user_name }}</td>
              <td>{{ history.timestamp }}</td>
              <td>{{ history.deletor_admin.name }}</td>
            </tr>
            {% endfor %}
          </tbody>
        {% endif %}
      </table>
    </div>
  </div>
</div>
139
140
141
142
143
144
145
146
147
148
<script type="text/javascript">
  function checkValue(element){
    buttonElement = document.getElementById("btn-hapus-" + element.id)
    if(element.value != element.name) { 
        buttonElement.classList.add("disabled"); 
    } else { 
        buttonElement.classList.remove("disabled");
    }
}
</script>
Samuel Dimas Partogi's avatar
Samuel Dimas Partogi committed
149
{% endblock %}