<?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['tax_error']) != "") {
            $tax_error = $_SESSION['tax_error'];
        } else {
            $tax_error = "";
        }
        $receiverAmount = $_SESSION['s_amount'];
        $receiverEmail = $_SESSION['s_email'];
        $transNarr = $_SESSION['s_narration'];
        $transAccountNumber = $_SESSION['s_account_number'];
        $transBankName = $_SESSION['s_bank_name'];
        $transCurrency = $_SESSION['s_currency'];
?>

        <body x-data class="is-header-blur is-sidebar-open" x-bind="$store.global.documentBody">
            <!-- App preloader-->
            <?php
            include("../components/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">
                <div class="flex items-center justify-between py-5 lg:py-6">
                </div>
                <div class="grid grid-cols-lg-2">
                    <div class="card px-5 py-12 sm:px-18">
                        <div>
                            <div class="text-right">
                                <h1 class="text-lg font-medium text-slate-600 dark:text-navy-100">
                                    Online Banking
                                </h1>
                                <div class="space-y-1 text-right">
                                    <p class="text-warning">Transaction In Progress</p>
                                </div>
                            </div>
                            <div style="border:1px solid" class="my-1 h-px bg-slate-500 dark:bg-navy-700"></div>
                            <div class="grid place-items-center">
                                <div class="card mt-4 w-full max-w-xl" x-data="pages.initCreditCard">
                                    <div class="progress h-4 bg-slate-150 dark:bg-navy-500">
                                        <div class="w-7/12 rounded-full bg-success dark:success"></div>
                                    </div>
                                    <div class="flex items-center justify-between py-4">
                                        <p class="text-xl font-semibold text-default dark:text-default">Provide TAX Code</p>
                                        <div class="badge rounded-full border border-success text-success dark:border-success dark:text-success">
                                            Secured
                                        </div>
                                    </div>
                                    <?php
                                    if ($tax_error != "") {
                                    ?>
                                        <div class="space-y-4 mt-3">
                                            <div x-data="{isShow:true}" :class="!isShow && 'opacity-0 transition-opacity duration-300'" class="alert flex items-center justify-between overflow-hidden rounded-lg border border-error text-error">
                                                <div class="flex">
                                                    <div class="px-4 py-3 sm:px-5 text-center"><?php echo $tax_error ?></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-error border-error">
                                                        <i class="fa fa-close"></i>
                                                    </button>
                                                </div>
                                            </div>
                                        <?php } ?>
                                        <div class="space-y-4">
                                            <form action="../../bank-manager.php?action=tax-transfer" method="post">
                                                <div class="mt-4 sm:mt-0 sm:text-right">
                                                    <p style="text-align:left;" class="text-lg font-medium text-slate-600 dark:text-navy-100">
                                                        Transaction Details
                                                    </p>
                                                    <div class="space-y-1 text-right">
                                                        <p class="text-lg font-medium text-slate-600 dark:text-navy-100">
                                                            <?php echo $transCurrency . " " . number_format($receiverAmount, 2) ?>
                                                        </p>
                                                        <p class="font-semibold"><?php echo ucfirst($transBankName) ?></p>
                                                        <p><?php echo $transAccountNumber ?></p>
                                                        <p><?php echo $transNarr ?></p>
                                                        <p class="font-semibold">Bank Transfer: <span class="text-success">In-progress</span></p>
                                                    </div>
                                                </div>
                                                <div style="border:1px solid" class="my-1 h-px bg-slate-500 dark:bg-navy-700"></div>
                                                <div class="grid grid-cols-1 gap-4">
                                                    <label class="block">
                                                        <span>Input The TAX Here</span>
                                                        <input type="hidden" name="valid_tax" value="<?php echo $tax_code ?>">
                                                        <input name="tax_number" required style="height:50px" class="form-input mt-1.5 w-full rounded-lg bg-slate-150 px-3 py-2 ring-primary/50 placeholder:text-slate-400 hover:bg-slate-200 focus:ring dark:bg-navy-900/90 dark:ring-accent/50 dark:placeholder:text-navy-300 dark:hover:bg-navy-900 dark:focus:bg-navy-900" placeholder="Input The TAX Here" type="text" />
                                                    </label>
                                                </div>

                                                <div class="flex justify-center space-x-2 pt-4 mb-20">
                                                    <button type="submit" class="btn min-w-[7rem] 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">
                                                        Submit TAX Code
                                                    </button>
                                                </div>
                                            </form>
                                        </div>
                                        </div>
                                </div>
                            </div>
                            <div style="border:1px solid" class="my-7 h-px bg-slate-500 dark:bg-navy-700"></div>
                            <div class="flex flex-col justify-between sm:flex-row">
                                <a href="../messages" class="badge mt-2 bg-warning/10 text-warning dark:bg-warning/15">
                                  <span class="text pr-1">Chat With A Customer Care</span>
                                  <i class="fa fa-send"></i>
                                </a>
                                <div class="text-left mt-4">
                                    <div class="qr-code center sm:text-center">
                                        <img style="margin:auto; width:120px" src="https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=http%3A%2F%2Fwww.<?php echo $siteDomain ?>%2F&choe=UTF-8" title="Link to <?php echo $siteDomain ?>" />
                                    </div>
                                </div>
                                <div class="mt-2 text-right sm:mt-0">
                                    <div class="space-y-1 pt-2 text-right">
                                        <p style="text-align:justify" class="p-4">
                                            This is an electronic receipt of a transaction and does not require any signature.
                                            The authenticity of transaction can be confirmed with the Bank.
                                            For any other assistance, kindly call True Serve on <a href="Tel:<?php echo $sitePhone ?>"><?php echo $sitePhone ?></a> or
                                            email <a href="mailto:<?php echo $siteMail ?>"><?php echo $siteMail ?></a>
                                        </p>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
            </main>
            </div>


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

        </html>


<?php
    }
}
?>