<?PHP
session_start();
$status = $_SESSION['status'];
$privilage = $_SESSION['privilage']; 

$background_color =$_SESSION['background_color'];
$text_color =$_SESSION['text_color'];

$bottom_backgroundcolor = $_SESSION['bottom_backgroundcolor'] ;
		$bottom_textcolor = $_SESSION['bottom_textcolor'] ;
$branch_key = $_SESSION['branch_key'];


$app_code = $_SESSION['app_code'];



if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
	header ("Location: ../login.php");
}

else if($privilage == "Priviledge" or $privilage == "Sales Rep" or $privilage == "Sales Rep" or $privilage == "Receptionist" or $privilage == "Inventory Manager" or $privilage == "Secetary"/*or $privilage == "Manager"*/)
{
	
	header ("Location: not_authorized.php");
	
}



//echo 'WELCOME'.'    '.$_SESSION['name'].'   '.'<A HREF = logout.php>Log out</A>';

?>

<?php


$app_name = $_SESSION['app_name'];
  $db_size = $_SESSION['db_size'];




$current_date = date("Y-m-d");
$activation_d = $_SESSION['activation_date'];
$expiration_d = $_SESSION['expiration_date'];
/*
$activation_d ="2013-03-15";
$expiration_d ="2013-03-30" ;

*/
//echo "<br>";






if($status === "inactive"){
//echo "it works";
	
	header ("Location: payment_activate.php");
	
 }



?>


<?php


$date1 = date_create("$current_date");

$date2 = date_create($expiration_d);

$date_diff = date_diff($date1,$date2);

  $date_diff->format("%a ")
	
	 ?>

<?php
	
	
if($date_diff->format("%R%a ") <0){
		
	header ("Location: expired_sub.php");
	}	
	  
	  

	
$notification = "";



if($date_diff->format("%a ") <=30){
		$notification = $date_diff->format("%a")."  "."days Remaining";
	}	
	
?>





<?php
	
	
	
	
	
	
	
require 'config.php';

$db_handle = mysqli_connect(DB_SERVER, DB_USER, DB_PASS);
$database = $_SESSION['database'];
//$database = "lawped_app";

$db_found = mysqli_select_db($db_handle, $database);




$SQL = "SELECT  date FROM txn_table where balance != 0 and  branch_key ='$branch_key' ORDER BY product_id ASC  ";
											
$result = mysqli_query($db_handle, $SQL);
  $txn_nbr = mysqli_num_rows($result);
 $progress = (mysqli_num_rows($result)/$db_size*100);





?>


<!DOCTYPE html>
<html lang="en">
<head>
	<title>Lawped</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	 <link rel="apple-touch-icon" sizes="76x76" href="./assets/img/apple-icon.png">
  <link rel="icon" type="image/png" href="assets/img/favicon.png">
	
	
	  <!--manifest file for pwa ap-->
	 <link href="manifest.json"  rel = "manifest">
	   <!--manifest file for pwa ap-->
	  
	  <!--ios support-->
	   <link href="img/icons/icon-96.png"  rel = "apple-touch-icon">
	  <meta name="apple-mobile-web-app-status-bar" content="#00695c">
	  <meta name="theme-color" content="#00695c">
	  <!--ios suppoer-->
	
	  <script src="app.js"></script>
	
	
<!--===============================================================================================-->	
		
	
 <script src="https://kit.fontawesome.com/42d5adcbca.js" crossorigin="anonymous"></script>
  <!-- Material Icons -->
  <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet">
  <!-- CSS Files -->
  <link id="pagestyle" href="assets/css/material-dashboard.css" rel="stylesheet" />
	
	 <link href="css/bootstrap-4.4.1.css" rel="stylesheet">
	 <link href="css/popup.css" rel="stylesheet">
<!--===============================================================================================-->
	
