@extends("layout")
@section("content")
<div>
	<ol class="breadcrumb">
	  <li><a href="{{{URL::route('user.home')}}}">{{trans('messages.home')}}</a></li>
	  <li class="active">{{ Lang::choice('messages.commodityList',2) }}</li>
	</ol>
</div>
@if (Session::has('message'))
	<div class="alert alert-info">{{ trans(Session::get('message')) }}</div>
@endif
<div  class="panel panel-default row" style="width:97%">
	<div class="panel-heading ">
		<span class="glyphicon glyphicon-user"></span>
		{{trans('messages.commodityList')}}
		<div class="panel-btn">
			<a class="btn btn-sm btn-info" href="{{ URL::route('commodity.create') }}">
				<span class="glyphicon glyphicon-plus-sign"></span>
				{{trans('messages.add-commodity')}}
			</a>
		</div>
	</div>
	<div class="panel-body">
	<div class="table-responsive">
  	<table class="table table-striped table-bordered search-table">
			<thead>
				<tr>
					<th>#</th>
					<th>{{Lang::choice('messages.commodity',1)}}</th>
					 <th>Commodity Category</th>
					<th>{{Lang::choice('messages.description',1)}}</th>
					<th>Pack <br> Size	</th>
					<th>{{Lang::choice('messages.unit-of-issue',1)}}</th>
					<!-- <th class="text-center">{{Lang::choice('messages.item-code',1)}}</th> -->
					<th class="text-center">Store Section</th>
					<!-- <th class="text-center">{{Lang::choice('messages.storage-req',1)}}</th> -->
					<th class="text-center">Qty <br> Available</th>
					<th class="text-center">Min <br> Level</th>
					<th class="text-center">Max <br> Level</th>
					<th class="text-center">{{trans('messages.actions')}}</th>
				</tr>
			</thead>
			<tbody>
				 <?php $row=1; ?>
			@foreach($commodities as $value)
				<tr>
					<th>{{ $row }}</th>
          <td>{{ $value->name}}</td>
         <td>{{ $value->category->name}}</td>
          <td>{{ $value->description}}</td>
          <td>{{ $value->pack_size}}</td>
          <td>{{ $value->metric->name }}</td>
          <td>{{ $value->stores->name }}</td>
          <!-- <td class="text-center">{{ $value->item_code }}</td> -->
					<!-- <td class="text-center">{{ $value->storage_req }}</td> -->
					<td class="text-center">{{ $value->available() }}</td>
					<td class="text-center">{{ $value->min_level}}</td>
					<td class="text-center">{{ $value->max_level }}</td>
					<td>
						<!-- edit this commodity (uses the edit method found at GET /inventory/{id}/edit -->
						<a class="btn btn-sm btn-info" href="{{ URL::route('commodity.edit', array($value->id)) }}" >
								<span class="glyphicon glyphicon-edit"></span>
								{{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="{{ URL::route('commodity.delete', array($value->id)) }}">
								<span class="glyphicon glyphicon-trash"></span>
								{{trans('messages.delete')}}
						</button>
					</td>
				</tr>
				<?php $row++; ?>
				@endforeach
			</tbody>
		</table>
		<?php Session::put('SOURCE_URL', URL::full());?>
	</div>
</div>
@stop
