<?php
$page = 'Room';
?>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Admin</title>

    <!-- Bootstrap Core CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/sb-admin.css" rel="stylesheet">

    <!-- Morris Charts CSS -->
    <link href="<?php echo base_url(); ?>assets/Backend/css/plugins/morris.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/Backend/font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
</head>

<body>

    <div id="wrapper">

        <!-- Navigation -->
        <?php
		include "include/header.php";
		?>
        <?php
		//foreach($about as $row)
		//$p_id = $row->p_id;
		?>

        <div id="page-wrapper">

            <div class="container-fluid">

                <!-- Page Heading -->
                <div class="row">
                    <div class="col-lg-12">
                        <h1 class="page-header">
                            Room Tariff 
                            <a href="<?php echo base_url(); ?>app/new_room" class="pull-right btn btn-primary">New Room</a>
                        </h1>
                       
                    </div>
                </div>
                
<div class="row">
                    <div class="col-lg-12">
                        <h2>Room Tariff Information</h2> 
                        <div class="pull-left">
                        <?php 
						foreach($discount as $d_row) 
						$d_id = $d_row->d_id; 
						?>
                        <form action="<?php echo base_url(); ?>update/up_discount/<?php echo $d_id; ?>" method="post">
                        <select class="form-control" name="d_status">
                        <option value="<?php if($d_row->d_status == 'No Discount') {echo '"selected=selected"';}?>No Discount">No Discount</option>
                        <option value="<?php if($d_row->d_status == 'Discount') {echo '"selected=selected"';}?>Discount">Discount</option>
                        </select>                        
                        </div>
                        <div class="pull-left">
                        <input type="text" name="d_discount" value="<?php echo $d_row->d_discount; ?>" class="form-control" placeholder="Enter In %">
                        </div>
                        <div class="pull-left">
                        <input type="submit" value="save" class="form-control btn btn-primary">
                        </form>
                        </div>               
                        <br><br>        
                        <div class="table-responsive">
                            <table class="table table-bordered table-hover">
                                <thead>
                                    <tr>
                                    	<th width="6%">Sr. No.</th>	
                                        <th>Room Category</th>
                                        <th>Room Type</th>
                                        <th>Rate</th>
                                        <?php if($d_row->d_status=='Discount'){?>
                                        <th>Discount</th>
                                        <th>Discount Rate</th>
                                        <?php }?>                                    
                                        <th>Total Rooms</th>
                                        <th width="8%">Status</th>
                                        <th width="12%">Action</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php
								$cnt=0;
								foreach($room as $row):
								$r_id = $row->r_id;
								$cnt+=1;
								?>
                                    <tr>
                                    	<td><?php echo $cnt; ?></td>
                                        <td><?php echo $row->r_name; ?></td>
                                        <td><?php echo $row->r_type; ?></td>
                                        <td><?php echo 'Rs '.$row->r_rate.' /-'; ?></td>
                                        <?php if($d_row->d_status=='Discount'){?>
                                        <td><?php echo $d_row->d_discount.'%'; ?></td>
                                        <td>
										<?php 
										$d_rate = $row->r_rate - ($row->r_rate * ($d_row->d_discount/100));
										echo 'Rs.'.$d_rate.' /-'; 
										?>
                                        </td>
                                        <?php }?>
                                   
                                        <td><?php echo $row->r_total; ?></td>
                                        <td><?php echo $row->r_status; ?></td>
                                        <td><a href="<?php echo base_url(); ?>app/update_room/<?php echo $r_id; ?>" class="btn btn-primary btn-sm">Edit</a>
                                        &nbsp;
                                        <a href="<?php echo base_url(); ?>delete/del_room/<?php echo $r_id; ?>" class="btn btn-danger btn-sm">Delete</a></td>
                                    </tr>
                                <?php
								endforeach;
								?>    
                                    
                                </tbody>
                            </table>
                        </div>
                    </div>
                    </div>
				
            </div>
            <!-- /.container-fluid -->

        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery Version 1.11.0 -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/jquery-1.11.0.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/bootstrap.min.js"></script>

    <!-- Morris Charts JavaScript -->
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/raphael.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/morris.min.js"></script>
    <script src="<?php echo base_url(); ?>assets/Backend/js/plugins/morris/morris-data.js"></script>

</body>

</html>