</head>
	
	 <script src="js/main.js"></script>
	
	
	
	<style>
		
		
	
		.btn {
 // background-color: DodgerBlue;
			
			 background-color: <?php echo  $bottom_backgroundcolor ?>;
  border: none;
  //color: white;
			
		color:<?php echo  $bottom_textcolor ?>;
  padding: 12px 16px;
  font-size: 16px;
  cursor: pointer;
}

/* Darker background on mouse-over */
.btn:hover {
 background-color: RoyalBlue;
	
	
}
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		.loader {
  border: 16px solid #f3f3f3;
  border-radius: 50%;
  border-top: 16px solid blue;
  border-right: 16px solid green;
  border-bottom: 16px solid red;
  border-left: 16px solid pink;
  width: 120px;
  height: 120px;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 1s linear infinite;
}

@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
		
		
		
		
		
		
		
		
		
		
		
		
		
	body, html {
background-color:<?php echo $bottom_backgroundcolor; ?>;
}

	
		
	
            div.scroll {
                //margin:4px, 4px;
                padding:4px;
               // background-color: #494747;
                width: 100%;
                height: 210px;
               // overflow-x: hidden;
               // overflow-y: auto;
				overflow: auto;
                text-align:justify;
            }
		
		div.scroll_history {
                //margin:4px, 4px;
               // padding:4px;
                background-color: #494747;
                width: 100%;
                height: 300px;
                //overflow-x: hidden;
                //overflow-y: auto;
				overflow: auto;
                text-align:justify;
            }
		
		
		div.scroll_body {
                margin:4px, 4px;
               // padding:4px;
                //background-color: green;
                width: 100%;
                height: 400px;
                overflow-x: hidden;
                overflow-y: auto;
				//overflow: auto;
                text-align:justify;
            }
		
		

	</style>

	<?php
	

	
	?>
	
<body onLoad= "<?php echo "customAlert.alert('$notification','Debtors Management ')"; ?>,unit_ac(),bulk_ac(),crude_ac(),spinner()">


	
	
	<!--newheader-->
	
	
	
	
	<!--new headeer-->
	
	
		<div class="jumbotron-fluid" style="background-color: #757672; color: #F0ECEC">
	
				
