mirror of
https://github.com/itflow-org/itflow
synced 2026-03-24 06:25:40 +00:00
Add Projects to client side nav and seperated the logic between client and global view of projects
This commit is contained in:
@@ -82,6 +82,18 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-item">
|
||||||
|
<a href="projects.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "projects.php" || basename($_SERVER["PHP_SELF"]) == "project_details.php") { echo "active"; } ?>">
|
||||||
|
<i class="nav-icon fas fa-project-diagram"></i>
|
||||||
|
<p>
|
||||||
|
Projects
|
||||||
|
<?php if ($num_active_projects) { ?>
|
||||||
|
<span class="right badge text-light" data-toggle="tooltip" title="Open Projects"><?php echo $num_active_projects; ?></span>
|
||||||
|
<?php } ?>
|
||||||
|
</p>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|||||||
@@ -148,6 +148,10 @@ if (isset($_GET['client_id'])) {
|
|||||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('recurring_ticket_id') AS num FROM recurring_tickets WHERE recurring_ticket_client_id = $client_id"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('recurring_ticket_id') AS num FROM recurring_tickets WHERE recurring_ticket_client_id = $client_id"));
|
||||||
$num_recurring_tickets = $row['num'];
|
$num_recurring_tickets = $row['num'];
|
||||||
|
|
||||||
|
// Active Project Count
|
||||||
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('project_id') AS num FROM projects WHERE project_archived_at IS NULL AND project_completed_at IS NULL AND project_client_id = $client_id"));
|
||||||
|
$num_active_projects = $row['num'];
|
||||||
|
|
||||||
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('service_id') AS num FROM services WHERE service_client_id = $client_id"));
|
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('service_id') AS num FROM services WHERE service_client_id = $client_id"));
|
||||||
$num_services = $row['num'];
|
$num_services = $row['num'];
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<option value="">- Select a Tickets -</option>
|
<option value="">- Select a Tickets -</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql_tickets_select = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_project_id = 0 AND ticket_closed_at IS NULL");
|
$sql_tickets_select = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_project_id = 0 AND ticket_closed_at IS NULL $client_ticket_select_query");
|
||||||
while ($row = mysqli_fetch_array($sql_tickets_select)) {
|
while ($row = mysqli_fetch_array($sql_tickets_select)) {
|
||||||
$ticket_id_select = intval($row['ticket_id']);
|
$ticket_id_select = intval($row['ticket_id']);
|
||||||
$ticket_prefix_select = nullable_htmlentities($row['ticket_prefix']);
|
$ticket_prefix_select = nullable_htmlentities($row['ticket_prefix']);
|
||||||
|
|||||||
@@ -1,6 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
// If client_id is in URI then show client Side Bar and client header
|
||||||
|
if (isset($_GET['client_id'])) {
|
||||||
|
require_once "includes/inc_all_client.php";
|
||||||
|
$client_query = "AND ticket_client_id = $client_id";
|
||||||
|
$client_ticket_select_query = "AND ticket_client_id = $client_id";
|
||||||
|
$client_url = "client_id=$client_id&";
|
||||||
|
} else {
|
||||||
require_once "includes/inc_all.php";
|
require_once "includes/inc_all.php";
|
||||||
|
$client_query = '';
|
||||||
|
$client_ticket_select_query = '';
|
||||||
|
$client_url = '';
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['project_id'])) {
|
if (isset($_GET['project_id'])) {
|
||||||
$project_id = intval($_GET['project_id']);
|
$project_id = intval($_GET['project_id']);
|
||||||
|
|||||||
57
projects.php
57
projects.php
@@ -4,7 +4,17 @@
|
|||||||
$sort = "project_name";
|
$sort = "project_name";
|
||||||
$order = "ASC";
|
$order = "ASC";
|
||||||
|
|
||||||
|
// If client_id is in URI then show client Side Bar and client header
|
||||||
|
if (isset($_GET['client_id'])) {
|
||||||
|
require_once "includes/inc_all_client.php";
|
||||||
|
$client_query = "AND project_client_id = $client_id";
|
||||||
|
|
||||||
|
$client_url = "client_id=$client_id&";
|
||||||
|
} else {
|
||||||
require_once "includes/inc_all.php";
|
require_once "includes/inc_all.php";
|
||||||
|
$client_query = '';
|
||||||
|
$client_url = '';
|
||||||
|
}
|
||||||
|
|
||||||
// Perms
|
// Perms
|
||||||
enforceUserPermission('module_support');
|
enforceUserPermission('module_support');
|
||||||
@@ -42,6 +52,7 @@ $sql_projects = mysqli_query(
|
|||||||
AND project_completed_at $status_query
|
AND project_completed_at $status_query
|
||||||
$project_permission_snippet
|
$project_permission_snippet
|
||||||
AND project_$archive_query
|
AND project_$archive_query
|
||||||
|
$client_query
|
||||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -59,6 +70,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form class="mb-4" autocomplete="off">
|
<form class="mb-4" autocomplete="off">
|
||||||
|
<?php if ($client_url) { ?>
|
||||||
|
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
|
||||||
|
<?php } ?>
|
||||||
<input type="hidden" name="archived" value="<?php echo $archived; ?>">
|
<input type="hidden" name="archived" value="<?php echo $archived; ?>">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
@@ -73,8 +87,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<div class="btn-toolbar float-right">
|
<div class="btn-toolbar float-right">
|
||||||
<div class="btn-group mr-2">
|
<div class="btn-group mr-2">
|
||||||
<a href="?status=0" class="btn btn-<?php if ($status == 0){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-open mr-2"></i>Open</a>
|
<a href="?<?php echo $client_url; ?>status=0" class="btn btn-<?php if ($status == 0){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-open mr-2"></i>Open</a>
|
||||||
<a href="?status=1" class="btn btn-<?php if ($status == 1){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-closed mr-2"></i>Closed</a>
|
<a href="?<?php echo $client_url; ?>status=1" class="btn btn-<?php if ($status == 1){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-closed mr-2"></i>Closed</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="btn-group mr-2">
|
<div class="btn-group mr-2">
|
||||||
@@ -142,11 +156,29 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</a>
|
</a>
|
||||||
</th>
|
</th>
|
||||||
<?php if ($status == 1) { ?>
|
<?php if ($status == 1) { ?>
|
||||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_completed_at&order=<?php echo $disp; ?>">Completed</a></th>
|
<th>
|
||||||
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_completed_at&order=<?php echo $disp; ?>">
|
||||||
|
Completed
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<?php } ?>
|
||||||
|
<th>
|
||||||
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">
|
||||||
|
Manager
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_created_at&order=<?php echo $disp; ?>">
|
||||||
|
Created
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
<?php if (!$client_url) { ?>
|
||||||
|
<th>
|
||||||
|
<a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">
|
||||||
|
Client
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=user_name&order=<?php echo $disp; ?>">Manager</a></th>
|
|
||||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=client_name&order=<?php echo $disp; ?>">Client</a></th>
|
|
||||||
<th><a class="text-dark" href="?<?php echo $url_query_strings_sort; ?>&sort=project_created_at&order=<?php echo $disp; ?>">Created</a></th>
|
|
||||||
<th class="text-center">Action</th>
|
<th class="text-center">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -170,7 +202,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$client_name = nullable_htmlentities($row['client_name']);
|
$client_name = nullable_htmlentities($row['client_name']);
|
||||||
if ($client_name) {
|
if ($client_name) {
|
||||||
$client_name_display = "<a href='tickets.php?client_id=$client_id'>$client_name</a>";
|
$client_name_display = "<a href='projects.php?client_id=$client_id'>$client_name</a>";
|
||||||
} else {
|
} else {
|
||||||
$client_name_display = "-";
|
$client_name_display = "-";
|
||||||
}
|
}
|
||||||
@@ -223,7 +255,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a class="text-dark" href="project_details.php?project_id=<?php echo $project_id; ?>">
|
<a class="text-dark" href="project_details.php?<?php echo $client_url; ?>project_id=<?php echo $project_id; ?>">
|
||||||
<?php echo "$project_prefix$project_number"; ?>
|
<?php echo "$project_prefix$project_number"; ?>
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -257,8 +289,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
<td><?php echo $project_completed_at_display; ?></td>
|
<td><?php echo $project_completed_at_display; ?></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<td><?php echo $project_manager_display; ?></td>
|
<td><?php echo $project_manager_display; ?></td>
|
||||||
<td><?php echo $client_name_display; ?></td>
|
|
||||||
<td><?php echo $project_created_at_display; ?></td>
|
<td><?php echo $project_created_at_display; ?></td>
|
||||||
|
<?php if (!$client_url) { ?>
|
||||||
|
<td><?php echo $client_name_display; ?></td>
|
||||||
|
<?php } ?>
|
||||||
<td>
|
<td>
|
||||||
<div class="dropdown dropleft text-center">
|
<div class="dropdown dropleft text-center">
|
||||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||||
@@ -306,13 +340,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<?php require_once "includes/filter_footer.php";
|
<?php require_once "includes/filter_footer.php"; ?>
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
require_once "modals/project_add_modal.php";
|
require_once "modals/project_add_modal.php";
|
||||||
|
|
||||||
require_once "includes/footer.php";
|
require_once "includes/footer.php";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user