@if(!empty($suppliers_array))
	@php $i=0; @endphp
	@foreach($suppliers_array as $key => $supp)

	@if($suppliers_array[$key]['qty'] > 0)
		@php $i++; @endphp
		<tr>
			<td>{{ $suppliers_array[$key]['name'] }}</td>
			<td>{{ $suppliers_array[$key]['qty'] }}</td>
			<td>{{ $suppliers_array[$key]['unit'] }}</td>
			<td><input type="text" class="form-control" name="input_qty[{{ $key }}]" value="0"></td>
			<td>
				<select class="form-control" name="unit_id[]" >
					@foreach ($units as $unit)
						<option value="{{ $unit->id }}" {{ ( $unit->name == unit_name() ?? app_info()->id ) ? 'selected' : '' }} >{{ $unit->name }}</option>
					@endforeach
				
				</select>
			</td>
			<input type="hidden" name="average_price[{{ $key }}]" class="form-control" readonly value="{{ $suppliers_array[$key]['price'] }}"> 
		</tr>
	@endif
	@endforeach
	@if($i == 0)
		<tr>
			<td colspan="3" class="text-center bg-danger">Sorry ! No Available Products !</td>
		</tr>
	@endif
@else
	<tr>
		<td colspan="3" class="text-center bg-danger">Sorry ! No Available Products !</td>
	</tr>
@endif