-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdetail-agen.php
177 lines (147 loc) · 6.22 KB
/
detail-agen.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
<?php
//session
session_start();
include 'connect-db.php';
// mengambil id agen dg method get
$idAgen = $_GET["id"];
// ambil data agen
$query = mysqli_query($connect, "SELECT * FROM agen WHERE id_agen = '$idAgen'");
$agen = mysqli_fetch_assoc($query);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php include "headtags.html"; ?>
<title><?= $agen["nama_laundry"] ?></title>
</head>
<body>
<!-- header -->
<?php include 'header.php'; ?>
<!-- end header -->
<br><br>
<!-- data agen -->
<div class="row">
<div class="col s2 offset-s4">
<img src="img/agen/<?= $agen['foto'] ?>" class="circle responsive-img" width="70%" />
<a id="download-button" class="btn red darken-3" href="pesan-laundry.php?id=<?= $idAgen ?>">PESAN LAUNDRY</a>
</div>
<div class="col s6">
<h3><?= $agen["nama_laundry"] ?></h3>
<ul>
<li>
<?php
$temp = $agen["id_agen"];
$queryStar = mysqli_query($connect,"SELECT * FROM transaksi WHERE id_agen = '$temp'");
$totalStar = 0;
$i = 0;
while ($star = mysqli_fetch_assoc($queryStar)){
// kalau belum kasi rating gak dihitung
if ($star["rating"] != 0){
$totalStar += $star["rating"];
$i++;
$fixStar = ceil($totalStar / $i);
}
}
if ( $totalStar == 0 ) {
?>
<fieldset class="bintang"><span class="starImg star-0"></span></fieldset>
<?php }else { ?>
<fieldset class="bintang"><span class="starImg star-<?= $fixStar ?>"></span></fieldset>
<?php } ?>
</li>
<li>Alamat : <?= $agen["alamat"] . ", " . $agen["kota"] ?></li>
<li>No. HP : <?= $agen["telp"] ?></li>
</ul>
</div>
</div>
<!-- data harga -->
<div class="row">
<div class="col s3 offset-s2">
<div class="card-panel grey lighten-5 z-depth-1">
<div class="row valign-wrapper">
<a href="pesan-laundry.php?id=<?= $idAgen ?>&jenis=cuci" style="margin:0% 15%"><button class="btn blue darken-3">CUCI</button></a>
<div>
<?php
$harga = mysqli_query($connect, "SELECT * FROM harga WHERE id_agen = '$idAgen' AND jenis = 'cuci'");
$harga = mysqli_fetch_assoc($harga);
echo "Rp. " . $harga['harga'] . " /Kg";
?>
</div>
</div>
</div>
</div>
<div class="col s3">
<div class="card-panel grey lighten-5 z-depth-1">
<div class="row valign-wrapper">
<a href="pesan-laundry.php?id=<?= $idAgen ?>&jenis=setrika" style="margin:0% 15%"><button class="btn blue darken-3">SETRIKA</button></a>
<div>
<?php
$harga = mysqli_query($connect, "SELECT * FROM harga WHERE id_agen = '$idAgen' AND jenis = 'setrika'");
$harga = mysqli_fetch_assoc($harga);
echo "Rp. " . $harga['harga'] . " /Kg";
?>
</div>
</div>
</div>
</div>
<div class="col s3">
<div class="card-panel grey lighten-5 z-depth-1">
<div class="row valign-wrapper">
<a href="pesan-laundry.php?id=<?= $idAgen ?>&jenis=komplit" style="margin:0% 15%"><button class="btn blue darken-3">KOMPLIT</button></a>
<div>
<?php
$harga = mysqli_query($connect, "SELECT * FROM harga WHERE id_agen = '$idAgen' AND jenis = 'komplit'");
$harga = mysqli_fetch_assoc($harga);
echo "Rp. " . $harga['harga'] . " /Kg";
?>
</div>
</div>
</div>
</div>
</div>
<!-- end agen -->
<hr><br>
<!-- komentar -->
<h3 class="header light center">Ulasan Pengguna</h3>
<br>
<div class="row">
<?php
$temp = mysqli_query($connect, "SELECT * FROM transaksi WHERE id_agen = $idAgen");
while ( $transaksi = mysqli_fetch_assoc($temp) ) :
$idPelanggan = $transaksi["id_pelanggan"];
$temp2 = mysqli_query($connect, "SELECT * FROM pelanggan WHERE id_pelanggan = $idPelanggan");
$pelanggan = mysqli_fetch_assoc($temp2);
?>
<div class="container">
<div class="col s3 offset-s1">
<table border=0>
<tr>
<td width=100px rowspan=3><img src="img/pelanggan/<?= $pelanggan['foto'] ?>" class="circle responsive-img" width=100px alt="foto"></td>
<td><?= "<h6 class='light'>" . $pelanggan["nama"] . "</h6>";?></td>
</tr>
<tr>
<td><fieldset class="bintang"><span class="starImg star-<?= $transaksi['rating'] ?>"></span></fieldset></td>
</tr>
<tr>
<td><?= $transaksi["komentar"]; ?></td>
</tr>
</table>
</div>
</div>
<!-- <div class="col s5 offset-s1">
<div class="col s2">
<img src="img/pelanggan/<?= $pelanggan['foto'] ?>" class="circle responsive-img" width=100% alt="foto">
</div>
<?= "<h6 class='light'>" . $pelanggan["nama"] . "</h6>";?>
<div class="col s4">
<fieldset class="bintang"><span class="starImg star-<?= $transaksi['rating'] ?>"></span></fieldset>
<?= $transaksi["komentar"]; ?>
</div>
</div> -->
<?php endwhile; ?>
</div>
<?php include "footer.php"; ?>
</body>
</html>