<script src="assets/js/king-table.js"></script>
<!-- MAIN CONTENT WRAPPER -->

<div class="content">
	
	<div class="main-content">
		<!-- DATA EXPORT -->
		<div class="widget widget-table">
			<div class="widget-header">
				<h3><i class="fa fa-table"></i> <?php echo e(__('user.viewemployee')); ?></h3>
				<div class="btn-group widget-header-toolbar">
					<?php if($data['create']=='1'): ?>
					<a class="btn createMod" href="user" title="Focus" class="btn-borderless btn-focus"><i class="fa fa-plus"></i></a>
					<?php endif; ?>
				</div>
			</div>
			<div class="widget-content">
				<table id="datatable-data-export" class="table table-sorting table-striped table-hover table-bordered datatable">
					<thead>
						<tr>
							<th><?php echo e(__('usertype.user_type')); ?></th>
							<?php
							/*
							<th>Branch</th>
							*/
							?>
							<th><?php echo e(__('user.emp_name')); ?></th>
							<th><?php echo e(__('user.login_id')); ?></th>
							<th><?php echo e(__('user.contactno')); ?></th>
							<th><?php echo e(__('user.emailid')); ?></th>
							<th><?php echo e(__('user.description')); ?></th>
							<th><?php echo e(__('user.status')); ?></th>			
							<?php if($data['edit']=='1' || $data['delete']=='1'){echo'<th>Action</th>';}?>							
						</tr>
					</thead>
					<tbody>
						<?php $__currentLoopData = $data['User']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $User): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
						<tr>
							<td><?php echo e($User->ut_type); ?></td>
							<?php
							/*
							<td>{{$User->br_name}}</td>
							*/
							?>
							<td><?php echo e($User->usr_name); ?></td>
							<td><?php echo e($User->usr_loginid); ?></td>
							<td><?php echo e($User->usr_contact1); ?></td>
							<td><?php echo e($User->usr_emailid); ?></td>
							<td><?php echo e($User->usr_note); ?></td>
							<td><?php echo e($User->usr_status); ?></td>
							<?php if($data['edit']=='1' || $data['delete']=='1'){ echo'<td>';}?>
							<?php if($data['edit']=='1'){echo'<button class="btn btn-default btn-xs edit" href="edituser/'.$User->usr_id.'"><i class="fa fa-pencil-square-o" aria-hidden="true"></i>' . __("mylanguage.edit") . '</button>'; } if($data['delete']=='1'){echo' <button class="btn btn-default btn-xs print" onclick="Delete('.$User->usr_id.')"><i class="fa fa-trash" aria-hidden="true"></i>' . __("mylanguage.delete") . '</button>';} echo '</td>'; ?>
							
						</tr>
						<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
					</tbody>
				</table>
			</div>
		</div>
		<!-- END DATA EXPORT -->
		
	</div>
</div>
<!-- /main -->
<script>
	$('.createMod').click(function(e)
	{   
		e.preventDefault();
		$('#sideMenu').load($(this).attr('href'));
	});
	
	$('.edit').click(function(e)
	{
		e.preventDefault();
		$('#sideMenu').load($(this).attr('href')); 
	});
	
	function Delete(id)
	{		
		if(confirm("Are you sure want to delete this record?") == true)
		{
			k = 0;
			if(k == 0)
			{
				k++;
				$.ajax({
					type: "GET",
					url:"/deluser",
					dataType: "json",
					data: {
						'_token': $('input[name=_token]').val(),
						'id': id
					},
					success: function (sdata) {
						if(sdata.status == 1)
						{
							//printSuccessMsg(sdata.message);
							$('#sideMenu').load('viewuser');
						}
						else
						{
							//printErrorMsg(sdata.message)
						}
					}
				});
			}
		}
	}
</script>