<?php 
		
	echo $_SESSION['name'].'   '.' (IDN '. $_SESSION['user_id'].' ) ';
			
			

		?>
			<div class="" style="float: right; color: #ED0307;"><a HREF = "logout.php" onClick="spinner()"><span style="color: #F9F833">Log out</span></a></div>
			<!--<button onclick="myFunction()">Click Me</button>-->
			

			
		</div>

	
			

	
	
		<div class="jumbotron" style="background-color:<?php echo $background_color; ?>; height: auto; text-align: center">
			
			
			<div style="color:;  "><h4><b><span style="color: <?php echo $text_color; ?>;  ">DEBT MANAGEMENT SYSTEM</span></b></h4></div>
	
			
			
			<div class="row">
		
				<div class="col-md-12" id="">
			
					<table style="margin: auto; width: auto" >
		
	
						<tr>
				
							<td>
					
					
							<!--	<input type="submit" value='CREDIT A/C' onClick="unit_ac()" class="btn btn-dark" style= "width: inherit; height: 70px" name = "A"  >-->
					
					
			
							</td>
	
							<!--<td>
		
								<a href="report_wizard.php"><input type="button" onClick="spinner()" value="Report" class="btn btn-info" style= "width: ; height: 70px" name = "A" ></a>
				
							</td>
	-->
							
							<td>
					
					 
							<!--<input type="submit" onClick="view_ac()" value="DEBTORS A/C" class="btn btn-dark" style= "width: inherit; height: 70px" name = "A" >-->
					
					
				
						</td>
							
							
						
							
							<!--<td>
		
								<a href="app_info.php"><input type="submit" value="APP info" class="btn btn-info" style= "width: inherit; height: 70px" name = "A" onClick="spinner()" ></a>
			
							</td>
	-->
	
	
				
						</tr>
		
					</table>
		
				</div>
	
    
			</div>
			
			
			
			<div class="row">
			
				<table style="margin: auto;width: auto" >
		
	
					<tr>
				
					<td>
					
					<a href="debtors.php"> <button class="" style= "width: inherit; height: "  onClick="spinner()">	  <i class="material-icons">arrow_back</i>  </button> 
					 
							<a href="dashboard.php"> <button class="" style= "width: inherit; height: "  onClick="spinner()">  <i class="material-icons">home</i>  </button> </a>
					
					
				
						</td>

							<td>
					
					 
							<a href="debtors.php">
								
								
								
								<button class="" style= "width: inherit; " onClick=" spinner()"><i class="fa fa-refresh"></i> </button>
								
								
								</a>
					
					
				
						</td>
						
						
						
						
						
						
						
						
						
						
						
						
						
						
						
						
						
	
	<!--
						<td>
		 
							<a href="add_user.php"> <input type="submit" value="Add users" onClick="spinner()" class="btn btn-danger" style= "width: inherit; height: 50px" name = "A"  ></a>
				
						</td>
	
	-->
	
					</tr>
			
			
				</table>
		
		
			
			</div>
				
	<!--
			<div class="row">
			
				<table style="margin: auto; width: auto"  >
		
	
					<tr>
				
						<td>
					
					 
							<a href="dashboard.php"><input type="button" value="Refresh" class="btn btn-danger" onClick=" spinner()" style= "width: inherit; height: 50px"  ></a>
					
					
				
						</td>
	
						<td>
		 
							<input type="button" value="Saved Receipts" class="btn btn-danger" style= "width: inherit; height: 50px" name = "A" onClick="window.alert('The page  you requsted is still under Development. Contact us (Alaye David 09055158742, head of iCT LAWPED GROUP,www.lawped.com.ng)')" >
				
						</td>
	
						<td>
		 
							<a href="setup_ac.php"><input type="submit" value="Setup" class="btn btn-danger" style= "width:inherit; height: 50px" name = "A" onClick= "spinner()" ></a>
				
						</td>
	
	
	
			
		
				</table>
	
			
		
				</tr>
			
	</div>
	
	<div class="row">
			
				<table style="margin: auto; width: auto"  >
		
	
					<tr>
				
						<td>
					
					 
							<a href=""><input type="button" value="HISTORY" class="btn btn-danger" onClick=" window.alert('still under development')" style= "width: inherit; height: 30px"  ></a>
					
					
				
						</td>
	
						<td>
		 
						<a href="database.php">	<input type="button" value="database" class="btn btn-danger" style= "width: inherit; height: 30px" name = "A" onClick="spinner()"  > </a>
				
						</td>
	
						<td>
		 
							<a href="customers.php"><input type="submit" value="customers" class="btn btn-danger" style= "width:inherit; height: 30px" name = "A" onClick="spinner()" ></a>
				
						</td>
	
	
	
			
		
				</table>
	
			
				</tr>
			
	</div>
			-->
	<div style="align-content: center; text-align: center; color:<?php echo $text_color; ?>"><?php echo $notification?>  </div>
	
	</div>
	
	
	
	
	<!--script to show recent inserted record-->
	
	
	
	<?php
			  //==================================================================================
			 //script to show recent inserted record
			//==================================================================================
	
	
	
	// echo $db_found_recent['amount'];
	
	  //===================================================================================
	  		?>
	
	<div style="text-align:  center;background-color:#050404; font-size: 2px ">
		<h6> <marquee behavior="scroll" style="color: #F7E81B"> <?php echo "you are welcome to"."  ".$_SESSION['biz_name']." ||  ".'your App'."  ".$_SESSION['app_code']."  ".'will be inactive on the'."  ". $expiration_d." || "."we are into:".$_SESSION['biz_nature'] ?>
		</marquee></h6>
