-
Notifications
You must be signed in to change notification settings - Fork 0
/
pasien.php
247 lines (227 loc) · 12.7 KB
/
pasien.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Klinik</title>
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<!-- Font Awesome Icons -->
<link rel="stylesheet" href="bootstrap/plugins/fontawesome-free/css/all.min.css">
<!-- Tempusdominus Bootstrap 4 -->
<link rel="stylesheet" href="bootstrap/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
<!-- Select2 -->
<link rel="stylesheet" href="bootstrap/plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="bootstrap/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="bootstrap/plugins/datatables-bs4/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="bootstrap/plugins/datatables-responsive/css/responsive.bootstrap4.min.css">
<link rel="stylesheet" href="bootstrap/plugins/datatables-buttons/css/buttons.bootstrap4.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="bootstrap/dist/css/adminlte.min.css">
</head>
<body class="hold-transition layout-top-nav">
<div class="wrapper">
<?php
require 'konfigurasi/ceksession.php';
require 'konfigurasi/koneksi.php';
require 'layout/navbar.php';
?>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<div class="content-header">
<div class="container">
<div class="row mb-2">
<div class="col-sm-6">
<h1 class="m-0"> Kelola Pasien</h1>
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content-header -->
<!-- Main content -->
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="card-title m-0">Form Pasien</h5>
</div>
<div class="card-body">
<form action="fungsi/simpanPasien.php" method="POST">
<input type="hidden" name="status" id="status" value="Tambah">
<input type="hidden" name="idPasienTxt" id="idPasienTxt">
<div class="form-group">
<label for="">Nomor Identitas</label>
<input type="text" class="form-control form-control-sm" name="noIdentitasTxt" id="noIdentitasTxt" required="required">
</div>
<div class="form-group">
<label for="">Nama Pasien</label>
<input type="text" class="form-control form-control-sm" name="namaPasienTxt" id="namaPasienTxt" required="required">
</div>
<div class="form-group">
<label for="">Jenis Kelamin</label>
<div class="row ml-1">
<div class="custom-control custom-radio col-md-6">
<input class="custom-control-input" type="radio" id="jkL" name="jenisKelamin" value="L" required>
<label for="jkL" class="custom-control-label">Laki-laki</label>
</div>
<div class="custom-control custom-radio col-md-6">
<input class="custom-control-input" type="radio" id="jkP" name="jenisKelamin" value="P">
<label for="jkP" class="custom-control-label">Perempuan</label>
</div>
</div>
</div>
<div class="form-group">
<label for="">Umur</label>
<input type="text" class="form-control form-control-sm" name="umurTxt" id="umurTxt" required="required">
</div>
<div class="form-group">
<label for="">Telepon</label>
<input type="text" class="form-control form-control-sm" name="teleponTxt" id="teleponTxt" required="required">
</div>
<div class="form-group">
<button class="btn btn-sm btn-success" type="submit" id="tombol">Tambah Pasien</button>
<button class="btn btn-sm btn-default" id="batal">Batal</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-8">
<div class="card card-primary card-outline">
<div class="card-header">
<h5 class="card-title m-0">Daftar Pasien</h5>
</div>
<div class="card-body">
<?php if (isset($_SESSION['info'])) { ?>
<div class="alert alert-success alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?= $_SESSION['info'] ?>
</div>
<?php
unset($_SESSION['info']);
}
?>
<div class="table-responsive table-sm">
<table id="tableDokter" class="table table-hover">
<thead>
<th>No</th>
<th>No Identitas</th>
<th>Nama Pasien</th>
<th>Jenis Kelamin</th>
<th>Umur</th>
<th>Telepon</th>
<th>Aksi</th>
</thead>
<tbody>
<?php
$query = mysqli_query($conn, "SELECT * FROM tb_pasien ORDER BY id_pasien DESC");
$no = 1;
while ($data = mysqli_fetch_array($query)) {
?>
<tr>
<td><?= $no++ ?></td>
<td><?= $data['nomor_identitas'] ?></td>
<td><?= $data['nama_pasien'] ?></td>
<td><?= $data['jenis_kelamin'] ?></td>
<td><?= $data['umur'] ?></td>
<td><?= $data['telepon'] ?></td>
<td>
<a href="fungsi/hapusPasien.php?id=<?= $data['id_pasien'] ?>" class="btn btn-sm btn-danger" title="Delete"> <i class="fas fa-times"></i> </a>
<button class="btn btn-sm btn-warning" title="Edit" onclick="edit(<?= $data['id_pasien'] ?>)"> <i class="fas fa-pencil-alt"></i> </button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</div>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- Main Footer -->
<footer class="main-footer">
<!-- To the right -->
<div class="float-right d-none d-sm-inline">
Created By Aisyah
</div>
<!-- Default to the left -->
<strong>Copyright © 2022 <a href="#">Klinik</a>.</strong> All rights reserved.
</footer>
</div>
<!-- ./wrapper -->
<!-- REQUIRED SCRIPTS -->
<!-- jQuery -->
<script src="bootstrap/plugins/jquery/jquery.min.js"></script>
<!-- Select2 -->
<script src="bootstrap/plugins/select2/js/select2.full.min.js"></script>
<!-- InputMask -->
<script src="bootstrap/plugins/moment/moment.min.js"></script>
<!-- Tempusdominus Bootstrap 4 -->
<script src="bootstrap/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
<script src="bootstrap/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="bootstrap/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
<script src="bootstrap/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
<script src="bootstrap/plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
<script src="bootstrap/plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
<script src="bootstrap/plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<!-- Bootstrap 4 -->
<script src="bootstrap/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="bootstrap/dist/js/adminlte.min.js"></script>
<script>
$(function() {
//Initialize Select2 Elements
$('.select2bs4').select2({
theme: 'bootstrap4'
});
//Initialize datatable
$('#tableDokter').DataTable({
"paging": true,
"searching": true,
"ordering": false,
"info": true,
"autoWidth": false,
"responsive": true,
});
$("#batal").click(function() {
$("#status").val('Tambah');
$("#idDokterTxt").val('');
$("#namaObatTxt").val('');
$("#keteranganTxt").val('');
$("#tombol").html("Tambah Obat");
});
});
function edit(id) {
$.ajax({
"url": "fungsi/getPasien.php?id=" + id,
"method": "GET",
}).done(function(response) {
var object = JSON.parse(response);
console.log(object);
$("#status").val('Edit');
$("#idPasienTxt").val(object[0][0]);
$("#noIdentitasTxt").val(object[0][1]);
$("#namaPasienTxt").val(object[0][2]);
if (object[0][3] == "L") {
$("#jkL").attr('checked', 'checked');
} else {
$("#jkP").attr('checked', 'checked');
}
$("#umurTxt").val(object[0][4]);
$("#teleponTxt").val(object[0][5]);
$("#tombol").html("Edit Pasien");
});
}
</script>
</body>
</html>