<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">Concepto</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'] }}" id="add_items" class="concepto-form" onsubmit="addconcepto(this); return false" id="concepto-form">
				<input type="hidden" name="action" class="action" value="adddetalle">
				<div class="content-relacional"></div>
				<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="concepto">
				<input type="hidden" name="cantidad" value="1">
				@csrf
				<div class="row">
					<div class="col-6">
						<select name="plan_cuentas_id" id="cuenta_id"  class="form-control dynamic_selects selectpicker update-picker" data-select="cuentas" data-live-search="true"  required=""  onchange="change_cuecc(this); return false" >
							<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-6">
						<select name="ccostos_id" id="ccostos" class="form-control ynamic_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>
				<hr>
				<div class="row">
					<div class="col-6">
						<select name="dhber" id="" class="form-control">
							<option value="debe">Debe</option>
							<option value="haber" {{(isset($head['tipe'])) ? 'selected' : ''}}>Haber</option>
						</select>
					</div>
					<div class="col-6 text-center">
						<b>Afecto </b><input type="checkbox" id="afect_js" name="afecto" checked onchange="percentc(this); return false">
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-4">
						<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="calcula_valor(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-4">
						<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="calcula_valor(this); return false" id="desc_1" placeholder="%">
								</div>
							</div>
							<div class="col-8">
								<div class="form-group">
									<input type="text" class="form-control" data-percent="active"   onkeyup="calcula_valor(this); return false"  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-4">
						<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="calcula_valor(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_valor" placeholder="Totales">
					</div>
					<div class="col-8 text-right">
						<button type="button" disabled="" class="btn btn-primary entidadf" id="entidadf">Buscar Doc relacional </button>
					</div>
				</div>
				<hr>
				<div class="row">
					<div class="col-6">
						<input type="text" id="document_f_relacional" readonly="" class="form-control" placeholder="Documento relacionado ">
					</div>
					<div class="col-6">
						<input type="text" class="form-control" placeholder="glosa" name="concepto" id="glosa_add">
					</div>
					
				</div>
				<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>$('.update-picker').selectpicker('refresh');</script>
