<?php
session_start();
include 'include/config.php';

if(!isset($_SESSION['id'])){
 echo "<script> window.location.href = 'index.php' </script>";
  }
?>

<?php  include 'include/head.php'; ?>
                    
                      <!-- Start Content-->
                      <div class="container-fluid">
                        
                        <!-- start page title -->
                        <div class="row">
                            <div class="col-12">
                                <div class="page-title-box">
                                    <div class="page-title-right">
                                        <ol class="breadcrumb m-0">
                                            <li class="breadcrumb-item"><a href="dashboard.php">Home</a></li>
                                            <li class="breadcrumb-item active">Privacy Policy</li>
                                        </ol>
                                    </div>
                                    <h4 class="page-title">Privacy Policy</h4>
                                </div>
                            </div>
                        </div>
                         <!--end page title -->
                         

                          <!--<div>-->
                          <!--    <a href="add_privacy_policy.php"  class="btn btn-success"> Add Privacy Policy</a>-->
                          <!--</div>-->

                        <div class="row">
                            <div class="col-12">
                                <div class="card">
                                    <div class="card-body">
                                        
                                        <?php
                                        if(isset($_GET['user'])){
                                            $id = $_GET['user'];
                                        
                                            $sql = "DELETE FROM `privacy_policy` WHERE id='$id'";
                                           // print_r($sql);
                                            if(mysqli_query($conn,$sql)){
                                             echo "<script>alert('Your Data deleted successfully');</script>";
                                            echo "<script>window.location.href='privacy_policy.php';</script>";
                                            }
                                           
                                        }
                                        ?>
                                        <div class="table-responsive">
                                            <div class="tab-pane show active" id="basic-datatable-preview">
                                                <table id="datatable" class="table table-striped dt-responsive nowrap w-100">
                                                    <thead>
                                                        <tr>
                                                            <th>Sr. No.</th>
                                                            <th>First Content Heading</th>
                                                             <th>First Content Description</th>
                                                             <th>Secont Content Heading </th>
                                                             <th>Second Content Description </th>
                                                             <th>Third Content Heading </th>
                                                             <th>Third Content Description </th>
                                                             <th>Fourth Content Heading </th>
                                                             <th>Fourth Content Description </th>
                                                             <th>Fifth Content Heading </th>
                                                             <th>Fofth Content Description </th>
                                                            <th>Action</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                    <?php
                                                    $sql = "SELECT * FROM `privacy_policy` ORDER BY id DESC";
                                                    $res = mysqli_query($conn, $sql);
                                                    $i = 1;
                                                    while ($row = mysqli_fetch_assoc($res)) {
                                                      
                                                    ?>
                                                        <tr>
                                                            <td><?= $i; ?></td>
                                                            <td><?= $row['first_content_heading'] ?></td>
                                                            <td><?= $row['first_content_description'] ?></td>
                                                            <td><?= $row['second_content_heading'] ?></td>
                                                            <td><?= $row['second_content_description'] ?></td>
                                                            <td><?= $row['third_content_heading'] ?></td>
                                                            <td><?= $row['third_content_description'] ?></td>
                                                            <td><?= $row['fourth_content_heading'] ?></td>
                                                            <td><?= $row['fourth_content_description'] ?></td>
                                                            <td><?= $row['fifth_content_heading'] ?></td>
                                                            <td><?= $row['fifth_content_description'] ?></td>
                                                            <td>
                                                                <a href="privacy_edit.php?id=<?=$row['id']?>" class="action-icon"> <i class="mdi mdi-square-edit-outline"></i></a>
                                                                <a href="privacy_policy.php?user=<?= $row['id'] ?>" onclick="return confirm('Are You Sure Want To Delete This?');" class="action-icon"> <i class="mdi mdi-delete"></i></a>

                                                            </td>
                                                         </tr>
                                                        <?php
                                                       $i++;  } 
                                                        ?>
                                                    </tbody>
                                                </table>                                           
                                            </div> <!-- end preview-->
                                        
                                            
                                        </div> <!-- end tab-content-->

                                    </div> <!-- end card body-->
                                </div> <!-- end card -->
                            </div><!-- end col-->
                        </div> <!-- end row-->

                    
                    </div> <!-- container -->


<?php  
include 'include/footer.php'; 
?>