<!-- END WIDGET MAIN CHART WITH TABBED CONTENT -->
<div class="EditCustomer">
	<div class="col-lg-12">
		<ul class="breadcrumb">
			<li><i class="fa fa-home"></i><a href="/home">Home</a></li>
			<!--<li><a href="#">Forms</a></li>-->
			<li class="active">Customer</li>
		</ul>
	</div>
	<script src="assets/js/king-table.js"></script>
	<div class="row">
		<div class="col-md-12">
			<!-- WIDGET TABLE -->
			<div class="widget widget-table">
				<div class="widget-header">
					<h3><i class="fa fa-user"></i> CUSTOMER</h3>
					<div class="btn-group widget-header-toolbar">
						<?php if($data['create']=='1'): ?>
						<a class="btn-borderless btn-focus clickme" href="CreateNewCCustomer" title="Focus" ><i class="fa fa-plus"></i></a>
						<?php endif; ?>
						<!--<a href="#" title="Expand/Collapse" class="btn-borderless btn-toggle-expand"><i class="fa fa-chevron-up"></i></a>
						<a href="#" title="Remove" class="btn-borderless btn-remove"><i class="fa fa-times"></i></a>-->
					</div>
					<!--<div class="btn-group widget-header-toolbar">
						<div class="control-inline toolbar-item-group">
						<span class="control-title">New Visits:</span>
						<div class="label label-success"><i class="fa fa-caret-up"></i> 3.5%</div>
						</div>
					</div>-->
				</div>
				<div class="widget-content">
					<table id="visit-stat-table" class="table table-sorting table-striped table-hover datatable">
						<thead>
							<tr>
								<th>Serial No</th>
								<th>Company</th>
								<th>Customer name</th>
								
								<th>Contact No. 1</th>
								<th>Contact No. 2</th>
								<th>Email ID</th>
								<?php if($data['edit']=='1' || $data['delete']=='1'){echo'<th>Action</th>';}?>
							</tr>
						</thead>
						<tbody>
							<?php $i=1;?>
							<?php $__currentLoopData = $data['customer']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $customer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
							<tr>
								<td><?php echo $i++;?></td>
								<td><?php echo e($customer->cmp_name); ?></td>
								<td><?php echo e($customer->cst_name); ?></td>
								<td><?php echo e($customer->cst_contact1); ?></td>
								<td><?php echo e($customer->cst_contact2); ?></td>
								<td><?php echo e($customer->cst_email); ?></td>
								<?php if($data['edit']=='1' || $data['delete']=='1'){ echo'<td>';}?>	
								
								<?php if($data['edit']=='1'){echo'<button class="btn btn-default btn-xs print" onclick="editcustomer('.$customer->cst_id.')">Edit</button>'; } if($data['delete']=='1'){echo' <button class="btn btn-default btn-xs print" onclick="DeleteCustomer('.$customer->cst_id.')">Delete</button>';} echo '</td>';?>
							</tr>
							<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>	
						</tbody>
					</table>
				</div>
				
				</div>
			<!-- END WIDGET TABLE -->
			<!-- WIDGET DONUT AND PIE CHART -->
			
			<!-- END WIDGET INLINE SPARKLINE -->
		</div>
	</div>
</div>
<script>
	$('.clickme').click(function(e)
	{
		e.preventDefault();
		$('#sideMenu').load($(this).attr('href'));
	});
	
	function editcustomer(custId)
	{
		$.ajax({
			url: 'EditCustomer',
			type: 'get',
			data:'&cst_id='+custId,
			success: function(data)
			{
				$('.EditCustomer').html(data);
			}
		});
		}
		
		function DeleteCustomer(custId)
		{
			if (confirm("Are you sure delete!") == true)
			{
				$.ajax({
					url: 'DeleteCustomer',
					type: 'get',
					data:'&cst_id='+custId,
					success: function(data)
					{
						$('#sideMenu').load('customerView');
					}
				});
			}
		}
	</script>	