403Webshell
Server IP : 127.0.0.1  /  Your IP : 192.168.99.1
Web Server : Apache/2.4.35 (Win64) OpenSSL/1.1.1b mod_fcgid/2.3.9
System : Windows NT WIN-JEJMB9EN0L0 10.0 build 14393 (Windows Server 2016) AMD64
User : Administrator ( 0)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  D:/bpkd_/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : D://bpkd_/lelang.php
<?php
/**
 * File: lelang.php
 * Halaman Lelang (Daftar + Detail)
 * URL: 
 *   - Daftar: /lelang
 *   - Detail: /lelang/nama-slug
 */

require_once 'includes/init.php';

// =====================================================
// DETEKSI URL: Apakah ada slug atau tidak?
// =====================================================
$slug = isset($_GET['slug']) ? sanitize($_GET['slug']) : '';

// =====================================================
// JIKA ADA SLUG → TAMPILKAN DETAIL LELANG
// =====================================================
if (!empty($slug)) {
    // Ambil data lelang berdasarkan slug
    $query = "SELECT * FROM lelang WHERE slug = ? AND status = 'publish'";
    $stmt = $conn->prepare($query);
    $stmt->bind_param("s", $slug);
    $stmt->execute();
    $result = $stmt->get_result();
    $lelang = $result->fetch_assoc();
    $stmt->close();
    
    // Jika lelang tidak ditemukan
    if (!$lelang) {
        http_response_code(404);
        $page_title = 'Lelang Tidak Ditemukan';
        include 'includes/header.php';
        ?>
        <div class="container py-5 text-center">
            <div class="row justify-content-center">
                <div class="col-md-6">
                    <div class="card shadow-sm border-0 rounded-4 p-5">
                        <i class="fas fa-gavel fa-5x text-muted mb-4"></i>
                        <h1 class="h3 fw-bold mb-3">Lelang Tidak Ditemukan</h1>
                        <p class="text-muted mb-4">Maaf, lelang yang Anda cari tidak tersedia.</p>
                        <a href="<?php echo BASE_URL; ?>/lelang" class="btn btn-primary">
                            <i class="fas fa-arrow-left me-2"></i> Kembali ke Lelang
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <?php
        include 'includes/footer.php';
        exit;
    }
    
    // =====================================================
    // TAMPILKAN DETAIL LELANG
    // =====================================================
    $page_title = $lelang['judul'] . ' - Lelang ' . ($settings['site_title'] ?? 'Website Instansi');
    $meta_description = substr(strip_tags($lelang['deskripsi']), 0, 160);
    
    include 'includes/header.php';
    ?>
    
    <style>
        .detail-container { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
        .detail-breadcrumb { background: #f8fafc; padding: 16px 0; border-bottom: 1px solid #eef2f6; margin-bottom: 30px; }
        .detail-grid { display: grid; grid-template-columns: 1fr 350px; gap: 40px; margin-bottom: 60px; }
        .detail-title { font-size: 2rem; font-weight: 800; color: #1e293b; margin-bottom: 16px; }
        .detail-image { margin-bottom: 30px; border-radius: 20px; overflow: hidden; }
        .detail-image img { width: 100%; height: auto; }
        .detail-description { font-size: 1rem; line-height: 1.8; color: #334155; }
        .detail-sidebar { position: sticky; top: 100px; }
        .detail-info-panel { background: white; border-radius: 20px; border: 1px solid #eef2f6; margin-bottom: 30px; }
        .detail-info-header { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); color: white; padding: 16px 20px; border-radius: 20px 20px 0 0; }
        .detail-info-item { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid #eef2f6; }
        .detail-info-item:last-child { border-bottom: none; }
        .detail-info-label { font-weight: 600; color: #475569; }
        .detail-info-price { font-size: 1.25rem; color: #3b82f6; font-weight: 700; }
        .detail-countdown { background: #fef3c7; padding: 12px; border-radius: 12px; text-align: center; margin-top: 10px; }
        .detail-back-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 40px; padding: 10px 20px; background: #f1f5f9; border-radius: 40px; color: #475569; text-decoration: none; }
        .detail-back-link:hover { background: #3b82f6; color: white; }
        .detail-share { background: #f8fafc; border-radius: 20px; padding: 20px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; margin: 30px 0; }
        
        @media (max-width: 992px) { .detail-grid { grid-template-columns: 1fr; } .detail-sidebar { position: static; order: -1; } }
        @media (max-width: 768px) { .detail-title { font-size: 1.5rem; } .detail-info-item { flex-direction: column; gap: 5px; } .detail-share { flex-direction: column; text-align: center; } }
    </style>

    <div class="container">
    <!-- Breadcrumb -->
    <div class="detail-breadcrumb py-5">
        <div class="detail-container">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb mb-0">
                    <li class="breadcrumb-item"><a href="<?php echo BASE_URL; ?>">Home</a></li>
                    <li class="breadcrumb-item"><a href="<?php echo BASE_URL; ?>/lelang">Lelang</a></li>
                    <li class="breadcrumb-item active"><?php echo htmlspecialchars(substr($lelang['judul'], 0, 50)); ?></li>
                </ol>
            </nav>
        </div>
    </div>
    
    <div class="detail-container">
        <div class="detail-grid">
            <!-- Main Content -->
            <div>
                <h1 class="detail-title"><?php echo htmlspecialchars($lelang['judul']); ?></h1>
                
                <?php if (!empty($lelang['gambar_utama'])): 
                    $gambar_path = '';
                    if (file_exists("uploads/lelang/" . $lelang['gambar_utama'])) {
                        $gambar_path = BASE_URL . "/uploads/lelang/" . $lelang['gambar_utama'];
                    } elseif (file_exists("assets/uploads/lelang/" . $lelang['gambar_utama'])) {
                        $gambar_path = BASE_URL . "/assets/uploads/lelang/" . $lelang['gambar_utama'];
                    }
                ?>
                <div class="detail-image">
                    <img src="<?php echo $gambar_path; ?>" class="img-fluid rounded-4 shadow-sm" alt="<?php echo htmlspecialchars($lelang['judul']); ?>">
                </div>
                <?php endif; ?>
                
                <div class="detail-description">
                    <?php echo nl2br(htmlspecialchars_decode($lelang['deskripsi'])); ?>
                </div>
                
                <!-- Share Section -->
                <div class="detail-share">
                    <span class="fw-semibold"><i class="fas fa-share-alt me-2"></i> Bagikan Informasi Lelang Ini</span>
                    <div class="d-flex gap-2">
                        <?php 
                        $current_url = urlencode(BASE_URL . $_SERVER['REQUEST_URI']);
                        $share_title = urlencode($lelang['judul']);
                        ?>
                        <a href="https://www.facebook.com/sharer/sharer.php?u=<?php echo $current_url; ?>" target="_blank" class="btn btn-sm rounded-circle" style="width: 36px; height: 36px; background: #1877f2; color: white; display: inline-flex; align-items: center; justify-content: center;">
                            <i class="fab fa-facebook-f"></i>
                        </a>
                        <a href="https://twitter.com/intent/tweet?url=<?php echo $current_url; ?>&text=<?php echo $share_title; ?>" target="_blank" class="btn btn-sm rounded-circle" style="width: 36px; height: 36px; background: #1da1f2; color: white; display: inline-flex; align-items: center; justify-content: center;">
                            <i class="fab fa-twitter"></i>
                        </a>
                        <a href="https://wa.me/?text=<?php echo $share_title . '%20' . $current_url; ?>" target="_blank" class="btn btn-sm rounded-circle" style="width: 36px; height: 36px; background: #25d366; color: white; display: inline-flex; align-items: center; justify-content: center;">
                            <i class="fab fa-whatsapp"></i>
                        </a>
                    </div>
                </div>
                
                <a href="<?php echo BASE_URL; ?>/lelang" class="detail-back-link">
                    <i class="fas fa-arrow-left"></i> Kembali ke Daftar Lelang
                </a>
            </div>
            
            <!-- Sidebar -->
            <div class="detail-sidebar">
                <div class="detail-info-panel">
                    <div class="detail-info-header">
                        <h5 class="mb-0"><i class="fas fa-info-circle me-2"></i> Informasi Lelang</h5>
                    </div>
                    <div class="p-3">
                        <div class="detail-info-item">
                            <span class="detail-info-label"><i class="fas fa-tag me-2"></i> Kategori</span>
                            <span><?php echo htmlspecialchars($lelang['kategori'] ?? 'Umum'); ?></span>
                        </div>
                        <div class="detail-info-item">
                            <span class="detail-info-label"><i class="fas fa-money-bill me-2"></i> Harga Awal</span>
                            <span class="detail-info-price">Rp <?php echo number_format($lelang['harga_awal'], 0, ',', '.'); ?></span>
                        </div>
                        <div class="detail-info-item">
                            <span class="detail-info-label"><i class="fas fa-calendar-alt me-2"></i> Mulai</span>
                            <span><?php echo date('d F Y H:i', strtotime($lelang['tanggal_mulai'])); ?></span>
                        </div>
                        <div class="detail-info-item">
                            <span class="detail-info-label"><i class="fas fa-calendar-check me-2"></i> Selesai</span>
                            <span><?php echo date('d F Y H:i', strtotime($lelang['tanggal_selesai'])); ?></span>
                        </div>
                        <?php if(!empty($lelang['lokasi'])): ?>
                        <div class="detail-info-item">
                            <span class="detail-info-label"><i class="fas fa-map-marker-alt me-2"></i> Lokasi</span>
                            <span><?php echo htmlspecialchars($lelang['lokasi']); ?></span>
                        </div>
                        <?php endif; ?>
                        <div class="detail-countdown" id="countdownContainer">
                            <div class="fw-bold" id="countdownTimer" data-enddate="<?php echo $lelang['tanggal_selesai']; ?>">Menghitung...</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    
    <script>
        function updateCountdown() {
            const timerElement = document.getElementById('countdownTimer');
            if (!timerElement) return;
            const endDate = new Date(timerElement.dataset.enddate).getTime();
            const distance = endDate - new Date().getTime();
            if (distance < 0) { 
                timerElement.innerHTML = 'Lelang Ditutup'; 
                timerElement.style.color = '#dc2626';
            } else {
                const days = Math.floor(distance / (1000*60*60*24));
                const hours = Math.floor((distance % (1000*60*60*24)) / (1000*60*60));
                const minutes = Math.floor((distance % (1000*60*60)) / (1000*60));
                let text = '';
                if (days > 0) text = days + ' hari ' + hours + ' jam';
                else if (hours > 0) text = hours + ' jam ' + minutes + ' menit';
                else text = minutes + ' menit';
                timerElement.innerHTML = text;
                timerElement.style.color = '#b45309';
            }
        }
        updateCountdown();
        setInterval(updateCountdown, 60000);
    </script>
    
    <?php include 'includes/footer.php';
    exit;
}

// =====================================================
// JIKA TIDAK ADA SLUG → TAMPILKAN DAFTAR LELANG
// =====================================================
$page_title = 'Lelang Publik - ' . ($settings['site_title'] ?? 'Website Instansi');
$meta_description = 'Informasi lelang aset daerah secara transparan dan akuntabel';

$page = isset($_GET['page']) ? (int)$_GET['page'] : 1;
$limit = 9;
$offset = ($page - 1) * $limit;
$kategori = isset($_GET['kategori']) ? sanitize($_GET['kategori']) : '';

$where = "WHERE status = 'publish' AND tanggal_mulai <= NOW()";
$params = [];
if (!empty($kategori)) { $where .= " AND kategori = ?"; $params[] = $kategori; }

$count_sql = "SELECT COUNT(*) as total FROM lelang $where";
$stmt = $conn->prepare($count_sql);
if (!empty($params)) $stmt->bind_param(str_repeat('s', count($params)), ...$params);
$stmt->execute();
$total_records = $stmt->get_result()->fetch_assoc()['total'];
$total_pages = ceil($total_records / $limit);
$stmt->close();

$sql = "SELECT id, judul, slug, deskripsi, harga_awal, gambar_utama, tanggal_mulai, tanggal_selesai, lokasi, kategori, no_lelang FROM lelang $where ORDER BY created_at DESC LIMIT ? OFFSET ?";
$params[] = $limit; $params[] = $offset;
$stmt = $conn->prepare($sql);
if (count($params) > 2) $stmt->bind_param(str_repeat('s', count($params)-2) . 'ii', ...$params);
else $stmt->bind_param('ii', $limit, $offset);
$stmt->execute();
$lelangs = $stmt->get_result();

$kategori_sql = "SELECT DISTINCT kategori FROM lelang WHERE status = 'publish' AND kategori IS NOT NULL ORDER BY kategori";
$kategori_result = $conn->query($kategori_sql);

include 'includes/header.php';
?>

<style>
/* ============================================
   LELANG PAGE STYLES
   ============================================ */
.lelang-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 20px;
}

.lelang-header {
    text-align: center;
    margin-bottom: 40px;
}

.lelang-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.lelang-header p {
    color: #64748b;
    font-size: 1rem;
}

.lelang-header-underline {
    width: 80px;
    height: 4px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    margin: 20px auto 0;
    border-radius: 4px;
}

.lelang-filter {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 40px;
    border: 1px solid #eef2f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.lelang-filter-title {
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lelang-filter-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.lelang-filter-select {
    padding: 10px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.lelang-filter-btn {
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.lelang-filter-btn:hover {
    background: #1d4ed8;
}

.lelang-filter-reset {
    padding: 10px 20px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
}

.lelang-filter-reset:hover {
    background: #e2e8f0;
}

.lelang-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.lelang-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.3s;
    border: 1px solid #eef2f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    height: 100%;
}

.lelang-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.12);
}

.lelang-card-link {
    text-decoration: none;
    display: block;
    height: 100%;
}

.lelang-card-header {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.lelang-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.lelang-card:hover .lelang-card-image {
    transform: scale(1.05);
}

.lelang-card-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 1;
}

.lelang-card-category {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    z-index: 1;
}

.lelang-card-body {
    padding: 20px;
}

.lelang-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lelang-card-desc {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lelang-card-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #eef2f6;
    border-bottom: 1px solid #eef2f6;
    margin-bottom: 15px;
}

.lelang-price-label {
    font-size: 0.75rem;
    color: #64748b;
}

.lelang-price-value {
    font-size: 1rem;
    font-weight: 700;
    color: #3b82f6;
}

.lelang-date {
    font-size: 0.7rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.lelang-countdown {
    background: #fef3c7;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #b45309;
    text-align: center;
}

.lelang-countdown.closed {
    background: #fee2e2;
    color: #dc2626;
}

.lelang-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.lelang-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    background: white;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.lelang-pagination a:hover,
.lelang-pagination .active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.lelang-empty {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 20px;
    border: 1px solid #eef2f6;
}

.lelang-empty i {
    font-size: 4rem;
    color: #cbd5e1;
    margin-bottom: 20px;
}

.lelang-empty h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .lelang-grid {
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .lelang-container {
        padding: 30px 16px;
    }
    
    .lelang-header h1 {
        font-size: 1.5rem;
    }
    
    .lelang-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .lelang-filter {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .lelang-filter-form {
        width: 100%;
        flex-direction: column;
    }
    
    .lelang-filter-select,
    .lelang-filter-btn,
    .lelang-filter-reset {
        width: 100%;
    }
    
    .lelang-card-header {
        height: 180px;
    }
}

@media (max-width: 576px) {
    .lelang-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .lelang-card-info {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}
</style>

<div class="container py-5">
    
    <!-- Header -->
    <div class="lelang-header">
        <h1><i class="fas fa-gavel me-2"></i> Lelang Publik</h1>
        <p>Informasi lelang aset daerah secara transparan dan akuntabel</p>
        <div class="lelang-header-underline"></div>
    </div>

    <!-- Filter Kategori -->
    <div class="lelang-filter">
        <div class="lelang-filter-title">
            <i class="fas fa-filter"></i> Filter Kategori
        </div>
        <form method="GET" class="lelang-filter-form">
            <select name="kategori" class="lelang-filter-select">
                <option value="">Semua Kategori</option>
                <?php 
                if ($kategori_result && $kategori_result->num_rows > 0) {
                    $kategori_result->data_seek(0);
                    while($kat = $kategori_result->fetch_assoc()): 
                ?>
                    <option value="<?php echo htmlspecialchars($kat['kategori']); ?>" <?php echo $kategori == $kat['kategori'] ? 'selected' : ''; ?>>
                        <?php echo htmlspecialchars($kat['kategori']); ?>
                    </option>
                <?php 
                    endwhile;
                } else { ?>
                    <option value="Kendaraan">Kendaraan</option>
                    <option value="Peralatan">Peralatan</option>
                    <option value="Properti">Properti</option>
                    <option value="Tanah">Tanah</option>
                    <option value="Lainnya">Lainnya</option>
                <?php } ?>
            </select>
            <button type="submit" class="lelang-filter-btn">
                <i class="fas fa-search me-1"></i> Tampilkan
            </button>
            <?php if (!empty($kategori)): ?>
                <a href="<?php echo BASE_URL; ?>/lelang" class="lelang-filter-reset">
                    <i class="fas fa-times me-1"></i> Reset
                </a>
            <?php endif; ?>
        </form>
    </div>

    <!-- Cards Grid -->
    <?php if ($lelangs && $lelangs->num_rows > 0): ?>
        <div class="lelang-grid">
            <?php while($row = $lelangs->fetch_assoc()): 
                // Default image
                $gambar_path = BASE_URL . '/assets/images/lelangdef.jpeg';
                
                // Cek file di uploads
                if (!empty($row['gambar_utama'])) {
                    $file_path_uploads = __DIR__ . '/../uploads/lelang/' . $row['gambar_utama'];
                    $file_path_assets = __DIR__ . '/../assets/uploads/lelang/' . $row['gambar_utama'];
                    
                    if (file_exists($file_path_uploads)) {
                        $gambar_path = BASE_URL . '/uploads/lelang/' . $row['gambar_utama'];
                    } elseif (file_exists($file_path_assets)) {
                        $gambar_path = BASE_URL . '/assets/uploads/lelang/' . $row['gambar_utama'];
                    }
                }
            ?>
                <div class="lelang-card">
                    <a href="<?php echo BASE_URL; ?>/lelang/<?php echo $row['slug']; ?>" class="lelang-card-link">
                        <div class="lelang-card-header">
                            <img src="<?php echo $gambar_path; ?>" class="lelang-card-image" alt="<?php echo htmlspecialchars($row['judul']); ?>">
                            <span class="lelang-card-badge"><?php echo htmlspecialchars($row['kategori'] ?? 'Umum'); ?></span>
                            <?php if(!empty($row['lokasi'])): ?>
                                <span class="lelang-card-category"><i class="fas fa-map-marker-alt"></i> <?php echo htmlspecialchars($row['lokasi']); ?></span>
                            <?php endif; ?>
                        </div>
                        <div class="lelang-card-body">
                            <h3 class="lelang-card-title"><?php echo htmlspecialchars($row['judul']); ?></h3>
                            <p class="lelang-card-desc"><?php echo strip_tags(substr($row['deskripsi'], 0, 100)); ?>...</p>
                            <div class="lelang-card-info">
                                <span class="lelang-price-label">Harga Awal</span>
                                <span class="lelang-price-value">Rp <?php echo number_format($row['harga_awal'], 0, ',', '.'); ?></span>
                            </div>
                            <div class="lelang-date">
                                <i class="fas fa-calendar-alt"></i> <?php echo date('d/m/Y', strtotime($row['tanggal_mulai'])); ?>
                            </div>
                            <div class="lelang-countdown" data-enddate="<?php echo $row['tanggal_selesai']; ?>">
                                <i class="fas fa-hourglass-half"></i> Menghitung...
                            </div>
                        </div>
                    </a>
                </div>
            <?php endwhile; ?>
        </div>

        <!-- Pagination -->
        <?php if ($total_pages > 1): ?>
        <div class="lelang-pagination">
            <a href="?page=<?php echo $page-1; ?>&kategori=<?php echo urlencode($kategori); ?>" class="<?php echo $page <= 1 ? 'disabled' : ''; ?>">
                <i class="fas fa-chevron-left"></i>
            </a>
            <?php for($i = 1; $i <= $total_pages; $i++): ?>
                <a href="?page=<?php echo $i; ?>&kategori=<?php echo urlencode($kategori); ?>" class="<?php echo $i == $page ? 'active' : ''; ?>">
                    <?php echo $i; ?>
                </a>
            <?php endfor; ?>
            <a href="?page=<?php echo $page+1; ?>&kategori=<?php echo urlencode($kategori); ?>" class="<?php echo $page >= $total_pages ? 'disabled' : ''; ?>">
                <i class="fas fa-chevron-right"></i>
            </a>
        </div>
        <?php endif; ?>
        
    <?php else: ?>
        <div class="lelang-empty">
            <i class="fas fa-gavel"></i>
            <h3>Belum Ada Lelang</h3>
            <p>Saat ini belum ada lelang yang tersedia. Silakan cek kembali nanti.</p>
        </div>
    <?php endif; ?>

</div>

<script>
function updateCountdowns() {
    document.querySelectorAll('.lelang-countdown').forEach(function(element) {
        const endDate = new Date(element.dataset.enddate).getTime();
        const now = new Date().getTime();
        const distance = endDate - now;
        
        if (distance < 0) {
            element.innerHTML = '<i class="fas fa-clock"></i> Ditutup';
            element.classList.add('closed');
        } else {
            const days = Math.floor(distance / (1000 * 60 * 60 * 24));
            const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
            
            if (days > 0) {
                element.innerHTML = '<i class="fas fa-hourglass-half"></i> ' + days + ' hari';
            } else if (hours > 0) {
                element.innerHTML = '<i class="fas fa-hourglass-half"></i> ' + hours + ' jam';
            } else {
                element.innerHTML = '<i class="fas fa-hourglass-half"></i> ' + minutes + ' menit';
            }
            element.classList.remove('closed');
        }
    });
}

updateCountdowns();
setInterval(updateCountdowns, 60000);
</script>

<?php include 'includes/footer.php'; ?>

Youez - 2016 - github.com/yon3zu
LinuXploit