<?php include("cn.php");?>
<?php $title = "Hotels";?>
<!DOCTYPE html>
<html lang="en">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<?php include("head-tag.php");

$sql = mysqli_query($connect, "select count(*) as total from hotels");
$data = mysqli_fetch_assoc($sql);

?>
<body>

<div class="inner-wrapper">
<?php include("pre-loader.php");?>

<?php include("header.php");?>
<div class="page-wrapper">
    <div class="container-fluid">
        <div class="row">
        
      <div class="col-xl-12 col-lg-12 col-md-12">
                <div class="card shadow-sm ctm-border-radius">
                    <div class="card-body">
                        <h4 class="card-title mb-0 mt-2"><?php echo $data["total"]?> Hotels
                        </h4>
                    </div>
                </div>
                
                <div class="ctm-border-radius shadow-sm card">
                    <div class="card-body">
                        <div class="table-responsive table-togglable table-hover"style="white-space: normal;">
                       <table id="hotel" class="table table-striped table-bordered ">
						<thead>
						<tr>
                          <th class="text-center">Sr# </th>
						  <th class="text-center">Name</th>
						  <th class="text-center">User Name</th>
						  <th class="text-center">Password</th>
						  <th class="text-center">Email</th>
						  <th class="text-center">Address</th>
						  <th class="text-center">Phone</th>
						  <th class="text-center">Role</th>
						  <th class="text-center">Representative</th>
						</tr>
						</thead>
						<tbody>
										<?php
                                        $sql;
                                        $query="SELECT * from users WHERE role = 'hotel'
										";
										$sql = mysqli_query($connect, $query);
                                        $i = 1;   
										while($data = mysqli_fetch_assoc($sql)){
                                            ?>
											<tr>
										<td class="text-center">
											    <?php echo  $i?>
											</td>
                                        
                                        <!-- Dsipaly Hotel Data Table/ List -->

                                            <td class="text-center"> <?php echo $data["FullName"]?> </td>
                                            <td class="text-center"> <?php echo $data["Username"]?> </td>
                                            <td class="text-center"><?php echo $data["Password"]?></td>
                                            <td class="text-center"> <?php echo $data["Email"]?></td>
                                            <td class="text-center"> <?php echo $data["Address"]?></td>
                                            <td class="text-center"> <?php echo $data["Phone"]?></td>
                                            <td class="text-center"> <?php echo $data["Role"]?></td>
                                            <td class="text-center"> <?php echo $data["Representative"]?></td>
                                         <!--   <td class="text-center">
                                                <a href="javascript:void(0)" 
                                                class="btn btn-theme button-1 ctm-border-radius text-white btn-sm float-center" 
                                                data-toggle="modal" data-target="#edit-driver<?php echo $data['driver_id']?>">
                                                    <i class="fa fa-pencil" aria-hidden="true">
                                                        
                                                    </i></a>
                                            </td> -->
                                        </tr>
                                        <?php $i++; }?>
									</tbody>
						</table>
                        
                    </div>
                </div>
            </div>
            
       </div>
    </div>
</div>
</div>
</div>
<div class="sidebar-overlay" id="sidebar_overlay"></div>

<?php include("scripts.php");?>
<script>
$('#hotel').DataTable( {
            dom: 'B<clear>frtip',
            "bFilter": true,
            "bSort": true,
            "bPaginate": true,
            "order": [ 0, 'desc' ],
            "lengthMenu": [ [10, 50, 100, -1], [10, 50, 100, "All"] ],
            columnDefs: [
                {
                    targets: 1,
                    className: 'noVis'
                }
            ],
            buttons: [
                {
                    extend: 'copy',
                    title: 'Hotels Report',
                    exportOptions: {
                        columns: ':visible'
                    }
                    
                },
                {
                    extend: 'excel',
                    title: 'Hotels Report',
                    exportOptions: {
                        columns: ':visible'
                    }
                },
                {
                extend: 'print',
                orientation: 'landscape',
                title: '<h3 style="text-align:center">Hotels Report </h3>',
                pageSize: 'LEGAL',
                exportOptions: {
                    columns: ':visible'
                }
                
            },
                {
                    extend: 'pdf',
                    title: 'Hotels Report',
                    orientation: 'portrait',
                    pageSize: 'A4',
                    exportOptions: {
                        columns: ':visible'
                    }
                    
                },
                
                {
                extend: 'colvis',
                collectionLayout: 'fixed three-column',
                columns: ':not(.noVis)',
                postfixButtons: [ 'colvisRestore' ]
            }
            ],
            language: {
            buttons: {
                colvis: 'Select Fields'
                }
            },
           
        } );
        

$(document).ready(function() {        

    
});
        </script>
</body>
</html>