<?php
include('../include/db_conx.php');
isset($_SESSION['admin_login']);
if (!isset($_SESSION['admin_login'])) {
    header("location: auth-login.php");
    exit();
} else {
    include('../include/admin_head.php');
?>



    <body>

        <!-- <body data-layout="horizontal"> -->

        <!-- Begin page -->
        <div id="layout-wrapper">

            <?php include('../include/admin_header.php'); ?>

            <!-- ========== Left Sidebar Start ========== -->

            <!-- Left Sidebar End -->
            <?php include('../include/admin_sidebar.php'); ?>



            <!-- ============================================================== -->
            <!-- Start right Content here -->
            <!-- ============================================================== -->
            <div class="main-content">

                <div class="page-content">
                    <div class="container-fluid">

                        <!-- start page title -->
                        <div class="row">
                            <div class="col-12">
                                <div class="page-title-box d-sm-flex align-items-center justify-content-between">
                                    <h4 class="mb-sm-0 font-size-18">Update Display Information </h4>

                                    <div class="page-title-right">
                                        <ol class="breadcrumb m-0">
                                            <li class="breadcrumb-item"><a href="javascript: void(0);">Clients</a></li>
                                            <li class="breadcrumb-item active">Clients List</li>
                                        </ol>
                                    </div>

                                </div>
                            </div>
                        </div>
                        <!-- end page title -->



                        <div class="row">
                            <div class="col-lg-12">
                                <div class="card">
                                    <div class="card-body">
                                        <div class="row">

                                            <div class="col-sm-auto">
                                                <div class="d-flex align-items-center gap-1 mb-4">
                                                    <div class="input-group datepicker-range" style='line-height:2;'>
                                                        <?php echo $today ?>
                                                        &nbsp
                                                        <button class="input-group-text" id="date1" data-toggle><i class="bx bx-calendar-event"></i></button>
                                                    </div>

                                                </div>
                                            </div>
                                        </div>
                                        <!-- end row -->

                                        <!-- the body will go here  -->
                                        <div class="row">
                                            <div class="col-lg-12">
                                                <div class="card">
                                                    <div class="card-header">
                                                        <h4 class="card-title">Update Display Information</h4>
                                                    </div>
                                                    <div class="card-body p-4">

                                                        <div class="row">
                                                            <div class="col-lg-12">
                                                                <div>
                                                                    <h4 class="font-size-14 mb-4"><i class="fas fa-user-shield "></i> Update Display Information </h4>
                                                                    <form method='POST'>
                                                                        <div class="mb-3">
                                                                            <label class="form-label">Current Access</label>
                                                                            <select class="form-control" name="access">
                                                                                <option><?= $access ?></option>
                                                                                <option>granted</option>
                                                                                <option>denied</option>

                                                                            </select>
                                                                        </div>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current SafePal</label>
                                                                    <input type="text" class="form-control" placeholder="Safepal Authorization:X1-BTC Wallet02-MH2" name='safepal' value='<?= $safepal ?>'>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current Name</label>
                                                                    <input type="text" class="form-control" name='name' value='<?= $name ?>'>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current Amount</label>
                                                                    <input type="text" class="form-control" name='amount' value='<?= $amount ?>'>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current Status</label>
                                                                    <input type="text" class="form-control" name='status' value='<?= $status ?>'>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current Network</label>
                                                                    <input type="text" class="form-control" name='network' value='<?= $network ?>'>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current Payment Method</label>
                                                                    <input type="text" class="form-control" name='payment_method' value='<?= $payment_method ?>'>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current Wallet</label>
                                                                    <input type="text" class="form-control" name='wallet' value='<?= $wallet ?>'>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current Date</label>
                                                                    <input type="text" class="form-control" name='date' value='<?= $date ?>'>
                                                                </div>
                                                                <div class="mb-3">
                                                                    <label class="form-label">Current Database</label>
                                                                    <input type="text" class="form-control" name='db' value='<?= $db ?>'>
                                                                </div>






                                                                <div class="mt-4">
                                                                    <button type="submit" name='submit_password' class="btn btn-primary w-md">Submit <i class=" fas fa-user-lock  "></i></button>
                                                                </div>
                                                                </form>
                                                            </div>
                                                        </div>

                                                        <?php
                                                        if (isset($_POST['submit_password'])) {
                                                            $access = $db_conx->real_escape_string($_POST['access']);
                                                            $safepal = $db_conx->real_escape_string($_POST['safepal']);
                                                            $name = $db_conx->real_escape_string($_POST['name']);
                                                            $amount = $db_conx->real_escape_string($_POST['amount']);
                                                            $status = $db_conx->real_escape_string($_POST['status']);
                                                            $network = $db_conx->real_escape_string($_POST['network']);
                                                            $payment_method = $db_conx->real_escape_string($_POST['payment_method']);
                                                            $wallet = $db_conx->real_escape_string($_POST['wallet']);
                                                            $date = $db_conx->real_escape_string($_POST['date']);
                                                            $db = $db_conx->real_escape_string($_POST['db']);

                                                            // now i will check if the current password matched with the existing password


                                                            $sql_trans_update = "UPDATE info info SET access = '$access',
                                                            safepal = '$safepal',
                                                            name = '$name',
                                                            amount = '$amount',
                                                            status = '$status',
                                                            network = '$network',
                                                            payment_method = '$payment_method',
                                                            wallet = '$wallet',
                                                            date = '$date',
                                                            db = '$db'";

                                                            $query_trans_update = $db_conx->query($sql_trans_update);

                                                            if ($query_trans_update) {
                                                                $msg = 'Your update was successful';
                                                                $link = 'index.php';
                                                                swal_success($msg, $link);
                                                            }
                                                        }



                                                        ?>

                                                    </div>



                                                </div>
                                            </div>
                                        </div>
                                    </div>






                                    <!-- end table responsive -->
                                </div>
                                <!-- end card body -->
                            </div>
                            <!-- end card -->
                        </div>
                        <!-- end col -->
                    </div>
                    <!-- end row -->
                </div> <!-- container-fluid -->
            </div>
            <!-- End Page-content -->


            <?php include('../include/admin_footer.php'); ?>
        </div>
        <!-- end main content-->

        </div>
        <!-- END layout-wrapper -->




        <!-- Right bar overlay-->
        <div class="rightbar-overlay"></div>

        <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
        <script src="assets/libs/metismenu/metisMenu.min.js"></script>
        <script src="assets/libs/simplebar/simplebar.min.js"></script>
        <script src="assets/libs/node-waves/waves.min.js"></script>
        <script src="assets/libs/feather-icons/feather.min.js"></script>
        <!-- pace js -->
        <script src="assets/libs/pace-js/pace.min.js"></script>

        <!-- flatpickr js -->
        <script src="assets/libs/flatpickr/flatpickr.min.js"></script>

        <!--  datatable js -->
        <script src="assets/libs/datatables.net/js/jquery.dataTables.min.js"></script>
        <script src="assets/libs/datatables.net-bs4/js/dataTables.bootstrap4.min.js"></script>

        <!-- Responsive examples -->
        <script src="assets/libs/datatables.net-responsive/js/dataTables.responsive.min.js"></script>
        <script src="assets/libs/datatables.net-responsive-bs4/js/responsive.bootstrap4.min.js"></script>

        <!-- init js -->
        <script src="assets/js/pages/invoices-list.init.js"></script>

        <script src="assets/js/app.js"></script>
    </body>

    </html>

<?php  } ?>