<?php
/***
Auth: Vastvikta Nishad
Date: 22 JAN 2025
Description: Display and Delete SMS Format 
*/
?>
<div class="style2-table">
    <div class="style-title">
        <h3>BULK EMAIL, WHATSAPP, SMS</h3>
        <div class="row">
            <?php $new_bulk_template = base64_encode('new_bulk_template');?>
            <div class="col-sm-4" style="text-align: end;">
                <a href="admin_index.php?token=<?php echo $new_bulk_template;?>" class="button-orange1">Add new template</a>
            </div>
        </div>       
    <div id="success"></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" width="5%">S.No.</td>
                                <td align="left">Template Name</td>
                                <td align="left">Template Content</td>
                                <td align="left">Type</td>
                                <!-- <td align="left">Slug</td> -->
                                <td align="left" width="5%">Action</td>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                                $result = view_bulk_data();

                                if (mysqli_num_rows($result) == 0) {
                                    echo '<tr><td colspan="6" align="center" class="contentred">No records found!</td></tr>';
                                } else {
                                    $count = 1;
                                    while ($row_doc = mysqli_fetch_array($result)) {
                                        $new_sms = base64_encode('new_sms');
                                        $id = base64_encode($row_doc['id']);
                                       
                                ?>
                                    <tr>
                                        <td align="left"><?=$count?></td>
                                        <td align="left"><?=$row_doc['name']?></td>
                                        <td align="left"><?=$row_doc['template_content']?></td>
      
                                        <td align="left"><?=$row_doc['type']?></td>
                                        <!-- <td align="left"><?=$row_doc['slug']?></td> -->
                                        <td>
                                            <a href='javascript:void(0)' onclick="window.location.href='admin_index.php?token=<?=$new_bulk_template ;?>&id=<?= $id?>';">
                                                <img src="<?=$SiteURL?>public/images/edit-icon.png" border="0" alt="Edit" />
                                            </a>
                                            <a href='javascript:void(0)' data-id="<?= $row_doc['id'] ?>" class="bulk_delete">
                                                <img src="<?=$SiteURL?>public/images/delete-icon.png" border="0"  alt="delete">
                                            </a>
                                        </td>
                                    </tr>
                                    <?php 
                                    $count++;
                                }
                            }
                            ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </form>
</div>
