javywithawhy / MGMT-460

Repository for Info Systems Dev
GNU General Public License v3.0
0 stars 0 forks source link

Update User Interface for Management table (update) #18

Open javywithawhy opened 1 year ago

javywithawhy commented 1 year ago

<html>
<head>
    <style>
        table, th, td {
          border: 1px solid black;
          border-collapse: collapse;
          padding: 5px;
        }
        th {
          background-color: rgb(0, 128, 98);
          color: black;
        }
      </style>
<script language="javascript">
    window.addEventListener("load", readAll)
    function readAll() {
        fetch("http://localhost:7777/retrieve")
        .then(response => response.json())
        .then(function(data) {
            var table = "<table><tr><th>PO Number</th><th>Vendor</th><th>Location Block</th><th>Location Shelf</th><th>Description</th></tr>";
            data.forEach(row => table += `<tr><td><a href=update-one.html?po_number=${row.po_number}>${row.po_number}</a></td><td>${row.vendor}</td><td>${row.location_block}</td><td>${row.location_shelf}</td><td>${row.desc}</td></tr>`);
            table += "</table>";
            document.getElementById("updateList").innerHTML = table;
// Add back button event listener
            var backButton = document.getElementById("backButton");
            backButton.addEventListener("click", function() {
                window.history.back();
            });
        })
    }
</script>
</head>
<body style="background-color:rgb(0, 128, 98);">
    <h1 style="font-family:lato;">Minimal CRUD Update User Interface</h1>
    <button id="backButton">Back</button>
    <div id="updateList"></div>
<body style="background-color:rgb(0, 128, 98);">
    <div id="updateList"></div>
</body>
</html> ```