<?php $__env->startSection('CSS'); ?>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('Contenido'); ?>
<div class="row">
	<div class="col-md-12">
		<h2><i class="fa fa-list"></i> Asignación de modulos a usuario </h2>
	</div>
</div>

<div class="row">
	<div class="col-md-12">
		<div class="block-web">
			<div class="header"> <h3 class="content-header"> Modulos asignados al usuario <strong> <?php echo $Usuario->username; ?> </strong> </h3> </div>
			<div class="porlets-content">
				<?php echo Form::open(array('route' => array('SysWebUsuariosModulosSistema', $Usuario->id), 'method' => 'post', 'class' => 'form-horizontal row-border', 'id' => 'frmAgregar')); ?>

					<div class="form-group">
						<div class="col-sm-12">
							<?php foreach($ModulosSistema as $ModuloSistema): ?>
							<?php $checked = (in_array($ModuloSistema->id, $idsMSU))?'checked':''; ?>
							<label class="checkbox-inline">
								<input type="checkbox" name="chModulo[]" value="<?php echo $ModuloSistema->id; ?>" <?php echo $checked; ?>>
								<span class="custom-checkbox"></span> <?php echo $ModuloSistema->nombre; ?>

							</label>
							<?php endforeach; ?>
						</div>
					</div>
					<div class="bottom">
						<?php echo Form::button('Asignar', array('class' => 'btn btn-primary', 'id' => 'btnAgregar', 'type' => 'submit')); ?>

						<?php echo HTML::linkRoute('SysWebUsuarios', 'Cancelar', array(), array('class' => 'btn btn-default')); ?>

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

		</div>
		
	</div>
</div><!--/row end-->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JS'); ?>
<?php /* HTML::script('WebPro/plugins/ckeditor-new/ckeditor.js') */ ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JSOr'); ?>
$("#frmAgregar").submit(function(e){
	$("#btnAgregar").html('<i class="fa fa-spinner fa-spin"></i> Cargando').prop("disabled", true);
	e.preventDefault();
	$.post(
		"<?php echo URL::route('SysWebUsuariosModulosSistema', array($Usuario->id)); ?>",
		$("#frmAgregar").serialize(),
		function(data){
			$("#btnAgregar").html("Agregar").prop("disabled", false);
			if(data.success){
				new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
				setTimeout( function(){ window.location.href = "<?php echo URL::route('SysWebUsuariosModulosSistema', array($Usuario->id)); ?>"; }, 3000 );
			}
			else{
				if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
				$.each(data.errMensajes, function(key, value){ if(value != ''){ $("#err"+key).html(value); } else{ $("#err"+key).html(""); } });
			}
		},
		"json"
	);
});
<?php $__env->stopSection(); ?>
<?php echo $__env->make('BaseSistemaWeb', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>