-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdaftar_kucing_detail.php
152 lines (128 loc) · 5.3 KB
/
daftar_kucing_detail.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
<?php include 'layout/header.php'; ?>
<div class="page-header d-print-none">
<div class="row align-items-center">
<div class="col">
<!-- Page pre-title -->
<h2 class="page-title">
Detail Request Kucing
</h2>
<div class="page-pretitle">
Lihat detail request iklan adopsi
</div>
</div>
<div class="col-auto ms-auto d-print-none">
<div class="btn-list">
<span class="d-none d-sm-inline">
<a href="daftar_kucing.php" class="btn btn-white">
Kembali
</a>
</span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<?php
if(isset($_SESSION['alert'])){
echo $_SESSION['alert'];
unset($_SESSION['alert']);
}
?>
<?php
$query = "SELECT kucing.*, user.nama, user.email FROM kucing JOIN user ON user.id = kucing.user_id WHERE kucing.id = '".$_GET['id']."'";
$kucing = mysqli_fetch_assoc(mysqli_query($koneksi, $query));
?>
<div class="row">
<div class="col-md-5">
<h3>Informasi</h3>
<table class="table">
<tr>
<td>Nama</td>
<th class="text-right"><?= $kucing['nama_kucing'] ?></th>
</tr>
<tr>
<td>Jenis</td>
<th class="text-right"><?= $kucing['jenis'] ?></th>
</tr>
<tr>
<td>Umur</td>
<th class="text-right"><?= $kucing['umur'] ?></th>
</tr>
<tr>
<td>Jenis Kelamin</td>
<th class="text-right"><?= $kucing['jenis_kelamin'] ?></th>
</tr>
<tr>
<td>Pemilik</td>
<th class="text-right"><?= $kucing['nama']."<br><small>".$kucing['email']."</small>" ?></th>
</tr>
<?php if($_SESSION['login_data']['akses'] == 'admin' && $kucing['status'] == 'pending'){ ?>
<tr class="bg-light">
<th colspan="2" class="text-center">
<a onclick="return confirm('Setujui iklan adopsi ?')" href="proses/kucing_acc.php?id=<?= $kucing['id'] ?>" class="btn btn-success">Setujui</a>
<a href="proses/kucing_deny.php?id=<?= $kucing['id'] ?>" onclick="return confirm('Tolak iklan adopsi ?')" class="btn btn-danger">Tolak</a>
</th>
</tr>
<?php }else{ ?>
<tr>
<th colspan="2" class="text-center">
<?php
if($kucing['status'] == 'acc'){
echo "<span class='badge badge-success'>Disetujui</span>";
}else{
echo "<span class='badge badge-danger'>Ditolak</span>";
}
?>
<?php } ?>
</th>
</tr>
</table>
</div>
<div class="col-md-7">
<h3>Keterangan</h3>
<center>
<img src="adopt_img/<?= $kucing['foto'] ?>" style="width: 200px; height: 200px">
</center>
<p class="mt-3"><?= nl2br($kucing['deskripsi']) ?></p>
<h3>Request Adopsi</h3>
<table class="table">
<tr>
<th style="width: 5%">No</th>
<th>Pengadopsi</th>
<th>Alasan adopsi</th>
<th>Status</th>
<th></th>
</tr>
<?php
$query = mysqli_query($koneksi, "SELECT adopsi.*, user.nama, user.email, user.no_hp FROM adopsi JOIN user ON user.id = adopsi.user_id WHERE kucing_id='".$kucing['id']."'") or die(mysqli_error($koneksi));
$i=1; while ($adopsi = mysqli_fetch_array($query)) { ?>
<tr>
<td><?= $i++; ?></td>
<td><?= $adopsi['nama']."<br><small>".$adopsi['email']."<br>".$adopsi['no_hp']."</small>" ?></td>
<td><?= nl2br($adopsi['alasan_adopsi']) ?></td>
<td>
<?php if($adopsi['is_adoption'] == '1'){ ?>
<span class="badge badge-success">Terpilih</span>
<?php } ?>
</td>
<td>
<?php if($_SESSION['login_data']['akses'] == 'user'){
if($kucing['is_adopted'] == '0'){
?>
<a href="proses/adopsi_select.php?id=<?= $adopsi['id']."&kucing_id=".$adopsi['kucing_id'] ?>" class="btn btn-success">Pilih sebagai pengadopsi</a>
<?php }
} ?>
</td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include 'layout/footer.php'; ?>