<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<?php $this->load->view('template/head.php'); ?>
<?php $this->load->view('template/header_admin.php'); ?>
<section>
	<div id="container">
		<h3 class="text-center"><?= $titulo ?></h3>
	</div>
	<a href="<?php echo base_url('permisos') ?>" class="btn btn-info">Regresar a lista de permisos</a>
	<div class="row contenedor-form">
		<?php
		$form_data         = ['name'       => 'crear-permiso-form',
		'id'         => 'crear-permiso-form',
		'class'      => 'create-form',
		'novalidate' => '',
	];
	$attributes_labels = ['class' => 'control-label'];
	?>
	<?php echo form_open(base_url('permisos/create'), $form_data); ?>
	<input type="hidden" name="TEX_MODULO" id="TEX_MODULO">
	<?php if (isset($permiso)): ?>
		<?= form_hidden('edit', 1) ?>
		<?= form_hidden('COD_PERMI', $permiso->COD_PERMI) ?>
	<?php endif; ?>

	<div class="row">
		<div class="col-lg-4 col-md-4" ">
			<div class="form-group input-type"> 
				<?php echo form_label('Nombre del permiso', 'TEX_NOMPERMI', $attributes_labels); ?>
				<div class="input-group">
					<div class="input-group-addon">
						<i class="fa fa-users"></i>
					</div>
					<?=
					form_input(['name'     => 'TEX_NOMPERMI',
						'id'       => 'TEX_NOMPERMI',
						'class'    => 'form-control',
						'required' => '',
						'readonly' => 'readonly',
						'value'    => (isset($permiso->TEX_NOMPERMI)) ? $permiso->TEX_NOMPERMI : ''])
						?>   
					</div>
				</div> 
			</div>
			<div class="col-lg-4 col-md-4" ">
				<div class="form-group input-type" style="width: 100%;"> 
					<?php  echo form_label('Seleccione el módulo', 'COD_MODULO', $attributes_labels); ?>
					<div class="input-group" style="width: 100%;">
						<select name="COD_MODULO"  id="COD_MODULO" class="form-control" required="required" <?= (@$permiso->TEX_MODULO)?'readonly':''  ?>>
							<option value=" ">Seleccione</option>
							<?php foreach ($modulos as $modulo): ?>
								<option style="font-weight: bold;"
								value="<?= $modulo->COD_MODULO ?>" <?= ($modulo->TEX_NOMMOD==@$permiso->TEX_MODULO)?'selected':'' ?>>
								<?= $modulo->TEX_NOMMOD ?></option>
							<?php endforeach; ?>
						</select> 
					</div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-lg-4 col-md-4">
				<div class="form-group input-type"> 
					<?php echo form_label('Tipo acción', 'TIPO_ACCION', $attributes_labels); ?>
					<div class="input-group">
						<div class="input-group-addon">
							<i class="fa fa-pencil"></i>
						</div>
						<?=
						form_input(['name'     => 'TIPO_ACCION',
							'id'       => 'TIPO_ACCION',
							'class'    => 'form-control',
							'required' => '',
							'value'    => (isset($permiso->TIPO_ACCION)) ? $permiso->TIPO_ACCION : ''])
							?>   
						</div>
					</div>
				</div>
				<div class="col-lg-4 col-md-4">
					<div class="form-group input-type"> 
						<?php echo form_label('Label', 'TEX_LABEL', $attributes_labels); ?>
						<div class="input-group">
							<div class="input-group-addon">
								<i class="fa fa-list"></i>
							</div>
							<?=
							form_input(['name'     => 'TEX_LABEL',
								'id'       => 'TEX_LABEL',
								'class'    => 'form-control',
								'required' => '',
								'value'    => (isset($permiso->TEX_LABEL)) ? $permiso->TEX_LABEL : ''])
								?>   
							</div>
						</div>
					</div>
				</div>	
				<?php if($modulo->COD_MODULO == 23):   ?>
					<div class="row">
						<div class="col-lg-4 col-md-4"></div>
						<div class="col-lg-4 col-md-4">
							<div class="form-group input-type"> 
								<label for="BOL_VOTACION" class="control-label input-group">En votación (Si se activa no se mostrará durante el proceso votación)
								</label>
								<div class="btn-group" data-toggle="buttons">
									<label class="switch btn btn-primary <?= (@$permiso->BOL_VOTACION) ? 'active' : '' ?>" data-toggle="button">
										<?= form_radio('BOL_VOTACION', '1', (@$permiso->BOL_VOTACION) ? true : '') ?>NO MOSTRAR
									</label>
									<label class="switch btn btn-primary <?= (@$permiso->BOL_VOTACION) ? '' : 'active' ?>" data-toggle="button">
										<?= form_radio('BOL_VOTACION', '0', (@$permiso->BOL_VOTACION) ? '' : true) ?>MOSTRAR
									</label>
								</div>
							</div>
						</div>
					</div>
				<?php endif;  ?>
				<div class="boton-submit">
					<div class="input-group">
						<a href="<?php echo base_url($route) ?>" class="btn btn-danger" style="margin-right: 10px;">Regresar</a>
						<input type="submit" value="Guardar" class="btn btn-default">
					</div>
				</div>

			</div>
		</div>
		<?php echo form_close(); ?>
	</section>
	<?php
	$data_view['loajs'] = $load_js;
	$this->load->view('template/footer.php', $data_view);
	?>