<?php
session_start();

require('../includes/database.php');

if (isset($_SESSION['username']) && $_SESSION['password'] != "") {
} else {
    header("Location:index.php");
}
$username = $_SESSION['username'];


$username = $_SESSION['username'];
$password = $_SESSION['password'];

$query = "SELECT *
			FROM admin	
			WHERE username = '$username'
			&&   password = '$password'";

$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('head.php');

?>

        <body class="theme-blush">

            <!-- Page Loader -->
            <?php
            include('loader.php');
            ?>

            <!-- Overlay For Sidebars -->
            <div class="overlay"></div>

            <!-- Main Search -->
            <div id="search">
                <button id="close" type="button" class="close btn btn-primary btn-icon btn-icon-mini btn-round">x</button>
                <form>
                    <input type="search" value="" placeholder="Search..." />
                    <button type="submit" class="btn btn-primary">Search</button>
                </form>
            </div>

            <?php
            include('right-sidebar.php');
            include('left-side.php');
            ?>



            <!-- Right Sidebar -->
            <?php
            include('settings&pops.php');
            ?>

            <?php
            require('../includes/database.php');
            $transid = $_GET['transid'];
            $sql = "SELECT * FROM transactions where id = '$transid'";
            $cons_list = mysqli_query($con, $sql) or die(mysqli_connect_error());
            if ($row = mysqli_fetch_assoc($cons_list)) {

            ?>
                <section class="content">
                    <div class="body_scroll">
                        <div class="block-header">
                            <div class="row">
                                <div class="col-lg-7 col-md-6 col-sm-12">
                                    <h2>Change Transaction Date</h2>
                                    <ul class="breadcrumb">
                                        <li class="breadcrumb-item"><a href="dashboard.php"><i class="zmdi zmdi-home"></i> Online Bank</a></li>
                                        <li class="breadcrumb-item">Pages</li>
                                        <li class="breadcrumb-item active">Profile</li>
                                    </ul>
                                    <button style="background:red;" class="btn btn-icon mobile_menu" type="button"><i class="zmdi zmdi-sort-amount-desc"></i></button>
                                </div>
                                <div class="col-lg-5 col-md-6 col-sm-12">
                                    <button style="background:red;" class="btn btn-icon float-right right_icon_toggle_btn" type="button"><i class="zmdi zmdi-arrow-right"></i></button>
                                </div>
                            </div>
                        </div>
                        <div class="container-fluid">
                            <div style="margin:auto;" class="row">
                                <div class="col-lg-10 col-sm-12 col-md-6">
                                    <div class="card mcard_3">
                                        <div class="body">
                                            <h4 class="m-t-10">Transaction ID: <?php echo $transid ?></h4>
                                            <div class="col-12 m-t-10">
                                                <span>Account Number:</span> <span style="float:right;"><input style="font-weight:bold" type="text" disabled value="<?php echo $row['account_number']; ?>" class="form-control"> </span>
                                                <hr>
                                                <br>
                                                <span>Transaction Type:</span> <span style="float:right"><input style="font-weight:bold" type="text" disabled value="<?php echo $row['trans_type']; ?>" class="form-control"> </span>
                                                <hr>
                                                <br>
                                                <span>Amount:</span> <span style="float:right"><input style="font-weight:bold" type="text" disabled value="<?php echo number_format($row['balance'], 2); ?>" class="form-control"> </span>
                                                <hr>
                                                <br>
                                                <span>Current Transaction Date:</span> <span style="float:right"><input style="font-weight:bold" type="text" disabled value="<?php echo $row['date']; ?>" class="form-control"> </span>
                                                <hr>

                                                <br>
                                                <form action="../bank-manager.php?action=change-date" method="post">
                                                    <span>Current Transaction Date:</span>
                                                    <span style="float:right">
                                                        <input style="font-weight:bold" type="datetime-local" name="date" value="" class="form-control">
                                                        <input type="hidden" name="id" value="<?php echo $row['id']; ?>">
                                                        <button class="btn btn-warning" type="submit"><i class="fa fa-edit"></i> Change Transaction Date </button>
                                                    </span>
                                                    <hr>
                                                </form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </section>
    <?php include('footer.php');
            }
        }
    } ?>