From 048b890465eafdbc4aa908b679cb35fa69f568b5 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 5 Apr 2024 14:06:57 -0400 Subject: [PATCH] Added Open and Closed Project button to projects list, renamed complete to close for projects --- post/project.php | 8 ++++---- project_details.php | 6 +++--- projects.php | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 41 insertions(+), 8 deletions(-) diff --git a/post/project.php b/post/project.php index 278372ab..2ad3cfaf 100644 --- a/post/project.php +++ b/post/project.php @@ -45,11 +45,11 @@ if (isset($_POST['edit_project'])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } -if (isset($_GET['complete_project'])) { +if (isset($_GET['close_project'])) { validateTechRole(); - $project_id = intval($_GET['complete_project']); + $project_id = intval($_GET['close_project']); // Get Project Name and client id for logging $sql = mysqli_query($mysqli, "SELECT * FROM projects WHERE project_id = $project_id"); @@ -60,9 +60,9 @@ if (isset($_GET['complete_project'])) { mysqli_query($mysqli, "UPDATE projects SET project_completed_at = NOW() WHERE project_id = $project_id"); // Logging - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Project', log_action = 'Complete', log_description = '$session_name marked project $project_name completed', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $project_id"); + mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Project', log_action = 'Close', log_description = '$session_name closed project $project_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $client_id, log_user_id = $session_user_id, log_entity_id = $project_id"); - $_SESSION['alert_message'] = "You marked Project $project_name as completed"; + $_SESSION['alert_message'] = "You closed Project $project_name"; header("Location: " . $_SERVER["HTTP_REFERER"]); } diff --git a/project_details.php b/project_details.php index 360a8a2e..1e2d09d3 100644 --- a/project_details.php +++ b/project_details.php @@ -34,7 +34,7 @@ if (isset($_GET['project_id'])) { $client_name = nullable_htmlentities($row['client_name']); if($project_completed_at) { - $project_status_display = "Complete"; + $project_status_display = "Closed"; } else { $project_status_display = "Open"; } @@ -128,8 +128,8 @@ if (isset($_GET['project_id'])) {
- - Complete + + Close
+
+
+ + +
+
" id="advancedFilter">
@@ -85,7 +109,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Project Tickets / Tasks - Due + Due + + + Completed + Client Created Action @@ -99,6 +127,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $project_name = nullable_htmlentities($row['project_name']); $project_description = nullable_htmlentities($row['project_description']); $project_due = nullable_htmlentities($row['project_due']); + $project_completed_at = date("Y-m-d", strtotime($row['project_completed_at'])); $project_created_at = date("Y-m-d", strtotime($row['project_created_at'])); $project_updated_at = nullable_htmlentities($row['project_updated_at']); @@ -170,6 +199,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); + + + @@ -182,6 +214,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));