<?php 



include('libraryPHP/site_config.php');

 include('libraryPHP/session_check_url.php');





?>


<!DOCTYPE html>

<html lang="en">



<head>

    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">

     <title><?php echo $appName?> | <?php echo $pageTitle?></title>

        

         <!-- App favicon -->



    <?php echo $appFaviconHtml?> 


    <!-- theme css start -->

    <?php include("commoncss.php"); ?>

    <!-- theme css end -->
<style type="text/css">
  
      
  

table td {
  word-wrap: break-word;
word-break: break-all;  
white-space:normal !important;

}
    
 </style>


</head>



<body>



    <!-- Main Wrapper -->

    <div class="main-wrapper">



        <!-- Header start  -->

        <?php include("header.php"); ?>

        <!-- /Header end -->



        <!-- Sidebar -->

        <?php include("sidebar.php"); ?>

        <!-- /Sidebar -->



        <!-- Page Wrapper -->

        <div class="page-wrapper">



            <div class="content container-fluid">



                <!-- Page Header -->

                <div class="page-header">

                    <div class="row">

                        <div class="col">

                            <h3 class="page-title">Manage Contact Us</h3>

                            <ul class="breadcrumb">

                                <li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>

                                <li class="breadcrumb-item active">Manage Contact Us</li>

                            </ul>

                        </div>

                    </div>

                </div>

                <!-- /Page Header -->



                <!-- start write start -->

                <div class="col-12">



                    <div class="card">



                        <div class="card-body">



                            <div class="table-responsive">



                                <table id="table_contactlist" class="table table-hover table-bordered" style="border-collapse: collapse; border-spacing: 0; width: 100%;">



                                    <thead>

                                        <tr>

                                            <th>S.No.</th>

                                              <th>Action</th>
                                             

                                            <th>User Name</th>

                                            <th>Email</th>

                                            <th>Message</th>

                                            
                                            <th>Replied Date & Time</th>
                                            <th>Status</th>
                                            <th>Create Date & Time</th>

                                          

                                        </tr>

                                    </thead>

                                 





                                </table>



                            </div>



                        </div>



                    </div>



                </div> <!-- end col -->



                <!-- start write end -->

            </div>

        </div>

        <!-- /Page Wrapper -->

        <!-- footer start -->

        <?php include("footer.php"); ?>

        <!-- footer end -->



    </div>

    <!-- /Main Wrapper -->



    <!-- sctipt start  -->

   

  
        <?php include('commonjs.php')?>

    <?php include('extrajs.php')?>

<script>             
  $(document).ready(function() {
    $('#table_contactlist').DataTable();
        getContactTable('first', 'all');
    } );
      function getContactTable(event, type){
      var link = URLAPI+'common_controller.php';
      var data = {
            action:'get_contact',
            type:type,
        }
        var messsage = msgLoading.blankMessage[language];
        console.log('link',link);
        apiRequest.get(link, data, messsage).then(function(obj){
            // console.log('obj',obj);

            if(obj.success === true) {

                var contact_arr =  obj.data.contact_arr;

                if(contact_arr.length>=0){

                    $('#table_contactlist').DataTable({

                        data: contact_arr,

                       "destroy": true,
                       
                            "paging": true,
                            "lengthChange": true,
                            "searching": true,
                            "ordering": true,
                            "info": true,
                            "autoWidth": false,
                            "responsive": true,
                            "aaSorting": [
                                [0, "asc"]
                            ],

                        "bJQueryUI":  "true" ,

                        "sPaginationType": "full_numbers",

                        "iDisplayLength": 5,

                        "aLengthMenu": [

                            [5, 10, 25, 50, 100, 200, -1],

                            [5, 10, 25, 50, 100, 200, "All"]

                        ],

                        "columns": [

                            //  { "data": "select" },

                               { "data": "srno" },

                              { "data": "action"},
                               



                         

                            { "data": "name" },                         

                           

                            { "data": "email" },
                             { "data": "message" },
                               { "data": "reply_datetime" },

                            { "data": "status" },
                            { "data": "createtime" },
                          


                          
                        ],

                        "rowId": "contact_id",

                    });

                }else{

                    dataTable.fnClearTable();

                    dataTable.fnDraw();

                    dataTable.fnDestroy();

                }

            } else {


                //------------ Operation Message --------------------

                var title = msgTitleOperation.userDeleted[language];

                var messsage = obj.msg[language];

                msgSuccessErrorHtml.error(title, messsage, '#msgSuccessErrorHtml');

                //------------ Operation Message End--------------------

                return false;

            }

        },function(err){

            console.log('err',err);

            //------------ Operation Message --------------------

            var title = msgTitleOperation.errorOnServer[language];

            var messsage = msgOperations.errorOnServer[language];

            msgSuccessErrorHtml.warning(title, messsage, '#msgSuccessErrorHtml');

            //------------ Operation Message End--------------------

            return false;
        });
    }
</script>



</body>



</html>