<?php 
session_start();
include '../db.php';
 include("../all_query.php");
//error_reporting(03

  	$page='';
	if(isset($_GET['page']))
	{
		$page=$_GET['page'];
	}

//echo $_SESSION['role'];
if($_SESSION['loan_crm_username'] && $_SESSION['loan_crm_password']){
	
		$page_name=$page;
	
	
	  
		    if(isset($_POST['add_submit']))
   			{
   				$_POST['add_submit']='submit_button';
				
					foreach(array_keys($_FILES) as $file_key)
				   {
					  
               
                       $image_name = $_FILES[$file_key]['name'];
					   
					   
                       $image_name = time().str_replace(" ","_",$image_name);					   
					   
					   move_uploaded_file($_FILES[$file_key]['tmp_name'],"../images/".$image_name);
					   
					   
					   $_POST[$file_key] = $image_name;
					   
				   }
				   
				    if(isset($_FILES['video']))
				   {
					  
               
                       $video_name = $_FILES['video']['name'];
					   
					   
                       $video_name = time().str_replace(" ","_",$video_name);					   
					   
					   move_uploaded_file($_FILES['video']['tmp_name'],"../video/".$video_name);
					   
					   
					   $_POST['video'] = $video_name;
					   
				   }
				   
				   foreach(array_keys($_POST) as $field)
				   {
					   
					  
					   
					if (strpos($field, '_ids') !== false || $field == 'show_in' ) {
				   
				  // $_POST[$field] = implode(",",json_decode(stripslashes($_POST[$field])));
				  
				 
					}
					
					if (strpos($field, '_access') !== false ) {
				   
				   $_POST[$field] = implode("+",json_decode(stripslashes($_POST[$field])));
				  
				 
					}
					
					
				 
					
					
					
					
					
					
					
					if (strpos($field, 'select_') !== false) {
						
						unset($_POST[$field]);
						
					}
					
					
					
					
				   }

				
				
				$is_need_save=true;
				
				if($page_name == 'advisors')
				{
				
				  $tAdvQ = mysqli_query($conn,"select *from `advisors` ");
				  if(mysqli_num_rows($tAdvQ) == 15)
				  {
				      $is_need_save=false;
				  }
				
				}
				
				
				
				if($is_need_save)
				{
   				insertTable($conn,$page_name,$_POST,'add_submit');
				}
   			}
			
			
			
			
			
			
			
			
			
   			
   			  if(isset($_POST['update_submit']))
   			{  $_POST['update_submit']='submit_button';
   				$id=$_POST['row_id'];
				
				
				foreach(array_keys($_FILES) as $file_key)
				   {
				 
				 if($_FILES[$file_key]['name'] !='')
				   {
					 
                       $image_name = $_FILES[$file_key]['name'];
                       $image_name = time().str_replace(" ","_",$image_name);					   
					   
					   move_uploaded_file($_FILES[$file_key]['tmp_name'],"../images/".$image_name);
					   
					   
					   $_POST[$file_key] = $image_name;
					   
				   }
				   else {
					    $_POST[$file_key] = $_POST[$file_key.'_h'];
					   
				         }
				   
				
				     unset($_POST[$file_key.'_h']);
				 
				
				   }
				
				
				if(isset($_POST['video_h']))
				{
				 if($_FILES['video']['name'] !='')
				   {
					 
                       $video_name = $_FILES['video']['name'];
                       $video_name = time().str_replace(" ","_",$video_name);					   
					   
					   move_uploaded_file($_FILES['video']['tmp_name'],"../video/".$video_name);
					   
					   
					   $_POST['video'] = $video_name;
					   
				   }
				   else {
					    $_POST['video'] = $_POST['video_h'];
					   
				         }
				   
				
				     unset($_POST['video_h']);
				}
				
				
				 foreach(array_keys($_POST) as $field)
				   {
					   
					if (strpos($field, '_ids') !== false  || $field == 'show_in' ) {
				   
				   $_POST[$field] = implode(",",json_decode(stripslashes($_POST[$field])));
				  
				 
					}
					
					if (strpos($field, '_access') !== false ) {
				   
				   $_POST[$field] = implode("+",json_decode(stripslashes($_POST[$field])));
				  
				 
					}
					
					
				 
					
					
					
					if (strpos($field, 'select_') !== false ) {
						
						unset($_POST[$field]);
						
					}
					
					
					
					
				   }
				   
				    
				   
				     
   
				   if($page_name == 'advisors')
				   {
					   if(!isset($_POST['is_auto_allocation']))
					   {
						   $_POST['is_auto_allocation'] = '';
					   }
					   
					   
					     if(!isset($_POST['is_busy_on_call']))
					   {
						   $_POST['is_busy_on_call'] = '';
					   }
					   
					    
					   
				   }
				   
				   
				    
				   
				   if($page_name == 'disposition')
				   {
					  
					    if(!isset($_POST['is_showdate']))
					   {
						   $_POST['is_showdate'] = '';
					   }
					   
					     if(!isset($_POST['is_amount']))
					   {
						   $_POST['is_amount'] = '';
					   }
					   
					       if(!isset($_POST['is_mode_of_payment']))
					   {
						   $_POST['is_mode_of_payment'] = '';
					   }
					    
						
						 if(!isset($_POST['is_scrap_phone']))
					   {
						   $_POST['is_scrap_phone'] = '';
					   }
					   
					   
					   
				   }

				   
				   
				   
				   
				   
				   
				   
				   


   				updateTable($conn,$page_name,$_POST,'update_submit',$id);
   				
   				
   			}
			if(isset($_POST['delete_submit']))
			{
				$id=$_POST['del_id'];
				deleteTable($conn,$page,$id);
			}
			
			
			
			  
  
    if (isset($_POST['member_activate_re']))
 {
	 $member_id= $_POST['member_id'];
	 $res=mysqli_query($conn,"update `$page` set `status1`='Activated'  where id = $member_id");
	 
	 if($page=='lead_owner_master')
	 {
		 mysqli_query($conn,"update `$page` set `is_auto_allocation`='on'  where id = $member_id and is_auto_allocation = 'off' ");
	 }
	 
  }
  
  
  	
 if (isset($_POST['member_deactivate']))
 {
	 $member_id= $_POST['member_id'];
	 $res=mysqli_query($conn,"update `$page` set `status1`='Deactivated'  where id = $member_id");
	 
	  if($page=='lead_owner_master')
	 {
		 mysqli_query($conn,"update `$page` set `is_auto_allocation`='off'  where id = $member_id and is_auto_allocation = 'on' ");
	 }
	 
  }
  
		 
		 
?>

	
	
<!DOCTYPE html>
 
<html lang="en" class="light-style layout-navbar-fixed layout-menu-fixed " dir="ltr" data-theme="theme-bordered" data-assets-path="../assets/" data-template="vertical-menu-template-bordered">
 
<head>
   <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />

    <title>CRM</title>
    
     <meta name="description" content="Start your development with a Dashboard for Bootstrap 5" />
    <meta name="keywords" content="dashboard, bootstrap 5 dashboard, bootstrap 5 design, bootstrap 5">
    <!-- Canonical SEO -->
    <link rel="canonical" href="https://1.envato.market/frest_admin">
    
    <!-- Favicon -->
    <link rel="icon" type="image/x-icon" href="https://pixinvent.com/demo/frest-clean-bootstrap-admin-dashboard-template/assets/img/favicon/favicon.ico" />

    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.googleapis.com/">
    <link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&amp;family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&amp;display=swap" rel="stylesheet">

    <!-- Icons -->
    <link rel="stylesheet" href="../assets/vendor/fonts/boxicons.css" />
    <link rel="stylesheet" href="../assets/vendor/fonts/fontawesome.css" />
    <link rel="stylesheet" href="../assets/vendor/fonts/flag-icons.css" />

    <!-- Core CSS -->
    <link rel="stylesheet" href="../assets/vendor/css/rtl/core.css" class="template-customizer-core-css" />
    <link rel="stylesheet" href="../assets/vendor/css/rtl/theme-bordered.css" class="template-customizer-theme-css" />
    <link rel="stylesheet" href="../assets/css/demo.css" />

    <!-- Vendors CSS -->
    <link rel="stylesheet" href="../assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.css" />
    <link rel="stylesheet" href="../assets/vendor/libs/typeahead-js/typeahead.css" />
    <link rel="stylesheet" href="../assets/vendor/libs/datatables-bs5/datatables.bootstrap5.css">
<link rel="stylesheet" href="../assets/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.css">
<link rel="stylesheet" href="../assets/vendor/libs/datatables-checkboxes-jquery/datatables.checkboxes.css">
<link rel="stylesheet" href="../assets/vendor/libs/datatables-buttons-bs5/buttons.bootstrap5.css">
<link rel="stylesheet" href="../assets/vendor/libs/flatpickr/flatpickr.css" />
<!-- Row Group CSS -->
<link rel="stylesheet" href="../assets/vendor/libs/datatables-rowgroup-bs5/rowgroup.bootstrap5.css">
<!-- Form Validation -->
<link rel="stylesheet" href="../assets/vendor/libs/formvalidation/dist/css/formValidation.min.css" />


    <!--! Template customizer & Theme config files MUST be included after core stylesheets and helpers.js in the <head> section -->
    <!--? Template customizer: To hide customizer set displayCustomizer value false in config.js.  -->
     <!--? Config:  Mandatory theme config file contain global vars & default theme options, Set your preferred theme option in this file.  -->
    <script src="../assets/js/config.js"></script>
	
	
	 <link rel="stylesheet" href="../assets/vendor/libs/toastr/toastr.css" />
	 <link rel="stylesheet" href="../assets/vendor/libs/animate-css/animate.css" />




    
    <!-- Page CSS -->
    	 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
   
   
   
   
  <link rel="stylesheet" href="../assets/vendor/libs/select2/select2.css" />

		 
	  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.min.js" integrity="sha384-FzT3vTVGXqf7wRfy8k4BiyzvbNfeYjK+frTVqZeNDFl8woCbF0CYG6g2fMEFFo/i" crossorigin="anonymous"></script>
   <script src="http://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-JAW99MJVpJBGcbzEuXk4Az05s/XyDdBomFqNlM3ic+I=" crossorigin="anonymous"></script>
	
	
	
  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert-dev.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.css">
  

  
  
  
    <!-- Helpers -->
    <script src="../assets/vendor/js/helpers.js"></script>

 
    <script src="../assets/js/config.js"></script>
    
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async="async" src="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>
    <script>
    window.dataLayer = window.dataLayer || [];

    function gtag() {
      dataLayer.push(arguments);
    }
    gtag('js', new Date());
    gtag('config', 'GA_MEASUREMENT_ID');
    </script>
    <!-- Custom notification for demo -->
    <!-- beautify ignore:end -->

</head>

<body>

 <?php
 require("phpexcel/php-excel-reader/excel_reader2.php");
	require('phpexcel/SpreadsheetReader.php');
 
   if(isset($_POST['upload_excel']))
   {
	   $filename=$_FILES['excelfile']['name'];
	   move_uploaded_file($_FILES['excelfile']['tmp_name'],'excel/'.$filename);
	   
	   date_default_timezone_set('UTC');

	$StartMem = memory_get_usage();


	try
	{
		$Filepath="excel/".$filename;
		$Spreadsheet = new SpreadsheetReader($Filepath);
		$BaseMem = memory_get_usage();

		$Sheets = $Spreadsheet -> Sheets();


		foreach ($Sheets as $Index => $Name)
		{
			

			$date = microtime(true);

			$Spreadsheet -> ChangeSheet($Index);
			
			
            $line=0;
			foreach ($Spreadsheet as $Key => $Row)
			{
				$line++;
				
				if($line!=1) {
				if ($Row)
				{
					
					$data= get_all_column($conn,$page);
					  $p=0;
				
				$RECORD=array();
				 foreach($data as $field)
					  {    
											 
					if($field!='id' && $field!='date_time' && $field!='status' )
					  {  
					
					 
					$RECORD[$field] = $Row[$p];
					
					  $p++;
					
					  }
					  
					  }
				
				
				$save = 1;
					if(isset($RECORD['name']))
				 {
					 
                //$_POST['name']=str_replace('\' ', '\'', ucwords(str_replace('\'', '\' ', strtolower(mysqli_real_escape_string($conn,$_POST['name'])))));

				
                  $name = $RECORD['name'];
				
				   $alreadyQ=mysqli_query($conn,"select *from `$page`  where `name` ='$name' ");	
                    if(mysqli_num_rows($alreadyQ) > 0)	
					{
						
						$save = 0;
						
					}						
		
				

				}	

               if($save == 1)
			   {
				 insertTable($conn,$page,$RECORD,'add_submit');
					 
			   }
					
	 
					
				}
				}
				
			}
		
			
		}
		
	}
	catch (Exception $E)
	{
		die("Invalid Excel Format");
	}
	   
	   
	   
   }
  
 
 
 ?>
 
 
   <script>
   
   	 $(function () {
  const select2 = $('.select2');

  // Select2 Country
  if (select2.length) {
    select2.each(function () {
      var $this = $(this);
      $this.wrap('<div class="position-relative"></div>').select2({
        dropdownParent: $this.parent()
      });
    });
  }
});

 

 function selectIds(id)
   {
	   
	   
	   <?php $data= get_all_column($conn,$page_name);
                                    
                                 
                                    // print_r($data);
                                    foreach($data as $field)
                                    {    
									
									if (strpos($field, '_ids') !== false ||  strpos($field, '_access') !== false ||  $field == 'user_access' ||  $field == 'under_stage' ) {
                                      ?>
	     var dataArr<?php echo $field; ?> = [];
	 
	   $("#select_<?php echo $field; ?>_"+id+" option:selected").each(function()
{
    // Add $(this).val() to your list
	 dataArr<?php echo $field; ?>.push($(this).val()); 
});
var jsonString<?php echo $field; ?> = JSON.stringify(dataArr<?php echo $field; ?>);

   document.getElementById('<?php echo $field; ?>'+id).value=jsonString<?php echo $field; ?>;

									<?php } }  ?>


 
   }


   
   </script>
   
   
   <script>
 
 function deleteSelected(table)
 {
	 
	 if(confirm('Are you sure?'))
	 {
		   var dataArr = [];
		   
		 $("input:checkbox[name=delete_checkbox]:checked").each(function(){
    dataArr.push($(this).val());
});
		 
		 
		  var jsonString = JSON.stringify(dataArr);
		  
		  
		   if(dataArr.length == 0)
			  
			  {
				  toastr.warning("Please Select Record!"); 
			  }
			  else {
				  
				  
		    $.ajax({
      type: "POST",
      url: 'delete_records_ajax.php',
	    data: {record_ids:jsonString,table:table},
      success: function(data) {
	
	    // toastr.warning(data.trim()); 
		  
		 window.location="";
		 
		
		 }
		  // <- this turns it into synchronous

		  }
	   );
			  }
		  
		  
	 }
	 
	 
 }
 
 
 
 function selectAll()
 {
	 
	 if($("input:checkbox[name=delete_checkbox]").prop('checked') == true)
	 {
		  $("input:checkbox[name=delete_checkbox]").prop('checked', false);
	 }
	 
	 else{
	 $("input:checkbox[name=delete_checkbox]").prop('checked', true);
	 }
 }


</script>	

   
   				 
   
   <script>
   $(document).ready(function(){

     $('#myTable').DataTable( {
			  "ordering": false,
        dom: 'Bfrtip',

        buttons: 
		[
			
	  	  
	  {
        extend: 'copy',
       
		
      } , 
	  {
        extend: 'csv',
       
		
      } ,			
	  {
        extend: 'excel',
      
		
      },			
	  {
        extend: 'pdf',
       
		
      } , {
        extend: 'print',
		       

		
      } 
	  
	  
	  
	  ]
    } );
});
   </script>
  <!-- Layout wrapper -->
<div class="layout-wrapper layout-content-navbar  ">
  <div class="layout-container">

    
    




<!-- Menu -->

<?php include('left_sidebar.php'); ?>

<!-- / Menu -->

    

    <!-- Layout container -->
    <div class="layout-page">
      
      



<!-- Navbar -->

  
<?php include('header.php'); ?>



  
<!-- / Navbar -->

      

      <!-- Content wrapper -->
      <div class="container-xxl ">

        <!-- Content -->
        
  
	<h4 class="py-3 breadcrumb-wrapper mb-4"><?php echo  ucfirst(str_replace('_',' ',$page)); ?></h4>


							<div class="row" style="    margin-bottom: 10px;">
							
							 <div class="col-md-2">
								<button    type="button" class="btn btn-primary  " data-bs-toggle="modal" data-bs-target="#myModal" ><i class="fa fa-plus"></i>Add</button>
							
							</div>
		 
			
			   <div class="col-md-10" style="padding-left:30%;">
			 		   <form action="" enctype="multipart/form-data" method="post" style="    display: flex;">
					   
					     <div class="col-md-3">
						 <label>Upload Excel:</label>
					   <input  required class="control-form" type="file" name="excelfile" />
					   </div>
					     <div class="col-md-6"><br/>
					   <input  type="submit" name="upload_excel" value="Upload" class="btn btn-success">
					      <a  class="btn btn-primary" href="../export_to_excel.php?type=<?php echo $page; ?>"><i class="fa fa-arrow-down"></i>&nbsp;Export</a>

					   </div>
					   </form>
					   </div>
					   
					</div>							
						 
			 
					<!-- Modal -->
		  <div class="modal fade" id="myModal" role="dialog">
									<div class="modal-dialog">
			<!-- Modal content-->
		  <div class="modal-content">
				<div class="modal-header">
				
			  <h4 class="modal-title">Add New </h4>
			  	<a href=""><button type="button" class="btn-close" ></button></a>
			</div>
								<form  id="add_form_no"   method="post" enctype="multipart/form-data"  >
												<div class="modal-body">
												<div class="alert alert-success" style="display:none" id="message"></div>
 													
														<div class="row">
														
														
														
														<?php 
														        $data= get_all_column($conn,$page);
																 
																 $i=0;
																// print_r($data);
															foreach($data as $field)
															 {    
											 
														     if($field!='status1' && $field!='status' && $field!='vendor_id' &&   $field!='id' && $field!='date_time' )
															 {  $i++;
														?>
															<div class="col-md-6 col-sm-6">
																<div class="form-group form-group-default">
																	<label><?php if($field=='is_fridge') { echo "Freeze On/Off"; } else { $heading_label = str_replace('_id','',$field);  if($field=='description' && $page=='noc_master' ) { echo "Main Duties"; } else { echo ucfirst(str_replace('_',' ',$heading_label)); } } ?></label>
																	
																	
												 <?php 
										
										if($field == 'image' || $field == 'signature') {


										?>
										 <input  id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="file" class="form-control "  >
									  
										
										<?php }
										
										else if($field == 'video') {


										?>
										 <input  id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="file" class="form-control "  >
									  
										
										<?php }
										
										
										
										
										
										else if($field == 'password') {


										?>
										 <input  id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="password" class="form-control"  >
									  
										
										<?php }
										
										else if (strpos($field, 'is_') !== false) {
											

										?>
										<Br/>
										 <input  id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="checkbox"   >
									  
										
										<?php }
										
											else if (strpos($field, '_date') !== false) {


										?>
										 <input  id="<?php echo $field; ?>" value="<?php echo date('Y-m-d'); ?>"  name="<?php echo $field; ?>" type="date" class="form-control" required >
									  
										
										<?php }
										
										
										else if (strpos($field, 'time') !== false) {


										?>
										 <input  id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="time" class="form-control" required >
									  
									  
										<?php }
										
										
										else if (strpos($field, 'color') !== false) {


										?>
										 <input  id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="color" class="form-control" required >
									  
										
										<?php }
								 
										
										
										
											else if (strpos($field, '_ids') !== false) {
												
												$table_field_name = str_replace('_ids','',$field);


										?>
										
										 <input type="hidden" id="<?php echo $field; ?>0" name="<?php echo $field; ?>" value="" />
								
								
										  <select   name="select_<?php echo $field; ?>" id="select_<?php echo $field; ?>_0"  class="select2 selectpicker show-tick form-control <?php echo $field; ?>" data-live-search="true" multiple >
										 
										 <?php $catQ= mysqli_query($conn,"select *from `$table_field_name`   ");
										   while($catData=mysqli_fetch_assoc($catQ))
										   {
											    ?>
												
												<option   value="<?php echo $catData['id']; ?>"><?php echo $catData['name']; ?></option>
												<?php
											   
										   }

										 ?>
										 </select>
										 


									  
										
										<?php }
										
										
										
										
										
											else if (strpos($field, '_access') !== false) {
												
											 
										?>
										
										 <input type="hidden" id="<?php echo $field; ?>0" name="<?php echo $field; ?>" value="" />
								
								
										  <select   name="select_<?php echo $field; ?>" id="select_<?php echo $field; ?>_0"  class="selectpicker show-tick form-control <?php echo $field; ?>" data-live-search="true" multiple >
										 
										 
												<option selected  value="Admin">Admin</option>
												<option   value="Sales">Sales</option>
												<option   value="Process">Process</option>
												 
										 </select>
										 


									  
										
										<?php }
										
										
											else if ($field == 'under_stage') {
												
											 
										?>
										
										 <input type="hidden" id="<?php echo $field; ?>0" name="<?php echo $field; ?>" value="" />
								
								
										  <select   name="select_<?php echo $field; ?>" id="select_<?php echo $field; ?>_0"  class="selectpicker show-tick form-control <?php echo $field; ?>" data-live-search="true" multiple >
										 
										 
 												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>   value="new">New</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="assigned">Assigned</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="inprocess">Evalution</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="PFNOC">PFNOC</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="hold">Hold</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="counseling">Counseling</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="counseling_done">Counseling Done</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="partial_converted">Partial Converted</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="converted">Converted</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="completed">In-Process</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="ITA">ITA</option>
												<option <?php if($page_name == 'appointment_slots') { echo "selected"; } ?>  value="rejection">Rejection</option>
												<option  <?php if($page_name == 'appointment_slots') { echo "selected"; } ?> value="cancelled">Cancelled</option>
												<option  <?php if($page_name == 'appointment_slots') { echo "selected"; } ?> value="expired">Expired</option>
												 
												 
										 </select>
										 


									  
										
										<?php }
										 
										 
										
										
										else   if($field == 'description' || $field == 'brief_description' || $field == 'example_title') { ?>
										
										 <textarea id="<?php echo $field; ?>"  name="<?php echo $field; ?>"  class="form-control" placeholder="Enter <?php echo str_replace('_',' ',$field); ?>"></textarea>
										 
										 <?php } else if($field == 'type') { ?>
										 <select id="<?php echo $field; ?>"  name="<?php echo $field; ?>"  class="form-control">
										 
												
												<option value="series">Series/Album/Shows</option>
												<option value="movies">Movies</option>
												<option value="single">Single Video</option>
												 
										 </select>
										 
										 
										 
										<?php }
										
										
							else if (strpos($field, '_id') !== false &&  strpos($field, '_ids') !== true ) {
												
												$table_field_name = str_replace('_id','',$field);
												
 

										?>
										
										    
										  <select   name="<?php echo $field; ?>"  class="select2 form-select <?php echo $field; ?>" data-allow-clear="true"     >
										  <option value="0">None</option>
										 <?php $catQ= mysqli_query($conn,"select *from `$table_field_name`   ");
										   while($catData=mysqli_fetch_assoc($catQ))
										   {
											    ?>
												
												<option    value="<?php echo $catData['id']; ?>"><?php echo $catData['name']; ?></option>
												<?php
											   
										   }

										 ?>
										 </select>
										 


									  
										
										<?php }


											else if ($field=='update_category') {
												
 

										?>
									 
								
										  <select   name="<?php echo $field; ?>" id="select_<?php echo $field; ?>_0"  class="form-control <?php echo $field; ?>"  >
										
										 <option value="">Select</option>
										 <option value="Contacted">Contacted</option>
										 <option value="Non-Contacted">Non-Contacted</option>
										 </select>
										 


									  
										
										<?php }
										 



										else {?>

									  <input <?php if($i==1) { echo "autofocus"; } ?> id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="text" class="form-control <?php echo $field; ?>" placeholder="Enter <?php echo str_replace('_',' ',$field); ?>">
									  
										<?php }  ?>				
																	
																	
																</div>
															</div>
															
														  <?php }   } ?>
															
															
															
														</div>
													
												</div>
												<div class="modal-footer no-bd">
													<Button  onclick="selectIds('0');"  type="submit" id="addRowButton" name="add_submit" class="btn btn-primary" />Add</Button>
													<a href="" class="btn btn-danger">Close</a>
												</div>
												</form>
			<div class="modal-footer">
		  
				</div>
			  </div>
		   </div>
					</div>
				 	
			
					
			
		 
				 
				 
 
			
				 <div class="card card-datatable table-responsive text-nowrap" style="padding:10px;zoom:90%;">
                             	<table   id="myTable" class=" table border-top">
	 
						<thead  >
                                        
												<tr>
													<th style="width:60px;cursor:pointer;"><a onclick="selectAll();">Sel</a></th>
													<th style="width:40px;">Sr.no</th>
													
													<?php 
														        $datac= get_all_column($conn,$page);
																 
																 
																// print_r($data);
															foreach($datac as $field)
															 {    
											 
														     if($field!='status' &&  $field!='status1' && $field!='date_time' && $field!='id' && $field!='date_time' && $field!='auto_dial_type_ids'  )
															 {
														?>
															
													<th><?php   if($field=='is_fridge') { echo "Freeze On/Off"; } else {  $field = str_replace('_id','',$field); if($field=='description' && $page=='noc_master' ) { echo "Main Duties"; } else { echo ucfirst(str_replace('_',' ',$field)); } } ?></th>
													
																	 
															
														  <?php }   } ?>
															
													
													
													<?php  if($page_name=='qr_code_referer') { ?><th></th> <?php } ?>
												
												
													<th></th>
												<?php  if($page_name=='lead_owner_master' || $page_name == 'process_lead_owner_master') { ?><th></th> <?php } ?>
												
												
												 
													 
											</thead>
											
											<tbody>
											
											<?php
											 
											$data=get_all_data($conn,$page);
											$i=0;
											foreach($data as $row)
																		
										     {    
											 
											 $i++; ?>
   											
												<tr>
												 <td>
											   <input type="checkbox" name="delete_checkbox" value="<?php echo $row['id']; ?>" />
													
												</td>	
												
												
													<td><?php echo $i; ?></td>
													
													<?php 
													foreach($datac as $field)
															 {  
															  if($field!='status' &&  $field!='status1' &&  $field!='date_time' && $field!='id' && $field!='date_time' && $field!='auto_dial_type_ids'    )
															 {
																 
                                             
																 
																 
																 
													?>
												   <td><?php  if($field=='image' || $field=='signature') { ?>
					 <a href="../images/<?php  echo $row[$field];  ?>" target="_BLANK" ><img src="../images/<?php  echo $row[$field];  ?>" height="30" width="30" /></a>

					 <?php  }
					 
					else if($field=='video') { ?>
					 <a href="../video/<?php  echo $row[$field];  ?>" target="_BLANK" ><?php  echo $row[$field];  ?></a>

					 <?php  }
					 
					  else if (strpos($field, '_date') !== false) {
						  
						  echo date('d M y',strtotime($row[$field]));
						  
						  
					  }
					 
					   else if ($field=='user_access' || $field == 'under_stage') {
						  
						 $user_access = json_decode($row[$field],TRUE);
						  
						  $a_string =  str_replace('inprocess','evalution',implode(', ',$user_access));
						  $a_string =  str_replace('completed','inprocess',$a_string);
						  echo $a_string;
						  
 						  
					  }
					 
					 
					 else if (strpos($field, '_ids') !== false) {
						 
						 $row_ids = $row[$field];
												
												$table_field_name = str_replace('_ids','',$field);
												
					 $idsQ=mysqli_query($conn,"select *from `$table_field_name` where id in ($row_ids) ");
					 $ik=0;
					 while($idsData = mysqli_fetch_assoc($idsQ))
					 {
						 $ik++;
						 echo   $idsData['name'].'<br/>';
					 }
												
												
					 }
					 
					  else if (strpos($field, '_id') !== false && strpos($field, '_ids') !== true ) {
						 
						  $row_id = $row[$field];
												
												$table_field_name = str_replace('_id','',$field);
												
					 $idQ=mysqli_query($conn,"select *from `$table_field_name` where id = $row_id ");
					 $ik=0;
					 while($idData = mysqli_fetch_assoc($idQ))
					 {
						 $ik++;
						 echo   $idData['name'];
					 }
												
												
					 }





					 else { echo $row[$field]; } ?></td>
													 
															 <?php } } ?>
															 
															 
															 
															 
									<?php  if($page_name=='qr_code_referer') { ?>
									<td>
									
									<img src="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=https%3A%2F%2Fwww.visalynk.com%2Fqr_form.php?qr_code_referer_id=<?php echo $row['id']; ?>&choe=UTF-8"
									 style="width:100px;height:100px;" />
									 <a href="https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=https%3A%2F%2Fwww.visalynk.com%2Fqr_form.php?qr_code_referer_id=<?php echo $row['id']; ?>&choe=UTF-8" target="_BLANK" download >Download</a>
									</td> 
									<?php } ?>						 
															 
															 
															 
															 
															 
															 
													<td>
														<div class="form-button-action">
														
														
															
																<i style="cursor:pointer"   data-bs-toggle="modal" data-bs-target="#editRowModal<?php echo $row['id']; ?>" class="fa fa-edit"></i>
																
															
															
															<div class="modal fade" id="editRowModal<?php echo $row['id']; ?>" tabindex="-1" role="dialog" aria-hidden="true">
										<div class="modal-dialog" role="document">
											<div class="modal-content">
												<div class="modal-header no-bd">
													<h5 class="modal-title">
														<span class="fw-mediumbold">
														Edit</span> 
														<span class="fw-light">
															
														</span>
													</h5>
													<button type="button"  class="btn-close"  data-bs-dismiss="modal" aria-label="Close">
													 
													</button>
												</div>
												<form action="" method="post" enctype="multipart/form-data"  >
												<input type="hidden"  name="row_id" value="<?php echo $row['id']; ?>" />
												<div class="modal-body">
												
												 
										  <div class="row">
                                             <?php 
                                                $datac= get_all_column($conn,$page_name);
                                                
                                                
                                                // print_r($data);
                                                foreach($datac as $field)
                                                {    
                                                
                                                if($field!='status'  &&  $field!='status1'  &&    $field!='id' && $field!='date_time'  && $field!='new_to_read' )
                                                {
                                                ?>
                                             <div class="col-md-6 col-lg-6">
                                               <div class="form-group form-group-default">
                                                <label><?php  if($field=='is_fridge') { echo "Freeze On/Off"; } else {  $heading_label = str_replace('_id','',$field);  if($field=='description' && $page=='noc_master' ) { echo "Main Duties"; } else { echo ucfirst(str_replace('_',' ',$heading_label)); }  } ?></label>
												   
												       <?php 
										
										if($field == 'image' || $field=='signature') {


										?>
										<br/>
										  <img src="../images/<?php echo $row[$field];?>" height="100" width="100" />
										  
										 <input  id="<?php echo $field; ?>"  value="<?php echo $row[$field];?>"  name="<?php echo $field; ?>" type="file" class="form-control"  >
										  <input type="hidden" name="<?php echo $field; ?>_h" value="<?php echo $row[$field];?>" />
									  
										
										<?php }
										else if($field == 'video') {


										?>
										<br/>
										 <a target="_BLANK" href="../video/<?php echo $row['video']; ?>"><?php echo $row['video']; ?></a>
										 <input  id="<?php echo $field; ?>"  value="<?php echo $row[$field];?>"  name="<?php echo $field; ?>" type="file" class="form-control"  >
										  <input type="hidden" name="video_h" value="<?php echo $row[$field];?>" />
									  
										
										<?php } 



										else   if($field == 'password') {
											?>
											
									    <input id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="password" class="form-control" placeholder="Enter <?php echo ucfirst(str_replace('_',' ',$field)); ?>"  value="<?php echo $row[$field];?>" />
										
											<?php
											
										}
										
										else if (strpos($field, 'is_') !== false) {
											


										?>
										<Br/>
										 <input  id="<?php echo $field; ?>"  name="<?php echo $field; ?>" <?php if($row[$field]=='on') { echo "checked"; } ?> type="checkbox"   >
									   
										<?php }
										
										
										 
										
											else if (strpos($field, '_date') !== false) {


										?>
										 <input  id="<?php echo $field; ?>"   value="<?php echo $row[$field];?>"   name="<?php echo $field; ?>" type="date" class="form-control" required >
									  
										
										<?php }
										
										
										
											else if (strpos($field, 'time') !== false) {


										?>
										 <input  id="<?php echo $field; ?>"   value="<?php echo $row[$field];?>"   name="<?php echo $field; ?>" type="time" class="form-control" required >
									  
										
										<?php }
										
										else if (strpos($field, 'color') !== false) {


										?>
										 <input  id="<?php echo $field; ?>"   value="<?php echo $row[$field];?>"   name="<?php echo $field; ?>" type="color" class="form-control" required >
									  
										
										<?php }
										

											else   if($field == 'description' || $field == 'brief_description' || $field == 'example_title') { ?>
										
										 <textarea id="<?php echo $field; ?>"  name="<?php echo $field; ?>"  class="form-control" placeholder="Enter <?php echo str_replace('_',' ',$field); ?>"><?php echo $row[$field];?></textarea>
									  
										 <?php } else if($field == 'type') { ?>
										 <select id="<?php echo $field; ?>"  name="<?php echo $field; ?>"  class="form-control">
										 
												
												<option <?php if($row['type']=='series') { echo "selected"; } ?> value="series">Series/Album/Shows</option>
												<option  <?php if($row['type']=='movies') { echo "selected"; } ?> value="movies">Movies</option>
												<option  <?php if($row['type']=='single') { echo "selected"; } ?> value="single">Single Video</option>
												 
										 </select>
										 
										 
										 
										<?php }
										
										 
										
										
										
											else if (strpos($field, '_ids') !== false) {
												
												$table_field_name = str_replace('_ids','',$field);
												
												  $inst_array = explode(",",$row[$field]);


										?>
										
										 <input type="hidden" id="<?php echo $field; ?><?php echo $row['id']; ?>" name="<?php echo $field; ?>" value="" />
								<br/>
								
										  <select   name="select_<?php echo $field; ?>" id="select_<?php echo $field; ?>_<?php echo $row['id']; ?>"  class="select2 selectpicker show-tick form-control <?php echo $field; ?>" data-live-search="true" multiple >
										 
										 <?php $catQ= mysqli_query($conn,"select *from `$table_field_name`   ");
										   while($catData=mysqli_fetch_assoc($catQ))
										   {
											    ?>
												
												<option <?php if(in_array($catData['id'],$inst_array)) { echo "selected"; } ?>   value="<?php echo $catData['id']; ?>"><?php echo $catData['name']; ?></option>
												<?php
											   
										   }

										 ?>
										 </select>
										 


									  
										
										<?php }
										
										
												else if  (strpos($field, '_access') !== false) { 
													
													
                                                    $inst_array = explode("+",$row[$field]);


													 // $inst_array = json_decode($row[$field],TRUE);
													  
													  

												
											 
										?>
										
										 <input type="hidden" id="<?php echo $field; ?><?php echo $row['id']; ?>" name="<?php echo $field; ?>" value="" />
								
								
										  <select   name="select_<?php echo $field; ?>" id="select_<?php echo $field; ?>_<?php echo $row['id']; ?>"  class="selectpicker show-tick form-control <?php echo $field; ?>" data-live-search="true" multiple >
										 
										 
												<option  <?php if(in_array('Admin',$inst_array)) { echo "selected"; } ?>    value="Admin">Admin</option>
												<option  <?php if(in_array('Sales',$inst_array)) { echo "selected"; } ?>    value="Sales">Sales</option>
												<option  <?php if(in_array('Process',$inst_array)) { echo "selected"; } ?>    value="Process">Process</option>
												 
										 </select>
										 


									  
										
										<?php }
										 
										 
										 
												else if ($field == 'under_stage') {
													
													
													  $inst_array = json_decode($row[$field],TRUE);
													  
													  

												
											 
										?>
										
										 <input type="hidden" id="<?php echo $field; ?><?php echo $row['id']; ?>" name="<?php echo $field; ?>" value="" />
								
								
										  <select   name="select_<?php echo $field; ?>" id="select_<?php echo $field; ?>_<?php echo $row['id']; ?>"  class="selectpicker show-tick form-control <?php echo $field; ?>" data-live-search="true" multiple >
										 
										 
											 
 												<option  <?php if(in_array('new',$inst_array)) { echo "selected"; } ?>    value="new">New</option>
												<option  <?php if(in_array('assigned',$inst_array)) { echo "selected"; } ?>  value="assigned">Assigned</option>
												<option  <?php if(in_array('inprocess',$inst_array)) { echo "selected"; } ?>  value="inprocess">Evalution</option>
												<option  <?php if(in_array('PFNOC',$inst_array)) { echo "selected"; } ?>  value="PFNOC">PFNOC</option>
												<option  <?php if(in_array('hold',$inst_array)) { echo "selected"; } ?>  value="hold">Hold</option>
												<option  <?php if(in_array('counseling',$inst_array)) { echo "selected"; } ?>  value="counseling">Counseling</option>
												<option  <?php if(in_array('counseling_done',$inst_array)) { echo "selected"; } ?>  value="counseling_done">Counseling Done</option>
												<option  <?php if(in_array('partial_converted',$inst_array)) { echo "selected"; } ?>  value="partial_converted">Partial Converted</option>
												<option  <?php if(in_array('converted',$inst_array)) { echo "selected"; } ?>  value="converted">Converted</option>
												<option  <?php if(in_array('completed',$inst_array)) { echo "selected"; } ?>  value="completed">In-Process</option>
												<option <?php if(in_array('ITA',$inst_array)) { echo "selected"; } ?>   value="ITA">ITA</option>
												<option   <?php if(in_array('rejection',$inst_array)) { echo "selected"; } ?> value="rejection">Rejection</option>
												<option   <?php if(in_array('cancelled',$inst_array)) { echo "selected"; } ?> value="cancelled">Cancelled</option>
												
												<option   <?php if(in_array('expired',$inst_array)) { echo "selected"; } ?> value="expired">Expired</option>
												 
												 
												 
										 </select>
										 


									  
										
										<?php }
										 
										
										
											
											
											
											
											
											
											
												 
												 
												 
										

											else if ($field=='update_category') {
												
 

										?>
									 
								
										  <select   name="<?php echo $field; ?>" id="select_<?php echo $field; ?>_0"  class="form-control <?php echo $field; ?>"  >
										
										 <option value="">Select</option>
										 <option  <?php if($row[$field]=='Contacted') { echo "selected"; } ?>  value="Contacted">Contacted</option>
										 <option  <?php if($row[$field]=='Non-Contacted') { echo "selected"; } ?>  value="Non-Contacted">Non-Contacted</option>
										 </select>
										 


									  
										
										<?php }
										 
										 

							else if(strpos($field, '_id') !== false &&  strpos($field, '_ids') !== true ) {
												
												$table_field_name = str_replace('_id','',$field);
												
 

										?>
										<br/>
										 
										  <select   name="<?php echo $field; ?>"     class="select2 form-select <?php echo $field; ?>" data-allow-clear="true"     >
										 <option value="0">None</option>
										 <?php $catQ= mysqli_query($conn,"select *from `$table_field_name`   ");
										   while($catData=mysqli_fetch_assoc($catQ))
										   {
											    ?>
												
												<option <?php if($row[$field]==$catData['id']) { echo "selected"; } ?>   value="<?php echo $catData['id']; ?>"><?php echo $catData['name']; ?></option>
												<?php
											   
										   }

										 ?>
										 </select>
										 


									  
										
										<?php }
										 


										else {?>


									    <input id="<?php echo $field; ?>"  name="<?php echo $field; ?>" type="text" class="form-control <?php echo $field; ?>" placeholder="Enter <?php echo ucfirst(str_replace('_',' ',$field)); ?>"  value="<?php echo $row[$field];?>" />
										
										<?php }  ?>
									  
												   
												  
                                                
                                                </div>
                                             </div>
                                             <?php }   } ?>
                                         
                                       </div>
 													
													 

													 
												</div>
												<div class="modal-footer no-bd">
													<button onclick="selectIds('<?php echo $row['id']; ?>');"  type="submit" id="addRowButton" name="update_submit" class="btn btn-primary">Update</button>
													<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
												</div>
												
												</form>
											</div>
										</div>
									</div>

									
														
															
															<form   action="" method="post" onSubmit="return confirm('are you sure');">
															<input type="hidden" name="del_id" value="<?php echo $row['id']; ?>" />
															<button   style="color:red; background: none;
    border: none;   margin-top: -40px;
    margin-left: 40px;" type="submit" name="delete_submit" data-toggle="tooltip" title="" class="btn btn-link btn-danger" data-original-title="Remove">
																<i  class="fa fa-trash"></i>
																</button>
																</form>
																
																
															
														</div>
													</td>
													
													
													
													
													
													
													
												<?php  if($page_name=='lead_owner_master' || $page_name == 'process_lead_owner_master') { ?>	
													 <td>
							 
								 
								  <?php if(  $row['status1']=='Deactivated') { ?>			

						<form action="" method="post" onSubmit="return confirm('are you sure');">
                                <input type="hidden" name="member_id" value="<?php echo $row['id']; ?>" />
							    <button class="btn btn-info" name="member_activate_re"  >Activate</button>
                             </form>
															 
						
								 <?php }  ?>
								 
								  <?php if( $row['status1']=='Activated' || $row['status1']=='') { ?>							
							 <form  action="" method="post" onSubmit="return confirm('are you sure');">
                                <input type="hidden" name="member_id" value="<?php echo $row['id']; ?>" />
							    <button class="btn btn-danger" name="member_deactivate"  >Deactivate</button>
                             </form>
								 <?php }  ?>
									 
									
									 </td>
													
												<?php } ?>					
													
													
													
													
													
													
													
													
													
													
													
													
													
									 				
												</tr>
																		<?php }  ?>

												</tbody>
										</table>
										
										
									
				</div>
		
								 
		<a style="color:red; cursor:pointer"  onclick="deleteSelected('<?php echo $page; ?>');" style="margin-top: -100px;"  >Delete</a>
                              
                                </div>
                              
						
			
			
			
 
          
      
         </div>
        <!-- Content wrapper -->
      </div>
      <!-- / Layout page -->
    </div>

    
    			
			
<script>
			 $(function () {
				 sub();
				 function sub(){
					 
					 
					 
					 
$('#add_form').submit(function() {
	
	 $(':button[type="submit"]').prop('disabled', true);
	var form=$("#add_form");
 
    var vcfData = new FormData($('#add_form')[0]); 
	
	//alert(rem);
	 //alert("hello");
        $.ajax({ 
            
            type:"post",
            url:"save_master_form_ajax.php?table=<?php echo $page; ?>",
			data:vcfData,
			 contentType: false,
            cache: false,
            processData:false,
            success: function(data) {
				//alert(data);
           		
				
				if(data.trim() == '1')
				{
             
				 document.getElementById("message").innerHTML="Record Added Successfully!";
				 document.getElementById("message").style.display = "block";
				 document.getElementById("add_form").reset();
				 $(':button[type="submit"]').prop('disabled', false);
				 $('#add_form').find('input[type=text],textarea,select').filter(':visible:first').focus();
    
				setTimeout(function() {
						$('#message').hide();
						//$("#purity").focus();
					}, 1000); // <-- time in milliseconds

				}
				if(data.trim() == '0')
				{
					 document.getElementById("message").innerHTML="Duplicate Name Found ";
				 document.getElementById("message").style.display = "block";
				 document.getElementById("add_form").reset();
				 $(':button[type="submit"]').prop('disabled', false);
				 $('#add_form').find('input[type=text],textarea,select').filter(':visible:first').focus();
    
				setTimeout(function() {
						$('#message').hide();
						//$("#purity").focus();
					}, 1000); // <-- time in milliseconds

					
					
				}
				
				
				window.location='';
			
			   
            }
        });
        return false; 
    });
				 }
			 });
</script>			
				
						
    
  </div>
  <!-- / Layout wrapper -->

 

 <!-- Core JS -->
  <!-- build:js assets/vendor/js/core.js -->
  <script src="../assets/vendor/libs/jquery/jquery.js"></script>
  <script src="../assets/vendor/libs/popper/popper.js"></script>
  <script src="../assets/vendor/js/bootstrap.js"></script>
  <script src="../assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.js"></script>
  <script src="../assets/vendor/libs/hammer/hammer.js"></script>
  <script src="../assets/vendor/libs/i18n/i18n.js"></script>
  <script src="../assets/vendor/libs/typeahead-js/typeahead.js"></script>
  
  <script src="../assets/vendor/js/menu.js"></script>
  <script src="../assets/vendor/libs/select2/select2.js"></script>
  
    <script src="../assets/vendor/libs/toastr/toastr.js"></script>

     <script src="../assets/js/ui-toasts.js"></script>


  <!-- endbuild -->

  <!-- Vendors JS -->
  <script src="../assets/vendor/libs/datatables/jquery.dataTables.js"></script>
<script src="../assets/vendor/libs/datatables-bs5/datatables-bootstrap5.js"></script>
<script src="../assets/vendor/libs/datatables-responsive/datatables.responsive.js"></script>
<script src="../assets/vendor/libs/datatables-responsive-bs5/responsive.bootstrap5.js"></script>
<script src="../assets/vendor/libs/datatables-checkboxes-jquery/datatables.checkboxes.js"></script>
<script src="../assets/vendor/libs/datatables-buttons/datatables-buttons.js"></script>
<script src="../assets/vendor/libs/datatables-buttons-bs5/buttons.bootstrap5.js"></script>
<script src="../assets/vendor/libs/jszip/jszip.js"></script>
<script src="../assets/vendor/libs/pdfmake/pdfmake.js"></script>
<script src="../assets/vendor/libs/datatables-buttons/buttons.html5.js"></script>
<script src="../assets/vendor/libs/datatables-buttons/buttons.print.js"></script>
<!-- Flat Picker -->
<script src="../assets/vendor/libs/moment/moment.js"></script>
<script src="../assets/vendor/libs/flatpickr/flatpickr.js"></script>
<!-- Row Group JS -->
<script src="../assets/vendor/libs/datatables-rowgroup/datatables.rowgroup.js"></script>
<script src="../assets/vendor/libs/datatables-rowgroup-bs5/rowgroup.bootstrap5.js"></script>
<!-- Form Validation -->
<script src="../assets/vendor/libs/formvalidation/dist/js/FormValidation.min.js"></script>
<script src="../assets/vendor/libs/formvalidation/dist/js/plugins/Bootstrap5.min.js"></script>
<script src="../assets/vendor/libs/formvalidation/dist/js/plugins/AutoFocus.min.js"></script>

  <!-- Main JS -->
  <script src="../assets/js/main.js"></script>

  <!-- Page JS -->
  <script src="../assets/js/tables-datatables-basic.js"></script>
</body>

 
</html>
  <?php  }  else { header("Location:login.php");  } ?>