JezK
Edit File: lodgeView.php
<?php include('header.php'); $lodgedetails=$db->getlodgebyid($_GET['lodge_id']); $executive_name=$db->getexecutivebylodge($_GET['lodge_id']); if($executive_name) { $executive_name=$executive_name; } else { $executive_name="Not Assigned"; } $rooms_list=$db->getResidenceRoomsList($_GET['lodge_id'],2); $table_rows = ''; if(!empty($rooms_list)) { $i=1; foreach($rooms_list as $list) { $table_rows.='<tr> <td>'.$i.'</td> <td>'.$list['room_number'].'</td> <td>'.$list['category_type'].'</td> <td>'.'₹ '.$list['room_price'].'</td> <td>'.$list['number_of_persons'].'</td> <td><a href="editroom_lodge.php?lodge_id='.$list['residence_id'].'&room_id='.$list['room_id'].'" data-toggle="tooltip" title="Edit Lodge"><i class="fa fa-2x fa-edit"></i></a> <a href="javascript:void(0)" onclick="deleteRoom('.$list['room_id'].')" data-toggle="tooltip" title="Delete Room"><i class="fa fa-2x fa-trash" aria-hidden="true"></i></a> </td>'; $i++; } } ?> <script> function selectimage() { document.getElementById("lodges").classList.add('active'); } </script> <!-- Page Content --> <div id="page-content-wrapper"> <div class="container-fluid"> <div class="row border-code"> <div class="col-lg-12 background-bar"> <a href="#menu-toggle" class="btn btn-default" id="menu-toggle"><i class="fa fa-bars" aria-hidden="true"></i></a> </div> </div><br> <div class="row"> <div class="col-lg-12"> <div class="text-center"> <input type="button" class="btn submit-login" style="float:left;margin-left: 11px;" onclick="location.href='lodgemanagement.php'" value="Back"> </div><br> <a href="addroom_lodge.php?lodge_id=<?php echo $_GET['lodge_id'];?>" class="addBtn">Add Room</a <div class="row" style="padding-top:23px;"> <div class=" col-12 col-sm-6 col-md-6 col-lg-6 pt-4 "> <h4 style="font-weight:5px;"><b>Lodge Details:</b></h4> <div class="row"> <div class="col-12 col-sm-6 col-md-6 col-lg-6"> <span style="font-weight:15px;"><b>Lodge Name</b> </span> </div> <div class="col-12 col-sm-6 col-md-6 col-lg-5"> :<span style="margin-left:10px;"><?php echo $lodgedetails['residence_name'];?></span> </div> </div> <br> <div class="row"> <div class="col-12 col-sm-6 col-md-6 col-lg-6"> <span><b>Mobile</b> </span> </div> <div class="col-12 col-sm-6 col-md-6 col-lg-5"> :<span style="margin-left:10px;"><?php echo $lodgedetails['contact_number'];?></span> </div> <br> </div> <br> <div class="row"> <div class="col-12 col-sm-6 col-md-6 col-lg-6"> <span><b>Executive Name</b></span> </div> <div class="col-12 col-sm-6 col-md-6 col-lg-5"> :<span style="margin-left:10px;"><?php echo $executive_name;?></span> </div> <br> </div> <br> </div> <div class="col-sm-10 col-sm-offset-1"> <h2 class="heading">Lodge Rooms</h2> <div class="table-responsive"> <table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%"> <thead> <tr> <th>S No</th> <th>Room Number</th> <th>Room Type</th> <th>Room Rate</th> <th>Capacity</th> <th>Action</th> </tr> </thead> <tbody> <?php echo $table_rows;?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- /#page-content-wrapper --> </div> <!-- /#wrapper --> <?php include('footer.html'); ?> <script src="https://cdn.datatables.net/1.10.12/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script> <script> $(document).ready(function() { $('#example').DataTable(); }); function deleteRoom(room_id) { //alert(appointment_id); var status=confirm('Are you sure you want to delete this room?'); if(status) { $.ajax({ url:"ajax_calls.php", type: 'POST', data:"type=3&room_id="+room_id, success:function(result) { if(result) { alert('Room Deleted Successfully'); location.reload(); } }, error:function(e) { } }) } } </script>