<?php $__env->startSection("content"); ?>
<div>
	<ol class="breadcrumb">
		<li><a href="<?php echo e(URL::route('user.home')); ?>"><?php echo trans('messages.home'); ?></a></li>
		<li><a href="<?php echo e(URL::route('unhls_els.index')); ?>">Supply Chain Management</a></li>
		<li><a href="<?php echo e(URL::route('asset_mgt.index')); ?>">Asset Management</a></li>
		<li><a href="<?php echo e(URL::route('fundmanager.index')); ?>">Hubs & Funds Manager</a></li>
		<li class="active">Store Section</li>
	</ol>
</div>
<?php if(Session::has('message')): ?>
<div class="alert alert-info"><?php echo trans(Session::get('message')); ?></div>
<?php endif; ?>
<div class="panel panel-default">
	<div class="box-header with-border">
		<h3 class="box-title">Store Sections / Bins</h3><br><br>
		<a href="<?php echo URL::route('storeunit.create'); ?>" class="btn btn-sm btn-info btn-flat pull-left">Add Section</a>

		<div class="box-tools pull-right">
			<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
			</button>
			<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
		</div>
	</div>

	<div class="box-body">
		<div class="table-responsive">
			<table id='example1' class="table table-striped table-hover table-bordered search-table">
				<thead>

					<tr>
						<th>#</th>
						<th >Store Section</th>
						<!-- <th class="text-center">Width</th>
						<th class="text-center">Length</th>
						<th class="text-center">Height</th> -->
						<th class="text-center">Minimum <br>Storage Temperature</th>
						<th class="text-center">Maximum	 <br>Storage Temperature</th>
						<th class="text-center">Stock Quantity <br>in Section / Bin</th>
						<th class="text-center">Capacity</th>
						<th class="text-center">Status</th>
						<th class="text-center">CREATED BY</th>
						<th class="text-center">OPTIONS</th>
					</tr>
				</thead>
				<tbody>
					<?php $row=1; ?>
					<?php foreach($storeunit as $key => $value): ?>
					<tr>
						<th> <?php echo $row; ?> </th>
						<td><?php echo $value->name; ?></td>
						<!-- <td class="text-center"><?php echo $value->width; ?></td>
						<td class="text-center"><?php echo $value->length; ?></td>
						<td class="text-center"><?php echo $value->height; ?></td> -->
						<td class="text-center"><?php echo $value->min_temp; ?></td>
						<td class="text-center"><?php echo $value->max_temp; ?></td>

						<?php

						$stock = Commodity::with('Stores')
						->groupBy('stores_id')
						->sum('stores_id');
						?>

						<td class="text-center"><?php echo $stock; ?></td>
						<td class="text-center"><?php echo $value->capacity; ?></td>
						<?php if($stock <= ($value->capacity)): ?>
						<td class="text-center" style="color:red">Low On Stock</td>
						<?php else: ?>
						<td class="text-center">Over Stocked</td>
						<?php endif; ?>
						<td class="text-center"><?php echo $value->created_by; ?></td>
						<td>

							<!-- edit this commodity (uses the edit method found at GET /inventory/{id}/edit -->
							<a class="btn btn-sm btn-info" href="<?php echo URL::route('storeunit.edit', array($value->id)); ?>" >
								<span class="glyphicon glyphicon-edit"></span>
								<?php echo trans('messages.edit'); ?>

							</a>
							<!-- delete this commodity (uses the delete method found at GET /inventory/{id}/delete -->
							<button class="btn btn-sm btn-danger delete-item-link"
							data-toggle="modal" data-target=".confirm-delete-modal"
							data-id="<?php echo URL::route('storeunit.delete', array($value->id)); ?>">
							<span class="glyphicon glyphicon-trash"></span>
							<?php echo trans('messages.delete'); ?>

						</button>
					</td>
				</tr>
				<?php $row++; ?>
				<?php endforeach; ?>
			</tbody>
		</table>
		<?php Session::put('SOURCE_URL', URL::full());?>
	</div>
</div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make("layout", array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>