<?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 class="active"><?php echo Lang::choice('messages.stock-list',2); ?></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="panel-heading ">
		<span class="ion-arrow-graph-down-left"></span>
		Low Stock Commodities
		<div class="panel-btn">


		</div>
	</div>

	<div class="panel-body">
		<div class="table-responsive">
			<table class="table table-striped table-hover table-bordered search-table">
				<thead>
					<tr>
						<th class="text-center">#</th>
						<th>Item</th>
						<th>Stock On Hand</th>
						<th>Months Of Stock</th>
					</tr>
				</thead>
				<tbody>
					<?php $row=1; ?>
					<?php foreach($stock as $value): ?>
					<tr>
						<th class="text-center"><?php echo $row; ?></th>
						<td><?php echo $value->commodity->name; ?>  </td>
							<?php 
								$count = DB::table('unhls_stockcard')->select('action', DB::raw('count(*) as avg'))->where('action','=','I')->groupBy('commodity_id')->get();
								$avg = (int)$count;
								?>
						<td><?php echo $value->balance; ?></td>
						<td><?php echo ($value->balance)/3; ?></td>
					</tr>
					<?php $row++; ?>
					<?php endforeach; ?>
				</tbody>
			</table>
		</div>
		<?php Session::put('SOURCE_URL', URL::full());?>
	</div>
</div>
<?php $__env->stopSection(); ?>

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