<?php
/***
Auth: Vastvikta Nishad
Date: 11 Feb 2024
Description:Display Escalations
*/
$msg = '';
$result = view_escalations();
?>
<div class="style2-table">
    <div class="style-title">
        <h3>View Escalations </h3>
    </div>
    <div id="success"><?php echo $msg; ?></div>
    <form name="frmService" action="" method="post">
        <div class="table" id="SRallview">
            <div class="">
                <div class="div2">
                    <table class="tableview tableview-2" id="admin_table">
                        <thead>
                        <tr class="background">
                            <td align="left">Escalation Level</td>
                            <td align="left">Escalated To</td>
                            <td align="left">Escalation Media</td>
                            <td align="left">Escalation User List</td>
                            <td align="left">Action</td>
                        </tr>
                    </thead>
                    <tbody>
                    <?php
                            if (mysqli_num_rows($result) == 0) {
                                echo '<tr><td colspan="5" align="center" class="contentred">No records found!</td></tr>';
                            } else {
                                $no = 1;
                                while ($res = mysqli_fetch_assoc($result)) {
                                    $new_escalation = base64_encode('new_escalation');
                                    $id = base64_encode($res['level']);
                                   
                                    ?>
                                    <tr>
                                        <td align="left"><?php echo $res['level'] ?></td>
                                        <td align="left"><?php echo escalation_to($res['escalation_to']) ?></td>
                                        <td align="left"><?php echo escalation_media($res['escalation_media']) ?></td>
                                        <td align="left"><?php echo displayagentname($res['escalation_list']) ?></td>
                                        <td>
                                        <a href='javascript:void(0)' onclick="window.location.href='admin_index.php?token=<?php echo $new_escalation ;?>&id=<?php echo $id ?>';">
                                                <img src="<?php echo$SiteURL?>public/images/edit-icon.png" border="0" alt="Edit" />
                                            </a> 
                                        </td>
                                    </tr>
                                    <?php
                                }
                            }
                            ?>                   
                    </tbody>
                </table>
            </div>
        </div>
    </form>
</div>