<?php
/***
Auth: Vastvikta Nishad
Date: 26 Jan 2024
Description: Display and Delete Mail Format
*/
?>
<div class="style2-table">
    <div class="style-title">
        <h3>User Registration Mail Format</h3>
        <div class="row">
            <?php $new_mail = base64_encode('new_mail');?>
            <div class="col-sm-2" style="text-align: end;">
                <a href="admin_index.php?token=<?php echo $new_mail;?>" class="button-orange1">New Mail</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">S.No.</td>
                                    <td align="left">Template Name</td>
                                    <!-- <td align="left">Type</td> -->
                                    <!-- <td align="left">Subject</td> -->
                                    <td align="left">Content</td>
                                    <!-- <td align="left">Expiry(In hours)</td> -->
                                    <td align="left">Action</td>
                                </tr>
                            </thead>
                            <?php
                                $result = view_mail_data();
                                $count = 0;

                                while ($row_doc = mysqli_fetch_array($result)) {
                                    $count = $count + 1;
                                    $bgcolor = ($count % 2 == 0) ? 'white' : 'efefef';
                                    $new_mail = base64_encode('new_mail');
                                    $id = base64_encode($row_doc['MailTypeID']);
                            ?>
                            <tr>
                                <td align="left"><?php echo $count ?></td>
                                <td align="left"><?php echo $row_doc['MailTemplateName'] ?></td>
                                <!-- <td align="left"><?php echo $row_doc['MailTypeID'] ?></td> -->
                                <!-- <td align="left"><?php echo $row_doc['MailSubject'] ?></td> -->
                                <td align="left" style="pointer-events: none;opacity: 0.7;"><?php echo $row_doc['MailGreeting'] . $row_doc['MailBody']?></td>
                                <!-- <td align="left"><?php echo $row_doc['MailExpiry'] ?></td> -->
                                <td>
                                <a href='javascript:void(0)' onclick="window.location.href='admin_index.php?token=<?php echo $new_mail; ?>&MailTypeID=<?php echo $id ?>';">
                                    <img src="<?php echo $SiteURL ?>public/images/edit-icon.png" border="0" alt="Edit" />
                                </a>
                                <a href='javascript:void(0);' data-id="<?php echo $row_doc['MailTypeID'] ?>" class="mail_delete">
                                    <img src="<?php echo$SiteURL?>public/images/delete-icon.png" border="0"  alt="delete">
                                </a>     
                                </td>
                            </tr>
                            <?php
                            } 
                            ?>
                        </table>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
