<?php
echo form_open('employees/save_password/'.$person_info->person_id,array('id'=>'employee_form'));
?>
<div class="field_row clearfix">	
<?php echo form_label($this->lang->line('employees_username').':', 'username',array('class'=>'required','style'=>'font-weight:bold;width: 98px;')); ?>
	<div class='form_field'>
	<?php echo form_input(array(
		'name'=>'username',
		'id'=>'username',
		'readonly'=>'true',
		'value'=>$person_info->username),'',' size="50" style="border: 1px solid #FF0000;"');?>
	</div>
</div>

<?php
$password_label_attributes = array('class'=>'required','style'=>'font-weight:bold;width: 98px;');
?>

<div class="field_row clearfix">	
<?php echo form_label($this->lang->line('employees_old_password').':', 'old_password',$password_label_attributes); ?>
	<div class='form_field'>
	<?php echo form_password(array(
		'name'=>'old_password',
		'id'=>'old_password'
	),'',' size="50" style="border: 1px solid #FF0000;"');?>
	</div>
</div>
<div class="field_row clearfix">	
<?php echo form_label($this->lang->line('employees_password').':', 'password',$password_label_attributes); ?>
	<div class='form_field'>
	<?php echo form_password(array(
		'name'=>'password',
		'id'=>'password'
	),'',' size="50" style="border: 1px solid #FF0000;"');?>
	</div>
</div>


<div class="field_row clearfix">	
<?php echo form_label($this->lang->line('employees_repeat_password').':', 'repeat_password',$password_label_attributes); ?>
	<div class='form_field'>
	<?php echo form_password(array(
		'name'=>'repeat_password',
		'id'=>'repeat_password'
	),'',' size="50" style="border: 1px solid #FF0000;"');?>
	</div>
</div>

<div class="field_row clearfix" style="text-align: center;">
<?php
echo form_submit(array(
	'name'=>'submit',
	'id'=>'submit',
	'value'=>"Update Password",
	'class'=>'button_thickbox button_thickbox_blue')
);

?>
</div>
<!--

<fieldset id="employee_permission_info">
<ul id="permission_list" style="display: none">
<?php
foreach($all_modules->result() as $module)
{
?>
<li>	
<?php //echo form_checkbox("permissions[]",$module->module_id, $this->Employee->has_permission($module->module_id,$person_info->person_id)); ?>
<?php echo form_checkbox("permissions[]",$module->module_id, true); ?>
<span class="medium"><?php echo $this->lang->line('module_'.$module->module_id);?>:</span>
<span class="small"><?php echo $this->lang->line('module_'.$module->module_id.'_desc');?></span>
</li>
<?php
}
?>
</ul>
<?php
echo form_submit(array(
	'name'=>'submit',
	'id'=>'submit',
	'value'=>$this->lang->line('common_submit'),
	'class'=>'submit_button float_right')
);

?>
</fieldset>
-->
<?php 
echo form_close();
?>
<script type='text/javascript'>

//validation and submit handling
$(document).ready(function()
{
	$('#employee_form').validate({
		submitHandler:function(form)
		{
			$(form).ajaxSubmit({
			success:function(response)
			{
				tb_remove();
				post_person_form_submit(response);
			},
			dataType:'json'
		});

		},
		errorLabelContainer: "#error_message_box",
 		wrapper: "li",
		rules: 
		{
			username:
			{
				required:true,
				//minlength: 5
			},
			
			old_password:
			{
				required:true,
				//minlength: 8
			},
			password:
			{
				required:true,
				//minlength: 8
			},	
			repeat_password:
			{
 				equalTo: "#password"
			}
   		},
		messages: 
		{
     		username:
     		{
     			required: "<?php echo $this->lang->line('employees_username_required'); ?>",
     			minlength: "<?php echo $this->lang->line('employees_username_minlength'); ?>"
     		},
     		
			old_password:
			{
				required:"<?php echo $this->lang->line('employees_old_password_required'); ?>",
			},
			password:
			{
				required:"<?php echo $this->lang->line('employees_password_required'); ?>",
				minlength: "<?php echo $this->lang->line('employees_password_minlength'); ?>"
			},
			repeat_password:
			{
				equalTo: "<?php echo $this->lang->line('employees_password_must_match'); ?>"
     		}
		}
	});
});
</script>