Upload New File

parent c6d151d9
<?php
session_start();
include('../config.php');
include("template/header.php");
include("../common/function.php");
include("functions.php");
// include("../common/dbconfig.php");
open_page("Tiket");
if(! isset($_SESSION['is_login']))
{
header('location:../index.php');
}
if (!isset($_SESSION["username"])){
// echo "<script>alert('Login terlebih dahulu');window.location='../index.php';</script>";
// exit;
echo "Anda harus login dulu <br><a href='../index.php'>Klik disini</a>";
exit;
}
$role = $_SESSION["role"];
if($role != "user"){
echo "<script>alert('Anda bukan user');window.location='../index.php';</script>";
exit;
}
$id_akun = $_SESSION["id_akun"];
$nama = $_SESSION["nama"];
$username = $_SESSION["username"];
// pagination
$jumlahdataperhalaman= 3;
$jumlahdata = count(query("SELECT * FROM t_tiketsdia"));
$jumlahhalaman = floor($jumlahdata / $jumlahdataperhalaman);
$halamanaktif = ( isset($_GET["halaman"])) ? $_GET["halaman"] : 1;
// halaman = 2 , awal data = 3
$awaldata = ($jumlahdataperhalaman * $halamanaktif) - $jumlahdataperhalaman;
$data = query("SELECT t_tiketsdia.id, t_tiketsdia.kode_tiket, destinasi.nama_destinasi, pt_trans.nama_transp, t_tiketsdia.harga, pt_kategori.nama_kategori
FROM pt_kategori INNER JOIN (pt_trans INNER JOIN (destinasi INNER JOIN t_tiketsdia ON destinasi.id_destinasi = t_tiketsdia.t_destinasi) ON pt_trans.id_transp = t_tiketsdia.t_kendaraan) ON pt_kategori.id_kategori = pt_trans.kategori_id
ORDER BY id ASC LIMIT $awaldata,$jumlahdataperhalaman");
// function cari
if (isset($_POST["cari"])){
$data = caritiket($_POST["keyword"]);
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Tiket</h2>
</div>
<!-- Navigasi -->
<div class="">
<!-- backward -->
<?php if($halamanaktif>1): ?>
<a href="?halaman=<?=$halamanaktif - 1?>">
<button class="btn btn-sm btn-outline-primary">
<svg class="bi bi-skip-backward" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M.5 3.5A.5.5 0 0 1 1 4v3.248l6.267-3.636c.52-.302 1.233.043 1.233.696v2.94l6.267-3.636c.52-.302 1.233.043 1.233.696v7.384c0 .653-.713.998-1.233.696L8.5 8.752v2.94c0 .653-.713.998-1.233.696L1 8.752V12a.5.5 0 0 1-1 0V4a.5.5 0 0 1 .5-.5zm7 1.133L1.696 8 7.5 11.367V4.633zm7.5 0L9.196 8 15 11.367V4.633z"/>
</svg>
</button>
</a>
<?php endif; ?>
<!-- endbackward -->
<?php for($i = 1; $i <= $jumlahhalaman;$i++) :?>
<?php if($i == $halamanaktif): ?>
<a href="?halaman=<?=$i?>">
<button class="btn btn-sm btn-outline-danger">
<b><i><u><?= $i ?></u></i></b>
</button>
</a>
<?php else: ?>
<a href="?halaman=<?=$i?>">
<button class="btn btn-sm btn-outline-primary">
<?= $i ?>
</button>
</a>
<?php endif; ?>
<?php endfor; ?>
<!-- forward -->
<?php if($halamanaktif < $jumlahhalaman): ?>
<a href="?halaman=<?=$halamanaktif + 1?>">
<button class="btn btn-sm btn-outline-primary">
<svg class="bi bi-skip-forward" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M15.5 3.5a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-1 0V8.752l-6.267 3.636c-.52.302-1.233-.043-1.233-.696v-2.94l-6.267 3.636C.713 12.69 0 12.345 0 11.692V4.308c0-.653.713-.998 1.233-.696L7.5 7.248v-2.94c0-.653.713-.998 1.233-.696L15 7.248V4a.5.5 0 0 1 .5-.5zM1 4.633v6.734L6.804 8 1 4.633zm7.5 0v6.734L14.304 8 8.5 4.633z"/>
</svg>
</button>
</a>
<?php endif; ?>
<!-- endforward -->
</div>
<!-- End Navigasi -->
</div>
</section>
<!-- End Breadcrumbs -->
<!-- Start form search -->
<div class="container mt-2 ml-2">
<form method="post" action="" class="ml-3 mt-2 mb-2">
<label for="">Cari Tiket </label><br>
<input type="text" class="btn-outline-light" name="keyword" placeholder="Masukkan keyword" id="keyword" autocomplete="off" autofocus>
<button type="submit" name="cari" class="btn btn-sm btn-outline-primary">
<svg class="bi bi-search" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1 0-1.415z"/>
<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
</svg>
</button>
</form>
</div>
<!-- End form search -->
<!-- Start content -->
<div class="container mt-1">
<div class="card-deck mb-3 text-center">
<?php
foreach($data as $tiket) { ?>
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal"><?=$tiket['nama_destinasi']?> (<?=$tiket['nama_kategori']?>)</h4>
</div>
<div class="card-body">
<h5 class="card-title pricing-card-title">Rp. <?=$tiket['harga']?></h5>
</div><div class="card-body">
<h5 class="card-title pricing-card-title"><?=$tiket['nama_transp']?></h5>
<a href="pesan_tiket.php?id=<?=$tiket['id']?>" class="btn btn-md btn-outline-success">
Beli
</a>
<a href="detailtiket.php?id=<?=$tiket['id']?>">
<button class="btn btn-md btn-outline-primary">Detail</button>
</a>
</div>
</div>
<?php } ?>
</div>
</div>
<!-- End content -->
<div class="">
</div>
<?php
include("template/footer.php")
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment