<?php session_start();  if(!isset($_SESSION['sales'])){ header('location:login.php'); die();}

include 'xyz.php';



   ?>
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><meta name="description" content="">
<meta name="author" content="">

    <title>My Outlet</title>
    <?php  include 'inc/toplinks.php';  ?>
</head>
<body id="page-top"><div id="wrapper"><?php  include 'inc/menus.php';  ?>

        

<?php include 'inc/top.php';   ?>



                <!-- End of Topbar -->

                <!-- Begin Page Content -->
                <div class="container-fluid">

                    <!-- Page Heading -->
                    <div class="d-sm-flex align-items-center justify-content-between mb-4">
<?php  include 'inc/greet.php';  ?><?php  include 'process.php';  ?>

                       <!--  <a href="#" class="d-none d-sm-inline-block btn btn-sm btn-primary shadow-sm"><i
                                class="fas fa-download fa-sm text-white-50"></i> Generate Report</a> -->
                    </div>

                    <!-- Content Row -->
                    <div class="row">

<?php $query ="SELECT * FROM products ORDER by item_name DESC";$selCrs=$lucas=$range='';?>
<div class="col-md-12">
<div class="card shadow mb-4">  <div class="card-header py-3 d-flex flex-row align-items-center justify-content-between bg-success text-white"><h6 class="m-0 font-weight-bold text-white">#STOCK & PRICE PREVIEW</h6></div><div class="card-body">


<!-- d-none d-md-block -->


 <input type="text" id="itemNameSearch" class="form-control mb-3" placeholder="Search by Item Name">
    <div id="dataTableContainer" class="table-responsive small">
      
    </div>


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


                     
                       
                      
                    </div>


                    <!-- Content Row -->
               

                </div>
                <!-- /.container-fluid -->

            </div>
            <!-- End of Main Content -->

            <!-- Footer -->
        <?php include 'inc/foot.php';  ?>

<?php include 'inc/modals.php'; include 'inc/bottom.php';    include 'js/foot_links.php';?>


<script>
$(document).ready(function() {
    // Function to handle item name search on keyup
    $('#itemNameSearch').on('keyup', function() {
        var itemName = $(this).val().trim(); myBranch = "<?php  echo $my_branch_code; ?>";

        // Perform AJAX request only if itemName is not empty
        if (itemName !== '') {
            // Abort any existing AJAX request to avoid stacking
            if (typeof xhr !== 'undefined') {
                xhr.abort();
            }

            // Perform AJAX request
            var xhr = $.ajax({
                url: 'search_items', // PHP script to handle search
                type: 'POST',
                dataType: 'html',
                data: { itemName: itemName,myBranch:myBranch },
                success: function(response) {
                    $('#dataTableContainer').html(response); // Update table with search results
                },
                error: function(xhr, status, error) {
                    console.error('Error:', error);
                }
            });
        } else {
            // Clear table content if search input is empty
            $('#dataTableContainer').html('');
        }
    });
});
</script>



</body>

</html>