<?php $__env->startSection('titulo', 'Crear de Usuario'); ?>
<?php $__env->startSection('botonera'); ?>
	<?php echo $__env->make('componentes.boton-volver-al-listado-de-usuarios', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
	<?php echo $__env->make('componentes.boton-salir-con-aviso', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
	<?php echo $__env->make('componentes.modal-volver-al-listado-de-usuarios', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
	<?php echo $__env->make('componentes.modal-salir', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
	<?php echo $__env->make('alerts.request', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
	<?php echo Form::open(['route'=>'usuario.store', 'method'=>'POST', 'accept-charset' => 'UTF-8', 'enctype' => 'multipart/form-data', 'files' => true]); ?>

		<?php echo $__env->make('usuario.forms.usuario', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
		<div class="row">
			<div class="col-xs-12">
				<?php echo Form::submit('Crear Usuario', ['class'=>'btn btn-primary']); ?>

			</div>
		</div>
	<?php echo Form::close(); ?>

	<br>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
	<script type="text/javascript">
		var rutaPadre = '<?php echo e(URL::to("")); ?>/';
	</script>
	<?php echo Html::script('js/localidades/ajax-cargar-municipios-desde-departamento.js'); ?>

	<script type="text/javascript">
		<?php echo $__env->make('componentes.script-mostrar-modal-request', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>;

		$(document).ready(function(){
			// Mostrar los divs ocultos para crear un usuario responsable
			o = $('.div-oculto');
			$('#cbx-es-responsable').click(function(){
				o.css('display') == 'none' ? o.fadeIn() : o.fadeOut();
			});
			// Si después de un error de validación se había diligenciado los campos ocultos de responsable, vuelve a habilitarlos
			<?php if(Session::has('responsable_id')): ?>
				o.fadeIn();
				$('#cbx-es-responsable').attr('checked', 1)
			<?php endif; ?>

			$('#archivo_firma').on('change', function(event){
				var ubiacion = URL.createObjectURL(event.target.files[0]);
				$('#imagen-output').attr('src', ubiacion);
				$('input[name=ubicacion_firma]').val(ubiacion);
			});
		});
	</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.admin-bloqueo-vista', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>