<?php
/***
Auth: Vastvikta Nishad
Date: 23 Jan 2024
Description: Display and Delete Province
*/
?><div class="style2-table">
    <div class="style-title">
        <h3>Province</h3>
        <div class="row">
            <?php $new_province = base64_encode('new_province');?>
            <div class="col-sm-2" style="text-align: end;">
                <a href="admin_index.php?token=<?php echo $new_province;?>" class="button-orange1">New Province</a>
            </div>
        </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">Province Name</td>
                                <td align="left" width="5%">Action</td>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            //function defined in web_admin_function.php 
                             $result = view_county();

                             if (mysqli_num_rows($result) == 0) {
                                echo '<tr><td colspan="3" align="center" class="contentred">No records found!</td></tr>';
                             } else {
                                $count = 1;
                                while ($row_doc = mysqli_fetch_array($result)) {
                                    $new_province = base64_encode('new_province');
                                    $id = base64_encode($row_doc['id']);
                                    ?>
                                    <tr>
                                        <td align="left"><?php echo $count; ?></td>
                                        <td align="left"><?php echo $row_doc['city']; ?></td>
                                        <td>
                                        <a href='javascript:void(0)' onclick="window.location.href='admin_index.php?token=<?php echo $new_province ;?>&id=<?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['id'] ?>" class="province_delete">
                                                <img src="<?php echo $SiteURL?>public/images/delete-icon.png" border="0"  alt="delete">
                                            </a>
                                        </td>
                                    </tr>
                                    <?php
                                    $count++;
                                }
                             }
                             ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </form>
</div>
