MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/hrms_cafsinfotech_in/application/views/employment_confirmation/form.php
<?php 
// $prime_id             = "prime_".$controller_name."_id";
$prime_id             = "prime_employees_id";
$form_id              = $controller_name."_form";
$access_data    	  = $this->session->userdata('access_data');
$access_deletess  	  = (int)$access_data[$controller_name]['access_delete'];
$count                = 0;
$date_exist           = false;
$date_time_exist      = false;
$drop_exist           = false;
$view_count           = 0;
$view_content         = "";
$document_load_script = "";
$validation_rule      = "";
	$input_box    		  = "";
foreach($form_info as $setting){
	$prime_form_id   = (int)$setting->prime_form_id;
	$field_type      = $setting->field_type;
	$label_id        = $setting->label_name;
	$label_name      = ucwords($setting->view_name);
	$mandatory_field = $setting->mandatory_field;
	$input_for       = (int)$setting->input_for;
	$field_isdefault = (int)$setting->field_isdefault;
	$default_value   =  $setting->default_value;
	$file_type       = $setting->file_type;	
	$extension       = $setting->upload_extension;
	$upload_filesize = $setting->upload_file_size;	
	$pick_table      = $setting->pick_table;
	$pick_list       = $setting->pick_list;
	$input_view_type = (int)$setting->input_view_type;
	$input_for       = (int)$setting->input_for;
	$field_length    = $setting->field_length;
	$text_type       = (int)$setting->text_type;
	$date_type       = (int)$setting->date_type;
	$edit_read       = (int)$setting->edit_read;
	$depen_pick_list = (int)$setting->dependent_pick_list;
	$depen_pick_input= $setting->dependent_pick_input;
	$table_column1   = $setting->table_column1;
	$table_column2   = $setting->table_column2;
	$prime_module_id = $setting->prime_module_id;
	$pick_display_val = $setting->pick_display_value;
	$read = '';
	$rem_readOnly     = array("conf_sts" => "conf_sts","ext_period" => "ext_period",);//"conf_date" => "conf_date",
	
	// if(((int)$edit_read === 1) && ((int)$form_view->$prime_id)){
		//if($setting->$label_id){
			if(!$rem_readOnly[$label_id]){
				$read = 'readonly';
			}
		//}
	// }
		
	$required = "";
	if((int)$mandatory_field === 1){
		$required = "required";
	}
	if($form_view->$label_id){
		$input_value = $form_view->$label_id;
	}else{
		$input_value = $default_value;
	}
	// if($prime_form_view_id === $input_for){
		/*=================== FORM INPUT PROCESS - START ===================*/
		$form_label = form_label($label_name, $label_id, array('class' => "control-label $required"));	
		$valid_class = "alpha";
		if(((int)$field_type === 3) ||((int)$field_type === 11)){
			$valid_class = "number";
		}
		if((int)$field_type === 2){
			$valid_class = "decimal_no";
		}						
		//TEXT BOX
		if((int)$field_type === 1){
			if($text_type === 1){
					$valid_class = "alpha_text";
				}else
				if($text_type === 2){
					$valid_class = "alpha";
				}else
				if($text_type === 3){
					$valid_class = "number";
				}
			$input_value = str_replace('^',"'",$input_value);
			$form_input = form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$input_value,"placeholder"=>$label_name, $read=>true,"class"=>"form-control input-sm $valid_class"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}else
		//DECIMALS
		if((int)$field_type === 2){
			$form_input = form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$input_value,"placeholder"=>$label_name, $read=>true, "class"=>"form-control input-sm $valid_class"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}else
		//INTEGER
		if((int)$field_type === 3){
			$form_input = form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$input_value,"placeholder"=>$label_name, $read=>true, "class"=>"form-control input-sm $valid_class"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}else
		//DATE
		if((int)$field_type === 4){
			$date_exist = true;
			$date = "";
			if($input_value){
				if((int)$date_type === 1){
					$date = date('d-m-Y',strtotime($input_value));
					if($date === "01-01-1970" || $date ==="30-11--0001"){
						$date = "";
					}
				}else{
					$date = $input_value;
				}
			}
			if((int)$date_type === 1){
				$datepicker = "datepicker";
			}else
			if((int)$date_type === 2){
				$datepicker = "datepicker_month";
			}else
			if((int)$date_type === 3){
				$datepicker = "datepicker_year";
			}
			$form_input =  form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$date,"placeholder"=>$label_name, $read=>true, "class"=>"form-control input-sm $datepicker"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}else
		//PICKLIST
		if((int)$field_type === 5){
			$drop_exist = true;
			$drop_down_array = array("name" => $label_id,"id" => $label_id,"class" =>'form-control input-sm select2');
			if($read){
				$drop_down_array['readonly'] = 'readonly';
			}
			$form_dropdown =  form_dropdown($drop_down_array,$all_pick[$label_id]['array_list'] ,$input_value);
			$input_box .= "<div class='form-group'>$form_label $form_dropdown</div>";
		}else
		//CHECKBOX
		if((int)$field_type === 6){
			$checkbox_array = array("name" => $label_id,"id" => $label_id, "value"=> 1, "checked" => ($input_value) ? 1 : 0);
			if($read){
				$checkbox_array['disabled'] = 'true';
			}
			$form_checkbox = form_checkbox($checkbox_array);
			$input_box .= "<div class='form-group'> <label class='checkbox-inline'> $form_checkbox $form_label </label></div>";
		}else
		//MULTI PICKLIST
		if((int)$field_type === 7){
			$drop_exist   = true;
			$multi_name   = $label_id."[]";
			$multi_pick[$label_id] = $multi_name;
			$multi_select = explode(',',$input_value);
			$drop_down_array = array("name" => $multi_name,"multiple id" => $label_id,"class" =>'form-control input-sm select2');
			if($read){
				$drop_down_array['readonly'] = 'readonly';
			}
			$form_dropdown = form_dropdown($drop_down_array,$all_pick[$label_id]['array_list'] ,$multi_select);
			$input_box .= "<div class='form-group'> $form_label $form_dropdown</div>";
		}else
		//TEXT AREA
		if((int)$field_type === 8){
			$value = str_replace("~",'"',$input_value);
			$value = str_replace("`","'",$value);
			$value = str_replace("^","&",$value);
			$input_box .= "<div class='form-group'> $form_label <textarea name='$label_id' id='$label_id' class='form-control' rows='4' placeholder='$label_name' $read = true>$value</textarea></div>";
		}else
		//AUTOCOMPLETE
		if((int)$field_type === 9){
			$hidden_id    = $label_id."_hidden_".$prime_form_id;
			$hidden_value = $all_pick[$label_id]['array_list'][$input_value];
			if($depen_pick_list === 1){
				$hidden_value = $auto_pick[$label_id][$input_value];
			}
			$autocomplete_array = array("name"=>$hidden_id, "id"=>$hidden_id,"value"=>$hidden_value,"placeholder"=>"Search ".$label_name, "class"=>"form-control input-sm");
			if($read){
				$autocomplete_array['readonly'] = 'readonly';
			}
			$form_input   = form_input($autocomplete_array);
			$hidden_input = form_input( array("name"=>$label_id, "id"=>$label_id,"value"=>$input_value,"type"=>"hidden"));
			$input_box   .= "<div class='form-group'>$form_label $hidden_input $form_input</div>";
		}else
		//FILE UPLOAD
		if((int)$field_type === 10){
			$value       = $input_value;
			$upload_id   = "upload_".$label_id;
			$tabel_id    = "table_".$label_id;
			$upload_old  = "old_".$label_id;
			$proof       = base_url("$value");
			$form_upload = form_upload(array('name' => $upload_id,'id' => $upload_id,'class' => 'form-control input-sm','value' => $input_value,'accept' => $file_type ));
			$remove_btn = "";
			$view_btn = "";
			if($value){
				$file_name = explode("/",$value);
				$file_name = $file_name[2];
				$file_ext_type  = explode(".", $value);
				$file_ext_type  = end($file_ext_type);
				$view_btn   = "<div onclick=view_upload_file('".$proof."','".$file_ext_type."');>$file_name<div>";
			}
			$row_send_data  .= "$upload_old:$('#$upload_old').val(),";
			
			$input_box .= "<div class='form-group'>
							$form_label 
							<input type='hidden' id='$label_id' name='$label_id' value='$value'>
							<input type='hidden' id='$upload_old' name='$upload_old' value='$value'>
							$form_upload
							<table style='width: 100%;' id='$tabel_id'>
								<tr>
									<td>$remove_btn</td>
									<td style='text-overflow: ellipsis; overflow: hidden; white-space: nowrap; max-width: 100px;'>$view_btn</td>
								</tr>
							</table>
							</div>";
		}else
		//MOBILE NUMBER
		if((int)$field_type === 11){
			$form_input = form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$input_value,"placeholder"=>$label_name,$read=>true,"class"=>"form-control input-sm $valid_class"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}else
		//EMAIL
		if((int)$field_type === 12){
			$form_input = form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$input_value,"placeholder"=>$label_name,$read=>true, "class"=>"form-control input-sm $valid_class"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}else
		//DATE & TIME
		if((int)$field_type === 13){
			$date_time_exist = true;
			$date = "";
			if($input_value){
				$date = "";
				if($input_value){
					$input_value = date('d-m-Y H:i:s',strtotime($input_value));
					$date = $input_value;
					if($date === "01-01-1970"){
						$date = "";
					}
				}
			}
			$form_input =  form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$date,"placeholder"=>$label_name,$read=>true, "class"=>"form-control input-sm datepicker_time"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}else
		//READ ONLY
		if((int)$field_type === 14){
			$read = '';
			if((int)$form_view->$label_id > 0){
				$read = 'readonly';
			}
			$form_input = form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$input_value,"placeholder"=>$label_name, $read => 'true',"class"=>"form-control input-sm $valid_class"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}else
		// TIME ONLY
		if((int)$field_type === 15){
			if($input_value){
				$time = $input_value;
			}else{
				$time = "00:00";
			}
			$form_input =  form_input(array("name"=>$label_id, "id"=>$label_id,"value"=>$time,"placeholder"=>$label_name, $read=>true, "class"=>"form-control input-sm only_time"));
			$input_box .= "<div class='form-group'>$form_label $form_input</div>";
		}
		/*=================== FORM INPUT PROCESS - END ===================*/
		
		/*================ FORM VALIDATION SCRIPT - START ================*/		
		$required = "";
		if((int)$mandatory_field === 1){

			$required = "required: true,";
		}
		/*================= FORM VALIDATION SCRIPT - END =================*/
	// }
	
}
	// $view_content .= $input_box;
