<div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Articulo</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
      		<div class="response-data">
			
			</div>
			<form action="{{ $head['url'] }}" class="concepto-form" onsubmit="update_contable(this); return false" id="concepto-form">
				<input type="hidden" name="action" class="action" value="updatearticulo">
				<div class="content-cuentas"></div>
				<div class="content-relacional"></div>
				<input type="hidden" name="iduser" value="{{ Auth::user()->id }}">
				<input type="hidden" name="tipe_linea" value="{{ $data['linea']->tipe_linea }}">
				<input type="hidden" name="um"  id="um" value="{{ $data['linea']->um }}">
				<div class="row">
					<div class="col-6">
						<input type="text" class="form-control" onkeyup="search_razon(this); return false" data-action="{{ url('articulos') }}" data-tipe="articulo"  id="article_search" placeholder="Buscar articulo...." name="nombre_articulo" value="{{$data['linea']->nombre_articulo }}">
						<div class="row row-search" >
							<div class="col-12">
								<div class="content-search article-search " >
								</div>
							</div>
						</div>		
					</div>
					<div class="col-6">
						<input type="text" class="form-control" name="codigo_art" id="codigo_art" placeholder="Codigo" value="{{$data['linea']->codigo_art }}">
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-4">
						<select name="ccostos_id" id="ccostos" class="form-control ynamic_selects selectpicker update-picker">
							<option value="">Centro de costos</option>
							@if($data['ccostos']->isNotEmpty())
								@foreach ($data['ccostos'] as $c)
								    @if(strlen($c->codigo) == 4)
									    <option value="{{ $c->id }}" {{ ($data['linea']->ccostos_id == $c->id ) ? 'selected' : '' }} >{{ $c->codigo }} || {{ $c->descripcion }}</option>
									@endif
								@endforeach
							@endif
						</select>
					</div>
					<div class="col-2">
						<input type="text" name="cantidad" data-imports="1" class="form-control" placeholder="Cantidad"  value="{{$data['linea']->cantidad }}" id="cantidad_art" onkeyup="calcular_valor_art(this); return false">
					</div>
					<div class="col-3">
						<input type="text" name="precio_art" data-imports="1" class="form-control" placeholder="Precio"  value="{{$data['linea']->precio }}"  id="precio_art"  onkeyup="calcular_valor_art(this); return false">
					</div>
					<div class="col-3">
						<input type="text" name="importe_art"  data-imports="1"class="form-control" placeholder="Importe"  id="importe_art" value="{{$data['linea']->importe_art }} ">
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-3">
						<fieldset>
							<legend class="font-weight-semibold"><i class="icon-reading mr-2"></i> Valor venta</legend>
						</fieldset>
						<div class="form-group">
							<input type="text" class="form-control" name="precio" id="precio_venta" data-tipe="valor" placeholder="Valor venta" onkeyup="calcular_valor_art(this); return false"  value="{{$data['linea']->precio }}">
						</div>
						<div class="form-group section_sol">
							<input type="text" class="form-control precio_soles" id="precio_soles" placeholder="Valor venta" value="{{ $data['linea']->precio_soles }}">
						</div>
					</div>
					<div class="col-3">
						<fieldset>
							<legend class="font-weight-semibold">
								<i class="icon-reading mr-2"></i> Descuento
							</legend>
						</fieldset>
						<div class="row">
							<div class="col-4">
								<div class="form-group">
									<input type="text" class="form-control" name="descuento_percent" data-tipe="valor" onkeyup="calcular_valor_art(this); return false" id="desc_1" placeholder="%"  value="{{$data['linea']->descuento_percent }}">
								</div>
							</div>
							<div class="col-8">
								<div class="form-group">
									<input type="text" class="form-control" data-percent="active" onkeyup="calcular_valor_art(this); return false"  name="descuento_valor" id="desc_2" placeholder="Valor descuento" value="{{ $data['linea']->descuento_valor }}">
								</div>
							</div>
						</div>
						<div  class="row section_sol">
							<div class="col-12">
								<div class="form-group"> 
									<input type="text" class="form-control desc_soles" id="desc_soles" placeholder="Valor descuento" value="{{ $data['linea']->descuento_soles }}">
								</div>
							</div>
						</div>
					</div>
					<div class="col-3">
						<fieldset>
							<legend class="font-weight-semibold"><i class="icon-reading mr-2"></i> Imp.Sel.Cons</legend>
						</fieldset>
						<div class="row">
							<div class="col-4">
								<div class="form-group">
									<input type="text" class="form-control"  data-tipe="valor"  id="sel_percent" name="imp_percent" value="{{ $data['linea']->imp_percent }}" placeholder="%" onkeyup="calcular_valor_art(this); return false">
								</div>
							</div>
							<div class="col-8">
								<div class="form-group">
									<input type="text" class="form-control"   id="sel_2" placeholder="Valor descuento" value="{{ $data['linea']->imp_sel }}">
								</div>
							</div>
						</div>
						<div  class="row section_sol">
							<div class="col-12">
								<div class="form-group"> 
									<input type="text" class="form-control" id="imp_soles" placeholder="Sel Value" value="{{ $data['linea']->imp_soles }}">
								</div>
							</div>
						</div>
					</div>
					<div class="col-3">
						<fieldset>
							<legend class="font-weight-semibold"><i class="icon-reading mr-2"></i> IGV</legend>
						</fieldset>
						<div class="row">
							<div class="col-6">
								<div class="form-group">
									<input type="text" name="igvpercent"  id="igvpercent" data-tipe="valor" onkeyup="calcular_valor_art(this); return false" class="form-control" placeholder="%" value="{{ $data['linea']->igvpercent }}">
								</div>
							</div>
							<div class="col-6">
								<div class="form-group">
									<input type="text" class="form-control" name="igv_val"  id="igvpercent2_art" placeholder="Valor igv" value="{{ $data['linea']->igv_val }}">
								</div>
							</div>
						</div>
						<div class="row section_sol">
							<div class="col-12">
								<div class="form-group">
									<input type="text" class="form-control igvsoles" id="igvsoles" placeholder="Valor igv" value="{{ $data['linea']->igv_soles }}">
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-4">
						<input type="text" class="form-control" name="total_valor" id="total_art_valor" placeholder="Totales" value="{{ $data['linea']->total_valor }}">
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-4">
						<input type="text" class="form-control" placeholder="glosa" name="concepto" value="{{ $data['linea']->concepto }}">
					</div>
					<div class="col-3 cuentas_articulos">
						<select name="plan_cuentas_id" id="cuenta_articulo"  class="form-control dynamic_selects selectpicker update-picker" data-live-search="true"  required="">
							<option value="">Cuentas contables</option>
							@if($data['cuentas']->isNotEmpty())
								@foreach ($data['cuentas'] as $c)
								    @if(strlen($c->codigo) == 7)
									    <option value="{{ $c->id }}" {{ ($data['linea']->plan_cuentas_id == $c->id ) ? 'selected' : '' }} data-description="{{ $c->descripcion }}">{{ $c->codigo }} || {{ $c->descripcion }}</option>
									@endif
								@endforeach
							@endif
						</select>
					</div>
					<div class="col-2">
						<input type="checkbox" name="obsequio" value="1" {{ ($data['linea']->obsequio == '1') ? 'checked' : '' }} onchange="change_p_articulo(this); return false"> <b>Obsequio</b>
					</div>
					<div class="col-3">
						<select id="cuenta_obsequio"  class="form-control dynamic_selects selectpicker update-picker" data-live-search="true"   disabled="">
							<option value="">Cuentas contables</option>
							@if($data['cuentas']->isNotEmpty())
								@foreach ($data['cuentas'] as $c)
								    @if(strlen($c->codigo) == 7)
									    <option value="{{ $c->id }}" data-description="{{ $c->descripcion }}" {{ ($data['linea']->plan_cuentas_id == $c->id ) ? 'selected' : '' }}>{{ $c->codigo }} || {{ $c->descripcion }}</option>
									@endif
								@endforeach
							@endif
						</select>
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-6 text-right">
						<button href="#" class="btn btn-primary entidadf" id="entidadf">Buscar Doc relacional </button>
					</div>
					<div class="col-6">
						<input type="text" id="document_f_relacional" readonly="" class="form-control" placeholder="Documento relacionado ">
					</div>
				</div>
				<div class="row">
					<div class="col-12 text-center">
						<br>
						<button class="btn btn-primary"><i class="icon-rotate-cw2 "></i> Actualizar</button>
					</div>
				</div>
			</form>
      </div>
    </div>
  </div>
</div>
<div class="reponse-ajax-relacional"></div>
<script>
	$(function() {
		$('.update-picker').selectpicker('refresh');
	});
</script>

