diff --git a/src/index.php b/src/index.php index 893a2a3..74fc814 100644 --- a/src/index.php +++ b/src/index.php @@ -230,12 +230,12 @@ -
+
- WEEKLY TOP SOLD PRODUCTS + TOP PRODUCT PAIRINGS OF THE WEEK
@@ -252,7 +252,7 @@ $output = shell_exec('python apriori/apriori_algo.py 2>&1'); // Fetch the specific item with ID 1 from the database - $sql = "SELECT antecedent, consequent FROM frequent_items WHERE id = 1"; + $sql = "SELECT antecedent, consequent FROM frequent_items"; $result = $db->query($sql); $topPickData = []; @@ -262,15 +262,13 @@ echo " - + "; @@ -285,15 +283,7 @@ "; } - // Fetch the all the items from the database - $sql = "SELECT antecedent, consequent FROM frequent_items"; - $result = $db->query($sql); - - $topPickDatas = []; - if ($result->num_rows > 0) { - while ($row = $result->fetch_assoc()) { - $topPickDatas[] = [addslashes($row["antecedent"]), '+', addslashes($row["consequent"])];}} - $jsonTopPickData = json_encode($topPickDatas); + $jsonTopPickData = json_encode($topPickData); ?>
- - " . htmlspecialchars($row["antecedent"]) . " + " . htmlspecialchars($row["antecedent"]) . "
++
- - " . htmlspecialchars($row["consequent"]) . " + " . htmlspecialchars($row["consequent"]) . "
diff --git a/src/javascript/reports.js b/src/javascript/reports.js index c86e033..6f57c3b 100644 --- a/src/javascript/reports.js +++ b/src/javascript/reports.js @@ -100,7 +100,7 @@ async function downloadPDF() { }, bodyStyles: { fillColor: "#ffffff", - textColor: "#88531E", + textColor: "#000000", }, }); @@ -147,14 +147,14 @@ async function downloadPDF() { }, bodyStyles: { fillColor: "#ffffff", - textColor: "#88531E", + textColor: "#000000", }, }); // Top Pick and Likely Paired With Table doc.setFontSize(14); doc.setFont("Helvetica", "bold"); - doc.text("Weekly Top Sold Products", 15, doc.previousAutoTable.finalY + 10); + doc.text("Top Product Pairings of the Week", 15, doc.previousAutoTable.finalY + 10); const topPickHeaders = ["Top Pick", "", "Likely Paired With"]; doc.autoTable({ @@ -163,19 +163,23 @@ async function downloadPDF() { body: topPickData, theme: "grid", styles: { - textColor: "#88531E", - fillColor: "#ffffff", + textColor: "#ffffff", + fillColor: "#88531E", halign: "center", }, headStyles: { - fillColor: "#ffffff", - textColor: "#88531E", + fillColor: "#88531E", + textColor: "#ffffff", }, bodyStyles: { fillColor: "#ffffff", - textColor: "#88531E", + textColor: "#000000", }, }); - doc.save("report.pdf"); + // Format the date for the filename + const formattedDate = today.toLocaleDateString('en-GB').replace(/\//g, '-'); + const fileName = `Reports for ${formattedDate}.pdf`; + + doc.save(fileName); } diff --git a/src/styles/main.css b/src/styles/main.css index 9a0d52d..fa4b9dd 100644 --- a/src/styles/main.css +++ b/src/styles/main.css @@ -12795,7 +12795,7 @@ textarea.form-control-lg { .styled-table thead tr { background-color: #FFFFFF; /* Changed background color */ - color: #343a40; + color: #C57C47; } .styled-table th, @@ -12819,11 +12819,6 @@ textarea.form-control-lg { background-color: #FFFFFF; } -.styled-table tbody tr.active-row { - font-weight: bold; - color: #343a40; -} - .plus-sign { font-weight: bold; font-size: 5em;