commit d3d23007267ca5b689e91a7f2d9f53de2b7d6249
parent 4a0b21dc1aa47721d4d58b06848bcf4aba7f6cfb
Author: William Lindholm <william_lindholm@outlook.com>
Date: Sun, 1 Oct 2023 18:38:45 +0000
Added datefilter for Operations.
Diffstat:
2 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/operations.php b/operations.php
@@ -5,7 +5,26 @@
$pageContent = '';
- $query = "SELECT * FROM Operation;";
+ $pageContent .= '<form action="" method="post" class="mt-3">';
+ $pageContent .= ' <div class="form-group">';
+ $pageContent .= ' <label for="startDate">Start Date:</label>';
+ $pageContent .= ' <input type="date" class="form-control" id="startDate" name="startDate">';
+ $pageContent .= ' </div>';
+ $pageContent .= ' <div class="form-group">';
+ $pageContent .= ' <label for="endDate">End Date:</label>';
+ $pageContent .= ' <input type="date" class="form-control" id="endDate" name="endDate">';
+ $pageContent .= ' </div>';
+ $pageContent .= ' <input type="hidden" name="OperationType" value="filter">';
+ $pageContent .= ' <button type="submit" class="btn btn-primary">Filter</button>';
+ $pageContent .= '</form><hr>';
+
+ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["OperationType"]) && $_POST["OperationType"] == "filter") {
+ $startDate = $_POST["startDate"];
+ $endDate = $_POST["endDate"];
+ $query = "CALL GetOperationsInRange('$startDate', '$endDate');";
+ } else {
+ $query = "SELECT * FROM Operation;";
+ }
$pageContent .= "<h3>Operations</h3>" . tableFactory::createTableWithRedirect($query, "operation.php", ["OperationName", "StartDate", "IncidentName", "IncidentNumber"], "Operation");
@@ -25,4 +44,4 @@
$pageContent .= $modalBuilder->generateOpenButton("Create operation");
include 'utils/pageTemplate.php';
-?>
-\ No newline at end of file
+?>
diff --git a/utils/logs.txt b/utils/logs.txt
@@ -2725,3 +2725,15 @@
2023-10-01 14:42:11 - FROM MODALBUILDER: posthandler intercepting messages with operationType: INSERT
2023-10-01 14:42:18 - FROM MODALBUILDER: posthandler intercepting messages with operationType: INSERT
2023-10-01 14:55:51 - Inserting into: Agent
+2023-10-01 18:37:02 - Inserting into: Operation
+2023-10-01 18:37:02 - calling from OperationInsertHandler: $incident = Arson, 108
+2023-10-01 18:37:02 - IncidentName= Arson
+2023-10-01 18:37:02 - IncidentNumber= 108
+2023-10-01 18:37:33 - Inserting into: Operation
+2023-10-01 18:37:33 - calling from OperationInsertHandler: $incident = Arson, 108
+2023-10-01 18:37:33 - IncidentName= Arson
+2023-10-01 18:37:33 - IncidentNumber= 108
+2023-10-01 18:37:44 - Inserting into: Operation
+2023-10-01 18:37:44 - calling from OperationInsertHandler: $incident = Arson, 108
+2023-10-01 18:37:44 - IncidentName= Arson
+2023-10-01 18:37:44 - IncidentNumber= 108