<!-- Content Header (Page header) -->
<section class="content-header">
	<div class="container-fluid">
		<div class="row mb-2">
			<div class="col-sm-6">
				<h1 class="m-0">Item</h1>
			</div>

			<div class="col-sm-6">
				<ol class="breadcrumb float-sm-right">
					<li class="breadcrumb-item"><a href="dashboard">Dashboard</a></li>
					<li class="breadcrumb-item"><a href="inventory">Inventory</a></li>
					<li class="breadcrumb-item active">Item</li>
				</ol>
			</div>
		</div>
	</div>
</section>

<!-- Main content -->
<section class="content">
	<div class="container-fluid">
		<div class="row mb-4">
			<div class="col-md-12">
				<?php $this->load->view( 'flash_message' );?>
			</div>

			<div class="col-lg-3 col-md-6">
				<a href="inventory/item-save" class="btn btn-block bg-gradient-primary"><i class="fa fa-plus"></i>&nbsp;&nbsp;&nbsp;<strong>Add New Item</strong></a>
			</div>
		</div>

		<div class="row">
			<div class="col-12">
				<div class="card">
					<div class="card-header">
						<h3 class="card-title">Item List</h3>
					</div>

					<div class="card-body">
						<table id="data-table" class="table table-bordered table-hover">
							<thead>
								<tr>
									<th>Code</th>
									<th>Name</th>
									<th>Picture</th>
									<!-- <th>Barcode</th> -->
									<th>Price</th>
									<th>Re Order Level</th>
									<th>Status</th>
									<th class="col-md-3 text-center">Action</th>
								</tr>
							</thead>
							<tbody>
								<?php foreach ( $items as $item ): ?>
									<tr>
										<td><?php echo $item['code']; ?></td>
										<td><?php echo $item['name']; ?></td>
										<td class="text-center"><?php if ( $item['picture'] != "" ) {echo '<img src="./uploads/items/' . $item['picture'] . '" height="100">';}?></td>
										<!-- <td><?php //echo '<img src="data:image/png;base64,' . base64_encode( $generator->getBarcode( $item['code'], $generator::TYPE_CODE_128 ) ) . '">'; ?></td> -->
										<td><?php echo number_format( $item['min_sale_price'], 2 ); ?></td>
										<td><?php echo $item['re_order']; ?></td>
										<td><?php echo $item['status']; ?></td>
										<td class="col-md-2 text-center">
											<a class="btn-sm btn-success" href="inventory/item-barcode/<?php echo $item['id']; ?>" target="_blank"><span class="fa fa-barcode"> Print Barcode</span></a>
											<a class="btn-sm btn-warning" href="inventory/item-save/<?php echo $item['id']; ?>"><span class="fa fa-edit"> Edit</span></a>
											<a class="btn-sm btn-danger del" href="inventory/item-delete/<?php echo $item['id']; ?>"><span class="fa fa-trash"> Delete</span></a>
										</td>
									</tr>
								<?php endforeach;?>
							</tbody>
							<tfoot>
								<tr>
									<th>Code</th>
									<th>Name</th>
									<th>Picture</th>
									<!-- <th>Barcode</th> -->
									<th>Price</th>
									<th>Re Order Level</th>
									<th>Status</th>
									<th class="col-md-3 text-center">Action</th>
								</tr>
							</tfoot>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>