-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpelanggan.php
115 lines (100 loc) · 3.43 KB
/
pelanggan.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
<?php include 'template/navbar.php' ?>
<?php include 'template/subnavbar.php' ?>
<?php
include 'sistem/core.php';
include 'sistem/db/MysqliDb.php';
$root = new Utility();
session_start();
$root->checkLogin('admin');
$db = new MysqliDb();
?>
<div class="main">
<div class="main-inner">
<div class="container">
<div class="row">
<!-- /span6 -->
<div class="span12">
<a href="tambah_pelanggan.php" class="btn btn-primary" title="Tambah">Tambah Pelanggan</a>
<p></p>
<table id="tabelku" class="table table-bordered table-striped">
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Alamat</th>
<th>Tgl. Lahir</th>
<th>No. Telp</th>
<th>Aksi</th>
<!-- <th><input type="checkbox" name="checkAll" id="checkAll" value="">Check all || <button id="kirimkan" >Kirim</button></th> -->
</tr>
</thead>
<tbody>
<?php
$pelanggan = $db->get('pelanggan');
$no = 1;
foreach ($pelanggan as $pel) { ?>
<tr>
<td><?= $no; ?></td>
<td><?= $pel['nama']; ?></td>
<td><?= $pel['alamat']; ?></td>
<td><?= $pel['tanggal_lahir']; ?></td>
<td><?= $pel['no_telepon']; ?></td>
<td>
<a href="edit_pelanggan.php?id=<?= $pel['id_pelanggan'] ?>" class="btn btn-info btn-small" title="Edit">Edit</a>
<a onclick="return confirm('apakah yakin ingin menghapus ?');" href="hapus_pelanggan.php?id=<?= $pel['id_pelanggan'] ?>" class="btn btn-danger btn-small" title="Hapus">Hapus</a>
</td>
<!-- <td class="no-sort"><input class="checkdong" type="checkbox" name="checkin" value="<?= $pel['id_pelanggan'] ?>"></td> -->
</tr>
<?php $no++; }
?>
</tbody>
</table>
</div>
</div>
<!-- /row -->
</div>
<!-- /container -->
</div>
<!-- /main-inner -->
</div>
<?php include('template/footer.php'); ?>
<script>
$(document).ready(function() {
$("#tabelku").dataTable({
'aoColumnDefs': [{
// "targets": 'no-sort',
// "orderable": false
'bSortable': false,
'aTargets': [-1]
}]
});
// get checked input
var arr = $.map($('input[name="checkin"]:checked'),function(c) {
return c.value;
});
// fungsi kirim
$('#kirimkan').click(function() {
var arr2 = $.map($('input[name="checkin"]:checked'),function(c) {
return c.value;
});
var value_kirim = arr2;
// console.log('kirim ya', value_kirim);
$.ajax({
url: 'kirim_checkall.php',
type: 'post',
data: {param1: value_kirim},
}).success(function(aha){
console.log(aha);
// alert(aha);
})
.error(function(err) {
console.log(err);
alert('Tidak memilih checklist');
});
});
// checkall
$('#checkAll').change(function() {
$('input:checkbox').prop('checked', $(this).prop('checked'));
});
});
</script>