</div>
	<!--script to show recent inserted record-->
	<div style="text-align:  center;background-color:; width: inherit; ">
		<h6>  
		</h6>
</div>	



	
	
	<div class="loader" id="spin" style="margin: auto"></div>
	
	
	
		<div class="container-fluid" style="" >
		
		
		
		
			<div class="jumbotron-fluid" style="background-color: ">
		
		
			
				<div class="row">
				
				
					<div class="col-md-4" style="padding-top: 8px" id="unit_ac">
					
						<div id="">
											
						
							<form METHOD ="POST" ACTION = "debtors.php" style="width: 100%">
							
								<table width="100%">
				
									<tr>
				
					
					
					
										<td>  <select class="custom-select"  style="width:"  id="inputGroupSelect03" name="product">
										
											<option selected>Select Product</option>
		
											<?php
											
											$SQL = "SELECT * FROM product_table ORDER BY product_name ASC ";
											
											$result = mysqli_query($db_handle, $SQL);
											
											$i =1;

											
											while ( $db_found = mysqli_fetch_assoc($result) ) {
											
												echo'<option value="'. $db_found['product_name'].'">'. $db_found['product_name'].'(Qty'. $db_found['unit_q'].', Amt '. $db_found['unit_p'].')</option>'; 													  }
		
											?>
											
											</select> 
					
										</td>
					
						 
							
										<td>
						 	  
											<input type= "number" style="width:100%" placeholder="QTY" class="form-control" aria-label="Amount (to the nearest dollar)" name="s_qty">
						 													
						 					
										</td>
										
										
										
											<td>
						 	  
											<input type= "number" style="width:100%" placeholder="0.00" class="form-control" aria-label="Amount (to the nearest dollar)" name="amount">
						 													
						 					
										</td>
									</tr>
			
								</table>
							
								<tr>
								
										<td>  
											<select class="custom-select"  style="width:100%"  id="inputGroupSelect03" name="customer">
										
											<option selected>Anonymous</option>
		
											<?php
											
											$SQL_customer = "SELECT * FROM customers_table ORDER BY name ASC ";
											
											$result = mysqli_query($db_handle, $SQL_customer);
											
											$i =1;

											
											while ( $db_found = mysqli_fetch_assoc($result) ) {
											
												echo'<option value="'. $db_found['name'].'">'. $db_found['name'].'</option>'; 
																									  }
		
											?>
											
											</select> 
					
										</td>
					
						 
								<td>
									
									<p></p>
							
									<input type="submit" value="Enter" onClick="spinner(), unit_ac()" class="btn-dark" style= "width: 100%" name = "A" >
								</td>
								
								
								</tr>
										
								
							</form>
							
						</div>	
											
						
					</div>
										
					
					
					<div class="col-md-4" style="padding-top: 8px" id="bulk_ac">
 
						<form METHOD ="POST" ACTION = "debtors.php" style="width: 100%">
						
							<table width="100%">
				
								<tr>
				
					
					
					
									<td>  
					
										<input type="text" class="form-control" name="product" placeholder="Job Description" aria-label="Amount" aria-describedby="basic-addon2">
					
									</td>
					
									<td>
					
										<input type="text" class="form-control" name="amount" placeholder="Amount" aria-label="Recipient's username" aria-describedby="basic-addon2">
				
					
										
									</td>
						 
												
						 												
						 
							
								</tr>
			
							</table>
			 
							<input type="submit" value="SAVE" class="btn-info" style= "width: 100%" name = "A" >
											
							
						</form>
						
					</div>
					
										
								
				
					<div class="col-md-4" style="padding-top: 8px; background-color:" id="crude_ac"  >
					
 
						<form METHOD ="POST" ACTION = "debtors.php" style="width: 100%">
						
							<table width="100%">
				
								<tr>
				
					
					
					
									<td>  
					
										<input type="text" class="form-control" name="amount" placeholder="Amount" aria-label="Recipient's username" aria-describedby="basic-addon2">
					
									</td>
					
									<td>
					
				
					 
										<input type="submit" value="SAVE" class="btn-dark" style= "width: 100%" name = "A" >
										
									</td>
						 
												
						 												
						 
							
								</tr>
			
							</table>
			
											
							
						</form>
				
					</div>


				
				</div>
		
		
		</div>
		
		
		
		
		
			<?php
		
		
		
		
	
		//	echo $dat = date("h:i") ;
		
		
			 $date = date("Y-m-d");
			  //==================================================================================
			 //this junk of code is to sum up daily transaction
			//==================================================================================
	  //$SQL_sum = "SELECT SUM(amount) FROM txn_table where date =current_date";
		// $SQL_sum = "SELECT SUM(amount) FROM txn_table where date = current_date";
		
		
			$SQL_sum = "SELECT SUM(balance), SUM(s_qty), SUM(unit_c) FROM txn_table where balance != 0 ";
	  
			$sum = mysqli_query($db_handle, $SQL_sum);
	  
			$db_found_sum = mysqli_fetch_assoc($sum) ;
	  //===================================================================================
		
			//===================================================
			//this code is used for the break even analyzise
			//====================================================
			$SQL_break_even = "SELECT SUM(amount/30) FROM fixed_cost  ORDER BY name ASC   ";
			 $result_break_even = mysqli_query($db_handle, $SQL_break_even);
			$db_found_even = mysqli_fetch_assoc($result_break_even)
				
		
			
		
	  		?>
		
	  <?php     
				
				
				
			//this set of codes are used to manipulate the daily account
			
				$daily_bep = $db_found_even['SUM(amount/30)'];  
			
			
			$gross_profit = $db_found_sum['SUM(unit_c)'];
			
			$net_profit = $gross_profit - $daily_bep;
			$adjusted_netprf = "";
			$remark = "fail";
			
			if($net_profit >0){
				
				$adjusted_netprf= $net_profit;
			}
			
				if($net_profit >0){
				
				$remark= "congratulations";
			}
			
			?>
		
		
			<div class="jumbotron-fluid" style="background-color: " id="view_ac">
		
			
				<div class="row " style="margin-top: 1px; background-color:">
		
			
					<div class = "col-md-4 " style="background-color:;padding: 10px">
				 
						<strong ><span style="color:#260B4D;color: white;padding: ">
							
							
						
							
							
							
							
							
							
							
							
							
							    </span></strong>
			
			  
				

					
					</div>
						
			
					<div class = "col-md-8 " style="background-color: #494747">
				  	
						<strong ><span style="color:#FAF7FF;padding: 4px"><br>Debt Turnover(<?php echo $txn_nbr?>)
					    
							</span> </strong>
				
						 
						<div class="jumbotron-fluid scroll_history" style="font-size:12; ">
				  
				  <!--<strong ><span style="color:#260B4D;background-color: #FBFBFC;padding: 4px">TRANSACTION HISTORY
					     </span></strong>-->
				  
	  
							<table class="table  table-hover" style="font-size:12; width:100%  " >
  
								<tbody>
    
									<tr  style="background-color:<?php echo $bottom_backgroundcolor; ?>; ; text-align: center; color: white">
      
										<th scope="col"></th>
	
										<th scope="col"><input type="button" value=" ID"> </th>
										
										<th scope="col"><input type="button" value="IDN"></th>
      
										<th scope="col"><input type="button" value="Description"></th>
										<!--<th scope="col"><input type="button" value="Debtors"></th>
		 -->
		<!-- <th scope="col">DESCRIPTION</th>-->
	
		   
										<th scope="col"><input type="button" value="Amount"></th>
										<th scope="col"><input type="button" value="Qty"></th>
									<!--	<th scope="col">Gross Profit</th>-->
										<th scope="col"><input type="button" value="Date"></th>
		
										
		 
										
										
		
     
    
									</tr>
 			
		



									<?PHP

