<div class="modal-dialog ui-front" role="document">
  	<div class="modal-content">

    {!! Form::open(['url' => action('ProductionCostingController@updateRecipeCostSetup', $production_costing_mst->id), 'method' => 'put', 'id' => 'account_type_form' ]) !!}
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title">Edit Production/ Decompose Setup for {{$product_list->name}}</h4>
    </div>

    <div class="modal-body">
      <div class="form-group">
        	{!! Form::label('main_category', 'Product Category:*') !!}
          	{!! Form::text('main_category', $product_list->category, ['class' => 'form-control','required','readonly']); !!}
      </div>
      <div class="form-group">
        	{!! Form::label('finished_product', 'Finished Product:*') !!}
          	{!! Form::text('finished_product', $product_list->name, ['class' => 'form-control','required','readonly']); !!}
      </div>
      <div class="form-group">
        	{!! Form::label('production_qty', 'Expected Output Qty:*') !!}
          	{!! Form::text('production_qty', $production_costing_mst->production_qty, ['class' => 'form-control input_number','required']); !!}
      </div>
	  <div class="clearfix"></div>
      
	<div class="row">
		<div class="col-sm-8 col-sm-offset-2">
			<div class="form-group">
				<div class="input-group">
					<span class="input-group-addon">
						<i class="fa fa-search"></i>
					</span>
					{!! Form::text('search_product', null, ['class' => 'form-control mousetrap', 'id' => 'search_product', 'placeholder' => __('lang_v1.search_product_placeholder')]); !!}
				</div>
			</div>
		</div> 
	</div>
	<div class="row"> 
	<div class="col-sm-12"> 
		<!-- Keeps count of product rows -->
		<input type="hidden" id="product_row_count" 
			value="{{$production_costing_txn->count()}}">
		<table class="table table-condensed table-bordered table-striped table-responsive" id="purchase_entry_table">
			<thead>
				<tr>
					<th class="tex-center col-md-7 ">	
						Raw Material
					</th>
					<th class="text-center col-md-4">
						@lang('sale.qty')
					</th>
					<th class="text-center"><i class="fas fa-times" aria-hidden="true"></i></th>
				</tr>
			</thead>
			<tbody>
			@php
			$row_count=1;
			@endphp
			@foreach ($production_costing_txn as $product)
			<tr>
				<td>
					{{ $product->name }}
					
				</td>
				<td>
					{!! Form::hidden('purchases[' . $row_count . '][product_id]', $product->raw_material ); !!}
					{!! Form::hidden('purchases[' . $row_count . '][variation_id]', $product->variation_id , ['class' => 'hidden_variation_id']); !!}

					@php
						$check_decimal = 'true';
						$currency_precision = config('constants.currency_precision', 2);
						$quantity_precision = config('constants.quantity_precision', 2);
					@endphp
					{!! Form::text('purchases[' . $row_count . '][quantity]', number_format(1, $quantity_precision,'.',','),['class' => 'form-control input-sm purchase_quantity input_number mousetrap', 'required', 'data-rule-abs_digit' => $check_decimal, 'data-msg-abs_digit' => __('lang_v1.decimal_value_not_allowed')]); !!}
					
				</td>
				<?php $row_count++ ;?>

				<td><i class="fa fa-times remove_purchase_entry_row text-danger" title="Remove" style="cursor:pointer;"></i></td>
			</tr>
			@endforeach
			</tbody>
		</table>
	</div> 
	</div> 

    </div>

    <div class="modal-footer">
      <button type="submit" class="btn btn-primary">@lang( 'messages.save' )</button>
      <button type="button" class="btn btn-default" data-dismiss="modal">@lang( 'messages.close' )</button>
    </div>

    {!! Form::close() !!}

  	</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->