-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_wisata.php
218 lines (158 loc) · 4.64 KB
/
manage_wisata.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
<div style='min-height:620px;'>
<?php
include "koneksi.php";
$per_page=10;
if (isset($_GET['page'])) {
$page = $_GET['page'];
}else {
$page=1;
}
// Page will start from 0 and Multiple by Per Page
$start_from = ($page-1) * $per_page;
$query_limit = "LIMIT $start_from, $per_page";
if(!isset($_GET['submit'])){
$query = "SELECT * FROM paket ORDER BY no ASC $query_limit";
$sql = mysqli_query($connect,$query);
}else{
$query = "SELECT * FROM paket WHERE ". $_GET['search_select'] ." LIKE '%". $_GET['search_value'] ."%' ORDER BY kategori DESC $query_limit";
$sql = mysqli_query($connect,$query);
}
?>
<div class="row">
<div class="col-md-12">
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
text-align: left;
padding: 8px;
}
tr:nth-child(even){background-color: #e6ecff}
th {
background-color: #3366ff;
color: white;
}
</style>
<table class='table table-striped' id="tblData">
<br><br><br><br><br>
<center><legend><h2>Manajemen Wisata</h2></legend></center>
<br>
<div class="row space-form ">
<div class="col-sm-8 col-sm-offset-0">
<a href="admin.php?menu=add_wisata" class="btn btn-sm btn-info" >
<span class="glyphicon glyphicon-plus"></span> Tambah Data
</a>
</div>
<div class="col-sm-4">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-search-plus"></i></span>
<input class="form-control" id="search" type="text" placeholder="Pencarian">
</div>
</div>
</div>
<br><br>
<tr>
<th>No.</th>
<th>Gambar</th>
<th>Kategori Wisata</th>
<th>Durasi</th>
<th>Harga</th>
<th>Rincian</th>
<th>Masa Berlaku</th>
<th>Sistem Pembayaran</th>
<th colspan="2"><center>Aksi</center></th>
</tr>
<?php
$no = 1;
$count = mysqli_num_rows($sql);
if($count<1){
echo "<tr><td colspan='9'><center>Data Tidak Ditemukan!</center></td></tr>";
}else{
while($data=mysqli_fetch_array($sql,MYSQLI_BOTH)){
?>
<tr>
<td><?php echo $no++; ?></td>
<td><img src="<?php echo $data['gambar'];?>" style="width:150px;height:100px;" /></td>
<td><?php echo $data['kategori']; ?></td>
<td><?php echo $data['durasi']; ?></td>
<td> Rp <?php echo number_format($data['harga']); ?>,-</td>
<td><?php echo $data['rincian']; ?></td>
<td><?php echo $data['masa_berlaku'] ?></td>
<td><?php echo $data['sistem_pembayaran'] ?></td>
<td width="50"><a id="recruit_detail" href="admin.php?menu=edit_wisata&no=<?php echo $data['no'];?>"><span class="glyphicon glyphicon-edit"></span></a>
<a id="actdelete" href="proses_hotel.php?del=1&no=<?php echo $data['no'];?>"><span class="glyphicon glyphicon-trash"></span></a></td>
</tr>
<?php
}
}
?>
</table>
</div>
</div>
<?php
//Now select all from table
if(!isset($_GET['submit'])){
$query = "SELECT * FROM paket";
}else{
$query = "SELECT * FROM paket WHERE ". $_GET['search_select'] ." LIKE '%". $_GET['search_value'] ."%'";
}
$result = mysqli_query($connect, $query);
// Count the total records
$total_records = mysqli_num_rows($result);
//Using ceil function to divide the total records on per page
$total_pages = ceil($total_records / $per_page);
//Going to first page
//echo "<center><a href='admin.php?p=mrecruit&cat=recruit&page=1'>".'First Page'."</a> ";
echo "<center>";
echo "<ul class='pagination'>";
for ($i=1; $i<=$total_pages; $i++) {
if($i==$page){
$active = "class='active'";
}else{
$active = "";
}
if(!isset($_GET['submit'])){
echo "<li $active><a href='admin.php?menu=hotel&page=".$i."'>".$i."</a></li>";
}else{
echo "<li $active><a href='admin.php?menu=hotel&search_select=". $_GET['search_select'] ."&search_value=". $_GET['search_value'] ."&submit=". $_GET['submit'] ."&page=".$i."'>".$i."</a></li>";
}
};
echo "</ul>";
echo "</center>";
// Going to last page
//echo "<a href='admin.php?menu=manage_tarif&page=$total_pages'>".'Last Page'."</a></center> ";
?>
<!-- JQuery Search -->
<script type="text/javascript">
$(document).ready(function()
{
$('#search').keyup(function()
{
searchTable($(this).val());
});
});
function searchTable(inputVal)
{
var table = $('#tblData');
table.find('tr').each(function(index, row)
{
var allCells = $(row).find('td');
if(allCells.length > 0)
{
var found = false;
allCells.each(function(index, td)
{
var regExp = new RegExp(inputVal, 'i');
if(regExp.test($(td).text()))
{
found = true;
return false;
}
});
if(found == true)$(row).show();else $(row).hide();
}
});
}
</script>