//if ($db_found) {

//$SQL = "SELECT * FROM product_table ORDER BY product_id ASC ";

	  
	  
//$SQL = "SELECT * FROM txn_table where date= current_date ORDER BY product_id DESC   ";

	 $txnid = $_GET['txnId'];								
	
	
									$SQL = "SELECT  * FROM txn_table  where balance != 0 and customers_name = '$txnid' and  branch_key ='$branch_key' ORDER BY product_id DESC";

	  
									
									$result = mysqli_query($db_handle, $SQL);

									$i =1;
	  		
									while ( $db_found = mysqli_fetch_assoc($result) ) {
	   
	
										echo'<tr style="text-align: center; color:red; background-color: white; font-size:13px;" >';

	
	
										echo '<td>'.$i++.'</td>';
		
										echo '<td>'.$db_found['product_id'].'</td>';
										
										echo '<td>'.$db_found['user_id'].'</td>';
		 
										echo '<td>'.$db_found['product_name'].'</td>';
										
									//	echo '<td>'.$db_found['customers_name'].'</td>';
		
										//echo '<td>'.$db_found['debt_fixed_amount'].'</td>';
									
		
	
									//	echo '<td>'.$db_found['unit_c'].'</td>';
	
	 
										//echo '<td>'.$db_found['qty_fixed'].'</td>';
										
										
	
										echo '<td>'.$db_found['balance'].'</td>';
										echo '<td>'.$db_found['s_qty'].'</td>';
										echo '<td>'.$db_found['date'].'</td>';
										
										
										
										
										
	//echo '<td>'.$db_found['SUM(amount)'].'</td>';
	
	//echo $db_found_sum['SUM(amount)']; 
	 
	 
	
									?>
									
									
										
	  
									
	
	   
									<td style="background-color: #4A4848"><a href="debtors_repayment.php?txnId=<?php echo $db_found["product_id"]?>">
   
										<input type="button" value="Pay Debt"  onClick="spinner(), view_ac()"></a>
									</td>
									
									
							
 
									

<!--	  


  <td><a href="construction.php?txnId=Receipt">
    <input type="button" value="Issue Receipt"></a></td>
	  
	  <td><a href="construction.php?txnId=Modify Account">
    <input type="button" value="Modify"></a></td>-->
	  
	  <!--
									<td>
    
										<input type="button" value="Issue Receipt"onClick= "window.alert('The page  you requsted is still under Development. Contact us (Alaye David 09055158742, head of iCT LAWPED GROUP,www.lawped.com.ng')"></td>
	  
	  
									<td>
    
										<input type="button" value="Modify"onClick= "window.alert('The page  you requsted is still under Development. Contact us (Alaye David 09055158742, head of iCT LAWPED GROUP,www.lawped.com.ng')" ></td>
	  
	   
								
   
										<input type="button" value="Delete" onClick="spinner(), view_ac()"></a></td>
	
	  -->
									<?php
	
										echo '</tr>';

	
	

									}

									mysqli_close($db_handle);
	  
			
									?>
	

								</tbody>

							</table>
						
	
	
						</div>
			
					</div>
			
		
				</div>
		
		
			</div>
		

		</div>
	
	



		</body>

