<!DOCTYPE html>
<html>
<head>
	<!-- <title>SMS to All View</title> -->
	<?php include('include/head.php'); ?>
	<link rel="stylesheet" type="text/css" href="src/plugins/datatables/media/css/jquery.dataTables.css">
	<link rel="stylesheet" type="text/css" href="src/plugins/datatables/media/css/dataTables.bootstrap4.css">
	<link rel="stylesheet" type="text/css" href="src/plugins/datatables/media/css/responsive.dataTables.css">
</head>
<body>
	<?php include('include/header.php'); ?>
	<?php include('include/sidebar.php'); ?>
	<div class="main-container">
		<div class="pd-ltr-20 customscroll customscroll-10-p height-100-p xs-pd-20-10">
			<div class="min-height-200px">
				<div class="page-header">
					<div class="row">
						<div class="col-md-9 col-sm-9">
							<div class="title">
								<h4>SMS to Batch View</h4>
							</div>
							<nav aria-label="breadcrumb" role="navigation">
								<ol class="breadcrumb">
									<li class="breadcrumb-item"><a href="dashboard.php">Dashboard</a></li>
									<li class="breadcrumb-item"><a href="sms_to_batch.php">Send SMS to Batch Students</a></li>
									<li class="breadcrumb-item active" aria-current="page">SMS to Batch View</li>
								</ol>
							</nav>
						</div>
						
						<div class="col-md-3 col-sm-3" align="right">
							<a href="sms_to_batch.php"><button type="button" class="btn btn-primary" align="right">Send SMS to<br> Batch Students</button></a>
						</div>
						
					</div>
				</div>
				
				<form method="post">
				<!-- Export Datatable start -->
				<div class="pd-20 bg-white border-radius-4 box-shadow mb-30">
					<!-- <div class="clearfix mb-20">
						<div class="pull-left">
							<h5 class="text-blue">SMS to All View</h5>
						</div>
					</div> -->
					
					<div class="row">
						<!-- <table class="stripe hover multiple-select-row data-table-export nowrap"> -->
						<table class="stripe hover data-table-export nowrap">
							<!-- <table class="data-table stripe hover nowrap"> -->
							<thead>
								<tr>
									<th class="table-plus datatable-nosort">Sr No</th>
									<th>Message Code</th>
									<th>Message</th>
                                    <th>Course Name</th>
                                    <th>Batch Time From</th>
                                    <th>Batch Time To</th>
                                    <th>Message Status</th>
                                    <th>Date</th>                                    
								</tr>
							</thead>
							<tbody>
								<?php 
								// $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
                                    $count=0; 
                                    $query="select c.*, cd.*,m.* from tbl_message m,tbl_course_details cd, tbl_course c where c.fld_course_id=m.fld_course_id and cd.fld_course_id=c.fld_course_id and m.fld_course_id=cd.fld_course_id and cd.fld_batch_time_from=m.fld_batch_time_from and cd.	fld_batch_time_to=m.fld_batch_time_to and m.fld_message_status='Batch Time' and m.fld_message_delete='0' order by m.fld_message_id desc";
                                    $row=mysqli_query($connect,$query) or die(mysqli_error($connect));
                                    
                                    while($fetch=mysqli_fetch_array($row)) {

                                    extract($fetch);
                                ?>
								<tr>
									<td class="table-plus"><?php echo ++$count; ?></td>
								<td><?php echo $fetch['fld_message_code'];?></td>   
								<td><?php echo $fetch['fld_message'];?></td>   
								<td><?php echo $fetch['fld_course_name'];?></td>
								<td><?php echo $fetch['fld_batch_time_from']; ?></td>
								<td><?php echo $fetch['fld_batch_time_to']; ?></td>
								<td><?php echo $fetch['fld_message_status']; ?></td>
								<td><?php echo $fetch['fld_message_created_date'];?></td>
							
								</tr>
								<?php } ?>
							</tbody>
						</table>
					</div>
				</div>
				<!-- Export Datatable End -->
			</form>
			</div>
			<?php include('include/footer.php'); ?>
		</div>
	</div>
	<?php include('include/script.php'); ?>
	<script src="src/plugins/datatables/media/js/jquery.dataTables.min.js"></script>
	<script src="src/plugins/datatables/media/js/dataTables.bootstrap4.js"></script>
	<script src="src/plugins/datatables/media/js/dataTables.responsive.js"></script>
	<script src="src/plugins/datatables/media/js/responsive.bootstrap4.js"></script>
	<!-- buttons for Export datatable -->
	<script src="src/plugins/datatables/media/js/button/dataTables.buttons.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.bootstrap4.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.print.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.html5.js"></script>
	<script src="src/plugins/datatables/media/js/button/buttons.flash.js"></script>
	<script src="src/plugins/datatables/media/js/button/pdfmake.min.js"></script>
	<script src="src/plugins/datatables/media/js/button/vfs_fonts.js"></script>
	<script>
		$('document').ready(function(){
			$('.data-table').DataTable({
				scrollCollapse: true,
				autoWidth: false,
				responsive: true,
				columnDefs: [{
					targets: "datatable-nosort",
					orderable: false,
				}],
				"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
				"language": {
					"info": "_START_-_END_ of _TOTAL_ entries",
					searchPlaceholder: "Search"
				},
			});
			$('.data-table-export').DataTable({
				scrollCollapse: true,
				autoWidth: false,
				responsive: true,
				columnDefs: [{
					targets: "datatable-nosort",
					orderable: false,
				}],
				"lengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
				"language": {
					"info": "_START_-_END_ of _TOTAL_ entries",
					searchPlaceholder: "Search"
				},
				dom: 'Bfrtip',
				buttons: [
				'copy', 'csv', 'pdf', 'print'
				]
			});
			var table = $('.select-row').DataTable();
			$('.select-row tbody').on('click', 'tr', function () {
				if ($(this).hasClass('selected')) {
					$(this).removeClass('selected');
				}
				else {
					table.$('tr.selected').removeClass('selected');
					$(this).addClass('selected');
				}
			});
			var multipletable = $('.multiple-select-row').DataTable();
			$('.multiple-select-row tbody').on('click', 'tr', function () {
				$(this).toggleClass('selected');
			});
		});
	</script>
	
</body>
</html>
