<?php 

    for($s=1; $s<=$i[1]; $s++): 
    $seat = $s;
    if($seat >= 0 && $seat <=9) $seat = "0" . $seat;
    $seat_no = "T{$i[0]}S{$seat}";

    $chair_status_class = "empty";

    $user_id_data = "";

    $user_name = "";

    $onhover = "";
    $hiddenP = "";
    $color = "";
    $category = "";
    if(isset($booked[$seat_no])) {

        $chair_status_class = "booked";
        $user_id_data = $booked[$seat_no]['id'];
        $user_name = $booked[$seat_no]['name'];
        $color = $booked[$seat_no]['color'];
        $category = strtolower($booked[$seat_no]['category']);
        
        $user_id_data = "data-category='" . $category . "' data-name='" . $user_name . "' data-type=" . $booked[$seat_no]['type'] . " data-id=" . $booked[$seat_no]['id'] . " ";

        $hiddenP = '<p class="hiddenP" style="z-index:99999;">' . $user_name . '</p>';

    }

?>
    
    <div class="booking-plan seat <?=(str_contains($category, "vip")?($category):(''))?> <?=convertNumber($s)?>" data-seatno=<?=$seat_no?> <?=$user_id_data?> data-row="<?=$i[0]?>" data-seat="<?=$seat?>" <?=$onhover?>  >

        <a href="#"> <div style="<?=($color!="")?(" background-color: {$color}; "):('')?>" class="chair <?=convertNumber($s)?> <?=$chair_status_class?>">
            <span>S<?=$seat?><?=$hiddenP?></span>
        </div></a>
    </div>
<?php endfor; ?>