<div class="editItem">
<div class="col-lg-12 ">
	
	
		<ul class="breadcrumb">
			<li><i class="fa fa-home"></i><a href="/home" class="home">Home</a></li>
			<!--<li><a href="#">Forms</a></li>-->
			<li class="active">View Item</li>
		</ul>
	</div><br>
		<!-- MAIN CONTENT WRAPPER -->
		<script src="assets/js/king-table.js"></script>
			<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> View Item records</h3>
									<div class="btn-group widget-header-toolbar">
								@if($data['create']=='1')
										<a class="btn-borderless btn-focus clickme" href="item" title="Focus" ><i class="fa fa-plus"></i></a>
								@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>
						<div class="widget-content">
							<table id="datatable-data-export" class="table table-sorting table-striped table-hover table-bordered datatable">
								<thead>
									<tr>
										<th>Category</th>
										<th>Item Type</th>
										<th>Item code</th>
										<th>Item name</th>
										<th>Purchase cost</th>
										<th>Sales cost</th>
										<th>UOM</th>
										<th>Note</th>	
										<th>Status</th>			
										<?php if($data['edit']=='1' || $data['delete']=='1'){echo'<th>Action</th>';}?>					
									</tr>
								</thead>
								<tbody>
								@foreach($data['loadView'] as $view)
								<tr>
								<td>{{$view->cat_name  }}</td>
								<td>{{$view->itm_type  }}</td>
								<td>{{$view->itm_code  }}</td>
								<td>{{$view->itm_name  }}</td>
								<td>{{$view->itm_purchasecost }}</td>
								<td>{{$view->itm_salescost  }}</td>
								<td>{{$view->unt_type }}</td>
								<td>{{$view->itm_note  }}</td>
								<td>{{$view->itm_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 print" onclick="edit('.$view->itm_id.')">Edit</button>'; } if($data['delete']=='1'){echo' <button class="btn btn-default btn-xs print" onclick="Delete('.$view->itm_id.')">Delete</button>';} echo '</td>';?>
								</tr>
								@endforeach

								</tbody>
							</table>
						</div>
					</div>
					<!-- END DATA EXPORT -->

				</div>
			</div>
			</div>
			<!-- /main -->
<script>
					$('.clickme').click(function(e)
					{
						e.preventDefault();
                        $('#sideMenu').load($(this).attr('href'));
					});
					
					function edit(editId)
					{
						//alert(editId);
						$.ajax({
							url: 'EditItem',
							type: 'get',
							data:'&editId='+editId,
							success: function(data)
							{
								$('.editItem').html(data)
							}
					});
					}
					
					function deleteContent(deleteId)
					{
					 if (confirm("Are you sure delete!") == true)
						 {
							$.ajax({
								url: 'DeleteItem',
								type: 'get',
								data:'&deleteId='+deleteId,
								success: function(data)
								{
									$('#sideMenu').load('viewitem');
								}
							});
						 }
					}
					</script>