<?php require_once('head.php'); ?>

  <body>
  <!-- container section start -->
  <section id="container" class="">
      
	<?php require_once('header.php'); ?>	

	<?php require_once('sidebar.php'); ?>
      
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">

			  <div class="row">
                  <div class="col-lg-12">
                      <!--breadcrumbs start -->
                      <ul class="breadcrumb">
                          <li><a href="dashboard.php"><i class="icon_house_alt"></i> Home</a></li>
						  <li><a href="accounts.php"><i class="icon-signal"></i> Accounts</a></li>
                          <li class="active"> Activate</li>
						  <li class="pull-right"> <i class="icon_calendar"></i>
							 <?php echo date('l jS F Y'); ?></li>
                      </ul>
                      <!--breadcrumbs end -->
                  </div>
              </div>
			  
			  
			  <div class="row">
					<div class="col-lg-12">
					<section class="panel panel-body">
					<h3><?php echo WEB_NAME ?></h3>
					<h4>ACCOUNT ACTIVATION</h4>
					<p>Find below the details of the application, and scroll down to activate it.</p>
					</section>
					</div>
              </div>
			  

			<?php
			dbconnect();
			$sql = "SELECT * FROM `".USERS_TABLE_NAME."` WHERE user_id='{$_GET['user']}'";
			$stmt = $pdo->query($sql);
			$row = $stmt->fetch(PDO::FETCH_ASSOC);
			?>
			  
			  <!-- Recent Transactions Starts -->
			  <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                              Personal Information
                          </header>
                          
						  <div class="panel-body">
						  
						  <div class="panel-body bio-graph-info">
							  <h1>Bio Graph</h1>
							  <div class="row">
								  <div class="bio-row">
									  <p><span>First Name </span>: <?php echo $row['first_name']; ?></p>
								  </div>
								  <div class="bio-row">
									  <p><span>Last Name </span>: <?php echo $row['last_name']; ?></p>
								  </div>                                              
								  <div class="bio-row">
									  <p><span>Date of Birth</span>: 
									  <?php if ($row['dob'] == "0000-00-00") { echo ""; }else{ echo date('jS F Y', strtotime($row['dob']));} ?>
									  </p>
								  </div>
								  <div class="bio-row">
									  <p><span>Gender </span>: <?php echo $row['user_gender']; ?></p>
								  </div>
								  <div class="bio-row">
									  <p><span>Email </span>: <?php echo $row['user_email']; ?></p>
								  </div>
								  <div class="bio-row">
									  <p><span>Mobile </span>: <?php echo $row['user_phone']; ?></p>
								  </div>
								  <div class="bio-row">
									  <p><span>Address </span>: <?php echo $row['user_add']; ?></p>
								  </div>
								  <div class="bio-row">
									  <p><span>City </span>:  <?php echo $row['user_city']; ?></p>
								  </div>
								  <div class="bio-row">
									  <p><span>State </span>:  <?php echo $row['user_state']; ?></p>
								  </div>
								  
								  <div class="bio-row">
									  <p><span>Zip Code </span>:  <?php echo $row['postcode']; ?></p>
								  </div>
								  
								  <div class="bio-row">
									  <p><span>Country </span>:  <?php echo $row['country']; ?></p>
								  </div>
							  </div>
						  </div>
						</div>
						
						
						
                      </section>
					  
					  <section class="panel">
                          <header class="panel-heading">
                              Personal Identification
                          </header>
                          
						  <div class="panel-body">
						  
						  <div class="panel-body bio-graph-info">
							  <h1>ID Information</h1>
							  <div class="row">
								  <div class="bio-row">
									  <p><span>ID Type </span>: <?php echo $row['id_type']; ?></p>
								  </div>
								  <div class="bio-row">
									  <p><span>ID Number </span>: <?php echo $row['id_number']; ?></p>
								  </div>                                              
								  <div class="bio-row">
									  <p><span>Expiry Date</span>: <?php if ($row['id_expiry'] == "") { echo ""; }else{ echo date('jS F Y', strtotime($row['id_expiry']));} ?></p>
								  </div>
							  </div>
						  </div>
						</div>
						
						
						
                      </section>
					  
					  
					  <section class="panel">
                          <header class="panel-heading">
                              Activate Account
                          </header>
                          
						  <div class="panel-body">
						  
						  <!-- Error Message -->
							<?php if (!empty($_GET['error'])): ?>
							<div class="alert fade in alert-danger">
								<button data-dismiss="alert" class="close close-sm" type="button">
								<i class="icon-remove"></i>
								</button>
								<?php echo $_GET['error']?>
							</div>
							<?php endif ?>
							
							<!-- Success Message -->
							<?php if (!empty($_GET['msg'])): ?>
							<div class="alert fade in alert-success">
								<button data-dismiss="alert" class="close close-sm" type="button">
								<i class="icon-remove"></i>
								</button>
								<?php echo $_GET['msg']?>
							</div>
							<?php endif ?>
						  
						  <form method="post" enctype="multipart/form-data" class="form-validate form-horizontal" id="activate-form" action="activated.php">
								<div class="form-group">
									<label class="col-md-12">
									Please fill and submit this form to activate account
									</label>
								</div>
								<div class="form-group">
									<label class="col-md-4 control-label">Account Number</label>
									<div class="col-md-6">
										<input type="text" name="acc"  value="<?php echo ACC_PREFIX ?><?php $acc = $_GET['user']; printf("%04d", $acc); ?>
										" placeholder="Enter Account Number" class="form-control required">
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-4 control-label">User ID </label>
									<div class="col-md-6">
										<input type="text" id="user" name="user" value="<?php echo get_userid($_GET['user'])?>" class="form-control required" placeholder="Enter User ID" required>
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-4 control-label">Password </label>
									<div class="col-md-6">
										<input type="text" name="pass" class="form-control required" value="<?php echo generateStrongPassword(); ?>" placeholder="Enter Password" required>
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-4 control-label">PIN </label>
									<div class="col-md-6">
										<input type="text" name="pin" value="<?php echo get_pin(4); ?>" class="form-control required" placeholder="Enter PIN" required>
									</div>
								</div>
                                <div class="form-group">
									<label class="col-md-4 control-label"><?php echo CODE1_NAME ?> </label>
									<div class="col-md-6">
										<input type="text" name="code1" value="<?php echo get_pin(6); ?>" class="form-control required" placeholder="Enter <?php echo CODE1_NAME ?>" required>
									</div>
								</div>
                                <?php
								if (CODE2_TRUE) { echo '
                                <div class="form-group">
									<label class="col-md-4 control-label">'.CODE2_NAME.'</label>
									<div class="col-md-6">
										<input type="text" name="code2" value="'.getRandomString(9).'" class="form-control required" placeholder="Enter '.CODE2_NAME.'" required>
									</div>
								</div>
                                ';}else{ echo '';}
								?>
                                <?php
								if (CODE3_TRUE) { echo '
                                <div class="form-group">
									<label class="col-md-4 control-label">'.CODE3_NAME.' </label>
									<div class="col-md-6">
										<input type="text" name="code3" value="'.getRandomString(13).'" class="form-control required" placeholder="Enter '.CODE3_NAME.'" required>
									</div>
								</div>
                                ';}else{ echo '';}
								?>
								<div class="form-group">
									<label class="col-md-4 control-label">Account Status </label>
									<div class="col-md-6">
										<select name="status" class="form-control required" placeholder="Select Account Status">
											<option value='' selected="selected">Account Status</option>
											<option value="active">Active</option>
											<option value="inactive">Inactive</option>
                                            <option value="on-hold">On Hold</option>
                                            <option value="suspended">Suspended</option>
											<option value="dormant">Dormant</option>
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-4 control-label">Account Type</label>
									<div class="col-md-6">
										<input type="text" name="type" class="form-control required" placeholder="Select Account Type" required>
									</div>
								</div>
								
<div class="form-group">
									<label class="col-md-4 control-label">Currency</label>
									<div class="col-md-6">
										<select name="currency" class="form-control required"  placeholder="Select Account Currency">
										<option value='' selected="selected">Currency</option>
									<?php
										foreach($currency as $key)
										{
										$currency = htmlspecialchars($currency);
										echo '<option value="'. $key .'">'. $key .'</option>';
										}
									?>
									</select>
									</div>
								</div>
								

								<?php 
									dbconnect();
									$sql = "SELECT * FROM `".USERS_TABLE_NAME."` WHERE user_id='{$_GET['user']}'";
									$stmt = $pdo->query($sql);
									$row = $stmt->fetch(PDO::FETCH_ASSOC);
									if (empty($row['user_photo'])) { echo '								
								<div class="form-group">
									<label class="col-md-4 control-label">Passport Photograph</label>
									<div class="col-md-6">
										<input type="file" name="photo" id="photo" class="form-control" accept="image/*" data-style="fileinput"  placeholder="Upload Passport Photo">
									</div>
								</div>
								';}else{ echo '';} 
								?>
								
								<div class="form-group">
									<label class="col-md-4 control-label">Send Details as Email</label>
									<div class="col-md-6">
										<input  type="checkbox" style="width: 20px" class="checkbox form-control" id="email" name="email" />
									</div>
								</div>
								
								
								<?php
								if (USE_SMS) { echo '
			
								<div class="form-group">
									<label class="col-md-4 control-label">Send Details as SMS</label>
									<div class="col-md-6">
										<input  type="checkbox" style="width: 20px" class="checkbox form-control" id="sms" name="sms" />
									</div>
								</div>
								
								';}else{ echo '';}
								?>
								
								<div class="form-group">
									<label class="col-md-4 control-label"></label>
									<div class="col-md-6">
									<input type="hidden" name="user_id" value="<?php echo $_GET['user']; ?>">
									<input type="submit" id="submit" name="submit" value="Activate" class="btn btn-primary pull-left">
									</div>
								</div>
							</form>
						</div>
						
						
						
                      </section>
					  
                  </div>
              </div>
			  <!-- Recent Transactions end -->

              

          </section>
      </section>
      <!--main content end-->
  </section>
  <!-- container section start -->

    <!-- javascripts -->
    <script src="../js/jquery.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <!-- check username -->
    <script>
		$(function() {

            //remove spaces
            $('#user').on('change', function(){
                $(this).val($(this).val().replace(/\s+/g, ''));
            });

		});
	</script>
    <!-- nice scroll -->
    <script src="../js/jquery.scrollTo.min.js"></script>
    <script src="../js/jquery.nicescroll.js" type="text/javascript"></script>
    <!-- jquery validate js -->
    <script type="text/javascript" src="../js/jquery.validate.min.js"></script>
	
	<!-- jquery ui -->
    <script src="../js/jquery-ui-1.9.2.custom.min.js"></script>
	
	<!--custom checkbox & radio-->
    <script type="text/javascript" src="../js/ga.js"></script>
  

    <!-- custom form validation script for this page-->
    <script src="../js/form-validation-script.js"></script>
	<!-- custom form component script for this page-->
    <script src="../js/form-component.js"></script>
    <!--custome script for all page-->
    <script src="../js/scripts.js"></script>

  </body>
</html>