<div class="form-ajax-box">
{!! Form::open(array('url'=>'condominio?return='.$return, 'class'=>'form-horizontal form-material validated','files' => true , 'parsley-validate'=>'','novalidate'=>' ','id'=> 'condominioFormAjax')) !!}

	<div class="toolbar-nav">	
		<div class="row">	
			<div class="col-sm-6 ">	
				<button type="submit" class="btn btn-sm  " name="apply">{{ Lang::get('core.sb_apply') }} </button>
				<button type="submit" class="btn btn-sm  " name="save">  {{ Lang::get('core.sb_save') }} </button>
			</div>	
			<div class="col-md-6 text-right">
				<a href="javascript://ajax" onclick="ajaxViewClose('#{{ $pageModule }}')" class="tips btn btn-sm  " title="{{ __('core.btn_back') }}" ><i class="fa  fa-times"></i></a>				
			</div>
					
		</div>
	</div>	
		<div class="card">
			<div class="card-body">

	
	<div class=""> <ul class="nav nav-tabs form-tab"><li class=" nav-item "><a href="#InformacionGeneral" data-toggle="tab" class="nav-link active">Informacion General</a></li>
				<li class=" nav-item "><a href="#InformacionAdicional" data-toggle="tab" class="nav-link ">Informacion Adicional</a></li>
				</ul><div class="tab-content mt-4"><div class="tab-pane p-3 active" id="InformacionGeneral"> 
				{!! Form::hidden('CondominioID', $row['CondominioID']) !!}					
									  <div class="form-group row  " >
										<label for="Nombre" class=" control-label col-md-4 text-left"> Nombre <span class="asterix"> * </span></label>
										<div class="col-md-6">
										  <input  type='text' name='Nombre' id='Nombre' value='{{ $row['Nombre'] }}' 
						required     class='form-control form-control-sm ' /> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  " >
										<label for="Dirección" class=" control-label col-md-4 text-left"> Dirección </label>
										<div class="col-md-6">
										  <input  type='text' name='Direccion' id='Direccion' value='{{ $row['Direccion'] }}' 
						     class='form-control form-control-sm ' /> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  " >
										<label for="Sector" class=" control-label col-md-4 text-left"> Sector <span class="asterix"> * </span></label>
										<div class="col-md-6">
										  <input  type='text' name='Sector' id='Sector' value='{{ $row['Sector'] }}' 
						required     class='form-control form-control-sm ' /> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  " >
										<label for="Provincia" class=" control-label col-md-4 text-left"> Provincia <span class="asterix"> * </span></label>
										<div class="col-md-6">
										  <select name='Provincia' rows='5' id='Provincia' class='select2 ' required  ></select> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  " >
										<label for="Estatus" class=" control-label col-md-4 text-left"> Estatus <span class="asterix"> * </span></label>
										<div class="col-md-6">
										  
					<?php $Estatus = explode(',',$row['Estatus']);
					$Estatus_opt = array( 'Activo' => 'Activo' ,  'Inactivo' => 'Inactivo' , ); ?>
					<select name='Estatus' rows='5' required  class='select2 '  > 
						<?php 
						foreach($Estatus_opt as $key=>$val)
						{
							echo "<option  value ='$key' ".($row['Estatus'] == $key ? " selected='selected' " : '' ).">$val</option>"; 						
						}						
						?></select> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 
				</div>
				
				<div class="tab-pane p-3 " id="InformacionAdicional"> 
									
									  <div class="form-group row  " >
										<label for="Fecha de Limite" class=" control-label col-md-4 text-left"> Fecha de Limite <span class="asterix"> * </span></label>
										<div class="col-md-6">
										  <input  type='text' name='Fechadecobro' id='Fechadecobro' value='{{ $row['Fechadecobro'] }}' 
						required     class='form-control form-control-sm ' /> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  " >
										<label for="Fecha de Extención" class=" control-label col-md-4 text-left"> Fecha de Extención <span class="asterix"> * </span></label>
										<div class="col-md-6">
										  <input  type='text' name='Fechadeextencion' id='Fechadeextencion' value='{{ $row['Fechadeextencion'] }}' 
						required     class='form-control form-control-sm ' /> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 
				</div>
				
				</div>									
						
	<input type="hidden" name="action_task" value="save" />

	</div>
	

</div>		
{!! Form::close() !!}
</div>

<style type="text/css">
	.modal-body .form-ajax-box {
		margin: -15px;
	}
</style>
@include('sximo.module.template.ajax.formjavascript')
<script type="text/javascript">
$(document).ready(function() { 
	 
	
	
		$("#Provincia").jCombo("{!! url('condominio/comboselect?filter=provincias:Provincias:Provincias') !!}",
		{  selected_value : '{{ $row["Provincia"] }}' });
		 	
	 
	
	var form = $('#condominioFormAjax'); 
	form.parsley();
	form.submit(function(){
		
		if(form.parsley().isValid()){			
			var options = { 
				dataType:      'json', 
				beforeSubmit :  function() {
				},
				success		:   function(data) {

					if(data.status == 'success')
					{
						ajaxViewClose('#{{ $pageModule }}');
						ajaxFilter('#{{ $pageModule }}','{{ $pageUrl }}/data');
						notyMessage(data.message);	
						$('#sximo-modal').modal('hide');	
					} else {
						notyMessageError(data.message);	
						return false;
					}	

				}  
			}  
			$(this).ajaxSubmit(options); 
			return false;
						
		} else {
			return false;
		}		
	
	});

});

</script>		 