<?php echo HTML::script('js/usedmats_child.js'); ?>
<h2><?php echo trans('labels.materials'); ?></h2>
<div class="table">
	<table id="tb_grid_mat" class='grid'>
	<thead>
		<tr>
			<th width=" 50px">
			<?php echo link_to_route('newUsedmat' , '', '', array( 'class'=>'button-small add', 'alt'=>'add', 'title'=>'προσθήκη')); ?>
			</th>
			<th width="150px"><?php echo trans('labels.desc'); ?></th>
			<th width="120px"><?php echo trans('labels.brand'); ?></th>
			<th width=" 70px"><?php echo trans('labels.size'); ?></th>
			<th width="180px"><?php echo trans('labels.supplier'); ?></th>
			<th width=" 60px"><?php echo trans('labels.quantity'); ?></th>
			<th width=" 60px"><?php echo trans('labels.price'); ?></th>
			<th width=" 60px"><?php echo trans('labels.cost'); ?></th>
		</tr>  
	</thead>	
	<tfoot>
	</tfoot>
	<tbody>
		<?php foreach($materials as $material): ?>
		<tr>
			<td>	<?php echo link_to_route('showUsedmat' , '', array($material->id), array( 'class'=>'button-small show', 'alt'=>'show', 'title'=>'προβολή')); ?>
					<?php echo link_to_route('editUsedmat', '', array($material->id), array( 'class'=>'button-small upd', 'alt'=>'upd', 'title'=>'αλλαγή')); ?>
					<?php echo link_to_route('deleteUsedmat', '', array($material->id), array( 'class'=>'button-small del', 'alt'=>'del', 'title'=>'διαγραφή')); ?></td>
			<td ><?php echo $material->material_name; ?></td>
			<td ><?php echo $material->material_brand . ' ' . $material->material_code; ?></td>
			<td ><?php echo $material->material_size; ?></td>
			<td ><?php echo $material->supplier_name; ?> 
				<?php echo link_to_route('showActor' , '', array($material->material_supplier), array( 'class'=>'button-link-l', 'alt'=>'go', 'title'=>'μετάβαση')); ?>
			</td>
			<td class="r"><?php echo $material->used_quantity; ?></td>
			<td class="r"><?php echo $material->unit_price . ' / ' $material->material_unit; ?></td>
			<td class="r">	<?php echo number_format($material->material_cost, 2, '.', ','); ?>€</td>
		</tr>
		<?php endforeach; ?>
	</tbody>
	</table>
</div>