Do not allow editing a closed project

This commit is contained in:
johnnyq 2024-04-05 14:19:34 -04:00
parent 048b890465
commit 05d979b3d8
2 changed files with 14 additions and 6 deletions

View File

@ -35,8 +35,10 @@ if (isset($_GET['project_id'])) {
if($project_completed_at) {
$project_status_display = "<span class='badge badge-pill badge-dark ml-2'>Closed</span>";
$project_completed_date_display = "<div class='text-primary text-bold'><small><i class='fa fa-fw fa-door-closed mr-2'></i>" . date('Y-m-d', strtotime($project_completed_at)) . "</small></div>";
} else {
$project_status_display = "<span class='badge badge-pill badge-primary ml-2'>Open</span>";
$project_completed_date_display = "";
}
// Get Tickets
@ -106,6 +108,7 @@ if (isset($_GET['project_id'])) {
<div class="media-body">
<h3 class="mb-0"><?php echo $client_name; ?></h3>
<div><small class='text-secondary'><i class='fa fa-fw fa-clock mr-2'></i><?php echo $project_due; ?></small></div>
<?php echo $project_completed_date_display; ?>
</div>
</div>
</div>
@ -137,14 +140,16 @@ if (isset($_GET['project_id'])) {
<i class="fas fa-fw fa-ellipsis-v"></i>
</button>
<div class="dropdown-menu">
<?php if(empty($project_completed_at)) { ?>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addProjectTicketModal">
<i class="fas fa-fw fa-life-ring mr-2"></i>Add Ticket
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?archive_project=<?php echo $project_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Archive
</a>

View File

@ -127,8 +127,10 @@ $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_completed_at = nullable_htmlentities($row['project_completed_at']);
$project_completed_at_display = date("Y-m-d", strtotime($project_completed_at));
$project_created_at = nullable_htmlentities($row['project_created_at']);
$project_created_at_display = date("Y-m-d", strtotime($project_created_at));
$project_updated_at = nullable_htmlentities($row['project_updated_at']);
$client_id = intval($row['client_id']);
@ -200,25 +202,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</td>
<td><?php echo $project_due; ?></td>
<?php if ($status == 1) { ?>
<td><?php echo $project_completed_at; ?></td>
<td><?php echo $project_completed_at_display; ?></td>
<?php } ?>
<td>
<a href="client_tickets.php?client_id=<?php echo $client_id; ?>">
<?php echo $client_name; ?>
</a>
</td>
<td><?php echo $project_created_at; ?></td>
<td><?php echo $project_created_at_display; ?></td>
<td>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php if(empty($project_completed_at)) { ?>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>">
<i class="fas fa-fw fa-edit mr-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project=<?php echo $project_id; ?>">
<i class="fas fa-fw fa-archive mr-2"></i>Delete
</a>