-
Notifications
You must be signed in to change notification settings - Fork 1
/
rent.php
96 lines (90 loc) · 4.62 KB
/
rent.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
<?php
session_start();
include 'koneksi.php';
// var_dump($_SESSION['user'])
$semuakategori = [];
$ambilkategori = $koneksi->query("SELECT * FROM kategori");
while($pecahkategori = $ambilkategori->fetch_assoc()){
$semuakategori[]= $pecahkategori;
}
?>
<!-- jika tidak ada session pelanggan -->
<?php if(!isset($_SESSION['user'])OR empty($_SESSION['user'])){
echo "<script>alert('Silahkan login terlebih dahulu!!')</script>";
echo "<script>location='login.php'</script>";
exit();
} ?>
<?php include 'navbar.php'?>
<!-- ========================= SECTION ========================= -->
<!-- judul -->
<div class="jumbotron color-grey-light mt-70">
<div class="d-flex align-items-center h-100">
<div class="container text-center py-5">
<h3 class="mb-0">Rent</h3>
</div>
</div>
</div>
<!-- end judul -->
<div class="container mt-3">
<div class="row">
<!-- sidebar -->
<div class="col-lg-3">
<h3 class="my-4">Kategori</h3>
<div class="list-group">
<?php foreach($semuakategori as $key => $tiapkategori):
?>
<a href="kategorisewa.php?id=<?=$tiapkategori['id_kategori']?>" class="list-group-item"><?= $tiapkategori['nama_kategori']?></a>
<?php endforeach?>
</div>
</div>
<!-- Main content -->
<div class="col-lg-9">
<h3 class="my-4">Produk Terbaru</h3>
<div class="row">
<?php $ambil = $koneksi->query("SELECT * FROM produk_sewa LEFT JOIN user ON produk_sewa.id_user=user.id_user");?>
<?php while($perproduk = $ambil->fetch_assoc()){?>
<div class="col-lg-3 col-xs-12 col-sm-6 mb-3">
<div class="card">
<img class="card-img-top" src="foto_produksewa/<?= $perproduk['foto_produksewa']?>" alt="Card image cap">
<div class="card-body">
<h5 class="card-title"><a href="detailsewa.php?&id=<?=$perproduk['id_produksewa']?>"><?= $perproduk['nama_produksewa']?></a></h5>
<h6 class="card-title"><i class=" fa fa-user"> <?=$perproduk['nama_user']?></i></h6>
<h6 class="card-title">Rp. <?= number_format($perproduk['harga_produksewa'])?>/ Hari</h6>
<?php if($perproduk['status_produksewa']=='Tersedia'):?>
<a href="sewa.php?id=<?=$perproduk['id_produksewa']?>"><button class="btn btn-primary">Sewa</button></a>
<a href="detailsewa.php?&id=<?=$perproduk['id_produksewa']?>" class="btn btn-secondary">Detail</a>
<?php else :?>
<p class="text-danger">Produk tidak tersedia</p>
<?php endif?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- ========================= SECTION END// ========================= -->
<!-- footer -->
<?php include 'footer.php'; ?>
<!-- end footer -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script>
$(document).ready(function() {
// executes when HTML-Document is loaded and DOM is ready
console.log("document is ready");
$(".card").hover(
function() {
$(this).addClass('shadow-lg').css('cursor', 'pointer');
},
function() {
$(this).removeClass('shadow-lg');
}
);
// document ready
});
</script>
</body>
</html>