</html>




	<script>
		
		

		function spinner() {
  
			var x = document.getElementById("spin");
	
	
	
  if (x.style.display === "none") {
    x.style.display = "block ";
	  
	  
  }
	else {
    x.style.display = "none";
  }
	
	
}
	
		
		
		
		
		
		
		
		
		
		
		function view_ac() {
  
			var x = document.getElementById("view_ac");
	
	 var unit_ac = document.getElementById("unit_ac");
	 var bulk_ac = document.getElementById("bulk_ac");
	 var crude_ac = document.getElementById("crude_ac");
	
  if (x.style.display === "none") {
    x.style.display = "block";
	  
	   
	  unit_ac.style.display="none";
	  crude_ac.style.display="none";
	  bulk_ac.style.display="none";
	  
  }
	else {
    x.style.display = "none";
  }
	
	
}
		
		
	
function unit_ac() {
	var x = document.getElementById("unit_ac");
	 var unit_ac = document.getElementById("bulk_ac");
	 var crude_ac = document.getElementById("crude_ac");
	var view_ac = document.getElementById("view_ac");
	
  if (x.style.display === "none") {
   
	   x.style.display = "block";
	  
	  unit_ac.style.display="none";
	  crude_ac.style.display="none";
	  view_ac.style.display="none";
	  
	  
  } 
	else {
    x.style.display = "none";
		
		
		
  }
	
	
}		
		
		
function bulk_ac() {
  var x = document.getElementById("bulk_ac");
	
	 var unit_ac = document.getElementById("unit_ac");
	 var crude_ac = document.getElementById("crude_ac");
	var view_ac = document.getElementById("view_ac");
	
  if (x.style.display === "none") {
    x.style.display = "block";
	  
	   unit_ac.style.display="none";
	  crude_ac.style.display="none";
	   view_ac.style.display="none";
  } 
	else {
    x.style.display = "none";
  }
}		
		
			
function crude_ac() {
  var x = document.getElementById("crude_ac");
	
	var unit_ac = document.getElementById("unit_ac");
	 var bulk_ac = document.getElementById("bulk_ac");
	var view_ac = document.getElementById("view_ac");
	
  if (x.style.display === "none") {
    x.style.display = "block";
	  unit_ac.style.display="none";
	  bulk_ac.style.display="none";
	  view_ac.style.display="none";
  } 
	else {
    x.style.display = "none";
  }
}		
		
			
		

		


