<div class="modal fade" id="createModal" 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="addconcepto(this); return false" id="concepto-form">
				<input type="hidden" name="action" class="action" value="addarticulo">
				<div class="content-cuentas-lineas"></div>
				<div class="content-ccostos-lineas"></div>
				<input type="hidden" name="iduser" value="{{ Auth::user()->id }}">
				<input type="hidden" name="{{$head['tipe_id']}}" value="{{ $head['id'] }}">
				<input type="hidden" name="tipe_linea" value="articulo">
				<input type="hidden" name="um" id="um_art">
				@csrf
				<div class="row">
					<div class="col-4">
						<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">
						<div class="row row-search" >
							<div class="col-12">
								<div class="content-search article-search " >
								</div>
							</div>
						</div>		
					</div>
					<div class="col-4">
						<input type="text" class="form-control" name="codigo_art" id="codigo_art" placeholder="Codigo">
					</div>
					<div class="col-4">
						<select name="dhber" id="" class="form-control">
							<option value="debe" >Debe</option>
							<option value="haber" {{(isset($head['tipe'])) ? 'selected' : ''}}>Haber</option>
						</select>
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-4">
						<select name="ccostos_id" id="ccostos" class="form-control dynamic_selects selectpicker update-picker" data-select="ccostos" onchange="change_cuecc(this); return false">
							<option value="">Centro de costos</option>
							@if($complet['ccostos']->isNotEmpty())
								@foreach ($complet['ccostos'] as $c)
									@if(strlen($c->codigo) == 4)
										<option value="{{ $c->id }}" data-description="{{ $c->descripcion }}" data-codigo="{{ $c->codigo }}">{{ $c->codigo }} || {{ $c->descripcion }}</option>
									@endif
								@endforeach
							@endif
						</select>
					</div>
					<div class="col-2">
						<input type="text" name="cantidad" data-imports="1" id="cantidad_art" class="form-control" placeholder="Cantidad" 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" onkeyup="calcular_valor_art(this); return false" id="precio_art">
					</div>
					<div class="col-3">
						<input type="text" name="importe_art" data-imports="1" class="form-control" id="importe_art" placeholder="Importe">
					</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">
						</div>
						<div class="form-group section_sol">
							<input type="text" class="form-control precio_soles" id="precio_soles" name="precio_soles" placeholder="Valor venta">
						</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-percent="active"  data-tipe="valor" onkeyup="calcular_valor_art(this); return false" id="desc_1" placeholder="%">
								</div>
							</div>
							<div class="col-8">
								<div class="form-group">
									<input type="text" class="form-control" onkeyup="calcular_valor_art(this); return false" data-percent="active"  name="descuento_valor" id="desc_2" placeholder="Valor descuento" >
								</div>
							</div>
						</div>
						<div  class="row section_sol">
							<div class="col-12">
								<div class="form-group"> 
									<input type="text" class="form-control desc_soles" name="descuento_soles" id="desc_soles" placeholder="Valor descuento">
								</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" 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 sel" name="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">
								</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="%">
								</div>
							</div>
							<div class="col-6">
								<div class="form-group">
									<input type="text" class="form-control" name="igv_val"  id="igvpercent2" placeholder="Valor igv">
								</div>
							</div>
						</div>
						<div class="row section_sol">
							<div class="col-12">
								<div class="form-group">
									<input type="text" class="form-control igvsoles" name="igv_soles" id="igvsoles" placeholder="Valor igv">
								</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">
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-4">
						<input type="text" class="form-control" placeholder="glosa" name="concepto" id="glosa_add">
					</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" data-select="cuentas"    onchange="change_cuecc(this); return false" required="">
							<option value="">Cuentas contables</option>
							@if($complet['cuentas']->isNotEmpty())
								@foreach ($complet['cuentas'] as $c)
									@if(strlen($c->codigo) == 7)
										<option value="{{ $c->id }}" data-description="{{ $c->descripcion }}" data-codigo="{{ $c->codigo }}">{{ $c->codigo }} || {{ $c->descripcion }}</option>
									@endif
								@endforeach
							@endif
						</select>
					</div>
					<div class="col-2">
						<input type="checkbox" name="obsequio" value="1" 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($complet['cuentas']->isNotEmpty())
								@foreach ($complet['cuentas'] as $c)
									<option value="{{ $c->id }}" data-description="{{ $c->descripcion }}">{{ $c->codigo }} || {{ $c->descripcion }}</option>
								@endforeach
							@endif
						</select>
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-12 text-center">
						<br>
						<button class="btn btn-primary"><i class="icon-floppy-disk "></i> Guardar</button>
					</div>
				</div>
			</form>
      </div>
    </div>
  </div>
</div>
<div class="reponse-ajax-relacional"></div>
<script>
	$(function() {
		$('.update-picker').selectpicker('refresh');
	});
</script>
