@extends('layouts.app')

@section('content')
<?php
$Condominio = Auth::user()->Condominio;
?>
<div class="page-header" style="background-color: #6382a6;;">
  <div class="modulo"><img class="imagenmodulo1" src="{{ URL::asset('dashboardimage/support.png') }}">
  <img class="imagenmodulo2" src="{{ URL::asset('dashboardimage/linea.png') }}">&nbsp   comunicación </div>
</div>

	{!! Form::open(array('url'=>'comunicacion?return='.$return, 'class'=>'form-horizontal form-material validated sximo-form','files' => true ,'id'=> 'FormTable' )) !!}
	<div class="toolbar-nav">
		<div class="row">
			
			<div class="col-md-6 " >
				
				<!--<button type="submit" class="btn btn-sm  " name="apply" style="border-color:#f29f41;">APLICAR CAMBIOS</button>-->
				<button type="submit" class="btn btn-sm  " name="save" style="border-color:#7fb3e3;">GUARDAR</button>
					<a href="{{ url($pageModule.'?return='.$return) }}" class="tips btn btn-sm " style="border-color:#ff7a7a;" >SALIR</a>	 
				
			</div>
			<div class="col-md-6 text-right " >
			
			</div>
		</div>
	</div>	


	<div class="card">
		<div class="card-body">
		
<div class="row"><div class="col-md-12">
					<fieldset style="border-color:#7fb3e3;"><legend> Información General</legend>
				{!! Form::hidden('ComID', $row['ComID']) !!}							
									  <div class="form-group row  " >
										<label for="Pregunta" class=" control-label col-md-4 text-left"> Pregunta :</label>
										<div class="col-md-6">
										  <input  type='text' name='Pregunta' id='Pregunta' value='{{ $row['Pregunta'] }}' 
						     class='form-control form-control-sm ' /> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  "  style="display: none;">
										<label for="Condominio" class=" control-label col-md-4 text-left"> Condominio </label>
										<div class="col-md-6">
										  <select name='Condominio' rows='5' id='Condominio' class='select2 '   ></select> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  " >
										<label for="Residente" class=" control-label col-md-4 text-left"> Residente :</label>
										<div class="col-md-6">
										  
					<?php $Residente = explode(',',$row['Residente']);
					$Residente_opt = array( 'No' => 'No' ,  'Si' => 'Si' , ); ?>
					<select name='Residente' rows='5'   class='select2 '  > 
						<?php 
						foreach($Residente_opt as $key=>$val)
						{
							echo "<option  value ='$key' ".($row['Residente'] == $key ? " selected='selected' " : '' ).">$val</option>"; 						
						}						
						?></select> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  " >
										<label for="Administrador" class=" control-label col-md-4 text-left"> Administrador :</label>
										<div class="col-md-6">
										  
					<?php $Administrador = explode(',',$row['Administrador']);
					$Administrador_opt = array( 'No' => 'No' ,  'Si' => 'Si' , ); ?>
					<select name='Administrador' rows='5'   class='select2 '  > 
						<?php 
						foreach($Administrador_opt as $key=>$val)
						{
							echo "<option  value ='$key' ".($row['Administrador'] == $key ? " selected='selected' " : '' ).">$val</option>"; 						
						}						
						?></select> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
									  </div> 					
									  <div class="form-group row  " >
										<label for="Usuario" class=" control-label col-md-4 text-left"> Usuario :</label>
										<div class="col-md-6">
										  <select name='Usuario[]' multiple rows='5' id='Usuario' class='select2 '   ></select> 
										 </div> 
										 <div class="col-md-2">
										 	
										 </div>
										  <input  type='hidden' name='Email' id='Email' value='{{ Auth::user()->email }}' 
						     class='form-control form-control-sm ' /> 
									  </div> </fieldset></div></div>
	
		</div>
		
		<input type="hidden" name="action_task" value="save" />
		
		
		</div>
	</div>		


	{!! Form::close() !!}
	
	@include('sximo.module.template.ajax.formjavascript')
   <script type="text/javascript">
	$(document).ready(function() { 
		
		var x= '<?php echo $Condominio;?>';		
		
		$("#Condominio").jCombo("{!! url('comunicacion/comboselect?filter=condominios:Nombre:Nombre') !!}",
		{  initial_text: "-- Seleccionar --",selected_value : x });
		
		$("#Usuario").jCombo("{!! url('comunicacion/comboselect?filter=tb_users:email:first_name|last_name') !!}&parent=Condominio:",
		{  parent: '#Condominio',initial_text: "-- Seleccionar --", selected_value : '{{ $row["Usuario"] }}' });
		 	
		 	 

		$('.removeMultiFiles').on('click',function(){
			var file =  $(this).attr('url') ;
			var removeUrl = '{{ url( $pageModule."/removefiles?file=")}}'+ file;
			$(this).parent().remove();
			$.get(removeUrl,function(response){});
			$(this).parent('div').empty();	
			return false;
		});
	});
	</script>
	<style>
  .btn:focus,.btn:active {
   outline: none !important;
   box-shadow: none;
}  
    
    
</style>
@stop