HEX
Server: Apache/2.4.41 (Amazon) OpenSSL/1.0.2k-fips PHP/5.6.40
System: Linux ip-172-31-40-18 4.14.146-93.123.amzn1.x86_64 #1 SMP Tue Sep 24 00:45:23 UTC 2019 x86_64
User: apache (48)
PHP: 5.6.40
Disabled: NONE
Upload Files
File: /var/www/html/taxicamera/application/views/admin/report/service_notification/list.php
<div class="main-content">
	<div class="content-wrapper">
		<div class="container-fluid">
		<?php if ($this->session->flashdata('success_msg')) : ?>
								<div class="alert alert-success">
									<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
									<?php echo $this->session->flashdata('success_msg') ?>
								</div>
							<?php endif ?>
							<?php if ($this->session->flashdata('error_msg')) : ?>
								<div class="alert alert-danger">
									<a href="#" class="close" data-dismiss="alert" aria-label="close" title="close">×</a>
									<?php echo $this->session->flashdata('error_msg') ?>
								</div>
							<?php endif ?>
		
		<!-- Basic form layout section start -->
			<section id="basic-form-layouts">
				
				<div class="row">
					<div class="col-md-12">
						<div class="card">
							<div class="card-header">
								<div class="page-title-wrap">
									<h4 class="card-title">Service Notification Report</h4>

								</div>


								<!--<p class="mb-0">This is the most basic and cost estimation form is the default position.</p>-->
							</div>
							<div class="card-body">
								<div class="px-3">
									<form class="form custom_form_style">
										<div class="form-body">
											<div class="user_permission_top">
												

											</div>


										</div>

										<!--<div class="form-actions">
								<button type="button" class="btn btn-danger mr-1">
									<i class="fa fa-times" aria-hidden="true"></i> Cancel
								</button>
								<button type="button" class="btn btn-success">
									<i class="fa fa-floppy-o" aria-hidden="true"></i> Save
								</button>
							</div>-->
									</form>
									<div class="row ">

										<div class="table-responsive custom_table_area export_table_area">
											<table id="income_table" class="table table-striped table-bordered export_btn_dt c_table_style">
												<thead>
													<tr>
														<th>SL No.</th>
														<th>Car No.</th>
														<th>Date</th>
														<th>Driver DC</th>
														<th>Driver Name</th>
														<th>Driver Phone Number</th>
														<th>KM Reading ( Last entered)</th>
														<th>Action</th>
													</tr>
												</thead>
												<tbody id="tbody_income_table">
													
												</tbody>
											</table>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</section>
			<!-- // Basic form layout section end -->
		</div>
	</div>
</div>
<script>
	$(document).ready(function() {
		service_notification_list();
	
	});

	function service_notification_list() {
		
		var resulthtml = '';
		$.ajax({
				url: "<?php echo base_url('admin/report/get_service_notification_report'); ?>",
				type: "POST",
				data: {},
				dataType: "json",
				encode: true,
				//async: false
			})
			.done(function(data) {

				if (data.status) {

					if (data.service_notification_list) {
						var i = 0;
						$.each(data.service_notification_list, function(key, value) {
							i++;
							
							resulthtml += '<tr>';
							resulthtml += '<td>' + i + '</td>';
							resulthtml += '<td>' + value.registration_no + '</td>';
							resulthtml += '<td>' + value.payin_date + '</td>';
							resulthtml += '<td>' + value.dc_no + '</td>';
							resulthtml += '<td>' + value.first_name.trim() +' '+value.middle_name.trim()+' '+value.last_name.trim()+'</td>';
							resulthtml += '<td>' + value.mobile + '</td>';
							resulthtml += '<td>' + parseFloat(value.last_service_notification_km).toFixed(0)+ '</td>';
							if(value.service_status == 0){
								resulthtml += '<td><a title="Pending" class="btn_action btn btn-warning settle_btn" href="<?= base_url();?>admin/report/service_booked/'+value.service_notification_id+'">Pending</a></td>';
							}
							else{
								resulthtml += '<td><a title="Service Booked" class="btn_action btn btn-success not_settle_btn" href="<?= base_url();?>admin/report/service_pending/'+value.service_notification_id+'">Service Booked</a></td>';
							}
							resulthtml += '</tr>';

						})
						//console.log(resulthtml);
						var now = new Date();
						var date = now.getFullYear() + ":" + now.getMonth() + ":" + now.getDate();
						$("#income_table").dataTable().fnDestroy();
						$("#tbody_income_table").html(resulthtml);
						$('#income_table').DataTable({
							pageLength: 100,
							dom: 'Bfrtip',
							buttons: [{
									extend: 'excel',
									text: 'Download Excel',
									className: 'btn btn-outline-primary mr-1',
									filename: 'service_notification_report' + date
								}
								//'copy', 'csv', 'excel', 'pdf', 'print'
							]
						});

						$('a.settle_btn').confirm({
		title: "Confirm Service Booked",    
		content: "Do you want to change the status to service booked?",  
		buttons: {
			Booked: {
				btnClass: 'btn-green',
				action: function(){
					location.href = this.$target.attr('href');
				}
			},         
			Close: {
				btnClass: 'btn-default',
				action: function(){
					
				}
			},  
		}
	});

	$('a.not_settle_btn').confirm({
		title: "Confirm Service Not Booked",    
		content: "Do you want to change the status to service not booked yet?",  
		buttons: {
			"Not Booked": {
				btnClass: 'btn-red',
				action: function(){
					location.href = this.$target.attr('href');
				}
			},         
			Close: {
				btnClass: 'btn-default',
				action: function(){
					
				}
			},  
		}
	});


					}

				} else {
					$.alert({
						type: 'red',
						title: 'Alert!',
						content: 'Oops!Something went wrong...',
					});
				}
			})
			.fail(function(result) {
				$.alert({
					type: 'red',
					title: 'Alert!',
					content: 'Oops!Something went wrong...',
				});
			})
	}

	
</script>