partially working CGPT

by KevinGabbert

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <!-- Include DataTables CSS from CDN -->
    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">

    <style>
        /* Add border style */
        #partsTable {
            border: 1px solid #dee2e6;
        }
    </style>
</head>
<body>
    <div class="container mt-5">
        <br>
        <div id="PartsTableSection">
            <div id="table-container">
                <!-- Placeholder for the table -->
            </div>
        </div>
    </div>

    <!-- Link jQuery and DataTables JS from CDN -->
    <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
    <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>

    <!-- Your script section -->
    <script type="text/javascript">
        $(document).ready(function () {
            // Fetch and populate grid on page load
            fetchDataAndUpdateGrid();
        });

        function fetchDataAndUpdateGrid() {
            // Generate fake data for demonstration
            var fakeData = [
                { Description: "Description 1", ProductCategory: "Category 1", LeadTime: 10, MinInventoryLevel: 5, MaxInventoryLevel: 15, SalesHistory: 100, LastPORUpdate: "2022-01-01", LastTIRun: "2022-01-02" },
                { Description: "Description 2", ProductCategory: "Category 2", LeadTime: 20, MinInventoryLevel: 10, MaxInventoryLevel: 25, SalesHistory: 200, LastPORUpdate: "2022-01-02", LastTIRun: "2022-01-03" },
                { Description: "Description 3", ProductCategory: "Category 3", LeadTime: 30, MinInventoryLevel: 15, MaxInventoryLevel: 35, SalesHistory: 300, LastPORUpdate: "2022-01-03", LastTIRun: "2022-01-04" },
                // Add more rows as needed
            ];

            // Update the grid with fetched data
            updateGrid(fakeData);
        }

        function updateGrid(data) {
            //...