<?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>
	<div class="row contenedor-form caja-forms">
		<?php
		$form_data         = ['name'       => 'crear_form',
		'id'         => 'crear-form',
		'class'      => 'create-form',
		'novalidate' => '',
	];
	$attributes_labels = ['class' => 'control-label'];
	?>
	<?php echo form_open(base_url('textos/create'), $form_data); ?>
    <?php if (isset($texto)): ?>
             <?= form_hidden('edit', 1) ?>
             <?= form_hidden('ID_TEXTOS', $texto->ID_TEXTOS) ?>
         <?php endif; ?>
	<div class="col-lg-6 col-md-6">
		<div class="form-group input-type"> 
			<?php echo form_label('Valor Texto', 'TEX_VALOR', $attributes_labels); ?>
			<div class="input-group">
				<div class="input-group-addon">
					<i class="fa fa-key"></i>
				</div>
				<?=
				form_input(['name'     => 'TEX_VALOR',
					'id'       => 'TEX_VALOR', 
					'class'    => 'form-control',
					'required' => '', 'value'    => (isset($texto->TEX_VALOR)) ? $texto->TEX_VALOR : ''])
					?>   
				</div>
			</div> 
		</div>
		<div class="col-lg-6 col-md-6">
			<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">
						<option value=" ">Seleccione</option>
						<?php foreach ($modulos as $modulo): ?>
							<option style="font-weight: bold;"
							value="<?= $modulo->COD_MODULO ?>"
							<?= ($modulo->COD_MODULO === @$texto->COD_MODULO) ? 'selected' : '' ?>>
							<?= $modulo->TEX_NOMMOD ?></option>
						<?php endforeach; ?>
					</select> 
				</div>
			</div>
		</div>
		<div class="col-lg-12 col-md-12">
			<div class="form-group input-type"> 
				<?php echo form_label('Texto a mostrar', 'TEX_LABEL', $attributes_labels); ?>
				<div class="input-group">
					<div class="input-group-addon">
						<i class="fa fa-list"></i>
					</div>
					<?=
					form_textarea	([
						'name'     => 'TEX_LABEL',
						'id'       => 'TEX_LABEL', 
						'class'    => 'form-control',
						'required' => '',
						'rows' => 4,
						'value'    => (isset($texto->TEX_LABEL)) ? $texto->TEX_LABEL : ''])
						?>   
					</div>
				</div>
			</div>
			
			<div class="col-lg-12 col-md-12">
				<div class="form-group input-type"> 
					<?php echo form_label('Descripción', 'TEX_OBSERVACION', $attributes_labels); ?>
					<div class="input-group">
						<div class="input-group-addon">
							<i class="fa fa-list"></i>
						</div>
						<?=
						form_textarea	([
							'name'     => 'TEX_OBSERVACION',
							'id'       => 'TEX_OBSERVACION', 
							'class'    => 'form-control',
							'rows' => 4,
							'value'    => (isset($texto->TEX_OBSERVACION)) ? $texto->TEX_OBSERVACION : ''])
							?>   
						</div>
					</div>		
				</div>
				<div class="row">
					<div class="col-lg-12 col-md-12">
						<div class="boton-submit" style="margin-top: 10px;">
							<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>
					<?php echo form_close(); ?>
				</section>
				<?php
				$data_view['loajs'] = $load_js;
				$this->load->view('template/footer.php', $data_view);
				?>