// }
$view_content  = "<h4 class='block_head'>Confirmation Details</h4>
				<div id='employee_details' class='block_content pd8'>
					$input_box
				</div>";
$view_content  = str_replace("@TABLI",$tab_li,$view_content);
$view_content  = str_replace("@TABCONTENT",$tab_content,$view_content);
$form_open     = form_open("$controller_name/save/".$primeId,array("id"=>$form_id,"class"=>"form-inline"));
$form_close    = form_close();
$prime_inupt   = form_input( array("name"=>$prime_id, "id"=>$prime_id,"value"=>$primeId,"type"=>"hidden"));

echo "$form_open
		<fieldset id='FundBasicInfo' style='margin:0px;padding:8px;background-color:#f2f2f2;'>
			$prime_inupt
			$view_content
		</fieldset>
	$form_close";
//User Role Based Condition BSK
$user_read_only = "";
if($role_based_condition){
	foreach ($role_based_condition as $key => $condition) {
		if($key === "readonly"){
			if($condition !== ""){
				$condition = str_replace(",", ",#", $condition);
				$user_read_only = "$('#".$condition."').attr('readonly','readonly');";
			}
		}
	}
}

?>
<script type="text/javascript">
$(document).ready(function(){
	<?php echo $user_read_only; ?>   
	var prime_id         = "#<?php echo $prime_id;?>";
	var form_id          = "#<?php echo $form_id;?>";
	var date_exist       = "<?php echo $date_exist;?>";
	var date_time_exist  = "<?php echo $date_time_exist;?>";
	if(date_exist === "1"){
		$(function () {
			$(".datepicker").datetimepicker({
				format: 'DD-MM-YYYY',
				//debug: true
			});
			$(".datepicker_month").datetimepicker({
				format: 'MM-YYYY',
				//debug: true
			});
			$(".datepicker_year").datetimepicker({
				format: 'YYYY',
				//debug: true
			});
		});
	}
	$('.only_time').datetimepicker({
        format: 'HH:mm',
    });
	if(date_time_exist === "1"){
		$(function () {
			$(".datepicker_time").datetimepicker({
				format: 'DD-MM-YYYY HH:mm:ss',
				//debug: true
			});
		});
	}
	var drop_exist = "<?php echo $drop_exist;?>";
	if(drop_exist === "1"){
		$(function(){
			$('.select2').select2({
				placeholder: '---- Select ----',
				allowClear: true,
				dropdownParent: $('.modal-dialog')
			});
			$('.select2-tags').select2({
				tags: true,
				tokenSeparators: [',']
			});
		});
	}
	
	$('textarea').on('keyup keypress', function(e) {
		if(e.keyCode === 13) {    
			e.stopPropagation();
		}else
		if(e.shiftKey){
			e.stopPropagation();
		}
	});
	$(".number").bind('keyup', function(e) {
		this.value = this.value.replace(/[^0-9]/g,'');
	});
	$(".decimal_no").bind('keyup', function(e) {
		this.value = this.value.replace(/[^0-9_.]/g,'');
	});
	$('.alpha').bind('keypress', function (event) {
		var regex = new RegExp("^[a-zA-Z0-9\-_.@\/\\s]+$");
		var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
		if (!regex.test(key)) {
		   event.preventDefault();
		   return false;
		}
	});
	$(".alpha_text").keypress(function(event){
		var regex = new RegExp("^[a-zA-Z\\s]+$");
        var key = String.fromCharCode(!event.charCode ? event.which : event.charCode);
        if (!regex.test(key)) {
            event.preventDefault();
			return false;
		}
	});
	$.validator.setDefaults({ignore:[]});	
	$.validator.addMethod("alphanumeric", function(value, element) {
		return this.optional(element) || /^[a-z0-9\-\s]+$/i.test(value);
	}, "Allow only letters, numbers, or dashes.");
	
	$(form_id).submit(function(event){ event.preventDefault(); }).validate({
		ignore: ".ignore",
        invalidHandler: function(e, validator){
        	if(validator.errorList.length)
            $('.nav-tabs a[href="#' + $(validator.errorList[0].element).closest(".tab-pane").attr('id') + '"]').tab('show');
        },
		rules:{
			<?php echo $validation_rule; ?>
			
		},
		submitHandler: function (form){
			var conf_sts        = parseInt($('#conf_sts').val());
			var ext_period      = $('#ext_period').val();
			if(conf_sts === 3 && (ext_period === "0" || ext_period === "")){
				toastr.error("Please Choose Extend Period..!");
				return false;
			}else{
				//Encrypted
				let formData   = new FormData(form);
				// Convert FormData to JSON object
				let jsonData   = Object.fromEntries(formData.entries());
				var key        = '<?php echo $encKey; ?>';
				var encData    = encrypt(key,jsonData);
				$("#submit").html("<i class='fa fa-spinner fa-spin'></i> Processing...");
				$('#submit').attr('disabled','disabled');
				$.ajax({
					url         : $(form).attr('action'), 
					type        : 'POST',
					contentType : 'text/plain', 
					data        : encData,
					success: function (response){
						$('#submit').attr('disabled',false);
						$("#submit").html("Submit");
						if(response.success){
							$(prime_id).val(response.insert_id);
							$('.row_btn').show();
							$('.modal').modal('hide');
							toastr.success(response.message);
							//$('#table').DataTable.reload();
							$('#table').DataTable().ajax.reload();
						}else{
							toastr.error(response.message);
						}
					},
					dataType: 'json'
				});
			}
			
		}
	});
	/* LOAD SCRIPT AND CONDITION LOAD */
	<?php
		echo "$document_load_script";
		foreach($condition_list as $list){
			echo $list;
		}
	?>
	/* LOAD SCRIPT AND CONDITION LOAD */

	//----------------------- DR STATIC CODE START -------------------------------------
	var conf_sts        = parseInt($('#conf_sts').val());
	var conf_date       = $('#conf_date').val();
		
	//HIDE AND SHOW FUNCTION
	conf_hide_show(conf_sts);
	//ON CHANGE PROCESS
	$("#conf_sts").change(function(e){	
		var conf_sts      = parseInt($('#conf_sts').val());
		//HIDE AND SHOW FUNCTION
		conf_hide_show(conf_sts,);
	});

	/*$("#conf_date").on("dp.hide",function (e) {
		var conf_sts          = parseInt($('#conf_sts').val());
		var on_conf_date      = $('#conf_date').val();
		var conf_date_for     = moment(on_conf_date, 'DD-MM-YYYY').format('YYYY-MM-DD');
		var today             = moment(new Date(), 'DD-MM-YYYY').format('YYYY-MM-DD');
		//HIDE AND SHOW 
		if(today >= conf_date_for){
			toastr("Please Choose Confirmation Date in Future Date..!");
		}
	});*/
	//----------------------- DR STATIC CODE END --------------------------------------
});

//CONFIRMATION HIDE AND SHOW FUNCTION
function conf_hide_show(conf_sts){
	// $('#conf_date').parent().hide();
	if(conf_sts !== 3){
		// $('#conf_date').parent().hide();
		$('#ext_period').parent().hide();
	}else{
		// $('#conf_date').parent().show();
		$('#ext_period').parent().show();
	}
}
</script>