<?php
include '../config/koneksi.php';
$query = "SELECT jenis FROM tb_transaksi WHERE jenis IN ('1', '2') AND status = 0";
$result = mysqli_query($conn, $query);

$notification = '';

if (mysqli_num_rows($result) > 0) {
    $count = mysqli_num_rows($result);
    $notification .= '<div class="alert alert-custom shadow-lg" role="alert" style="background: #ffffff; border-left: 5px solid #f39c12; color: #333; padding: 15px; border-radius: 8px; margin-bottom: 10px; position: relative; min-width: 300px;">';
    $notification .= '  <div class="d-flex align-items-center">';
    $notification .= '    <div style="font-size: 24px; color: #f39c12; margin-right: 15px;"><i class="fas fa-bell"></i></div>';
    $notification .= '    <div>';
    $notification .= '      <strong style="display: block; font-size: 14px; color: #f39c12;">PESAN SISTEM</strong>';
    $notification .= '      <span style="font-size: 13px;">Ada <b>' . $count . '</b> transaksi menunggu proses.</span>';
    $notification .= '      <div class="mt-2">';
    
    // Link yang lebih rapi
    $notification .= '        <a href="/office/request_depo.php" class="badge badge-warning p-2 mr-1" style="text-decoration:none">Cek Deposit</a>';
    $notification .= '        <a href="/office/request_withdraw.php" class="badge badge-danger p-2" style="text-decoration:none">Cek WD</a>';
    
    $notification .= '      </div>';
    $notification .= '    </div>';
    $notification .= '  </div>';
    $notification .= '  <button type="button" class="close" data-dismiss="alert" aria-label="Close" style="position: absolute; top: 5px; right: 10px;">';
    $notification .= '    <span aria-hidden="true">&times;</span>';
    $notification .= '  </button>';
    $notification .= '  <audio autoplay style="display:none;"><source src="/ayah.mp3" type="audio/mpeg"></audio>';
    $notification .= '</div>';
}

echo json_encode(['notification' => $notification]);
?>