</script>			
			




 <!--   Core JS Files   -->
  <script src="assets/js/core/popper.min.js"></script>
  <script src="assets/js/core/bootstrap.min.js"></script>
 
  <script>
    var win = navigator.platform.indexOf('Win') > -1;
    if (win && document.querySelector('#sidenav-scrollbar')) {
      var options = {
        damping: '0.5'
      }
      Scrollbar.init(document.querySelector('#sidenav-scrollbar'), options);
    }
  </script>
  <!-- Github buttons -->
  <script async defer src="https://buttons.github.io/buttons.js"></script>
  <!-- Control Center for Material Dashboard: parallax effects, scripts for the example pages etc -->



<script>
	
	//pop scripts
	
	
function CustomAlert(){
  this.alert = function(message,title){
    document.body.innerHTML = document.body.innerHTML + '<div id="dialogoverlay"></div><div id="dialogbox" class="slit-in-vertical"><div><div id="dialogboxhead"></div><div id="dialogboxbody"></div><div id="dialogboxfoot"></div></div></div>';

    let dialogoverlay = document.getElementById('dialogoverlay');
    let dialogbox = document.getElementById('dialogbox');
    
    let winH = window.innerHeight;
    dialogoverlay.style.height = winH+"px";
    
    dialogbox.style.top = "100px";

    dialogoverlay.style.display = "block";
    dialogbox.style.display = "block";
    
    document.getElementById('dialogboxhead').style.display = 'block';

    if(typeof title === 'undefined') {
      document.getElementById('dialogboxhead').style.display = 'none';
    } else {
      document.getElementById('dialogboxhead').innerHTML = '<i class="fa fa-exclamation-circle" aria-hidden="true"></i> '+ title;
    }
    document.getElementById('dialogboxbody').innerHTML = message;
    document.getElementById('dialogboxfoot').innerHTML = '<button class="pure-material-button-contained active" onclick="customAlert.ok()">OK</button>';
  }
  
  this.ok = function(){
    document.getElementById('dialogbox').style.display = "none";
    document.getElementById('dialogoverlay').style.display = "none";
  }
}

let customAlert = new CustomAlert();
	</script>