<?php $this->load->view('header');?>

	<div class="row-fluid">
		<div class="span12">

			<!-- BEGIN PAGE TITLE & BREADCRUMB-->

			<h3 class="page-title"><?php echo $this->lang->line('hf_edit_admin');?> </h3>

			<ul class="breadcrumb">

				<li><i class="icon-home"></i><a href="<?php echo base_url();?>home/"><?php echo $this->lang->line('hf_home');?></a> <i class="icon-angle-right"></i></li>
				<li><?php echo $this->lang->line('hf_admin');?> <i class="icon-angle-right"></i></li>
				<li><?php echo $this->lang->line('hf_edit_admin');?></li>
			</ul>
			<!-- END PAGE TITLE & BREADCRUMB-->
		</div>
	</div>
	
	<div class="row-fluid">
		<div class="span12">
			<div class="portlet box blue">

				<div class="portlet-title">

					<div class="caption"><i class="icon-reorder"></i><?php echo $this->lang->line('hf_edit_admin');?></div>

				</div>
				
				<div class="portlet-body form">

					<!-- BEGIN FORM-->

					<form id="admin-form" class="form-horizontal" method="post" action="<?php echo base_url();?>admin/update/<?php echo $this->uri->segment(3);?>/" onsubmit="return validateForm('admin-form')">
						<?php 
							$alert_box = '';
							$alert_msg = '';
							
							if($this->session->userdata('form_msg_type') == 100) {
								$alert_box = 'success';
								$alert_msg = $this->session->userdata('form_msg');
							}
							else if($this->session->userdata('form_msg_type') == 200) {
								$alert_box = 'error';
								$alert_msg = $this->session->userdata('form_msg');
							}
							
							if($this->session->userdata('form_msg_type') == 100 OR $this->session->userdata('form_msg_type') == 200) {
								$this->session->unset_userdata(array('form_msg_type' => '', 'form_msg' => ''));
							}

							if( ! empty($alert_msg)) {
						?>
						<div class="alert alert-<?php echo $alert_box;?>">
							<button class="close" data-dismiss="alert"></button>
							<?php echo $alert_msg;?>
						</div>
						<?php }?>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('admin_real_name');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<input type="text" id="real_name" name="real_name" class="m-wrap span4" value="<?php echo isset($real_name) ? htmlspecialchars($real_name, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('admin_mobile_no');?>:</label>
							<div class="controls">
								<input type="text" id="mobile_no" name="mobile_no" class="m-wrap span4" value="<?php echo isset($mobile_no) ? htmlspecialchars($mobile_no, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('admin_email');?>:</label>
							<div class="controls">
								<input type="text" id="email" name="email" class="m-wrap span4" value="<?php echo isset($email) ? htmlspecialchars($email, ENT_QUOTES) : '';?>">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('admin_username');?>:</label>
							<div class="controls">
								<span class="text"><?php echo isset($username) ? $username : '';?></span>
								<input type="hidden" id="username" name="username" value="<?php echo isset($username) ? htmlspecialchars($username, ENT_QUOTES) : '';?>">
							</div>
						</div>

						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('admin_password');?>:</label>
							<div class="controls">
								<input type="password" id="password" name="password" class="m-wrap span4" value="">
								<span class="help-block"><?php echo $this->lang->line('admin_password_format_message');?></span>
							</div>
						</div>

						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('admin_confirm_password');?>:</label>
							<div class="controls">
								<input type="password" id="confirm_password" name="confirm_password" class="m-wrap span4" value="">
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label" ><?php echo $this->lang->line('admin_status');?>: <span class="mandatory">*</span></label>
							<div class="controls">
								<select id="status" name="status" class="m-wrap span4">
									<option value="P" <?php echo (isset($status) AND $status == 'P') ? 'selected="selected"' : ''?>><?php echo $this->lang->line('admin_pending');?></option>
									<option value="S" <?php echo (isset($status) AND $status == 'S') ? 'selected="selected"' : ''?>><?php echo $this->lang->line('admin_suspend');?></option>
									<option value="A" <?php echo (isset($status) AND $status == 'A') ? 'selected="selected"' : ''?>><?php echo $this->lang->line('admin_approve');?></option>
								</select>
							</div>
						</div>
						
						<div class="control-group">
							<label class="control-label"><?php echo $this->lang->line('admin_permission');?>: </label>
							<div class="controls">
								<select name="modules[]" multiple="multiple" id="modules-selector" class="m-wrap span4 modules-selector">
									<?php
										foreach ($module_list as $key => $var) {
											if (in_array($key, $modules)) {
												$selected = ' selected';
											} else {
												$selected = '';
											}

											echo sprintf('<option value="%s"%s>%s</option>', $key, $selected, $var);
										}
									?>
								</select>
							</div>
						</div>
						
						<div class="form-actions">
							
							<input class="no_display" type="hidden" id="<?php echo $this->security->get_csrf_token_name(); ?>" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
							<button type="submit" class="btn blue"><i class="icon-ok"></i> <?php echo $this->lang->line('admin_submit');?></button>

						</div>

					</form>

					<!-- END FORM-->  

				</div>
			</div>					
		</div><!-- End span12 -->
		
	</div> <!-- End Row Fluid -->

<?php $this->load->view('footer');?>