<?php
session_start();

require('../../includes/database.php');
include("../../log.php");

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

$accUsername = $_SESSION['accUsername'];
$accPassword = $_SESSION['accPassword'];

$query = "SELECT * FROM accounts	
			WHERE username = '$accUsername'
			&&   password = '$accPassword'";

$result = mysqli_query($con, $query) or die(mysqli_connect_error());
$rows = mysqli_num_rows($result);
if ($rows == 1) {
   while ($data = mysqli_fetch_assoc($result)) {

      extract($data);
      include('../components/head.php');

      if (isset($_SESSION['check_info']) != "") {
         $check_info = $_SESSION['check_info'];
      } else {
         $check_info = "";
      }
?>

      <body x-data class="is-header-blur is-sidebar-open" x-bind="$store.global.documentBody">
         <!-- App preloader-->
         <?php
         include("../components/sidebar.php");
         include("../components/sidebar-body.php");
         include("../components/nav.php");
         include("../components/mobile-search.php");
         include("../components/right-sidebar.php");
         ?>

         <!-- Main Content Wrapper -->
         <main class="main-content w-full px-[var(--margin-x)] pb-8">
            <?php
            if ($check_info != "") {
            ?>
               <div x-data="{isShow:true}" :class="!isShow && 'opacity-0 transition-opacity duration-300'" class="mt-3 alert flex items-center justify-between overflow-hidden rounded-lg border border-success text-success">
                  <div class="flex">
                     <div class="px-4 py-3 sm:px-5 text-center"><b><?php echo $check_info ?></b></div>
                  </div>
                  <div class="px-2">
                     <button @click="isShow = false; setTimeout(()=>$root.remove(),300)" class="btn h-7 w-7 rounded-full p-0 font-medium text-success border-success">
                        <i class="fa fa-close"></i>
                     </button>
                  </div>
               </div>

            <?php } ?>
            <div class="flex items-center space-x-4 py-5 lg:py-6">
               <h2 class="text-xl font-medium text-slate-800 dark:text-navy-50 lg:text-2xl">
                  Deposit Check
               </h2>
               <div class="hidden h-full py-1 sm:flex">
                  <div class="h-full w-px bg-slate-300 dark:bg-navy-600"></div>
               </div>
               <ul class="flex-wrap items-center space-x-2 sm:flex">
                  <li class="flex items-center space-x-2">
                     <a href="check-deposit-history.php" class="btn space-x-2 rounded-full bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 dark:bg-navy-500 dark:text-navy-50 dark:hover:bg-navy-450 dark:focus:bg-navy-450 dark:active:bg-navy-450/90">
                        <i class="fa-regular fa-eye"></i>
                        <span> Deposit History</span>
                     </a>
                     <svg x-ignore xmlns="http://www.w3.org/2000/svg" class="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
                     </svg>
                  </li>
                  <li>
                     With your camera enabled phone take a photo of the front and back of the endorsed check.
                  </li>
               </ul>
            </div>

            <div class="d-none d-lg-block grid grid-cols-12 gap-4 sm:gap-5 lg:gap-6">
               <div class="col-span-12 grid lg:col-span-4 lg:place-items-center">
                  <div>
                     <ol class="steps is-vertical line-space [--size:2.75rem] [--line:.5rem]">
                        <li class="step space-x-4 pb-12 before:bg-slate-200 dark:before:bg-navy-500">
                           <div class="step-header mask is-hexagon bg-primary text-white dark:bg-accent">
                              <i class="fa-solid fa-layer-group text-base"></i>
                           </div>
                           <div class="text-left">
                              <p class="text-xs text-slate-400 dark:text-navy-300">
                                 Step 1
                              </p>
                              <h3 class="text-base font-medium text-primary dark:text-accent-light">
                                 Complete Form
                              </h3>
                           </div>
                        </li>
                        <li class="step space-x-4 pb-12 before:bg-slate-200 dark:before:bg-navy-500">
                           <div class="step-header mask is-hexagon bg-slate-200 text-slate-500 dark:bg-navy-500 dark:text-navy-100">
                              <i class="fa-solid fa-list text-base"></i>
                           </div>
                           <div class="text-left">
                              <p class="text-xs text-slate-400 dark:text-navy-300">
                                 Step 2
                              </p>
                              <h3 class="text-base font-medium">Upload Checks</h3>
                              <p class="text-xs text-slate-400 dark:text-navy-300">
                                 <small>
                                    Using this method, Account holders gets an option to deposit a cheque to account.
                                    Please do Upload clear images of the scanned front-side and back-side of your check
                                 </small>
                              </p>
                           </div>
                        </li>
                        <li class="step space-x-4 before:bg-slate-200 dark:before:bg-navy-500">
                           <div class="step-header mask is-hexagon bg-slate-200 text-slate-500 dark:bg-navy-500 dark:text-navy-100">
                              <i class="fa-solid fa-check text-base"></i>
                           </div>
                           <div class="text-left">
                              <p class="text-xs text-slate-400 dark:text-navy-300">
                                 Step 3
                              </p>
                              <h3 class="text-base font-medium">Confirm</h3>
                           </div>
                        </li>
                     </ol>
                  </div>
               </div>
               <div class="col-span-12 grid lg:col-span-8">
                  <div class="card">
                     <div class="border-b border-slate-200 p-4 dark:border-navy-500 sm:px-5">
                        <div class="flex items-center space-x-2">
                           <div class="flex h-7 w-7 items-center justify-center rounded-lg bg-primary/10 p-1 text-primary dark:bg-accent-light/10 dark:text-accent-light">
                              <i class="fa-solid fa-layer-group"></i>
                           </div>
                           <h4 class="text-lg font-medium text-slate-700 dark:text-navy-100">
                              Have a Check?
                           </h4>
                        </div>
                     </div>
                     <div class="space-y-4 p-4 sm:p-5">
                        <form action="../../bank-manager.php?action=deposit-check" enctype="multipart/form-data" method="post">
                           <label class="block">
                              <span>Bank Name - <small>(from which check is issued)</small></span>
                              <input name="bank_name" required class="form-input mt-1.5 w-full rounded-lg border border-slate-300 bg-transparent px-3 py-2 placeholder:text-slate-400/70 hover:border-slate-400 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent" placeholder="Check Issuing Bank" type="text" />
                           </label>
                           <div class="mt-3" x-data="{config:{numeral: true, numeralThousandsGroupStyle: 'thousand'}}">
                              <span class="text-xs+">Amount</span>
                              <div class="mt-1.5 flex h-9 -space-x-px">
                                 <select class="form-select rounded-l-lg border border-slate-300 bg-white px-3 py-2 pr-9 hover:z-10 hover:border-slate-400 focus:z-10 focus:border-primary dark:border-navy-450 dark:bg-navy-700 dark:hover:border-navy-400 dark:focus:border-accent">
                                    <option class="hover:bg-primary/20" x-tooltip.placement.right="'<?php echo $currency ?>'"><?php echo $currency ?></option>
                                 </select>
                                 <input required id="send-amount-mb" value="" x-input-mask="config" name="amount" onblur="amountInputMb()" class="form-input w-full rounded-r-lg border border-slate-300 bg-transparent px-3 py-2 placeholder:text-slate-400/70 hover:z-10 hover:border-slate-400 focus:z-10 focus:border-primary dark:border-navy-450 dark:hover:border-navy-400 dark:focus:border-accent" placeholder="Amount" />
                              </div>
                           </div>
                           <?php include('../components/userSendInfo.php'); ?>
                           <div style="height:100px" class="mt-5 grid w-full grid-cols-2 gap-2">
                              <label class="btn bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 dark:bg-navy-500 dark:text-navy-50 dark:hover:bg-navy-450 dark:focus:bg-navy-450 dark:active:bg-navy-450/90">
                                 <input tabindex="-1" name="frontpage" type="file" class="pointer-events-none absolute inset-0 h-full w-full opacity-0" />
                                 <div class="flex items-center space-x-2">
                                    <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                       <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" />
                                    </svg>
                                    <span>Upload FrontPage</span>
                                 </div>
                              </label>
                              <label class="btn bg-slate-150 font-medium text-slate-800 hover:bg-slate-200 focus:bg-slate-200 active:bg-slate-200/80 dark:bg-navy-500 dark:text-navy-50 dark:hover:bg-navy-450 dark:focus:bg-navy-450 dark:active:bg-navy-450/90">
                                 <input tabindex="-1" type="file" name="backpage" class="pointer-events-none absolute inset-0 h-full w-full opacity-0" />
                                 <div class="flex items-center space-x-2">
                                    <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                       <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" />
                                    </svg>
                                    <span>Upload BackPage</span>
                                 </div>
                              </label>
                           </div>
                           <div class="flex justify-center space-x-2 pt-4">
                              <button type="submit" class="btn space-x-2 bg-primary font-medium text-white hover:bg-primary-focus focus:bg-primary-focus active:bg-primary-focus/90 dark:bg-accent dark:hover:bg-accent-focus dark:focus:bg-accent-focus dark:active:bg-accent/90">
                                 <span>Submit Check <i class="fa fa-money-check"></i></span>
                              </button>
                           </div>
                        </form>
                     </div>
                  </div>
               </div>
            </div>
         </main>
         </div>

         <div id="x-teleport-target"></div>
         <script>
            window.addEventListener("DOMContentLoaded", () => Alpine.start());
         </script>
      </body>

      </html>


<?php
   }
}
?>