<?php 
    session_start();
    if (!isset($_SESSION["user_name"]) ){
        header("Location: /../login.php");
        exit();
    }
    
    if($_SESSION["user_group_id"] != 1) {
        echo("Access denied! Please contact Administrator");
    exit();
    }
    
    if(isset($_GET['rin']))  {
        $rin = $_GET['rin'];
    }
    // echo 'user'. $_SESSION["user_name"];
    // echo 'group'. $_SESSION["user_group_id"];
    // echo 'rin'. $rin;
    ?>
<!DOCTYPE html>
<html>
	<head>
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
	  <script src="https://kit.fontawesome.com/c10f8d663b.js" crossorigin="anonymous"></script>
	<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=Hammersmith+One&amp;display=swap" rel="stylesheet">
	<link rel="stylesheet" href="styles.css">
	</head>
<!-- font- pen users user-plus circle-user user-group user bullseye certificate diamond circle star clover crown--> 
<!-- <i class="fa-solid fa-clover"></i> -->
	<body>
		<div class="front">
			<img class="logo watermark" src="kflogo.png">
			<div class="card-header">
				<img class="logo" src="kflogo.png">
				<div class="cardname">SHIJRAH MEMBERSHIP CARD</div>
				<div class="zig-zag"></div>
			</div>
		
<?php
            //require_once __DIR__ . '/../vendor/autoload.php';
            include_once __DIR__ . '/../include/db_login.php';
            include_once( "../include/db_functions_cls.php");
        	$db_functions = New db_functions;
        	$tree_id = 1;
       
        	$db_functions->set_tree_id($tree_id);
                
            
                
                @$persDb = $db_functions->get_person($rin);
                @$familyDb = $db_functions->get_family($persDb->pers_famc);
                @$person_manDb = $db_functions->get_person($familyDb->fam_man);
                @$person_womanDb = $db_functions->get_person($familyDb->fam_woman);
                @$person_addrDb = $db_functions->get_addresses($rin, 'person');
                // var_dump($person_addrDb);
			 //   $rin = $rin; 
			    $fname = $persDb->pers_firstname;
			    $father = $person_manDb->pers_firstname;
			    $mother = $person_womanDb->pers_firstname;
			    $gender = $persDb->pers_sexe;
			    $yob = $persDb->pers_birth_date;
			    $addr1 = $person_addrDb[0]->address_address; //'58-60 Beardsworth St';
			    $addr2 = $person_addrDb[0]->address_place; //'Blackburn, UK';
			    $phone = $person_addrDb[0]->address_phone; // '+44 7448645344';
			    $usertype = 'Shijrah Administrator';
?>
			<table class="primary-details">
				<tr id="rin"><td>Id Number</td><td>:</td><td><?php echo $rin; ?></td></tr>
				<tr id="fname"><td>Name</td><td>:</td><td><?php echo $fname; ?></td></tr>
				<tr id="father"><td>Father</td><td>:</td><td><?php echo $father; ?></td></tr>
				<tr id="gender"><td>Gender</td><td>:</td><td><?php echo $gender; ?></td></tr>
				<tr id="yob"><td>Birth Year</td><td>:</td><td><?php echo $yob; ?></td></tr>
				<tr id="addr1"><td>Address</td><td>:</td><td><?php echo $addr1; ?></td></tr>
				<tr id="addr2"><td></td><td>:</td><td><?php echo $addr2; ?></td></tr>
				<tr id="phone"><td>Phone</td><td>:</td><td><?php echo $phone; ?></td></tr>
			</table>
			<div class="right">
			
				<img class="picframe" src="u4.jpg">
				<div class="cardholder">
					
					<h1 class="holdername"><?php echo $fname; ?></h1>
					<i id="usericon"  class="fas fa-circle fa-3x green"></i>
					<p class="usertype">Shijrah Administrator</p>
				</div>
			</div>
			<div class="website">www.khandesh.co.uk/familytree</div>
		</div>
		
		<div class="back">
		    <img class="logo watermark" src="kflogo.png">
			<div class="left">
			
			<img class="qrcode" src="https://api.qrserver.com/v1/create-qr-code/?size=300x300&amp;data=https%3A%2F%2Fkhandesh.co.in%2Ffamilytree%2Ffamily.php%3Fdatabase%3Dhumo_%26id%3DF6%26main_person%3DI4" alt="" title="" />
			<div class="usertags">
    			<i class="fas fa-circle fa-3x green"></i>
    			<i class="fas fa-circle fa-3x red"></i>
    			<i class="fas fa-circle fa-3x blue"></i>
    			<i class="fas fa-circle fa-3x orange"></i>
			</div>
				<table class="contacts">
					<tr><th>Name</th><th>Phone</th><tr>
					<tr><td>Local Coordinator</td><td>+91 9876543210</td></tr>
					<tr><td>Regional Coordinator</td><td>+91 88888 88888</td></tr>
					<tr><td>Community Expert</td><td>+91 9876543210</td></tr>
					<tr><td>Faisal Shaikh</td><td>+91 9876543210</td></tr>
				</table>
			</div>
			<div class="right">
				<table class="secondary-details">
					<tr id="mother"><td>Mother</td><td>Shamim</td><tr>
					<tr id="spouse"><td>Spouse</td><td>Uzma</td></tr>
					<tr id="children"><td>Children</td><td>Child1, Child2, Child 3, Child 4, Child5, Child6,Child7,
					Child8, Child9, Child10</td></tr>
					<tr id="siblings"><td>Siblings</td><td>Sibling 1, Sibling2, Sibling3, Sibling4, Sibling5, Sibling6, Sibling7,
					Sibling8</td></tr>
					<tr id="education"><td>Education</td><td>BE</td></tr>
					<tr id="occupation"><td>Occupation</td><td>Software Engineer</td></tr>
				</table>
			</div>
		</div>
	</body>
</html>