Css fixes

This commit is contained in:
johnnyq
2026-08-16 22:25:05 -04:00
parent 92377b918a
commit 6df101c217
50 changed files with 5955 additions and 5996 deletions

View File

@@ -18,21 +18,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-key me-2"></i>API Keys</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/api/api_key_add.php"><i class="fas fa-plus me-2"></i>New API Key</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search keys">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
@@ -57,111 +57,110 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
</div>
<div class="table-responsive-sm">
<div class="table-responsive-sm">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="pe-0">
<div class="form-check">
<input class="form-check-input" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_name&order=<?= $disp ?>">
Name <?php if ($sort == 'api_key_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_user_id&order=<?= $disp ?>">
User <?php if ($sort == 'api_key_user_id') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_secret&order=<?= $disp ?>">
Secret <?php if ($sort == 'api_key_secret') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_created_at&order=<?= $disp ?>">
Created <?php if ($sort == 'api_key_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_expire&order=<?= $disp ?>">
Expires <?php if ($sort == 'api_key_expire') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$api_key_id = intval($row['api_key_id']);
$api_key_name = escapeHtml($row['api_key_name']);
$api_key_secret = escapeHtml("************" . substr($row['api_key_secret'], -4));
$api_key_created_at = escapeHtml($row['api_key_created_at']);
$api_key_expire = escapeHtml($row['api_key_expire']);
if ($api_key_expire < date("Y-m-d H:i:s")) {
$api_key_expire = $api_key_expire . " (Expired)";
}
$api_key_user = !empty($row['user_name']) ? escapeHtml($row['user_name']) : "<i>None</i>";
?>
<tr>
<td class="pe-0">
<div class="form-check">
<input class="form-check-input" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="api_key_ids[]" value="<?= $api_key_id ?>">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_name&order=<?= $disp ?>">
Name <?php if ($sort == 'api_key_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_user_id&order=<?= $disp ?>">
User <?php if ($sort == 'api_key_user_id') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_secret&order=<?= $disp ?>">
Secret <?php if ($sort == 'api_key_secret') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_created_at&order=<?= $disp ?>">
Created <?php if ($sort == 'api_key_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=api_key_expire&order=<?= $disp ?>">
Expires <?php if ($sort == 'api_key_expire') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$api_key_id = intval($row['api_key_id']);
$api_key_name = escapeHtml($row['api_key_name']);
$api_key_secret = escapeHtml("************" . substr($row['api_key_secret'], -4));
$api_key_created_at = escapeHtml($row['api_key_created_at']);
$api_key_expire = escapeHtml($row['api_key_expire']);
if ($api_key_expire < date("Y-m-d H:i:s")) {
$api_key_expire = $api_key_expire . " (Expired)";
}
$api_key_user = !empty($row['user_name']) ? escapeHtml($row['user_name']) : "<i>None</i>";
?>
<tr>
<td class="pe-0">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="api_key_ids[]" value="<?= $api_key_id ?>">
</div>
</td>
<td class="text-bold"><?= $api_key_name ?></td>
<td><?= $api_key_user ?></td>
<td><?= $api_key_secret ?></td>
<td><?= $api_key_created_at ?></td>
<td><?= $api_key_expire ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/api/api_key_edit.php?id=<?= $api_key_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
<td class="text-bold"><?= $api_key_name ?></td>
<td><?= $api_key_user ?></td>
<td><?= $api_key_secret ?></td>
<td><?= $api_key_created_at ?></td>
<td><?= $api_key_expire ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/api/api_key_edit.php?id=<?= $api_key_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($api_key_expire > date("Y-m-d H:i:s")) { ?>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?revoke_api_key=<?= $api_key_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-times me-2"></i>Revoke
</a>
<?php if ($api_key_expire > date("Y-m-d H:i:s")) { ?>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?revoke_api_key=<?= $api_key_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-times me-2"></i>Revoke
</a>
<?php } ?>
<?php if ($api_key_expire < date("Y-m-d H:i:s")) { ?>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_api_key=<?= $api_key_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-times me-2"></i>Delete
</a>
<?php } ?>
</div>
<?php } ?>
<?php if ($api_key_expire < date("Y-m-d H:i:s")) { ?>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_api_key=<?= $api_key_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-times me-2"></i>Delete
</a>
<?php } ?>
</div>
</td>
</tr>
</div>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</tbody>
</table>
</form>
</form>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -40,15 +40,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-3">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title"><i class="fas fa-fw fa-history me-2"></i>App Logs</h3>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="mb-3">
<div>
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search app logs">
<button class="btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter"><i class="fas fa-filter"></i></button>
@@ -58,7 +58,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="col-sm-2">
<div class="mb-3">
<div>
<select class="form-select select2" name="type" onchange="this.form.submit()">
<option value="">- All Types -</option>
@@ -77,7 +77,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="col-sm-2">
<div class="mb-3">
<div>
<select class="form-select select2" name="category" onchange="this.form.submit()">
<option value="">- All Categories -</option>
@@ -96,10 +96,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -109,62 +109,61 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=app_log_created_at&order=<?= $disp ?>">
Timestamp <?php if ($sort == 'app_log_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=app_log_type&order=<?= $disp ?>">
Type <?php if ($sort == 'app_log_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=app_log_category&order=<?= $disp ?>">
Category <?php if ($sort == 'app_log_category') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=app_log_details&order=<?= $disp ?>">
Details <?php if ($sort == 'app_log_details') { echo $order_icon; } ?>
</a>
</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=app_log_created_at&order=<?= $disp ?>">
Timestamp <?php if ($sort == 'app_log_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=app_log_type&order=<?= $disp ?>">
Type <?php if ($sort == 'app_log_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=app_log_category&order=<?= $disp ?>">
Category <?php if ($sort == 'app_log_category') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=app_log_details&order=<?= $disp ?>">
Details <?php if ($sort == 'app_log_details') { echo $order_icon; } ?>
</a>
</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$log_id = intval($row['app_log_id']);
$log_type = escapeHtml($row['app_log_type']);
$log_category = escapeHtml($row['app_log_category']);
$log_details = escapeHtml($row['app_log_details']);
$log_created_at = escapeHtml($row['app_log_created_at']);
while ($row = mysqli_fetch_assoc($sql)) {
$log_id = intval($row['app_log_id']);
$log_type = escapeHtml($row['app_log_type']);
$log_category = escapeHtml($row['app_log_category']);
$log_details = escapeHtml($row['app_log_details']);
$log_created_at = escapeHtml($row['app_log_created_at']);
?>
<tr>
<td class="font-monospace"><?= $log_created_at ?></td>
<td><?= $log_type ?></td>
<td><?= $log_category ?></td>
<td><?= $log_details ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<tr>
<td class="font-monospace"><?= $log_created_at ?></td>
<td><?= $log_type ?></td>
<td><?= $log_category ?></td>
<td><?= $log_details ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -65,15 +65,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-3">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title"><i class="fas fa-fw fa-history me-2"></i>Audit Logs</h3>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search audit logs">
<button class="btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@@ -81,7 +81,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="col-sm-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="client" onchange="this.form.submit()">
<option value="">- All Clients -</option>
@@ -101,7 +101,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="col-sm-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="user" onchange="this.form.submit()">
<option value="">- All Users -</option>
@@ -121,7 +121,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="col-sm-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="type" onchange="this.form.submit()">
<option value="">- All Types -</option>
@@ -140,7 +140,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="col-sm-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="action" onchange="this.form.submit()">
<option value="">- All Actions -</option>
@@ -158,11 +158,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -172,109 +172,108 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
</div>
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_created_at&order=<?= $disp ?>">
Timestamp <?php if ($sort == 'log_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
User <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (empty($client)) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_created_at&order=<?= $disp ?>">
Timestamp <?php if ($sort == 'log_created_at') { echo $order_icon; } ?>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
User <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (empty($client)) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_type&order=<?= $disp ?>">
Type <?php if ($sort == 'log_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_action&order=<?= $disp ?>">
Action <?php if ($sort == 'log_action') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_description&order=<?= $disp ?>">
Description <?php if ($sort == 'log_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_ip&order=<?= $disp ?>">
IP Address <?php if ($sort == 'log_ip') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_user_agent&order=<?= $disp ?>">
User Agent <?php if ($sort == 'log_user_agent') { echo $order_icon; } ?>
</a>
</th>
</tr>
</thead>
<tbody>
<?php
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_type&order=<?= $disp ?>">
Type <?php if ($sort == 'log_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_action&order=<?= $disp ?>">
Action <?php if ($sort == 'log_action') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_description&order=<?= $disp ?>">
Description <?php if ($sort == 'log_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_ip&order=<?= $disp ?>">
IP Address <?php if ($sort == 'log_ip') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=log_user_agent&order=<?= $disp ?>">
User Agent <?php if ($sort == 'log_user_agent') { echo $order_icon; } ?>
</a>
</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$log_id = intval($row['log_id']);
$log_type = escapeHtml($row['log_type']);
$log_action = escapeHtml($row['log_action']);
$log_description = escapeHtml($row['log_description']);
$log_ip = escapeHtml($row['log_ip']);
$log_user_agent = escapeHtml($row['log_user_agent']);
$log_user_os = getOS($log_user_agent);
$log_user_browser = getWebBrowser($log_user_agent);
$log_created_at = escapeHtml($row['log_created_at']);
$user_id = intval($row['user_id']);
$user_name = escapeHtml($row['user_name']);
if (empty($user_name)) {
$user_name_display = "-";
} else {
$user_name_display = $user_name;
}
$client_name = escapeHtml($row['client_name']);
$client_id = intval($row['client_id']);
if (empty($client_name)) {
$client_name_display = "-";
} else {
$client_name_display = "<a href='../agent/client_overview.php?client_id=$client_id'>$client_name</a>";
}
$log_entity_id = intval($row['log_entity_id']);
?>
<tr>
<td class="font-monospace"><?= $log_created_at ?></td>
<td><?= $user_name_display ?></td>
<?php if(empty($client)) { ?>
<td><?= $client_name_display ?></td>
<?php } ?>
<td><?= $log_type ?></td>
<td><?= $log_action ?></td>
<td><?= $log_description ?></td>
<td class="font-monospace"><?= $log_ip ?></td>
<td><?= "$log_user_os<div class='text-secondary'>$log_user_browser</div>" ?></td>
</tr>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$log_id = intval($row['log_id']);
$log_type = escapeHtml($row['log_type']);
$log_action = escapeHtml($row['log_action']);
$log_description = escapeHtml($row['log_description']);
$log_ip = escapeHtml($row['log_ip']);
$log_user_agent = escapeHtml($row['log_user_agent']);
$log_user_os = getOS($log_user_agent);
$log_user_browser = getWebBrowser($log_user_agent);
$log_created_at = escapeHtml($row['log_created_at']);
$user_id = intval($row['user_id']);
$user_name = escapeHtml($row['user_name']);
if (empty($user_name)) {
$user_name_display = "-";
} else {
$user_name_display = $user_name;
}
$client_name = escapeHtml($row['client_name']);
$client_id = intval($row['client_id']);
if (empty($client_name)) {
$client_name_display = "-";
} else {
$client_name_display = "<a href='../agent/client_overview.php?client_id=$client_id'>$client_name</a>";
}
$log_entity_id = intval($row['log_entity_id']);
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<tr>
<td class="font-monospace"><?= $log_created_at ?></td>
<td><?= $user_name_display ?></td>
<?php if(empty($client)) { ?>
<td><?= $client_name_display ?></td>
<?php } ?>
<td><?= $log_type ?></td>
<td><?= $log_action ?></td>
<td><?= $log_description ?></td>
<td class="font-monospace"><?= $log_ip ?></td>
<td><?= "$log_user_os<div class='text-secondary'>$log_user_browser</div>" ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -27,19 +27,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-comment-dots me-2"></i>Canned Responses</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/canned_response/canned_response_add.php" data-modal-size="lg"><i class="fas fa-plus me-2"></i>New Canned Response</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Canned Responses">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -50,85 +50,84 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=canned_response_name&order=<?= $disp ?>">
Response <?php if ($sort == 'canned_response_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Ticket Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($sql)){
$canned_response_id = intval($row['canned_response_id']);
$canned_response_name = escapeHtml($row['canned_response_name']);
$canned_response_category_id = intval($row['canned_response_category_id']);
$canned_response_category_name = escapeHtml($row['category_name']);
// The body is HTML from TinyMCE. This is a preview, not a render - tags
// are stripped rather than escaped so the column reads as the sentence
// the agent will actually be inserting
$canned_response_preview = escapeHtml(mb_strimwidth(trim(html_entity_decode(strip_tags($row['canned_response_body']), ENT_QUOTES, 'UTF-8')), 0, 120, '...'));
?>
<tr>
<td>
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-comment-dots me-3"></i>
<div class="flex-grow-1">
<div>
<a class="ajax-modal" href="#" data-modal-url="modals/canned_response/canned_response_edit.php?id=<?= $canned_response_id ?>" data-modal-size="lg">
<?= $canned_response_name ?>
</a>
</div>
<div><small class="text-secondary"><?= $canned_response_preview ?></small></div>
</div>
</div>
</td>
<td>
<?php if ($canned_response_category_id && $canned_response_category_name) { ?>
<span class="badge bg-secondary"><?= $canned_response_category_name ?></span>
<?php } else { ?>
<span class="badge bg-dark">All ticket categories</span>
<?php } ?>
</td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/canned_response/canned_response_edit.php?id=<?= $canned_response_id ?>" data-modal-size="lg">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_canned_response=<?= $canned_response_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=canned_response_name&order=<?= $disp ?>">
Response <?php if ($sort == 'canned_response_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Ticket Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($sql)){
$canned_response_id = intval($row['canned_response_id']);
$canned_response_name = escapeHtml($row['canned_response_name']);
$canned_response_category_id = intval($row['canned_response_category_id']);
$canned_response_category_name = escapeHtml($row['category_name']);
// The body is HTML from TinyMCE. This is a preview, not a render - tags
// are stripped rather than escaped so the column reads as the sentence
// the agent will actually be inserting
$canned_response_preview = escapeHtml(mb_strimwidth(trim(html_entity_decode(strip_tags($row['canned_response_body']), ENT_QUOTES, 'UTF-8')), 0, 120, '...'));
?>
<tr>
<td>
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-comment-dots me-3"></i>
<div class="flex-grow-1">
<div>
<a class="ajax-modal" href="#" data-modal-url="modals/canned_response/canned_response_edit.php?id=<?= $canned_response_id ?>" data-modal-size="lg">
<?= $canned_response_name ?>
</a>
</div>
<div><small class="text-secondary"><?= $canned_response_preview ?></small></div>
</div>
</div>
</td>
<td>
<?php if ($canned_response_category_id && $canned_response_category_name) { ?>
<span class="badge bg-secondary"><?= $canned_response_category_name ?></span>
<?php } else { ?>
<span class="badge bg-dark">All ticket categories</span>
<?php } ?>
</td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/canned_response/canned_response_edit.php?id=<?= $canned_response_id ?>" data-modal-size="lg">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_canned_response=<?= $canned_response_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -131,7 +131,7 @@ $archive_toggle_url = '?' . http_build_query($archive_toggle_query);
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>

View File

@@ -18,8 +18,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-contract me-2"></i>Contract Templates</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/contract_template/contract_template_add.php" data-modal-size="lg">
@@ -27,7 +27,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="input-group">
@@ -35,89 +35,88 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>Template Name</th>
<th>Type</th>
<th>Update Frequency</th>
<th>SLA (L/M/H Response)</th>
<th>SLA (L/M/H Resolution)</th>
<th>Hourly Rate</th>
<th>After Hours Rate</th>
<th>Support Hours</th>
<th>Net Terms</th>
<th>Created</th>
<th>Updated</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$id = intval($row['contract_template_id']);
$name = escapeHtml($row['contract_template_name']);
$type = escapeHtml($row['contract_template_type']);
$freq = escapeHtml($row['contract_template_renewal_frequency']);
$sla_low_resp = escapeHtml($row['contract_template_sla_low_response_time']);
$sla_med_resp = escapeHtml($row['contract_template_sla_medium_response_time']);
$sla_high_resp = escapeHtml($row['contract_template_sla_high_response_time']);
$sla_low_res = escapeHtml($row['contract_template_sla_low_resolution_time']);
$sla_med_res = escapeHtml($row['contract_template_sla_medium_resolution_time']);
$sla_high_res = escapeHtml($row['contract_template_sla_high_resolution_time']);
$hourly_rate = escapeHtml($row['contract_template_rate_standard']);
$after_hours = escapeHtml($row['contract_template_rate_after_hours']);
$support_hours = escapeHtml($row['contract_template_support_hours']);
$net_terms = escapeHtml($row['contract_template_net_terms']);
$created = escapeHtml($row['contract_template_created_at']);
$updated = escapeHtml($row['contract_template_updated_at']);
?>
<tr>
<td>
<a class="text-bold" href="contract_template_details.php?contract_template_id=<?= $id ?>">
<i class="fas fa-fw fa-file-alt text-dark"></i> <?= $name ?>
</a>
<div class="mt-1 text-secondary"><?= escapeHtml($row['contract_template_description']) ?></div>
</td>
<td><?= $type ?></td>
<td><?= $freq ?></td>
<td><?= "$sla_low_resp / $sla_med_resp / $sla_high_resp" ?></td>
<td><?= "$sla_low_res / $sla_med_res / $sla_high_res" ?></td>
<td><?= $hourly_rate ?></td>
<td><?= $after_hours ?></td>
<td><?= $support_hours ?></td>
<td><?= $net_terms ?></td>
<td><?= $created ?></td>
<td><?= $updated ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="xl"
data-modal-url="modals/contract_template/contract_template_edit.php?id=<?= $id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="post.php?delete_contract_template=<?= $id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<br>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>Template Name</th>
<th>Type</th>
<th>Update Frequency</th>
<th>SLA (L/M/H Response)</th>
<th>SLA (L/M/H Resolution)</th>
<th>Hourly Rate</th>
<th>After Hours Rate</th>
<th>Support Hours</th>
<th>Net Terms</th>
<th>Created</th>
<th>Updated</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$id = intval($row['contract_template_id']);
$name = escapeHtml($row['contract_template_name']);
$type = escapeHtml($row['contract_template_type']);
$freq = escapeHtml($row['contract_template_renewal_frequency']);
$sla_low_resp = escapeHtml($row['contract_template_sla_low_response_time']);
$sla_med_resp = escapeHtml($row['contract_template_sla_medium_response_time']);
$sla_high_resp = escapeHtml($row['contract_template_sla_high_response_time']);
$sla_low_res = escapeHtml($row['contract_template_sla_low_resolution_time']);
$sla_med_res = escapeHtml($row['contract_template_sla_medium_resolution_time']);
$sla_high_res = escapeHtml($row['contract_template_sla_high_resolution_time']);
$hourly_rate = escapeHtml($row['contract_template_rate_standard']);
$after_hours = escapeHtml($row['contract_template_rate_after_hours']);
$support_hours = escapeHtml($row['contract_template_support_hours']);
$net_terms = escapeHtml($row['contract_template_net_terms']);
$created = escapeHtml($row['contract_template_created_at']);
$updated = escapeHtml($row['contract_template_updated_at']);
?>
<tr>
<td>
<a class="text-bold" href="contract_template_details.php?contract_template_id=<?= $id ?>">
<i class="fas fa-fw fa-file-alt text-dark"></i> <?= $name ?>
</a>
<div class="mt-1 text-secondary"><?= escapeHtml($row['contract_template_description']) ?></div>
</td>
<td><?= $type ?></td>
<td><?= $freq ?></td>
<td><?= "$sla_low_resp / $sla_med_resp / $sla_high_resp" ?></td>
<td><?= "$sla_low_res / $sla_med_res / $sla_high_res" ?></td>
<td><?= $hourly_rate ?></td>
<td><?= $after_hours ?></td>
<td><?= $support_hours ?></td>
<td><?= $net_terms ?></td>
<td><?= $created ?></td>
<td><?= $updated ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="xl"
data-modal-url="modals/contract_template/contract_template_edit.php?id=<?= $id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="post.php?delete_contract_template=<?= $id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<br>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php require_once "../includes/footer.php"; ?>

View File

@@ -42,7 +42,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>

View File

@@ -19,8 +19,8 @@
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-alt me-2"></i>Document Templates</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/document_template/document_template_add.php" data-modal-size="xl">
@@ -28,109 +28,108 @@
</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="input-group">
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search templates">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search templates">
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
</div>
</form>
<hr>
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=document_template_name&order=<?= $disp ?>">
Template Name <?php if ($sort == 'document_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=document_template_created_at&order=<?= $disp ?>">
Created <?php if ($sort == 'document_template_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=document_template_updated_at&order=<?= $disp ?>">
Updated <?php if ($sort == 'document_template_updated_at') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">
Action
</th>
</tr>
</thead>
<tbody>
<?php
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=document_template_name&order=<?= $disp ?>">
Template Name <?php if ($sort == 'document_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=document_template_created_at&order=<?= $disp ?>">
Created <?php if ($sort == 'document_template_created_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=document_template_updated_at&order=<?= $disp ?>">
Updated <?php if ($sort == 'document_template_updated_at') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">
Action
</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$document_template_id = intval($row['document_template_id']);
$document_template_name = escapeHtml($row['document_template_name']);
$document_template_description = escapeHtml($row['document_template_description']);
$document_template_content = escapeHtml($row['document_template_content']);
$document_template_created_by_name = escapeHtml($row['user_name']);
$document_template_created_at = escapeHtml($row['document_template_created_at']);
$document_template_updated_at = escapeHtml($row['document_template_updated_at']) ?: '-';
while ($row = mysqli_fetch_assoc($sql)) {
$document_template_id = intval($row['document_template_id']);
$document_template_name = escapeHtml($row['document_template_name']);
$document_template_description = escapeHtml($row['document_template_description']);
$document_template_content = escapeHtml($row['document_template_content']);
$document_template_created_by_name = escapeHtml($row['user_name']);
$document_template_created_at = escapeHtml($row['document_template_created_at']);
$document_template_updated_at = escapeHtml($row['document_template_updated_at']) ?: '-';
?>
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-size="xl"
data-modal-url="modals/document_template/document_template_edit.php?id=<?= $document_template_id ?>">
<div class="d-flex">
<i class="fas fa-fw fa-2x fa-file-alt me-2"></i>
<div class="flex-grow-1">
<div><?= $document_template_name ?></div>
<div><small class="text-secondary"><?= $document_template_description ?></small></div>
</div>
</div>
</a>
</td>
<td>
<?= $document_template_created_at ?>
<div class="text-secondary"><?= $document_template_created_by_name ?></div>
</td>
<td><?= $document_template_updated_at ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="document_template.php?document_template_id=<?= $document_template_id ?>">
<i class="fas fa-fw fa-eye me-2"></i>View
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="xl"
data-modal-url="modals/document_template/document_template_edit.php?id=<?= $document_template_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="post.php?delete_document_template=<?= $document_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-size="xl"
data-modal-url="modals/document_template/document_template_edit.php?id=<?= $document_template_id ?>">
<div class="d-flex">
<i class="fas fa-fw fa-2x fa-file-alt me-2"></i>
<div class="flex-grow-1">
<div><?= $document_template_name ?></div>
<div><small class="text-secondary"><?= $document_template_description ?></small></div>
</div>
</div>
</td>
</tr>
</a>
</td>
<td>
<?= $document_template_created_at ?>
<div class="text-secondary"><?= $document_template_created_by_name ?></div>
</td>
<td><?= $document_template_updated_at ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="document_template.php?document_template_id=<?= $document_template_id ?>">
<i class="fas fa-fw fa-eye me-2"></i>View
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="xl"
data-modal-url="modals/document_template/document_template_edit.php?id=<?= $document_template_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold" href="post.php?delete_document_template=<?= $document_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
<?php
}
}
?>
?>
</tbody>
</table>
<br>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</tbody>
</table>
<br>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php require_once "../includes/footer.php";

View File

@@ -19,13 +19,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-3">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title"><i class="fas fa-fw fa-inbox me-2"></i>Email Queue</h3>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search mail queue">
@@ -52,11 +52,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -66,124 +66,123 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
</div>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="bg-light pe-0">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_queued_at&order=<?= $disp ?>">
Queued <?php if ($sort == 'email_queued_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_from&order=<?= $disp ?>">
From <?php if ($sort == 'email_from') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_recipient&order=<?= $disp ?>">
To <?php if ($sort == 'email_recipient') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_subject&order=<?= $disp ?>">
Subject <?php if ($sort == 'email_subject') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_status&order=<?= $disp ?>">
Status <?php if ($sort == 'email_status') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_attempts&order=<?= $disp ?>">
Attempts <?php if ($sort == 'email_attempts') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
<div class="table-responsive-sm">
<table class="table table-sm table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="bg-light pe-0">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_queued_at&order=<?= $disp ?>">
Queued <?php if ($sort == 'email_queued_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_from&order=<?= $disp ?>">
From <?php if ($sort == 'email_from') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_recipient&order=<?= $disp ?>">
To <?php if ($sort == 'email_recipient') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_subject&order=<?= $disp ?>">
Subject <?php if ($sort == 'email_subject') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_status&order=<?= $disp ?>">
Status <?php if ($sort == 'email_status') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=email_attempts&order=<?= $disp ?>">
Attempts <?php if ($sort == 'email_attempts') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$email_id = intval($row['email_id']);
$email_from = escapeHtml($row['email_from']);
$email_from_name = escapeHtml($row['email_from_name']);
$email_recipient = escapeHtml($row['email_recipient']);
$email_recipient_name = escapeHtml($row['email_recipient_name']);
$email_subject = escapeHtml($row['email_subject']);
$email_attempts = intval($row['email_attempts']);
$email_queued_at = escapeHtml($row['email_queued_at']);
$email_failed_at = escapeHtml($row['email_failed_at']);
$email_sent_at = escapeHtml($row['email_sent_at']);
$email_status = intval($row['email_status']);
if ($email_status == 0) {
$email_status_display = "<div class='text-primary'>Queued</div>";
} elseif($email_status == 1) {
$email_status_display = "<div class='text-warning'>Sending</div>";
} elseif($email_status == 2) {
$email_status_display = "<div class='text-danger'>Failed</div><small class='text-secondary font-monospace'>$email_failed_at</small>";
} else {
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary font-monospace'>$email_sent_at</small>";
}
?>
<tr>
<td class="pe-0 bg-light">
<?php if ($email_status !== 3) { ?>
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="email_ids[]" value="<?= $email_id ?>">
</div>
<?php } ?>
</td>
<td class="font-monospace"><?= $email_queued_at ?></td>
<td><?= "$email_from<br><small class='text-secondary'>$email_from_name</small>" ?></td>
<td><?= "$email_recipient<br><small class='text-secondary'>$email_recipient_name</small>" ?></td>
<td><?= $email_subject ?></td>
<td><?= $email_status_display ?></td>
<td><?= $email_attempts ?></td>
<td class="text-center">
<a class="btn btn-sm btn-secondary ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/mail_queue/mail_queue_message_view.php?id=<?= $email_id ?>">
<i class="fas fa-fw fa-eye"></i>
</a>
<!-- Show force resend if all retries have failed -->
<?php if ($email_status == 2 && $email_attempts > 3) { ?>
<a class="btn btn-sm btn-success" href="post.php?send_failed_mail=<?= $email_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-paper-plane"></i></a>
<?php } ?>
<!-- Allow cancelling a message if it hasn't yet been picked up (e.g. stuck/bugged) -->
<?php if ($email_status !== 3) { ?>
<a class="btn btn-sm btn-danger confirm-link" href="post.php?cancel_mail=<?= $email_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-trash"></i></a>
<?php } ?>
</td>
</tr>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$email_id = intval($row['email_id']);
$email_from = escapeHtml($row['email_from']);
$email_from_name = escapeHtml($row['email_from_name']);
$email_recipient = escapeHtml($row['email_recipient']);
$email_recipient_name = escapeHtml($row['email_recipient_name']);
$email_subject = escapeHtml($row['email_subject']);
$email_attempts = intval($row['email_attempts']);
$email_queued_at = escapeHtml($row['email_queued_at']);
$email_failed_at = escapeHtml($row['email_failed_at']);
$email_sent_at = escapeHtml($row['email_sent_at']);
$email_status = intval($row['email_status']);
if ($email_status == 0) {
$email_status_display = "<div class='text-primary'>Queued</div>";
} elseif($email_status == 1) {
$email_status_display = "<div class='text-warning'>Sending</div>";
} elseif($email_status == 2) {
$email_status_display = "<div class='text-danger'>Failed</div><small class='text-secondary font-monospace'>$email_failed_at</small>";
} else {
$email_status_display = "<div class='text-success'>Sent</div><small class='text-secondary font-monospace'>$email_sent_at</small>";
}
?>
</tbody>
</table>
</div>
</form>
<tr>
<td class="pe-0 bg-light">
<?php if ($email_status !== 3) { ?>
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="email_ids[]" value="<?= $email_id ?>">
</div>
<?php } ?>
</td>
<td class="font-monospace"><?= $email_queued_at ?></td>
<td><?= "$email_from<br><small class='text-secondary'>$email_from_name</small>" ?></td>
<td><?= "$email_recipient<br><small class='text-secondary'>$email_recipient_name</small>" ?></td>
<td><?= $email_subject ?></td>
<td><?= $email_status_display ?></td>
<td><?= $email_attempts ?></td>
<td class="text-center">
<a class="btn btn-sm btn-secondary ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/mail_queue/mail_queue_message_view.php?id=<?= $email_id ?>">
<i class="fas fa-fw fa-eye"></i>
</a>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<!-- Show force resend if all retries have failed -->
<?php if ($email_status == 2 && $email_attempts > 3) { ?>
<a class="btn btn-sm btn-success" href="post.php?send_failed_mail=<?= $email_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-paper-plane"></i></a>
<?php } ?>
<!-- Allow cancelling a message if it hasn't yet been picked up (e.g. stuck/bugged) -->
<?php if ($email_status !== 3) { ?>
<a class="btn btn-sm btn-danger confirm-link" href="post.php?cancel_mail=<?= $email_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-trash"></i></a>
<?php } ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -17,8 +17,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-puzzle-piece me-2"></i>Access Modules</h3>
<div class="card-tools">
<div class="btn-group">
@@ -28,9 +28,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(escapeHtml($q));} ?>" placeholder="Search Modules">
@@ -39,71 +39,70 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=module_name&order=<?= $disp ?>">
Module <?php if ($sort == 'module_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=module_name&order=<?= $disp ?>">
Module <?php if ($sort == 'module_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$module_id = intval($row['module_id']);
$module_name = escapeHtml($row['module_name']);
$module_description = escapeHtml($row['module_description']);
?>
<tr>
<td>
<a href="#" <?php if ($module_id > 6) { ?> class="ajax-modal" data-modal-url="modals/modules/module_edit.php?id=<?= $module_id ?>" <?php } ?>>
<strong class="text-dark"><?= $module_name ?></strong>
</a>
<div class="text-secondary"><?= $module_description ?></div>
</td>
<td>
<?php if ($module_id > 6) { ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/module/module_edit.php?id=<?= $module_id ?>">
<i class="fas fa-fw fa-user-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_module=<?= $module_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Delete
</a>
</div>
</div>
<?php } else { echo "<p class='text-center'>N/A Predefined</p>"; } ?>
</td>
</tr>
<?php
}
while ($row = mysqli_fetch_assoc($sql)) {
$module_id = intval($row['module_id']);
$module_name = escapeHtml($row['module_name']);
$module_description = escapeHtml($row['module_description']);
?>
<tr>
<td>
<a href="#" <?php if ($module_id > 6) { ?> class="ajax-modal" data-modal-url="modals/modules/module_edit.php?id=<?= $module_id ?>" <?php } ?>>
<strong class="text-dark"><?= $module_name ?></strong>
</a>
<div class="text-secondary"><?= $module_description ?></div>
</td>
<td>
<?php if ($module_id > 6) { ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/module/module_edit.php?id=<?= $module_id ?>">
<i class="fas fa-fw fa-user-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_module=<?= $module_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Delete
</a>
</div>
</div>
<?php } else { echo "<p class='text-center'>N/A Predefined</p>"; } ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -19,19 +19,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-project-diagram me-2"></i>Project Templates</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/project_template/project_template_add.php"><i class="fas fa-plus me-2"></i>New Project Template</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Project Templates">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -42,97 +42,96 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=project_template_name&order=<?= $disp ?>">
Template <?php if ($sort == 'project_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>Tickets</th>
<th>Tasks</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=project_template_name&order=<?= $disp ?>">
Template <?php if ($sort == 'project_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>Tickets</th>
<th>Tasks</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($sql)){
$project_template_id = intval($row['project_template_id']);
$project_template_name = escapeHtml($row['project_template_name']);
$project_template_description = escapeHtml($row['project_template_description']);
$project_template_created_at = escapeHtml($row['project_template_created_at']);
while($row = mysqli_fetch_assoc($sql)){
$project_template_id = intval($row['project_template_id']);
$project_template_name = escapeHtml($row['project_template_name']);
$project_template_description = escapeHtml($row['project_template_description']);
$project_template_created_at = escapeHtml($row['project_template_created_at']);
// Get Ticket Template Count
$sql_ticket_templates = mysqli_query($mysqli, "SELECT 1 FROM ticket_templates, project_template_ticket_templates
WHERE ticket_templates.ticket_template_id = project_template_ticket_templates.ticket_template_id
AND project_template_ticket_templates.project_template_id = $project_template_id
ORDER BY ticket_template_order ASC, ticket_template_name ASC");
$ticket_template_count = mysqli_num_rows($sql_ticket_templates);
// Get Ticket Template Count
$sql_ticket_templates = mysqli_query($mysqli, "SELECT 1 FROM ticket_templates, project_template_ticket_templates
WHERE ticket_templates.ticket_template_id = project_template_ticket_templates.ticket_template_id
AND project_template_ticket_templates.project_template_id = $project_template_id
ORDER BY ticket_template_order ASC, ticket_template_name ASC");
$ticket_template_count = mysqli_num_rows($sql_ticket_templates);
// Get Tasks Template Count
$sql_task_templates = mysqli_query($mysqli,
"SELECT 1 FROM ticket_templates, task_templates, project_template_ticket_templates
WHERE ticket_templates.ticket_template_id = project_template_ticket_templates.ticket_template_id
AND project_template_ticket_templates.project_template_id = $project_template_id
AND ticket_templates.ticket_template_id = task_template_ticket_template_id
ORDER BY task_template_created_at ASC"
);
$task_template_count = mysqli_num_rows($sql_task_templates);
?>
<tr>
<td>
<a class="text-dark" href="project_template.php?project_template_id=<?= $project_template_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-project-diagram me-3"></i>
<div class="flex-grow-1">
<div>
<?= $project_template_name ?>
</div>
<div>
<small class="text-secondary"><?= $project_template_description ?></small>
</div>
</div>
</div>
</a>
</td>
<td><?= $ticket_template_count ?></td>
<td><?= $task_template_count ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/project_template/project_template_edit.php?project_template_id=<?= $project_template_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_project_template=<?= $project_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
// Get Tasks Template Count
$sql_task_templates = mysqli_query($mysqli,
"SELECT 1 FROM ticket_templates, task_templates, project_template_ticket_templates
WHERE ticket_templates.ticket_template_id = project_template_ticket_templates.ticket_template_id
AND project_template_ticket_templates.project_template_id = $project_template_id
AND ticket_templates.ticket_template_id = task_template_ticket_template_id
ORDER BY task_template_created_at ASC"
);
$task_template_count = mysqli_num_rows($sql_task_templates);
?>
<tr>
<td>
<a class="text-dark" href="project_template.php?project_template_id=<?= $project_template_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-project-diagram me-3"></i>
<div class="flex-grow-1">
<div>
<?= $project_template_name ?>
</div>
<div>
<small class="text-secondary"><?= $project_template_description ?></small>
</div>
</div>
</div>
</a>
</td>
<td><?= $ticket_template_count ?></td>
<td><?= $task_template_count ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/project_template/project_template_edit.php?project_template_id=<?= $project_template_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_project_template=<?= $project_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php

View File

@@ -18,8 +18,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-user-shield me-2"></i>Roles</h3>
<div class="card-tools">
<div class="btn-group">
@@ -29,9 +29,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(escapeHtml($q));} ?>" placeholder="Search Roles">
@@ -40,108 +40,107 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=role_name&order=<?= $disp ?>">
Role <?php if ($sort == 'role_name') { echo $order_icon; } ?>
</a>
</th>
<th>Members</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=role_is_admin&order=<?= $disp ?>">
Admin <?php if ($sort == 'role_is_admin') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=role_name&order=<?= $disp ?>">
Role <?php if ($sort == 'role_name') { echo $order_icon; } ?>
</a>
</th>
<th>Members</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=role_is_admin&order=<?= $disp ?>">
Admin <?php if ($sort == 'role_is_admin') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$role_id = intval($row['role_id']);
$role_name = escapeHtml($row['role_name']);
$role_description = escapeHtml($row['role_description']);
$role_admin = intval($row['role_is_admin']);
$role_archived_at = escapeHtml($row['role_archived_at']);
while ($row = mysqli_fetch_assoc($sql)) {
$role_id = intval($row['role_id']);
$role_name = escapeHtml($row['role_name']);
$role_description = escapeHtml($row['role_description']);
$role_admin = intval($row['role_is_admin']);
$role_archived_at = escapeHtml($row['role_archived_at']);
// Count number of users that have each role
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(user_id) FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
// Count number of users that have each role
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(user_id) FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
$sql_users = mysqli_query($mysqli, "SELECT user_name FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
// Initialize an empty array to hold user names
$user_names = [];
$sql_users = mysqli_query($mysqli, "SELECT user_name FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
// Initialize an empty array to hold user names
$user_names = [];
// Fetch each row and store the user_name in the array
while($row = mysqli_fetch_assoc($sql_users)) {
$user_names[] = escapeHtml($row['user_name']);
}
// Fetch each row and store the user_name in the array
while($row = mysqli_fetch_assoc($sql_users)) {
$user_names[] = escapeHtml($row['user_name']);
}
// Convert the array of user names to a comma-separated string
$user_names_string = implode(",", $user_names);
if (empty($user_names_string)) {
$user_names_string = "-";
}
?>
<tr>
<td>
<a class="<?php if ($role_id !== 3) { ?> ajax-modal" data-modal-url="modals/role/role_edit.php?id=<?= $role_id ?>" <?php } ?> href="#">
<div class="d-flex">
<i class="fas fa-fw fa-2x fa-user-shield text-dark me-2"></i>
<div class="flex-grow-1">
<div><?= $role_name ?></div>
<div><small class="text-secondary"><?= $role_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $user_names_string ?></td>
<td><?= $role_admin ? 'Yes' : 'No' ?></td>
<td>
<?php if ($role_id !== 3) { ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/role/role_edit.php?id=<?= $role_id ?>">
<i class="fas fa-fw fa-user-edit me-2"></i>Edit
</a>
<?php if (empty($role_archived_at) && $role_user_count == 0) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_role=<?= $role_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
</div>
</div>
<?php } ?>
</td>
</tr>
<?php
// Convert the array of user names to a comma-separated string
$user_names_string = implode(",", $user_names);
if (empty($user_names_string)) {
$user_names_string = "-";
}
?>
<tr>
<td>
<a class="<?php if ($role_id !== 3) { ?> ajax-modal" data-modal-url="modals/role/role_edit.php?id=<?= $role_id ?>" <?php } ?> href="#">
<div class="d-flex">
<i class="fas fa-fw fa-2x fa-user-shield text-dark me-2"></i>
<div class="flex-grow-1">
<div><?= $role_name ?></div>
<div><small class="text-secondary"><?= $role_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $user_names_string ?></td>
<td><?= $role_admin ? 'Yes' : 'No' ?></td>
<td>
<?php if ($role_id !== 3) { ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/role/role_edit.php?id=<?= $role_id ?>">
<i class="fas fa-fw fa-user-edit me-2"></i>Edit
</a>
<?php if (empty($role_archived_at) && $role_user_count == 0) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_role=<?= $role_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
</div>
</div>
<?php } ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -43,13 +43,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<li class="breadcrumb-item active">Saved Payment Methods (Stripe)</li>
</ol>
<div class="card card-dark">
<div class="card-header">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title"><i class="fas fa-fw fa-credit-card me-2"></i>Saved Payment Methods</h3>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(escapeHtml($q));} ?>" placeholder="Search Saved Payment Methods">
@@ -60,94 +60,93 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=payment_provider_name&order=<?= $disp ?>">
Provider <?php if ($sort == 'payment_provider_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=saved_payment_description&order=<?= $disp ?>">
Description <?php if ($sort == 'saved_payment_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=payment_provider_client&order=<?= $disp ?>">
Provider Client ID <?php if ($sort == 'payment_provider_client') { echo $order_icon; } ?>
</a>
</th>
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=payment_provider_name&order=<?= $disp ?>">
Provider <?php if ($sort == 'payment_provider_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=saved_payment_description&order=<?= $disp ?>">
Description <?php if ($sort == 'saved_payment_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=payment_provider_client&order=<?= $disp ?>">
Provider Client ID <?php if ($sort == 'payment_provider_client') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=saved_payment_provider_method&order=<?= $disp ?>">
Provider Payment Method ID <?php if ($sort == 'saved_payment_provider_method') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=saved_payment_created_at&order=<?= $disp ?>">
Created <?php if ($sort == 'saved_payment_created_at') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=saved_payment_provider_method&order=<?= $disp ?>">
Provider Payment Method ID <?php if ($sort == 'saved_payment_provider_method') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=saved_payment_created_at&order=<?= $disp ?>">
Created <?php if ($sort == 'saved_payment_created_at') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$saved_payment_id = intval($row['saved_payment_id']);
$client_id = intval($row['saved_payment_client_id']);
$client_name = escapeHtml($row['client_name']);
$provider_id = intval($row['saved_payment_provider_id']);
$provider_name = escapeHtml($row['payment_provider_name']);
$saved_payment_description = escapeHtml($row['saved_payment_description']);
$provider_client = escapeHtml($row['payment_provider_client']);
$provider_payment_method = escapeHtml($row['saved_payment_provider_method']);
$saved_payment_created_at = escapeHtml($row['saved_payment_created_at']);
?>
<tr>
<td>
<?= $client_name ?>
<br>
<small class="text-secondary">ID: <?= $client_id ?></small>
</td>
<td>
<?= $provider_name ?>
<br>
<small class="text-secondary">ID: <?= $provider_id ?></small>
</td>
<td><?= $saved_payment_description ?></td>
<td><?= $provider_client ?></td>
<td><?= $provider_payment_method ?></td>
<td><?= $saved_payment_created_at ?></td>
<td>
<a class="btn btn-outline-danger confirm-link" href="post.php?delete_saved_payment=<?= $saved_payment_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</td>
</tr>
<?php
}
while ($row = mysqli_fetch_assoc($sql)) {
$saved_payment_id = intval($row['saved_payment_id']);
$client_id = intval($row['saved_payment_client_id']);
$client_name = escapeHtml($row['client_name']);
$provider_id = intval($row['saved_payment_provider_id']);
$provider_name = escapeHtml($row['payment_provider_name']);
$saved_payment_description = escapeHtml($row['saved_payment_description']);
$provider_client = escapeHtml($row['payment_provider_client']);
$provider_payment_method = escapeHtml($row['saved_payment_provider_method']);
$saved_payment_created_at = escapeHtml($row['saved_payment_created_at']);
?>
<tr>
<td>
<?= $client_name ?>
<br>
<small class="text-secondary">ID: <?= $client_id ?></small>
</td>
<td>
<?= $provider_name ?>
<br>
<small class="text-secondary">ID: <?= $provider_id ?></small>
</td>
<td><?= $saved_payment_description ?></td>
<td><?= $provider_client ?></td>
<td><?= $provider_payment_method ?></td>
<td><?= $saved_payment_created_at ?></td>
<td>
<a class="btn btn-outline-danger confirm-link" href="post.php?delete_saved_payment=<?= $saved_payment_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</td>
</tr>
</tbody>
</table>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php

View File

@@ -26,18 +26,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-th-list me-2"></i><?= escapeHtml($table) ?> Fields</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#createCustomFieldModal"><i class="fas fa-plus me-2"></i>Create</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<input type="hidden" name="table" value="<?= escapeHtml($table) ?>">
<div class="row">
<div class="col-sm-4 mb-2">
<div class="row g-2 align-items-center">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@@ -51,65 +51,64 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=custom_field_label&order=<?= $disp ?>">Label</a></th>
<th><a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=custom_field_type&order=<?= $disp ?>">Type</a></th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=custom_field_label&order=<?= $disp ?>">Label</a></th>
<th><a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=custom_field_type&order=<?= $disp ?>">Type</a></th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$custom_field_id = intval($row['custom_field_id']);
$custom_field_label = escapeHtml($row['custom_field_label']);
$custom_field_type = escapeHtml($row['custom_field_type']);
$custom_field_location = intval($row['custom_field_location']);
$custom_field_order = intval($row['custom_field_order']);
?>
<tr>
<td><a class="text-dark" href="#" data-bs-toggle="modal" data-bs-target="#editCustomFieldModal<?= $custom_field_id ?>"><?= $custom_field_label ?></a></td>
<td><?= $custom_field_type ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#editCustomFieldModal<?= $custom_field_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_custom_field=<?= $custom_field_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
//$colors_diff = array_diff($colors_array,$colors_used_array);
include "custom_field_edit_modal.php";
}
while ($row = mysqli_fetch_assoc($sql)) {
$custom_field_id = intval($row['custom_field_id']);
$custom_field_label = escapeHtml($row['custom_field_label']);
$custom_field_type = escapeHtml($row['custom_field_type']);
$custom_field_location = intval($row['custom_field_location']);
$custom_field_order = intval($row['custom_field_order']);
?>
<tr>
<td><a class="text-dark" href="#" data-bs-toggle="modal" data-bs-target="#editCustomFieldModal<?= $custom_field_id ?>"><?= $custom_field_label ?></a></td>
<td><?= $custom_field_type ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#editCustomFieldModal<?= $custom_field_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_custom_field=<?= $custom_field_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<?php
//$colors_diff = array_diff($colors_array,$colors_used_array);
include "custom_field_edit_modal.php";
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -19,19 +19,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-cube me-2"></i>License Templates</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/software_template/software_template_add.php"><i class="fas fa-plus me-2"></i>New License Template</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search License Templates">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -42,88 +42,87 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_template_name&order=<?= $disp ?>">
Template <?php if ($sort == 'software_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_template_type&order=<?= $disp ?>">
Type <?php if ($sort == 'software_template_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_template_license_type&order=<?= $disp ?>">
License Type <?php if ($sort == 'software_template_license_type') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_template_name&order=<?= $disp ?>">
Template <?php if ($sort == 'software_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_template_type&order=<?= $disp ?>">
Type <?php if ($sort == 'software_template_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_template_license_type&order=<?= $disp ?>">
License Type <?php if ($sort == 'software_template_license_type') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($sql)){
$software_template_id = intval($row['software_template_id']);
$software_template_name = escapeHtml($row['software_template_name']);
$software_template_version = escapeHtml($row['software_template_version']);
$software_template_description = escapeHtml($row['software_template_description']);
$software_template_type = escapeHtml($row['software_template_type']);
$software_template_license_type = escapeHtml($row['software_template_license_type']);
$software_template_notes = escapeHtml($row['software_template_notes']);
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/software_template/software_template_edit.php?id=<?= $software_template_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-cube me-3"></i>
<div class="flex-grow-1">
<div><?= "$software_template_name <span>$software_template_version</span>" ?></div>
<div><small class="text-secondary"><?= $software_template_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $software_template_type ?></td>
<td><?= $software_template_license_type ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/software_template/software_template_edit.php?id=<?= $software_template_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_software_template=<?= $software_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
while($row = mysqli_fetch_assoc($sql)){
$software_template_id = intval($row['software_template_id']);
$software_template_name = escapeHtml($row['software_template_name']);
$software_template_version = escapeHtml($row['software_template_version']);
$software_template_description = escapeHtml($row['software_template_description']);
$software_template_type = escapeHtml($row['software_template_type']);
$software_template_license_type = escapeHtml($row['software_template_license_type']);
$software_template_notes = escapeHtml($row['software_template_notes']);
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/software_template/software_template_edit.php?id=<?= $software_template_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-cube me-3"></i>
<div class="flex-grow-1">
<div><?= "$software_template_name <span>$software_template_version</span>" ?></div>
<div><small class="text-secondary"><?= $software_template_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $software_template_type ?></td>
<td><?= $software_template_license_type ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/software_template/software_template_edit.php?id=<?= $software_template_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_software_template=<?= $software_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -97,7 +97,7 @@ while ($row = mysqli_fetch_assoc($sql_tag_type_counts)) {
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>

View File

@@ -42,7 +42,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>

View File

@@ -23,19 +23,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-life-ring me-2"></i>Ticket Templates</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/ticket_template/ticket_template_add.php" data-modal-size="lg"><i class="fas fa-plus me-2"></i>New Ticket Template</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Ticket Templates">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -46,75 +46,74 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0) { echo "d-none"; } ?>">
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=ticket_template_name&order=<?= $disp ?>">
Template <?php if ($sort == 'ticket_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=task_count&order=<?= $disp ?>">
Tasks <?php if ($sort == 'task_count') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($sql)){
$ticket_template_id = intval($row['ticket_template_id']);
$ticket_template_name = escapeHtml($row['ticket_template_name']);
$ticket_template_description = escapeHtml($row['ticket_template_description']);
$ticket_template_subject = escapeHtml($row['ticket_template_subject']);
$ticket_template_created_at = escapeHtml($row['ticket_template_created_at']);
$task_count = intval($row['task_count']);
?>
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=ticket_template_name&order=<?= $disp ?>">
Template <?php if ($sort == 'ticket_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=task_count&order=<?= $disp ?>">
Tasks <?php if ($sort == 'task_count') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_assoc($sql)){
$ticket_template_id = intval($row['ticket_template_id']);
$ticket_template_name = escapeHtml($row['ticket_template_name']);
$ticket_template_description = escapeHtml($row['ticket_template_description']);
$ticket_template_subject = escapeHtml($row['ticket_template_subject']);
$ticket_template_created_at = escapeHtml($row['ticket_template_created_at']);
$task_count = intval($row['task_count']);
?>
<tr>
<td>
<a class="text-dark">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-life-ring me-3"></i>
<div class="flex-grow-1">
<div>
<a href="ticket_template.php?ticket_template_id=<?= $ticket_template_id ?>">
<?= $ticket_template_name ?>
</a>
</div>
<div><small class="text-secondary"><?= $ticket_template_description ?></small></div>
<td>
<a class="text-dark">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-life-ring me-3"></i>
<div class="flex-grow-1">
<div>
<a href="ticket_template.php?ticket_template_id=<?= $ticket_template_id ?>">
<?= $ticket_template_name ?>
</a>
</div>
</div>
</a>
</td>
<td><?= $task_count ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_ticket_template=<?= $ticket_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<div><small class="text-secondary"><?= $ticket_template_description ?></small></div>
</div>
</div>
</td>
</tr>
</a>
</td>
<td><?= $task_count ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_ticket_template=<?= $ticket_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -22,8 +22,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-users me-2"></i>Users</h3>
<div class="card-tools">
<div class="btn-group">
@@ -49,9 +49,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(escapeHtml($q));} ?>" placeholder="Search Users">
@@ -61,183 +61,182 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-8">
<div class="btn-group float-end">
<a href="?archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
</div>
</div>
</div>
</form>
<hr>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th class="text-center">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Name <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_email&order=<?= $disp ?>">
Email <?php if ($sort == 'user_email') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=role_name&order=<?= $disp ?>">
Role <?php if ($sort == 'role_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_status&order=<?= $disp ?>">
Status <?php if ($sort == 'user_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">MFA</th>
<th>
Last Login
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive-sm">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th class="text-center">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Name <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_email&order=<?= $disp ?>">
Email <?php if ($sort == 'user_email') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=role_name&order=<?= $disp ?>">
Role <?php if ($sort == 'role_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_status&order=<?= $disp ?>">
Status <?php if ($sort == 'user_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">MFA</th>
<th>
Last Login
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$user_id = intval($row['user_id']);
$user_name = escapeHtml($row['user_name']);
$user_email = escapeHtml($row['user_email']);
$user_status = intval($row['user_status']);
if ($user_status == 2) {
$user_status_display = "<span class='text-info'>Invited</span>";
} elseif ($user_status == 1) {
$user_status_display = "<span class='text-success'>Active</span>";
} else{
$user_status_display = "<span class='text-danger'>Disabled</span>";
}
$user_avatar = escapeHtml($row['user_avatar']);
$user_token = escapeHtml($row['user_token']);
if(empty($user_token)) {
$mfa_status_display = "<i class='fas fa-fw fa-unlock text-danger'></i>";
} else {
$mfa_status_display = "<i class='fas fa-fw fa-lock text-success'></i>";
}
$user_config_force_mfa = intval($row['user_config_force_mfa']);
$user_role = intval($row['user_role_id']);
$user_role_display = escapeHtml($row['role_name']);
$user_archived_at = escapeHtml($row['user_archived_at']);
$user_initials = escapeHtml(initials($user_name));
while ($row = mysqli_fetch_assoc($sql)) {
$user_id = intval($row['user_id']);
$user_name = escapeHtml($row['user_name']);
$user_email = escapeHtml($row['user_email']);
$user_status = intval($row['user_status']);
if ($user_status == 2) {
$user_status_display = "<span class='text-info'>Invited</span>";
} elseif ($user_status == 1) {
$user_status_display = "<span class='text-success'>Active</span>";
} else{
$user_status_display = "<span class='text-danger'>Disabled</span>";
}
$user_avatar = escapeHtml($row['user_avatar']);
$user_token = escapeHtml($row['user_token']);
if(empty($user_token)) {
$mfa_status_display = "<i class='fas fa-fw fa-unlock text-danger'></i>";
} else {
$mfa_status_display = "<i class='fas fa-fw fa-lock text-success'></i>";
}
$user_config_force_mfa = intval($row['user_config_force_mfa']);
$user_role = intval($row['user_role_id']);
$user_role_display = escapeHtml($row['role_name']);
$user_archived_at = escapeHtml($row['user_archived_at']);
$user_initials = escapeHtml(initials($user_name));
$sql_last_login = mysqli_query(
$mysqli,
"SELECT log_created_at, log_ip, log_user_agent FROM logs
WHERE log_user_id = $user_id AND log_type = 'Login'
ORDER BY log_id DESC LIMIT 1"
);
if (mysqli_num_rows($sql_last_login) == 0) {
$last_login = "<span class='text-bold'>Never logged in</span>";
} else {
$row = mysqli_fetch_assoc($sql_last_login);
$log_created_at = escapeHtml($row['log_created_at']);
$log_ip = escapeHtml($row['log_ip']);
$log_user_agent = escapeHtml($row['log_user_agent']);
$log_user_os = getOS($log_user_agent);
$log_user_browser = getWebBrowser($log_user_agent);
$last_login = "$log_created_at<small class='text-secondary'><div class='mt-1'>$log_user_os</div><div class='mt-1'>$log_user_browser</div><div class='mt-1'><i class='fa fa-fw fa-globe'></i> $log_ip</div></small>";
}
// Get User Client Access Permissions
$user_client_access_sql = mysqli_query($mysqli,"SELECT client_id FROM user_client_permissions WHERE user_id = $user_id");
$client_access_array = [];
while ($row = mysqli_fetch_assoc($user_client_access_sql)) {
$client_access_array[] = intval($row['client_id']);
}
$sql_remember_tokens = mysqli_query($mysqli, "SELECT 1 FROM remember_tokens WHERE remember_token_user_id = $user_id");
$remember_token_count = mysqli_num_rows($sql_remember_tokens);
?>
<tr>
<td class="text-center">
<a href="#" title="UserID: <?= $user_id ?>"
<?php if ($user_id !== $session_user_id) { // Prevent modifying self ?>
class="ajax-modal"
data-modal-url="modals/user/user_edit.php?id=<?= $user_id ?>"
<?php } ?>
>
<?php if (!empty($user_avatar)) { ?>
<img class="img-size-50 rounded-circle" src="<?= "../uploads/users/$user_id/$user_avatar" ?>">
<?php } else { ?>
<span class="fa-stack fa-2x">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?= $user_initials ?></span>
</span>
<br>
<?php } ?>
<div class="text-secondary"><?= $user_name ?></div>
</a>
</td>
<td><a href="mailto:<?= $user_email ?>"><?= $user_email ?></a></td>
<td><?= $user_role_display ?></td>
<td><?= $user_status_display ?></td>
<td class="text-center"><?= $mfa_status_display ?></td>
<td><?= $last_login ?></td>
<td>
<?php if ($user_id !== $session_user_id) { // Prevent modifying self ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/user/user_edit.php?id=<?= $user_id ?>">
<i class="fas fa-fw fa-user-edit me-2"></i>Edit
</a>
<?php if ($remember_token_count > 0) { ?>
<a class="dropdown-item" href="post.php?revoke_remember_me=<?= $user_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-ban me-2"></i>Revoke <?= $remember_token_count ?> Remember Tokens
</a>
<?php } ?>
<?php if ($user_status == 0) { ?>
<a class="dropdown-item text-success" href="post.php?activate_user=<?= $user_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-user-check me-2"></i>Activate
</a>
<?php }elseif ($user_status == 1) { ?>
<a class="dropdown-item text-danger" href="post.php?disable_user=<?= $user_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-user-slash me-2"></i>Disable
</a>
<?php } ?>
<?php if ($user_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info ajax-modal" href="#" data-modal-url="modals/user/user_restore.php?id=<?= $user_id ?>">
<i class="fas fa-fw fa-redo-alt me-2"></i>Restore
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger ajax-modal" href="#" data-modal-url="modals/user/user_archive.php?id=<?= $user_id ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
</div>
</div>
<?php } ?>
</td>
</tr>
<?php
$sql_last_login = mysqli_query(
$mysqli,
"SELECT log_created_at, log_ip, log_user_agent FROM logs
WHERE log_user_id = $user_id AND log_type = 'Login'
ORDER BY log_id DESC LIMIT 1"
);
if (mysqli_num_rows($sql_last_login) == 0) {
$last_login = "<span class='text-bold'>Never logged in</span>";
} else {
$row = mysqli_fetch_assoc($sql_last_login);
$log_created_at = escapeHtml($row['log_created_at']);
$log_ip = escapeHtml($row['log_ip']);
$log_user_agent = escapeHtml($row['log_user_agent']);
$log_user_os = getOS($log_user_agent);
$log_user_browser = getWebBrowser($log_user_agent);
$last_login = "$log_created_at<small class='text-secondary'><div class='mt-1'>$log_user_os</div><div class='mt-1'>$log_user_browser</div><div class='mt-1'><i class='fa fa-fw fa-globe'></i> $log_ip</div></small>";
}
?>
// Get User Client Access Permissions
$user_client_access_sql = mysqli_query($mysqli,"SELECT client_id FROM user_client_permissions WHERE user_id = $user_id");
$client_access_array = [];
while ($row = mysqli_fetch_assoc($user_client_access_sql)) {
$client_access_array[] = intval($row['client_id']);
}
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
$sql_remember_tokens = mysqli_query($mysqli, "SELECT 1 FROM remember_tokens WHERE remember_token_user_id = $user_id");
$remember_token_count = mysqli_num_rows($sql_remember_tokens);
?>
<tr>
<td class="text-center">
<a href="#" title="UserID: <?= $user_id ?>"
<?php if ($user_id !== $session_user_id) { // Prevent modifying self ?>
class="ajax-modal"
data-modal-url="modals/user/user_edit.php?id=<?= $user_id ?>"
<?php } ?>
>
<?php if (!empty($user_avatar)) { ?>
<img class="img-size-50 rounded-circle" src="<?= "../uploads/users/$user_id/$user_avatar" ?>">
<?php } else { ?>
<span class="fa-stack fa-2x">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?= $user_initials ?></span>
</span>
<br>
<?php } ?>
<div class="text-secondary"><?= $user_name ?></div>
</a>
</td>
<td><a href="mailto:<?= $user_email ?>"><?= $user_email ?></a></td>
<td><?= $user_role_display ?></td>
<td><?= $user_status_display ?></td>
<td class="text-center"><?= $mfa_status_display ?></td>
<td><?= $last_login ?></td>
<td>
<?php if ($user_id !== $session_user_id) { // Prevent modifying self ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/user/user_edit.php?id=<?= $user_id ?>">
<i class="fas fa-fw fa-user-edit me-2"></i>Edit
</a>
<?php if ($remember_token_count > 0) { ?>
<a class="dropdown-item" href="post.php?revoke_remember_me=<?= $user_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"><i class="fas fa-fw fa-ban me-2"></i>Revoke <?= $remember_token_count ?> Remember Tokens
</a>
<?php } ?>
<?php if ($user_status == 0) { ?>
<a class="dropdown-item text-success" href="post.php?activate_user=<?= $user_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-user-check me-2"></i>Activate
</a>
<?php }elseif ($user_status == 1) { ?>
<a class="dropdown-item text-danger" href="post.php?disable_user=<?= $user_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-user-slash me-2"></i>Disable
</a>
<?php } ?>
<?php if ($user_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info ajax-modal" href="#" data-modal-url="modals/user/user_restore.php?id=<?= $user_id ?>">
<i class="fas fa-fw fa-redo-alt me-2"></i>Restore
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger ajax-modal" href="#" data-modal-url="modals/user/user_archive.php?id=<?= $user_id ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
</div>
</div>
<?php } ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -19,8 +19,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2">
<i class="fas fa-fw fa-building me-2"></i>Vendor Templates
</h3>
@@ -30,12 +30,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Vendors Templates">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -43,124 +43,123 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_template_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_template_description&order=<?= $disp ?>">
Description <?php if ($sort == 'vendor_template_description') { echo $order_icon; } ?>
</a>
</th>
<th>Contact</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$vendor_template_id = intval($row['vendor_template_id']);
$vendor_template_name = escapeHtml($row['vendor_template_name']);
$vendor_template_description = escapeHtml($row['vendor_template_description']);
if (empty($vendor_template_description)) {
$vendor_template_description_display = "-";
} else {
$vendor_template_description_display = $vendor_template_description;
}
$vendor_template_account_number = escapeHtml($row['vendor_template_account_number']);
$vendor_template_contact_name = escapeHtml($row['vendor_template_contact_name']);
if (empty($vendor_template_contact_name)) {
$vendor_template_contact_name_display = "-";
} else {
$vendor_template_contact_name_display = $vendor_template_contact_name;
}
$vendor_template_phone = formatPhoneNumber($row['vendor_template_phone']);
$vendor_template_extension = escapeHtml($row['vendor_template_extension']);
$vendor_template_email = escapeHtml($row['vendor_template_email']);
$vendor_template_website = escapeHtml($row['vendor_template_website']);
$vendor_template_hours = escapeHtml($row['vendor_template_hours']);
$vendor_template_sla = escapeHtml($row['vendor_template_sla']);
$vendor_template_code = escapeHtml($row['vendor_template_code']);
$vendor_template_notes = escapeHtml($row['vendor_template_notes']);
?>
<tr>
<th>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/vendor_template/vendor_template_edit.php?id=<?= $vendor_template_id ?>">
<i class="fa fa-fw fa-building text-secondary me-2"></i><?= $vendor_template_name ?>
</a>
<?php
if (!empty($vendor_template_account_number)) {
?>
<br>
<small class="text-secondary"><?= $vendor_template_account_number ?></small>
<?php
}
?>
</th>
<td><?= $vendor_template_description_display ?></td>
<td>
<?php
if (!empty($vendor_template_contact_name)) {
?>
<i class="fa fa-fw fa-user text-secondary me-2 mb-2"></i><?= $vendor_template_contact_name_display ?>
<br>
<?php
} else {
echo $vendor_template_contact_name_display;
}
if (!empty($vendor_template_phone)) { ?>
<i class="fa fa-fw fa-phone text-secondary me-2 mb-2"></i><?= $vendor_template_phone ?>
<br>
<?php }
if (!empty($vendor_template_email)) { ?>
<i class="fa fa-fw fa-envelope text-secondary me-2 mb-2"></i><?= $vendor_template_email ?>
<br>
<?php } ?>
</td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/vendor_template/vendor_template_edit.php?id=<?= $vendor_template_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_vendor_template=<?= $vendor_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_template_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_template_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_template_description&order=<?= $disp ?>">
Description <?php if ($sort == 'vendor_template_description') { echo $order_icon; } ?>
</a>
</th>
<th>Contact</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$vendor_template_id = intval($row['vendor_template_id']);
$vendor_template_name = escapeHtml($row['vendor_template_name']);
$vendor_template_description = escapeHtml($row['vendor_template_description']);
if (empty($vendor_template_description)) {
$vendor_template_description_display = "-";
} else {
$vendor_template_description_display = $vendor_template_description;
}
$vendor_template_account_number = escapeHtml($row['vendor_template_account_number']);
$vendor_template_contact_name = escapeHtml($row['vendor_template_contact_name']);
if (empty($vendor_template_contact_name)) {
$vendor_template_contact_name_display = "-";
} else {
$vendor_template_contact_name_display = $vendor_template_contact_name;
}
$vendor_template_phone = formatPhoneNumber($row['vendor_template_phone']);
$vendor_template_extension = escapeHtml($row['vendor_template_extension']);
$vendor_template_email = escapeHtml($row['vendor_template_email']);
$vendor_template_website = escapeHtml($row['vendor_template_website']);
$vendor_template_hours = escapeHtml($row['vendor_template_hours']);
$vendor_template_sla = escapeHtml($row['vendor_template_sla']);
$vendor_template_code = escapeHtml($row['vendor_template_code']);
$vendor_template_notes = escapeHtml($row['vendor_template_notes']);
?>
<tr>
<th>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/vendor_template/vendor_template_edit.php?id=<?= $vendor_template_id ?>">
<i class="fa fa-fw fa-building text-secondary me-2"></i><?= $vendor_template_name ?>
</a>
<?php
if (!empty($vendor_template_account_number)) {
?>
<br>
<small class="text-secondary"><?= $vendor_template_account_number ?></small>
<?php
}
?>
</th>
<td><?= $vendor_template_description_display ?></td>
<td>
<?php
if (!empty($vendor_template_contact_name)) {
?>
<i class="fa fa-fw fa-user text-secondary me-2 mb-2"></i><?= $vendor_template_contact_name_display ?>
<br>
<?php
} else {
echo $vendor_template_contact_name_display;
}
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
if (!empty($vendor_template_phone)) { ?>
<i class="fa fa-fw fa-phone text-secondary me-2 mb-2"></i><?= $vendor_template_phone ?>
<br>
<?php }
if (!empty($vendor_template_email)) { ?>
<i class="fa fa-fw fa-envelope text-secondary me-2 mb-2"></i><?= $vendor_template_email ?>
<br>
<?php } ?>
</td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/vendor_template/vendor_template_edit.php?id=<?= $vendor_template_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_vendor_template=<?= $vendor_template_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php

View File

@@ -21,103 +21,102 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-piggy-bank me-2"></i>Accounts</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/account/account_add.php"><i class="fas fa-plus me-2"></i>New Account</button>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<div class="input-group">
<input type="search" class="form-control col-md-4" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Accounts">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=account_name&order=<?= $disp ?>">
Name <?php if ($sort == 'account_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=account_currency_code&order=<?= $disp ?>">
Currency <?php if ($sort == 'account_currency_code') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">Balance</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=account_name&order=<?= $disp ?>">
Name <?php if ($sort == 'account_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=account_currency_code&order=<?= $disp ?>">
Currency <?php if ($sort == 'account_currency_code') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">Balance</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$account_id = intval($row['account_id']);
$account_name = escapeHtml($row['account_name']);
$opening_balance = floatval($row['opening_balance']);
$account_currency_code = escapeHtml($row['account_currency_code']);
$account_notes = escapeHtml($row['account_notes']);
while ($row = mysqli_fetch_assoc($sql)) {
$account_id = intval($row['account_id']);
$account_name = escapeHtml($row['account_name']);
$opening_balance = floatval($row['opening_balance']);
$account_currency_code = escapeHtml($row['account_currency_code']);
$account_notes = escapeHtml($row['account_notes']);
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
$row = mysqli_fetch_assoc($sql_payments);
$total_payments = floatval($row['total_payments']);
$sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id");
$row = mysqli_fetch_assoc($sql_payments);
$total_payments = floatval($row['total_payments']);
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
$row = mysqli_fetch_assoc($sql_revenues);
$total_revenues = floatval($row['total_revenues']);
$sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id");
$row = mysqli_fetch_assoc($sql_revenues);
$total_revenues = floatval($row['total_revenues']);
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
$row = mysqli_fetch_assoc($sql_expenses);
$total_expenses = floatval($row['total_expenses']);
$sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id");
$row = mysqli_fetch_assoc($sql_expenses);
$total_expenses = floatval($row['total_expenses']);
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/account/account_edit.php?id=<?= $account_id ?>">
<?= $account_name ?>
</a>
</td>
<td><?= $account_currency_code ?></td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $balance, $account_currency_code) ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/account/account_edit.php?id=<?= $account_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($balance == 0 && $account_id != $config_stripe_account) { //Cannot Archive an Account until it reaches 0 Balance and cant be selected as an online account ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?archive_account=<?= $account_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/account/account_edit.php?id=<?= $account_id ?>">
<?= $account_name ?>
</a>
</td>
<td><?= $account_currency_code ?></td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $balance, $account_currency_code) ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/account/account_edit.php?id=<?= $account_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($balance == 0 && $account_id != $config_stripe_account) { //Cannot Archive an Account until it reaches 0 Balance and cant be selected as an online account ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?archive_account=<?= $account_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php

View File

@@ -211,8 +211,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-desktop me-2"></i>Assets</h3>
<div class="card-tools">
<?php if (lookupUserPermission("module_support") >= 2) { ?>
@@ -241,23 +241,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="type" value="<?= stripslashes(escapeHtml($_GET['type'])) ?>">
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-3">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search <?php if (!empty($_GET['type'])) { echo ucwords(stripslashes(escapeHtml($_GET['type']))); } else { echo "Asset"; } ?>s">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
</div>
<?php if ($client_url) { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="location" onchange="this.form.submit()">
<option value="">- All Locations -</option>
@@ -283,7 +283,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<?php } else { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="client" onchange="this.form.submit()">
<option value="" <?php if ($client == "") { echo "selected"; } ?>>- All Clients -</option>
@@ -310,7 +310,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<?php } ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select onchange="this.form.submit()" class="form-select select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
<?php
@@ -335,7 +335,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="expire_days" onchange="this.form.submit()">
<option value="" <?php if ($expire_days == "") { echo "selected"; } ?>>- Expiring In -</option>
<option value="expired" <?php if ($expire_days === "expired") { echo "selected"; } ?>>Expired</option>
@@ -348,7 +348,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-md-2">
<div class="mb-3">
<div>
<select onchange="this.form.submit()" class="form-select select2" name="show_column[]" data-placeholder="- Show Additional Columns -" multiple>
<option
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Mac_Address', $_GET['show_column'])) { echo 'selected'; } ?>>Mac_Address
@@ -368,7 +368,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-1">
<div class="btn-group float-end">
<a href="?<?= $client_url ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
<div class="dropdown ms-2" id="bulkActionButton" hidden>
@@ -455,348 +455,347 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
</div>
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive">
<table class="table border table-hover">
<thead class="table-light <?php if (!$num_rows[0]) { echo "d-none"; } ?> text-nowrap">
<div class="table-responsive">
<table class="table border table-hover mb-0">
<thead class="table-light <?php if (!$num_rows[0]) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_name&order=<?= $disp ?>">
Name <?php if ($sort == 'asset_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_type&order=<?= $disp ?>">
Type <?php if ($sort == 'asset_type') { echo $order_icon; } ?>
</a>
</th>
<?php if ($_GET['type'] !== 'virtual') { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_make&order=<?= $disp ?>">
Model <?php if ($sort == 'asset_make') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=interface_ip&order=<?= $disp ?>">
IP <?php if ($sort == 'interface_ip') { echo $order_icon; } ?>
</a>
</th>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Mac_Address', $_GET['show_column'])) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=interface_mac&order=<?= $disp ?>">
MAC Address <?php if ($sort == 'interface_mac') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Purchase_Date', $_GET['show_column'])) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_purchase_date&order=<?= $disp ?>">
Purchase Date <?php if ($sort == 'asset_purchase_date') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Install_Date', $_GET['show_column'])) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_install_date&order=<?= $disp ?>">
Install Date <?php if ($sort == 'asset_install_date') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Warranty_Expire', $_GET['show_column'])) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_warranty_expire&order=<?= $disp ?>">
Warranty Expire <?php if ($sort == 'asset_warranty_expire') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'server' && $_GET['type'] !== 'other') { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=contact_name&order=<?= $disp ?>">
Assigned To <?php if ($sort == 'contact_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_name&order=<?= $disp ?>">
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_status&order=<?= $disp ?>">
Status <?php if ($sort == 'asset_status') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$asset_id = intval($row['asset_id']);
$asset_type = escapeHtml($row['asset_type']);
$asset_name = escapeHtml($row['asset_name']);
$asset_description = escapeHtml($row['asset_description']);
if ($asset_description) {
$asset_description_display = $asset_description;
} else {
$asset_description_display = "-";
}
$asset_make = escapeHtml($row['asset_make']);
$asset_model = escapeHtml($row['asset_model']);
$asset_serial = escapeHtml($row['asset_serial']);
if ($asset_serial) {
$asset_serial_display = "<span class='font-monospace'>$asset_serial</span>";
} else {
$asset_serial_display = "-";
}
$asset_os = escapeHtml($row['asset_os']);
$asset_ip = escapeHtml($row['interface_ip']) ?: '-';
$asset_ipv6 = escapeHtml($row['interface_ipv6']);
$asset_nat_ip = escapeHtml($row['interface_nat_ip']);
$asset_mac = escapeHtml($row['interface_mac']) ?: '-';
$asset_uri = escapeUrl($row['asset_uri']);
$asset_uri_2 = escapeUrl($row['asset_uri_2']);
$asset_uri_client = escapeUrl($row['asset_uri_client']);
$asset_status = escapeHtml($row['asset_status']);
$asset_purchase_reference = escapeHtml($row['asset_purchase_reference']);
$asset_purchase_date = escapeHtml($row['asset_purchase_date']);
if ($asset_purchase_date) {
$asset_purchase_date_display = $asset_purchase_date;
} else {
$asset_purchase_date_display = "-";
}
$asset_warranty_expire = escapeHtml($row['asset_warranty_expire']);
if ($asset_warranty_expire) {
$asset_warranty_expire_display = $asset_warranty_expire;
} else {
$asset_warranty_expire_display = "-";
}
$asset_install_date = escapeHtml($row['asset_install_date']);
if ($asset_install_date) {
$asset_install_date_display = $asset_install_date;
} else {
$asset_install_date_display = "-";
}
$asset_photo = escapeHtml($row['asset_photo']);
$asset_physical_location = escapeHtml($row['asset_physical_location']);
if ($asset_physical_location) {
$asset_physical_location_display = "<div class='text-secondary'>$asset_physical_location</div>";
} else {
$asset_physical_location_display = "";
}
$asset_notes = escapeHtml($row['asset_notes']);
$asset_favorite = intval($row['asset_favorite']);
$asset_created_at = escapeHtml($row['asset_created_at']);
$asset_archived_at = escapeHtml($row['asset_archived_at']);
$asset_vendor_id = intval($row['asset_vendor_id']);
$asset_location_id = intval($row['asset_location_id']);
$asset_contact_id = intval($row['asset_contact_id']);
$asset_network_id = intval($row['interface_network_id']);
$device_icon = getAssetIcon($asset_type);
$contact_archived_at = escapeHtml($row['contact_archived_at']);
if ($contact_archived_at) {
$contact_archive_display = "<span class='text-danger'>(Archived)</span>";
} else {
$contact_archive_display = '';
}
$contact_name = escapeHtml($row['contact_name']);
if ($contact_name) {
$contact_name_display = "<a class='ajax-modal' href='#' data-modal-url='modals/contact/contact.php?id=$asset_contact_id' data-modal-size='lg'>$contact_name $contact_archive_display</a>";
} else {
$contact_name_display = "-";
}
$location_name = escapeHtml($row['location_name']);
if (empty($location_name)) {
$location_name = "-";
}
$location_archived_at = escapeHtml($row['location_archived_at']);
if ($location_archived_at) {
$location_name_display = "<div class='text-danger' title='Archived'><s>$location_name</s></div>";
} else {
$location_name_display = $location_name;
}
$sql_credentials = mysqli_query($mysqli, "SELECT 1 FROM credentials WHERE credential_asset_id = $asset_id");
$credential_count = mysqli_num_rows($sql_credentials);
// Tags
$asset_tag_name_display_array = array();
$asset_tag_id_array = array();
$sql_asset_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, tag_id, tag_name FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_asset_tags)) {
$asset_tag_id = intval($row['tag_id']);
$asset_tag_name = escapeHtml($row['tag_name']);
$asset_tag_color = escapeHtml($row['tag_color']);
if (empty($asset_tag_color)) {
$asset_tag_color = "dark";
}
$asset_tag_icon = escapeHtml($row['tag_icon']);
if (empty($asset_tag_icon)) {
$asset_tag_icon = "tag";
}
$asset_tag_id_array[] = $asset_tag_id;
$asset_tag_name_display_array[] = "<a href='assets.php?$client_url tags[]=$asset_tag_id'><span class='badge text-light p-1 me-1' style='background-color: $asset_tag_color;'><i class='fa fa-fw fa-$asset_tag_icon me-1'></i>$asset_tag_name</span></a>";
}
$asset_tags_display = implode('', $asset_tag_name_display_array);
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="asset_ids[]" value="<?= $asset_id ?>">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_name&order=<?= $disp ?>">
Name <?php if ($sort == 'asset_name') { echo $order_icon; } ?>
<td>
<a class="text-dark" href="asset.php?client_id=<?= $client_id ?>&asset_id=<?= $asset_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-<?= $device_icon ?> me-3 mt-1"></i>
<div class="flex-grow-1">
<div>
<?= $asset_name ?>
<?php if ($asset_favorite) { echo "<i class='fas fa-fw fa-star text-warning' title='Favorite'></i>"; } ?></div>
<div><small class="text-secondary"><?= $asset_description ?></small></div>
<?php if ($asset_tags_display) { echo $asset_tags_display; } ?>
</div>
</div>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_type&order=<?= $disp ?>">
Type <?php if ($sort == 'asset_type') { echo $order_icon; } ?>
</a>
</th>
</td>
<td>
<div>
<?= $asset_type ?>
<?php if ( !empty($asset_uri) || !empty($asset_uri_2) || !empty($asset_uri_client)) { ?>
<div class="dropdown d-inline">
<button class="btn btn-tool" type="button" data-bs-toggle="dropdown">
<i class="fas fa-external-link-alt"></i>
</button>
<div class="dropdown-menu">
<?php if ($asset_uri) { ?>
<a href="<?= $asset_uri ?>" alt="<?= $asset_uri ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt me-2"></i><?= truncate($asset_uri,40) ?>
</a>
<?php } ?>
<?php if ($asset_uri_2) { ?>
<div class="dropdown-divider"></div>
<a href="<?= $asset_uri_2 ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt me-2"></i><?= truncate($asset_uri_2,40) ?>
</a>
<?php } ?>
<?php if ($asset_uri_client) { ?>
<div class="dropdown-divider"></div>
<a href="<?= $asset_uri_client ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt me-2"></i>Client URI: <?= truncate($asset_uri_client,40) ?>
</a>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
<div><small class="text-secondary"><?= $asset_os ?></small></div>
</td>
<?php if ($_GET['type'] !== 'virtual') { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_make&order=<?= $disp ?>">
Model <?php if ($sort == 'asset_make') { echo $order_icon; } ?>
</a>
</th>
<td>
<div><?= "$asset_make $asset_model" ?></div>
<div><small class="text-secondary"><?= $asset_serial_display ?></small></div>
</td>
<?php } ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=interface_ip&order=<?= $disp ?>">
IP <?php if ($sort == 'interface_ip') { echo $order_icon; } ?>
</a>
</th>
<td class="font-monospace">
<?= $asset_ip ?>
<div class="text-secondary"><small><?= $asset_ipv6 ?></small></div>
</td>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Mac_Address', $_GET['show_column'])) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=interface_mac&order=<?= $disp ?>">
MAC Address <?php if ($sort == 'interface_mac') { echo $order_icon; } ?>
</a>
</th>
<td class="font-monospace"><?= $asset_mac ?></td>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Purchase_Date', $_GET['show_column'])) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_purchase_date&order=<?= $disp ?>">
Purchase Date <?php if ($sort == 'asset_purchase_date') { echo $order_icon; } ?>
</a>
</th>
<td><?= $asset_purchase_date_display ?></td>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Install_Date', $_GET['show_column'])) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_install_date&order=<?= $disp ?>">
Install Date <?php if ($sort == 'asset_install_date') { echo $order_icon; } ?>
</a>
</th>
<td><?= $asset_install_date_display ?></td>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Warranty_Expire', $_GET['show_column'])) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_warranty_expire&order=<?= $disp ?>">
Warranty Expire <?php if ($sort == 'asset_warranty_expire') { echo $order_icon; } ?>
</a>
</th>
<td><?= $asset_warranty_expire_display ?></td>
<?php } ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'server' && $_GET['type'] !== 'other') { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=contact_name&order=<?= $disp ?>">
Assigned To <?php if ($sort == 'contact_name') { echo $order_icon; } ?>
</a>
</th>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other' && $_GET['type'] !== 'server') { ?>
<td><?= $contact_name_display ?></td>
<?php } ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_name&order=<?= $disp ?>">
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=asset_status&order=<?= $disp ?>">
Status <?php if ($sort == 'asset_status') { echo $order_icon; } ?>
</a>
</th>
<td>
<div><?= $location_name_display ?></div>
<div><small><?= $asset_physical_location_display ?></small></div>
</td>
<td><span class="badge rounded-pill bg-secondary p-2"><?= $asset_status ?></span></td>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<td><a href="assets.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<th class="text-center">Action</th>
<td class="text-center">
<div class="btn-group">
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown"><i class="fas fa-ellipsis-h"></i></button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/asset/asset_edit.php?id=<?= $asset_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/asset/asset_copy.php?id=<?= $asset_id ?>">
<i class="fas fa-fw fa-copy me-2"></i>Copy
</a>
<?php if ($session_user_role > 2) { ?>
<?php if ($asset_archived_at) { ?>
<a class="dropdown-item text-info" href="post.php?restore_asset=<?= $asset_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_asset=<?= $asset_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } else { ?>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_asset=<?= $asset_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</td>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$asset_id = intval($row['asset_id']);
$asset_type = escapeHtml($row['asset_type']);
$asset_name = escapeHtml($row['asset_name']);
$asset_description = escapeHtml($row['asset_description']);
if ($asset_description) {
$asset_description_display = $asset_description;
} else {
$asset_description_display = "-";
}
$asset_make = escapeHtml($row['asset_make']);
$asset_model = escapeHtml($row['asset_model']);
$asset_serial = escapeHtml($row['asset_serial']);
if ($asset_serial) {
$asset_serial_display = "<span class='font-monospace'>$asset_serial</span>";
} else {
$asset_serial_display = "-";
}
$asset_os = escapeHtml($row['asset_os']);
$asset_ip = escapeHtml($row['interface_ip']) ?: '-';
$asset_ipv6 = escapeHtml($row['interface_ipv6']);
$asset_nat_ip = escapeHtml($row['interface_nat_ip']);
$asset_mac = escapeHtml($row['interface_mac']) ?: '-';
$asset_uri = escapeUrl($row['asset_uri']);
$asset_uri_2 = escapeUrl($row['asset_uri_2']);
$asset_uri_client = escapeUrl($row['asset_uri_client']);
$asset_status = escapeHtml($row['asset_status']);
$asset_purchase_reference = escapeHtml($row['asset_purchase_reference']);
$asset_purchase_date = escapeHtml($row['asset_purchase_date']);
if ($asset_purchase_date) {
$asset_purchase_date_display = $asset_purchase_date;
} else {
$asset_purchase_date_display = "-";
}
$asset_warranty_expire = escapeHtml($row['asset_warranty_expire']);
if ($asset_warranty_expire) {
$asset_warranty_expire_display = $asset_warranty_expire;
} else {
$asset_warranty_expire_display = "-";
}
$asset_install_date = escapeHtml($row['asset_install_date']);
if ($asset_install_date) {
$asset_install_date_display = $asset_install_date;
} else {
$asset_install_date_display = "-";
}
$asset_photo = escapeHtml($row['asset_photo']);
$asset_physical_location = escapeHtml($row['asset_physical_location']);
if ($asset_physical_location) {
$asset_physical_location_display = "<div class='text-secondary'>$asset_physical_location</div>";
} else {
$asset_physical_location_display = "";
}
$asset_notes = escapeHtml($row['asset_notes']);
$asset_favorite = intval($row['asset_favorite']);
$asset_created_at = escapeHtml($row['asset_created_at']);
$asset_archived_at = escapeHtml($row['asset_archived_at']);
$asset_vendor_id = intval($row['asset_vendor_id']);
$asset_location_id = intval($row['asset_location_id']);
$asset_contact_id = intval($row['asset_contact_id']);
$asset_network_id = intval($row['interface_network_id']);
}
$device_icon = getAssetIcon($asset_type);
?>
$contact_archived_at = escapeHtml($row['contact_archived_at']);
if ($contact_archived_at) {
$contact_archive_display = "<span class='text-danger'>(Archived)</span>";
} else {
$contact_archive_display = '';
}
$contact_name = escapeHtml($row['contact_name']);
if ($contact_name) {
$contact_name_display = "<a class='ajax-modal' href='#' data-modal-url='modals/contact/contact.php?id=$asset_contact_id' data-modal-size='lg'>$contact_name $contact_archive_display</a>";
} else {
$contact_name_display = "-";
}
$location_name = escapeHtml($row['location_name']);
if (empty($location_name)) {
$location_name = "-";
}
$location_archived_at = escapeHtml($row['location_archived_at']);
if ($location_archived_at) {
$location_name_display = "<div class='text-danger' title='Archived'><s>$location_name</s></div>";
} else {
$location_name_display = $location_name;
}
$sql_credentials = mysqli_query($mysqli, "SELECT 1 FROM credentials WHERE credential_asset_id = $asset_id");
$credential_count = mysqli_num_rows($sql_credentials);
// Tags
$asset_tag_name_display_array = array();
$asset_tag_id_array = array();
$sql_asset_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, tag_id, tag_name FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_asset_tags)) {
$asset_tag_id = intval($row['tag_id']);
$asset_tag_name = escapeHtml($row['tag_name']);
$asset_tag_color = escapeHtml($row['tag_color']);
if (empty($asset_tag_color)) {
$asset_tag_color = "dark";
}
$asset_tag_icon = escapeHtml($row['tag_icon']);
if (empty($asset_tag_icon)) {
$asset_tag_icon = "tag";
}
$asset_tag_id_array[] = $asset_tag_id;
$asset_tag_name_display_array[] = "<a href='assets.php?$client_url tags[]=$asset_tag_id'><span class='badge text-light p-1 me-1' style='background-color: $asset_tag_color;'><i class='fa fa-fw fa-$asset_tag_icon me-1'></i>$asset_tag_name</span></a>";
}
$asset_tags_display = implode('', $asset_tag_name_display_array);
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="asset_ids[]" value="<?= $asset_id ?>">
</div>
</td>
<td>
<a class="text-dark" href="asset.php?client_id=<?= $client_id ?>&asset_id=<?= $asset_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-<?= $device_icon ?> me-3 mt-1"></i>
<div class="flex-grow-1">
<div>
<?= $asset_name ?>
<?php if ($asset_favorite) { echo "<i class='fas fa-fw fa-star text-warning' title='Favorite'></i>"; } ?></div>
<div><small class="text-secondary"><?= $asset_description ?></small></div>
<?php if ($asset_tags_display) { echo $asset_tags_display; } ?>
</div>
</div>
</a>
</td>
<td>
<div>
<?= $asset_type ?>
<?php if ( !empty($asset_uri) || !empty($asset_uri_2) || !empty($asset_uri_client)) { ?>
<div class="dropdown d-inline">
<button class="btn btn-tool" type="button" data-bs-toggle="dropdown">
<i class="fas fa-external-link-alt"></i>
</button>
<div class="dropdown-menu">
<?php if ($asset_uri) { ?>
<a href="<?= $asset_uri ?>" alt="<?= $asset_uri ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt me-2"></i><?= truncate($asset_uri,40) ?>
</a>
<?php } ?>
<?php if ($asset_uri_2) { ?>
<div class="dropdown-divider"></div>
<a href="<?= $asset_uri_2 ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt me-2"></i><?= truncate($asset_uri_2,40) ?>
</a>
<?php } ?>
<?php if ($asset_uri_client) { ?>
<div class="dropdown-divider"></div>
<a href="<?= $asset_uri_client ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt me-2"></i>Client URI: <?= truncate($asset_uri_client,40) ?>
</a>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
<div><small class="text-secondary"><?= $asset_os ?></small></div>
</td>
<?php if ($_GET['type'] !== 'virtual') { ?>
<td>
<div><?= "$asset_make $asset_model" ?></div>
<div><small class="text-secondary"><?= $asset_serial_display ?></small></div>
</td>
<?php } ?>
<td class="font-monospace">
<?= $asset_ip ?>
<div class="text-secondary"><small><?= $asset_ipv6 ?></small></div>
</td>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Mac_Address', $_GET['show_column'])) { ?>
<td class="font-monospace"><?= $asset_mac ?></td>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Purchase_Date', $_GET['show_column'])) { ?>
<td><?= $asset_purchase_date_display ?></td>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Install_Date', $_GET['show_column'])) { ?>
<td><?= $asset_install_date_display ?></td>
<?php } ?>
<?php if (isset($_GET['show_column']) && is_array($_GET['show_column']) && in_array('Warranty_Expire', $_GET['show_column'])) { ?>
<td><?= $asset_warranty_expire_display ?></td>
<?php } ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other' && $_GET['type'] !== 'server') { ?>
<td><?= $contact_name_display ?></td>
<?php } ?>
<td>
<div><?= $location_name_display ?></div>
<div><small><?= $asset_physical_location_display ?></small></div>
</td>
<td><span class="badge rounded-pill bg-secondary p-2"><?= $asset_status ?></span></td>
<?php if (!$client_url) { ?>
<td><a href="assets.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td class="text-center">
<div class="btn-group">
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown"><i class="fas fa-ellipsis-h"></i></button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/asset/asset_edit.php?id=<?= $asset_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/asset/asset_copy.php?id=<?= $asset_id ?>">
<i class="fas fa-fw fa-copy me-2"></i>Copy
</a>
<?php if ($session_user_role > 2) { ?>
<?php if ($asset_archived_at) { ?>
<a class="dropdown-item text-info" href="post.php?restore_asset=<?= $asset_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_asset=<?= $asset_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } else { ?>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_asset=<?= $asset_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -77,8 +77,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-lock me-2"></i>Certificates</h3>
<div class="card-tools">
<div class="btn-group">
@@ -95,16 +95,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Certificates">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -140,7 +140,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="expire_days" onchange="this.form.submit()">
<option value="" <?php if ($expire_days == "") { echo "selected"; } ?>>- Expiring In -</option>
<option value="expired" <?php if ($expire_days === "expired") { echo "selected"; } ?>>Expired</option>
@@ -160,7 +160,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="btn-group float-end">
<a href="?<?= $client_url ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
<div class="dropdown ms-2" id="bulkActionButton" hidden>
@@ -184,165 +184,164 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive">
</div>
<div class="table-responsive">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=certificate_name&order=<?= $disp ?>">
Name <?php if ($sort == 'certificate_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=certificate_domain&order=<?= $disp ?>">
Domain <?php if ($sort == 'certificate_domain') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=certificate_issued_by&order=<?= $disp ?>">
Issued By <?php if ($sort == 'certificate_issued_by') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=certificate_expire&order=<?= $disp ?>">
Expire <?php if ($sort == 'certificate_expire') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$certificate_id = intval($row['certificate_id']);
$certificate_name = escapeHtml($row['certificate_name']);
$certificate_description = escapeHtml($row['certificate_description']);
$certificate_domain = escapeHtml($row['certificate_domain']);
$certificate_issued_by = escapeHtml($row['certificate_issued_by']);
$certificate_expire = escapeHtml($row['certificate_expire']);
$certificate_created_at = escapeHtml($row['certificate_created_at']);
$certificate_archived_at = escapeHtml($row['certificate_archived_at']);
$certificate_expire_ago = timeAgo($certificate_expire);
// Convert the expiry date to a timestamp
$certificate_expire_timestamp = strtotime($row['certificate_expire']);
$current_timestamp = time(); // Get current timestamp
// Calculate the difference in days
$days_until_expiry = ($certificate_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
// Determine the class based on the number of days until expiry
if ($days_until_expiry <= 0) {
$tr_class = "table-secondary";
} elseif ($days_until_expiry <= 1) {
$tr_class = "table-danger";
} elseif ($days_until_expiry <= 7) {
$tr_class = "table-warning";
} else {
$tr_class = '';
}
?>
<tr class="<?= $tr_class ?>">
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="certificate_ids[]" value="<?= $certificate_id ?>">
<input type="hidden" name="client_id" value="<?= $client_id ?>">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=certificate_name&order=<?= $disp ?>">
Name <?php if ($sort == 'certificate_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=certificate_domain&order=<?= $disp ?>">
Domain <?php if ($sort == 'certificate_domain') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=certificate_issued_by&order=<?= $disp ?>">
Issued By <?php if ($sort == 'certificate_issued_by') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=certificate_expire&order=<?= $disp ?>">
Expire <?php if ($sort == 'certificate_expire') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$certificate_id = intval($row['certificate_id']);
$certificate_name = escapeHtml($row['certificate_name']);
$certificate_description = escapeHtml($row['certificate_description']);
$certificate_domain = escapeHtml($row['certificate_domain']);
$certificate_issued_by = escapeHtml($row['certificate_issued_by']);
$certificate_expire = escapeHtml($row['certificate_expire']);
$certificate_created_at = escapeHtml($row['certificate_created_at']);
$certificate_archived_at = escapeHtml($row['certificate_archived_at']);
$certificate_expire_ago = timeAgo($certificate_expire);
// Convert the expiry date to a timestamp
$certificate_expire_timestamp = strtotime($row['certificate_expire']);
$current_timestamp = time(); // Get current timestamp
// Calculate the difference in days
$days_until_expiry = ($certificate_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
// Determine the class based on the number of days until expiry
if ($days_until_expiry <= 0) {
$tr_class = "table-secondary";
} elseif ($days_until_expiry <= 1) {
$tr_class = "table-danger";
} elseif ($days_until_expiry <= 7) {
$tr_class = "table-warning";
} else {
$tr_class = '';
}
?>
<tr class="<?= $tr_class ?>">
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="certificate_ids[]" value="<?= $certificate_id ?>">
<input type="hidden" name="client_id" value="<?= $client_id ?>">
</div>
</td>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/certificate/certificate_edit.php?<?= $client_url ?>&id=<?= $certificate_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-lock me-3"></i>
<div class="flex-grow-1">
<div><?= $certificate_name ?></div>
<div><small class="text-secondary"><?= $certificate_description ?></small></div>
</div>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/certificate/certificate_edit.php?<?= $client_url ?>&id=<?= $certificate_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-lock me-3"></i>
<div class="flex-grow-1">
<div><?= $certificate_name ?></div>
<div><small class="text-secondary"><?= $certificate_description ?></small></div>
</div>
</a>
</td>
<td><?= $certificate_domain ?></td>
</div>
</a>
</td>
<td><?= $certificate_domain ?></td>
<td><?= $certificate_issued_by ?></td>
<td><?= $certificate_issued_by ?></td>
<td>
<div><?= $certificate_expire ?: '-' ?></div>
<?php if (!empty($certificate_expire)) { ?>
<div><small><?= $certificate_expire_ago ?></small></div>
<?php } ?>
</td>
<?php if (!$client_url) { ?>
<td><a href="certificates.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<td>
<div><?= $certificate_expire ?: '-' ?></div>
<?php if (!empty($certificate_expire)) { ?>
<div><small><?= $certificate_expire_ago ?></small></div>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/certificate/certificate_edit.php?<?= $client_url ?>&id=<?= $certificate_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</td>
<?php if (!$client_url) { ?>
<td><a href="certificates.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/certificate/certificate_edit.php?<?= $client_url ?>&id=<?= $certificate_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?refresh_certificate=<?= $certificate_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-sync-alt me-2"></i>Refresh Certificate
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($certificate_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_certificate=<?= $certificate_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?refresh_certificate=<?= $certificate_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-sync-alt me-2"></i>Refresh Certificate
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_certificate=<?= $certificate_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_certificate=<?= $certificate_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($certificate_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_certificate=<?= $certificate_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_certificate=<?= $certificate_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_certificate=<?= $certificate_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</div>
</td>
</tr>
</div>
</td>
</tr>
<?php
}
?>
<?php
}
?>
</tbody>
</table>
</tbody>
</table>
</form>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</form>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -106,22 +106,20 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
</div>
</div>
<div class="card-header pb-2 pt-3">
<div class="card-header py-3">
<form autocomplete="off">
<input type="hidden" name="leads" value="<?= $leads_filter ?>">
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-md-5">
<div class="mb-3">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search <?php if($leads_filter == 0){ echo "clients"; } else { echo "leads"; } ?>" autofocus>
<button class="btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search <?php if($leads_filter == 0){ echo "clients"; } else { echo "leads"; } ?>" autofocus>
<button class="btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="col-md-7">
<div class="btn-toolbar mb-3 float-end">
<div class="btn-toolbar justify-content-md-end">
<div class="btn-group me-2">
<a href="?leads=0" class="btn btn-<?php if ($leads_filter == 0){ echo "primary"; } else { echo "default"; } ?>" title="Clients"><i class="fa fa-fw fa-user-friends"></i><span class="d-none d-sm-inline ms-2">Clients</span></a>
<a href="?leads=1" class="btn btn-<?php if ($leads_filter == 1){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-bullhorn"></i><span class="d-none d-sm-inline ms-2">Leads</span></a>
@@ -200,7 +198,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div
class="collapse
class="collapse mt-3
<?php
if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01'
|| $industry_filter
@@ -212,10 +210,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
"
id="advancedFilter"
>
<div class="row">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -223,8 +221,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-md-3">
<div class="mb-3">
<label>Tag</label>
<div>
<label class="form-label">Tag</label>
<select onchange="this.form.submit()" class="form-select select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
<?php
$sql_tags_filter = mysqli_query($mysqli, "
@@ -246,8 +244,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<label>Industry</label>
<div>
<label class="form-label">Industry</label>
<select class="form-select select2" name="industry" onchange="this.form.submit()">
<option value="">- All Industries -</option>
@@ -265,8 +263,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<label>Referral</label>
<div>
<label class="form-label">Referral</label>
<select class="form-select select2" name="referral" onchange="this.form.submit()">
<option value="">- All Referrals -</option>

View File

@@ -85,8 +85,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-address-book me-2"></i>Contacts</h3>
<div class="card-tools">
<div class="btn-group">
@@ -112,23 +112,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Contacts">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="col-md-3">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select onchange="this.form.submit()" class="form-select select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
<?php
@@ -155,7 +155,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php if ($client_url) { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="location" onchange="this.form.submit()">
<option value="">- All Locations -</option>
@@ -181,7 +181,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<?php } else { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="client" onchange="this.form.submit()">
<option value="" <?php if ($client == "") { echo "selected"; } ?>>- All Clients -</option>
@@ -211,7 +211,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-3">
<div class="btn-group float-end">
<a href="?<?= $client_url ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
<div class="dropdown ms-2" id="bulkActionButton" hidden>
@@ -282,285 +282,284 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
</div>
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive">
<table class="table border">
<thead class="table-light <?php if (!$num_rows[0]) { echo "d-none"; } ?>">
<div class="table-responsive">
<table class="table border mb-0">
<thead class="table-light <?php if (!$num_rows[0]) { echo "d-none"; } ?>">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary ms-3" href="?<?= $url_query_strings_sort ?>&sort=contact_name&order=<?= $disp ?>">
Name <?php if ($sort == 'contact_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=contact_department&order=<?= $disp ?>">
Department <?php if ($sort == 'contact_department') { echo $order_icon; } ?>
</a>
</th>
<th>Contact</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_name&order=<?= $disp ?>">
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th></th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$contact_id = intval($row['contact_id']);
$contact_name = escapeHtml($row['contact_name']);
$contact_title = escapeHtml($row['contact_title']);
if (empty($contact_title)) {
$contact_title_display = "";
} else {
$contact_title_display = "<small class='text-secondary'>$contact_title</small>";
}
$contact_department = escapeHtml($row['contact_department']) ?: '-';
$contact_extension = escapeHtml($row['contact_extension']);
if (empty($contact_extension)) {
$contact_extension_display = "";
} else {
$contact_extension_display = "<small class='text-secondary ms-1'>x$contact_extension</small>";
}
$contact_phone_country_code = escapeHtml($row['contact_phone_country_code']);
$contact_phone = escapeHtml(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
if (empty($contact_phone)) {
$contact_phone_display = "";
} else {
$contact_phone_display = "<div><i class='fas fa-fw fa-phone me-2'></i><a href='tel:$contact_phone'>$contact_phone$contact_extension_display</a></div>";
}
$contact_mobile_country_code = escapeHtml($row['contact_mobile_country_code']);
$contact_mobile = escapeHtml(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
if (empty($contact_mobile)) {
$contact_mobile_display = "";
} else {
$contact_mobile_display = "<div class='mt-2'><i class='fas fa-fw fa-mobile-alt me-2'></i><a href='tel:$contact_mobile'>$contact_mobile</a></div>";
}
$contact_email = escapeHtml($row['contact_email']);
if (empty($contact_email)) {
$contact_email_display = "";
} else {
$contact_email_display = "<div class='mt-1'><i class='fas fa-fw fa-envelope me-2'></i><a href='mailto:$contact_email'>$contact_email</a><button class='btn btn-sm clipboardjs' type='button' data-clipboard-text='$contact_email'><i class='far fa-copy text-secondary'></i></button></div>";
}
$contact_info_display = "$contact_phone_display $contact_mobile_display $contact_email_display";
if (empty($contact_info_display)) {
$contact_info_display = "-";
}
$contact_pin = escapeHtml($row['contact_pin']);
$contact_photo = escapeHtml($row['contact_photo']);
$contact_initials = initials($contact_name);
$contact_notes = escapeHtml($row['contact_notes']);
$contact_primary = intval($row['contact_primary']);
$contact_important = intval($row['contact_important']);
$contact_billing = intval($row['contact_billing']);
$contact_technical = intval($row['contact_technical']);
$contact_created_at = escapeHtml($row['contact_created_at']);
$contact_archived_at = escapeHtml($row['contact_archived_at']);
if ($contact_primary == 1) {
$contact_primary_display = "<small class='text-success'>Primary Contact</small>";
} else {
$contact_primary_display = false;
}
$contact_location_id = intval($row['contact_location_id']);
$location_name = escapeHtml($row['location_name']);
if (empty($location_name)) {
$location_name = "<span class='text-muted'>N/A</span>";
}
$location_archived_at = escapeHtml($row['location_archived_at']);
if ($location_archived_at) {
$location_name_display = "<div class='text-danger' title='Archived'><s>$location_name</s></div>";
} else {
$location_name_display = $location_name;
}
$auth_method = escapeHtml($row['user_auth_method']);
$contact_user_id = intval($row['contact_user_id']);
if ($contact_user_id) {
$user_exists_display = "<span class='badge rounded-pill bg-dark p-1' title='User: $auth_method'><i class='fas fa-fw fa-user'></i></span>";
} else {
$user_exists_display = "";
}
// Counts
// Asset Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('asset_id') AS num FROM assets WHERE asset_contact_id = $contact_id AND asset_archived_at IS NULL"));
$asset_count = $row['num'];
if ($asset_count) {
$asset_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#assets' class='me-2 mb-1 badge rounded-pill bg-dark p-2' title='Assets ($asset_count)'><i class='fas fa-fw fa-desktop me-2'></i>$asset_count</a>";
} else {
$asset_count_display = '';
}
// Credential Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('credential_id') AS num FROM credentials WHERE credential_contact_id = $contact_id AND credential_archived_at IS NULL"));
$credential_count = $row['num'];
if ($credential_count) {
$credential_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#credentials' class='me-2 mb-1 badge rounded-pill bg-secondary p-2' title='Credentials ($credential_count)'><i class='fas fa-fw fa-key me-2'></i>$credential_count</a>";
} else {
$credential_count_display = '';
}
// Software Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('software_id') AS num FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id AND software_archived_at IS NULL"));
$software_count = $row['num'];
if ($software_count) {
$software_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#software' class='me-2 mb-1 badge rounded-pill bg-secondary p-2' title='Licenses ($software_count)'><i class='fas fa-fw fa-cube me-2'></i>$software_count</a>";
} else {
$software_count_display = '';
}
// Ticket Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('ticket_id') AS num FROM tickets WHERE ticket_contact_id = $contact_id AND ticket_archived_at IS NULL"));
$ticket_count = $row['num'];
if ($ticket_count) {
$ticket_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#tickets' class='me-2 mb-1 badge rounded-pill bg-secondary p-2' title='Tickets ($ticket_count)'><i class='fas fa-fw fa-life-ring me-2'></i>$ticket_count</a>";
} else {
$ticket_count_display = '';
}
// Tags
$contact_tag_name_display_array = array();
$contact_tag_id_array = array();
$sql_contact_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, contact_tags.tag_id, tag_name FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_contact_tags)) {
$contact_tag_id = intval($row['tag_id']);
$contact_tag_name = escapeHtml($row['tag_name']);
$contact_tag_color = escapeHtml($row['tag_color']);
if (empty($contact_tag_color)) {
$contact_tag_color = "dark";
}
$contact_tag_icon = escapeHtml($row['tag_icon']);
if (empty($contact_tag_icon)) {
$contact_tag_icon = "tag";
}
$contact_tag_id_array[] = $contact_tag_id;
$contact_tag_name_display_array[] = "<a href='contacts.php?$client_url tags[]=$contact_tag_id'><span class='badge text-light p-1 me-1' style='background-color: $contact_tag_color;'><i class='fa fa-fw fa-$contact_tag_icon me-2'></i>$contact_tag_name</span></a>";
}
$contact_tags_display = implode('', $contact_tag_name_display_array);
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="contact_ids[]" value="<?= $contact_id ?>">
</div>
</td>
<th>
<a class="text-secondary ms-3" href="?<?= $url_query_strings_sort ?>&sort=contact_name&order=<?= $disp ?>">
Name <?php if ($sort == 'contact_name') { echo $order_icon; } ?>
<td>
<a class="text-dark" href="contact.php?client_id=<?= $client_id ?>&contact_id=<?= $contact_id ?>">
<div class="d-flex">
<?php if ($contact_photo) { ?>
<span class="fa-stack fa-2x me-3 text-center">
<img class="img-size-50 rounded-circle" src="<?= "../uploads/clients/$client_id/$contact_photo" ?>">
</span>
<?php } else { ?>
<span class="fa-stack fa-2x me-3">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?= $contact_initials ?></span>
</span>
<?php } ?>
<div class="flex-grow-1">
<div class="<?php if($contact_important) { echo "text-bold"; } ?>"><?= $contact_name ?> <?= $user_exists_display ?></div>
<?= $contact_title_display ?>
<div><?= $contact_primary_display ?></div>
<?php
if (!empty($contact_tags_display)) { ?>
<div class="mt-1">
<?= $contact_tags_display ?>
</div>
<?php } ?>
</div>
</div>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=contact_department&order=<?= $disp ?>">
Department <?php if ($sort == 'contact_department') { echo $order_icon; } ?>
</a>
</th>
<th>Contact</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_name&order=<?= $disp ?>">
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th></th>
</td>
<td><?= $contact_department ?></td>
<td><?= $contact_info_display ?></td>
<td><?= $location_name_display ?></td>
<td>
<?= "$asset_count_display$credential_count_display$software_count_display$ticket_count_display" ?>
</td>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<td><a href="contacts.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$contact_id = intval($row['contact_id']);
$contact_name = escapeHtml($row['contact_name']);
$contact_title = escapeHtml($row['contact_title']);
if (empty($contact_title)) {
$contact_title_display = "";
} else {
$contact_title_display = "<small class='text-secondary'>$contact_title</small>";
}
$contact_department = escapeHtml($row['contact_department']) ?: '-';
$contact_extension = escapeHtml($row['contact_extension']);
if (empty($contact_extension)) {
$contact_extension_display = "";
} else {
$contact_extension_display = "<small class='text-secondary ms-1'>x$contact_extension</small>";
}
$contact_phone_country_code = escapeHtml($row['contact_phone_country_code']);
$contact_phone = escapeHtml(formatPhoneNumber($row['contact_phone'], $contact_phone_country_code));
if (empty($contact_phone)) {
$contact_phone_display = "";
} else {
$contact_phone_display = "<div><i class='fas fa-fw fa-phone me-2'></i><a href='tel:$contact_phone'>$contact_phone$contact_extension_display</a></div>";
}
$contact_mobile_country_code = escapeHtml($row['contact_mobile_country_code']);
$contact_mobile = escapeHtml(formatPhoneNumber($row['contact_mobile'], $contact_mobile_country_code));
if (empty($contact_mobile)) {
$contact_mobile_display = "";
} else {
$contact_mobile_display = "<div class='mt-2'><i class='fas fa-fw fa-mobile-alt me-2'></i><a href='tel:$contact_mobile'>$contact_mobile</a></div>";
}
$contact_email = escapeHtml($row['contact_email']);
if (empty($contact_email)) {
$contact_email_display = "";
} else {
$contact_email_display = "<div class='mt-1'><i class='fas fa-fw fa-envelope me-2'></i><a href='mailto:$contact_email'>$contact_email</a><button class='btn btn-sm clipboardjs' type='button' data-clipboard-text='$contact_email'><i class='far fa-copy text-secondary'></i></button></div>";
}
$contact_info_display = "$contact_phone_display $contact_mobile_display $contact_email_display";
if (empty($contact_info_display)) {
$contact_info_display = "-";
}
$contact_pin = escapeHtml($row['contact_pin']);
$contact_photo = escapeHtml($row['contact_photo']);
$contact_initials = initials($contact_name);
$contact_notes = escapeHtml($row['contact_notes']);
$contact_primary = intval($row['contact_primary']);
$contact_important = intval($row['contact_important']);
$contact_billing = intval($row['contact_billing']);
$contact_technical = intval($row['contact_technical']);
$contact_created_at = escapeHtml($row['contact_created_at']);
$contact_archived_at = escapeHtml($row['contact_archived_at']);
if ($contact_primary == 1) {
$contact_primary_display = "<small class='text-success'>Primary Contact</small>";
} else {
$contact_primary_display = false;
}
$contact_location_id = intval($row['contact_location_id']);
$location_name = escapeHtml($row['location_name']);
if (empty($location_name)) {
$location_name = "<span class='text-muted'>N/A</span>";
}
$location_archived_at = escapeHtml($row['location_archived_at']);
if ($location_archived_at) {
$location_name_display = "<div class='text-danger' title='Archived'><s>$location_name</s></div>";
} else {
$location_name_display = $location_name;
}
$auth_method = escapeHtml($row['user_auth_method']);
$contact_user_id = intval($row['contact_user_id']);
if ($contact_user_id) {
$user_exists_display = "<span class='badge rounded-pill bg-dark p-1' title='User: $auth_method'><i class='fas fa-fw fa-user'></i></span>";
} else {
$user_exists_display = "";
}
// Counts
// Asset Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('asset_id') AS num FROM assets WHERE asset_contact_id = $contact_id AND asset_archived_at IS NULL"));
$asset_count = $row['num'];
if ($asset_count) {
$asset_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#assets' class='me-2 mb-1 badge rounded-pill bg-dark p-2' title='Assets ($asset_count)'><i class='fas fa-fw fa-desktop me-2'></i>$asset_count</a>";
} else {
$asset_count_display = '';
}
// Credential Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('credential_id') AS num FROM credentials WHERE credential_contact_id = $contact_id AND credential_archived_at IS NULL"));
$credential_count = $row['num'];
if ($credential_count) {
$credential_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#credentials' class='me-2 mb-1 badge rounded-pill bg-secondary p-2' title='Credentials ($credential_count)'><i class='fas fa-fw fa-key me-2'></i>$credential_count</a>";
} else {
$credential_count_display = '';
}
// Software Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('software_id') AS num FROM software, software_contacts WHERE software.software_id = software_contacts.software_id AND software_contacts.contact_id = $contact_id AND software_archived_at IS NULL"));
$software_count = $row['num'];
if ($software_count) {
$software_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#software' class='me-2 mb-1 badge rounded-pill bg-secondary p-2' title='Licenses ($software_count)'><i class='fas fa-fw fa-cube me-2'></i>$software_count</a>";
} else {
$software_count_display = '';
}
// Ticket Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('ticket_id') AS num FROM tickets WHERE ticket_contact_id = $contact_id AND ticket_archived_at IS NULL"));
$ticket_count = $row['num'];
if ($ticket_count) {
$ticket_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#tickets' class='me-2 mb-1 badge rounded-pill bg-secondary p-2' title='Tickets ($ticket_count)'><i class='fas fa-fw fa-life-ring me-2'></i>$ticket_count</a>";
} else {
$ticket_count_display = '';
}
// Tags
$contact_tag_name_display_array = array();
$contact_tag_id_array = array();
$sql_contact_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, contact_tags.tag_id, tag_name FROM contact_tags LEFT JOIN tags ON contact_tags.tag_id = tags.tag_id WHERE contact_id = $contact_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_contact_tags)) {
$contact_tag_id = intval($row['tag_id']);
$contact_tag_name = escapeHtml($row['tag_name']);
$contact_tag_color = escapeHtml($row['tag_color']);
if (empty($contact_tag_color)) {
$contact_tag_color = "dark";
}
$contact_tag_icon = escapeHtml($row['tag_icon']);
if (empty($contact_tag_icon)) {
$contact_tag_icon = "tag";
}
$contact_tag_id_array[] = $contact_tag_id;
$contact_tag_name_display_array[] = "<a href='contacts.php?$client_url tags[]=$contact_tag_id'><span class='badge text-light p-1 me-1' style='background-color: $contact_tag_color;'><i class='fa fa-fw fa-$contact_tag_icon me-2'></i>$contact_tag_name</span></a>";
}
$contact_tags_display = implode('', $contact_tag_name_display_array);
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="contact_ids[]" value="<?= $contact_id ?>">
</div>
</td>
<td>
<a class="text-dark" href="contact.php?client_id=<?= $client_id ?>&contact_id=<?= $contact_id ?>">
<div class="d-flex">
<?php if ($contact_photo) { ?>
<span class="fa-stack fa-2x me-3 text-center">
<img class="img-size-50 rounded-circle" src="<?= "../uploads/clients/$client_id/$contact_photo" ?>">
</span>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="contact.php?<?= $client_url ?>contact_id=<?= $contact_id ?>">
<i class="fas fa-fw fa-eye me-2"></i>Details
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_note_add.php?id=<?= $contact_id ?>">
<i class="fas fa-fw fa-sticky-note me-2"></i>Make Note
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_edit.php?id=<?= $contact_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3 && $contact_primary == 0) { ?>
<?php if ($contact_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_contact=<?= $contact_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php } else { ?>
<span class="fa-stack fa-2x me-3">
<i class="fa fa-circle fa-stack-2x text-secondary"></i>
<span class="fa fa-stack-1x text-white"><?= $contact_initials ?></span>
</span>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_contact=<?= $contact_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?anonymize_contact=<?= $contact_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-user-secret me-2"></i>Anonymize & Archive
</a>
<?php } ?>
<div class="flex-grow-1">
<div class="<?php if($contact_important) { echo "text-bold"; } ?>"><?= $contact_name ?> <?= $user_exists_display ?></div>
<?= $contact_title_display ?>
<div><?= $contact_primary_display ?></div>
<?php
if (!empty($contact_tags_display)) { ?>
<div class="mt-1">
<?= $contact_tags_display ?>
</div>
<?php } ?>
</div>
</div>
</a>
</td>
<td><?= $contact_department ?></td>
<td><?= $contact_info_display ?></td>
<td><?= $location_name_display ?></td>
<td>
<?= "$asset_count_display$credential_count_display$software_count_display$ticket_count_display" ?>
</td>
<?php if (!$client_url) { ?>
<td><a href="contacts.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="contact.php?<?= $client_url ?>contact_id=<?= $contact_id ?>">
<i class="fas fa-fw fa-eye me-2"></i>Details
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_contact=<?= $contact_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_note_add.php?id=<?= $contact_id ?>">
<i class="fas fa-fw fa-sticky-note me-2"></i>Make Note
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_edit.php?id=<?= $contact_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3 && $contact_primary == 0) { ?>
<?php if ($contact_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_contact=<?= $contact_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_contact=<?= $contact_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?anonymize_contact=<?= $contact_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-user-secret me-2"></i>Anonymize & Archive
</a>
<?php } ?>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_contact=<?= $contact_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</div>
</td>
</tr>
</div>
</td>
</tr>
<?php
}
<?php
}
?>
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -100,8 +100,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-key me-2"></i>Credentials</h3>
<div class="card-tools">
<?php if (lookupUserPermission("module_credential") >= 2) { ?>
@@ -129,23 +129,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Credentials">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="col-md-3">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select onchange="this.form.submit()" class="form-select select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
<?php
@@ -172,7 +172,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php if ($client_url) { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="location" onchange="this.form.submit()">
<option value="">- All Asset Locations -</option>
@@ -192,7 +192,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<?php } else { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="client" onchange="this.form.submit()">
<option value="" <?php if ($client == "") { echo "selected"; } ?>>- All Clients -</option>
@@ -222,7 +222,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-3">
<div class="btn-group float-end">
<a href="?<?= $client_url ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
<div class="dropdown ms-2" id="bulkActionButton" hidden>
@@ -270,270 +270,269 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
</div>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=credential_name&order=<?= $disp ?>">
Name <?php if ($sort == 'credential_name') { echo $order_icon; } ?>
</a>
</th>
<th>Username / ID</th>
<th>Password / Key</th>
<th>OTP</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=credential_uri&order=<?= $disp ?>">
URI <?php if ($sort == 'credential_uri') { echo $order_icon; } ?>
</a>
</th>
<th></th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=credential_name&order=<?= $disp ?>">
Name <?php if ($sort == 'credential_name') { echo $order_icon; } ?>
</a>
</th>
<th>Username / ID</th>
<th>Password / Key</th>
<th>OTP</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=credential_uri&order=<?= $disp ?>">
URI <?php if ($sort == 'credential_uri') { echo $order_icon; } ?>
</a>
</th>
<th></th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$credential_id = intval($row['c_credential_id']);
$credential_name = escapeHtml($row['credential_name']);
$credential_description = escapeHtml($row['credential_description']);
$credential_uri = escapeUrl($row['credential_uri']);
if (empty($credential_uri)) {
$credential_uri_display = "-";
} else {
$credential_uri_display = "<a href='$credential_uri'>" . truncate($credential_uri,40) . "</a><button class='btn btn-sm clipboardjs' type='button' title='$credential_uri' data-clipboard-text='$credential_uri'><i class='far fa-copy text-secondary'></i></button>";
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$credential_id = intval($row['c_credential_id']);
$credential_name = escapeHtml($row['credential_name']);
$credential_description = escapeHtml($row['credential_description']);
$credential_uri = escapeUrl($row['credential_uri']);
if (empty($credential_uri)) {
$credential_uri_display = "-";
} else {
$credential_uri_display = "<a href='$credential_uri'>" . truncate($credential_uri,40) . "</a><button class='btn btn-sm clipboardjs' type='button' title='$credential_uri' data-clipboard-text='$credential_uri'><i class='far fa-copy text-secondary'></i></button>";
}
$credential_uri_2 = escapeUrl($row['credential_uri_2']);
$credential_username = escapeHtml(decryptCredentialEntry($row['credential_username']));
if (empty($credential_username)) {
$credential_username_display = "-";
} else {
$credential_username_display = "$credential_username<button class='btn btn-sm clipboardjs' type='button' data-clipboard-text='$credential_username'><i class='far fa-copy text-secondary'></i></button>";
}
$credential_otp_secret = escapeHtml($row['credential_otp_secret']);
if (empty($credential_otp_secret)) {
$otp_display = "-";
} else {
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
}
$credential_note = escapeHtml($row['credential_note']);
$credential_created_at = escapeHtml($row['credential_created_at']);
$credential_archived_at = escapeHtml($row['credential_archived_at']);
$credential_favorite = intval($row['credential_favorite']);
$credential_contact_id = intval($row['credential_contact_id']);
$contact_name = escapeHtml($row['contact_name']);
$credential_asset_id = intval($row['credential_asset_id']);
$asset_name = escapeHtml($row['asset_name']);
// Tags
$credential_tag_name_display_array = array();
$credential_tag_id_array = array();
$sql_credential_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, credential_tags.tag_id, tag_name FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_credential_tags)) {
$credential_tag_id = intval($row['tag_id']);
$credential_tag_name = escapeHtml($row['tag_name']);
$credential_tag_color = escapeHtml($row['tag_color']);
if (empty($credential_tag_color)) {
$credential_tag_color = "dark";
}
$credential_uri_2 = escapeUrl($row['credential_uri_2']);
$credential_username = escapeHtml(decryptCredentialEntry($row['credential_username']));
if (empty($credential_username)) {
$credential_username_display = "-";
} else {
$credential_username_display = "$credential_username<button class='btn btn-sm clipboardjs' type='button' data-clipboard-text='$credential_username'><i class='far fa-copy text-secondary'></i></button>";
}
$credential_otp_secret = escapeHtml($row['credential_otp_secret']);
if (empty($credential_otp_secret)) {
$otp_display = "-";
} else {
$otp_display = "<span onmouseenter='showOTPViaCredentialID($credential_id)'><i class='far fa-clock'></i> <span id='otp_$credential_id'><i>Hover..</i></span></span>";
}
$credential_note = escapeHtml($row['credential_note']);
$credential_created_at = escapeHtml($row['credential_created_at']);
$credential_archived_at = escapeHtml($row['credential_archived_at']);
$credential_favorite = intval($row['credential_favorite']);
$credential_contact_id = intval($row['credential_contact_id']);
$contact_name = escapeHtml($row['contact_name']);
$credential_asset_id = intval($row['credential_asset_id']);
$asset_name = escapeHtml($row['asset_name']);
// Tags
$credential_tag_name_display_array = array();
$credential_tag_id_array = array();
$sql_credential_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, credential_tags.tag_id, tag_name FROM credential_tags LEFT JOIN tags ON credential_tags.tag_id = tags.tag_id WHERE credential_id = $credential_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_credential_tags)) {
$credential_tag_id = intval($row['tag_id']);
$credential_tag_name = escapeHtml($row['tag_name']);
$credential_tag_color = escapeHtml($row['tag_color']);
if (empty($credential_tag_color)) {
$credential_tag_color = "dark";
}
$credential_tag_icon = escapeHtml($row['tag_icon']);
if (empty($credential_tag_icon)) {
$credential_tag_icon = "tag";
}
$credential_tag_id_array[] = $credential_tag_id;
$credential_tag_name_display_array[] = "<a href='credentials.php?$client_url tags[]=$credential_tag_id'><span class='badge text-light p-1 me-1' style='background-color: $credential_tag_color;'><i class='fa fa-fw fa-$credential_tag_icon me-2'></i>$credential_tag_name</span></a>";
}
$credential_tags_display = implode('', $credential_tag_name_display_array);
if ($credential_contact_id) {
$credential_contact_display = "<a href='#' class='me-2 mb-1 badge rounded-pill bg-dark p-2 ajax-modal' title='$contact_name'
data-modal-size='lg'
data-modal-url='modals/contact/contact.php?id=$credential_contact_id'>
<i class='fas fa-fw fa-user'></i></a>";
} else {
$credential_contact_display = '';
$credential_tag_icon = escapeHtml($row['tag_icon']);
if (empty($credential_tag_icon)) {
$credential_tag_icon = "tag";
}
if ($credential_asset_id) {
$credential_asset_display = "<a href='#' class='me-2 mb-1 badge rounded-pill bg-secondary p-2 ajax-modal' title='$asset_name' data-toggle=''
data-modal-size='lg'
data-modal-url='modals/asset/asset.php?id=$credential_asset_id'>
<i class='fas fa-fw fa-desktop'></i></a>";
} else {
$credential_asset_display = '';
}
// Check if shared
$sql_shared = mysqli_query(
$mysqli,
"SELECT item_active, item_created_at, item_expire_at, item_id, item_key, item_note, item_recipient,
item_related_id, item_type, item_view_limit, item_views FROM shared_items
WHERE item_client_id = $client_id
AND item_active = 1
AND (COALESCE(item_view_limit, 0) = 0 OR item_views < item_view_limit)
AND item_expire_at > NOW()
AND item_type = 'Credential'
AND item_related_id = $credential_id
LIMIT 1"
);
if (mysqli_num_rows($sql_shared) > 0) {
$row = mysqli_fetch_assoc($sql_shared);
$item_id = intval($row['item_id']);
$item_active = escapeHtml($row['item_active']);
$item_key = escapeHtml($row['item_key']);
$item_type = escapeHtml($row['item_type']);
$item_related_id = intval($row['item_related_id']);
$item_note = escapeHtml($row['item_note']);
$item_recipient = escapeHtml($row['item_recipient']);
$item_views = escapeHtml($row['item_views']);
$item_view_limit = escapeHtml($row['item_view_limit']);
$item_created_at = escapeHtml($row['item_created_at']);
$item_expire_at = escapeHtml($row['item_expire_at']);
$item_expire_at_human = timeAgo($row['item_expire_at']);
}
?>
<tr class="<?php if ($credential_favorite) { echo "text-bold"; } ?>">
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="credential_ids[]" value="<?= $credential_id ?>">
</div>
</td>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/credential/credential_edit.php?id=<?= $credential_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-key me-3"></i>
<div class="flex-grow-1">
<div><?= $credential_name ?> <?php if ($credential_favorite) { echo "<i class='fas fa-fw fa-star text-warning' title='Favorite'></i>"; } ?></div>
<div><small class="text-secondary"><?= $credential_description ?></small></div>
<?php
if (!empty($credential_tags_display)) { ?>
<div class="mt-1">
<?= $credential_tags_display ?>
</div>
<?php } ?>
</div>
</div>
</a>
</td>
<td class="text-nowrap"><?= $credential_username_display ?></td>
<td class="text-nowrap">
<button class="btn p-0" type="button" onclick="showPasswordViaCredentialID(this, <?= $credential_id ?>)"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></button><button class="btn btn-sm" type="button" onclick="copyPasswordViaCredentialID(this, <?= $credential_id ?>)"><i class="far fa-copy text-secondary"></i></button>
</td>
<td class="text-nowrap"><?= $otp_display ?></td>
<td><?= $credential_uri_display ?></td>
<td>
<?= "$credential_contact_display$credential_asset_display" ?>
<?php if (mysqli_num_rows($sql_shared) > 0) { ?>
<div class="d-flex" title="Expires <?= $item_expire_at_human ?>">
<i class="fas fa-link me-2 mt-1"></i>
<div class="flex-grow-1">Shared
<br>
<small class="text-secondary"><?= $item_recipient ?></small>
</div>
</div>
<?php } ?>
</td>
<?php if (!$client_url) { ?>
<td><a href="credentials.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td class="text-center">
<div class="btn-group">
<?php if ( !empty($credential_uri) || !empty($credential_uri_2) ) { ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-default btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fa fa-fw fa-external-link-alt"></i>
</button>
<div class="dropdown-menu">
<?php if ($credential_uri) { ?>
<a href="<?= $credential_uri ?>" alt="<?= $credential_uri ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt"></i> <?= truncate($credential_uri,40) ?>
</a>
<?php } ?>
<?php if ($credential_uri_2) { ?>
<div class="dropdown-divider"></div>
<a href="<?= $credential_uri_2 ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt"></i> <?= truncate($credential_uri_2,40) ?>
</a>
<?php } ?>
</div>
</div>
<?php } ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/credential/credential_edit.php?id=<?= $credential_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<?php if ($client_url) { ?>
<a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#shareModal" onclick="populateShareModal(<?= "$client_id, 'Credential', $credential_id" ?>)">
<i class="fas fa-fw fa-share me-2"></i>Share
</a>
<?php } ?>
<?php if (lookupUserPermission("module_credential") >= 2) { ?>
<?php if ($credential_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_credential=<?= $credential_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if (lookupUserPermission("module_credential") >= 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_credential=<?= $credential_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
<?php } ?>
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_credential=<?= $credential_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</td>
</tr>
<?php
$credential_tag_id_array[] = $credential_tag_id;
$credential_tag_name_display_array[] = "<a href='credentials.php?$client_url tags[]=$credential_tag_id'><span class='badge text-light p-1 me-1' style='background-color: $credential_tag_color;'><i class='fa fa-fw fa-$credential_tag_icon me-2'></i>$credential_tag_name</span></a>";
}
$credential_tags_display = implode('', $credential_tag_name_display_array);
if ($credential_contact_id) {
$credential_contact_display = "<a href='#' class='me-2 mb-1 badge rounded-pill bg-dark p-2 ajax-modal' title='$contact_name'
data-modal-size='lg'
data-modal-url='modals/contact/contact.php?id=$credential_contact_id'>
<i class='fas fa-fw fa-user'></i></a>";
} else {
$credential_contact_display = '';
}
?>
if ($credential_asset_id) {
$credential_asset_display = "<a href='#' class='me-2 mb-1 badge rounded-pill bg-secondary p-2 ajax-modal' title='$asset_name' data-toggle=''
data-modal-size='lg'
data-modal-url='modals/asset/asset.php?id=$credential_asset_id'>
<i class='fas fa-fw fa-desktop'></i></a>";
} else {
$credential_asset_display = '';
}
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
// Check if shared
$sql_shared = mysqli_query(
$mysqli,
"SELECT item_active, item_created_at, item_expire_at, item_id, item_key, item_note, item_recipient,
item_related_id, item_type, item_view_limit, item_views FROM shared_items
WHERE item_client_id = $client_id
AND item_active = 1
AND (COALESCE(item_view_limit, 0) = 0 OR item_views < item_view_limit)
AND item_expire_at > NOW()
AND item_type = 'Credential'
AND item_related_id = $credential_id
LIMIT 1"
);
if (mysqli_num_rows($sql_shared) > 0) {
$row = mysqli_fetch_assoc($sql_shared);
$item_id = intval($row['item_id']);
$item_active = escapeHtml($row['item_active']);
$item_key = escapeHtml($row['item_key']);
$item_type = escapeHtml($row['item_type']);
$item_related_id = intval($row['item_related_id']);
$item_note = escapeHtml($row['item_note']);
$item_recipient = escapeHtml($row['item_recipient']);
$item_views = escapeHtml($row['item_views']);
$item_view_limit = escapeHtml($row['item_view_limit']);
$item_created_at = escapeHtml($row['item_created_at']);
$item_expire_at = escapeHtml($row['item_expire_at']);
$item_expire_at_human = timeAgo($row['item_expire_at']);
}
?>
<tr class="<?php if ($credential_favorite) { echo "text-bold"; } ?>">
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="credential_ids[]" value="<?= $credential_id ?>">
</div>
</td>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/credential/credential_edit.php?id=<?= $credential_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-key me-3"></i>
<div class="flex-grow-1">
<div><?= $credential_name ?> <?php if ($credential_favorite) { echo "<i class='fas fa-fw fa-star text-warning' title='Favorite'></i>"; } ?></div>
<div><small class="text-secondary"><?= $credential_description ?></small></div>
<?php
if (!empty($credential_tags_display)) { ?>
<div class="mt-1">
<?= $credential_tags_display ?>
</div>
<?php } ?>
</div>
</div>
</a>
</td>
<td class="text-nowrap"><?= $credential_username_display ?></td>
<td class="text-nowrap">
<button class="btn p-0" type="button" onclick="showPasswordViaCredentialID(this, <?= $credential_id ?>)"><i class="fas fa-2x fa-ellipsis-h text-secondary"></i><i class="fas fa-2x fa-ellipsis-h text-secondary"></i></button><button class="btn btn-sm" type="button" onclick="copyPasswordViaCredentialID(this, <?= $credential_id ?>)"><i class="far fa-copy text-secondary"></i></button>
</td>
<td class="text-nowrap"><?= $otp_display ?></td>
<td><?= $credential_uri_display ?></td>
<td>
<?= "$credential_contact_display$credential_asset_display" ?>
<?php if (mysqli_num_rows($sql_shared) > 0) { ?>
<div class="d-flex" title="Expires <?= $item_expire_at_human ?>">
<i class="fas fa-link me-2 mt-1"></i>
<div class="flex-grow-1">Shared
<br>
<small class="text-secondary"><?= $item_recipient ?></small>
</div>
</div>
<?php } ?>
</td>
<?php if (!$client_url) { ?>
<td><a href="credentials.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td class="text-center">
<div class="btn-group">
<?php if ( !empty($credential_uri) || !empty($credential_uri_2) ) { ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-default btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fa fa-fw fa-external-link-alt"></i>
</button>
<div class="dropdown-menu">
<?php if ($credential_uri) { ?>
<a href="<?= $credential_uri ?>" alt="<?= $credential_uri ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt"></i> <?= truncate($credential_uri,40) ?>
</a>
<?php } ?>
<?php if ($credential_uri_2) { ?>
<div class="dropdown-divider"></div>
<a href="<?= $credential_uri_2 ?>" target="_blank" class="dropdown-item" >
<i class="fa fa-fw fa-external-link-alt"></i> <?= truncate($credential_uri_2,40) ?>
</a>
<?php } ?>
</div>
</div>
<?php } ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/credential/credential_edit.php?id=<?= $credential_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<?php if ($client_url) { ?>
<a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#shareModal" onclick="populateShareModal(<?= "$client_id, 'Credential', $credential_id" ?>)">
<i class="fas fa-fw fa-share me-2"></i>Share
</a>
<?php } ?>
<?php if (lookupUserPermission("module_credential") >= 2) { ?>
<?php if ($credential_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_credential=<?= $credential_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if (lookupUserPermission("module_credential") >= 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_credential=<?= $credential_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
<?php } ?>
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_credential=<?= $credential_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<!-- Include script to get TOTP code via the login ID -->

View File

@@ -87,8 +87,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-globe me-2"></i>Domains</h3>
<div class="card-tools">
<div class="btn-group">
@@ -106,15 +106,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Domains">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -122,7 +122,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php if (!$client_url) { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="client" onchange="this.form.submit()">
<option value="" <?php if ($client == "") { echo "selected"; } ?>>- All Clients -</option>
@@ -150,7 +150,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="expire_days" onchange="this.form.submit()">
<option value="" <?php if ($expire_days == "") { echo "selected"; } ?>>- Expiring In -</option>
<option value="expired" <?php if ($expire_days === "expired") { echo "selected"; } ?>>Expired</option>
@@ -170,7 +170,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="btn-group float-end">
<a href="?<?= $client_url ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
<div class="dropdown ms-2" id="bulkActionButton" hidden>
@@ -206,199 +206,198 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive">
</div>
<div class="table-responsive">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=domain_name&order=<?= $disp ?>">
Domain <?php if ($sort == 'domain_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=registrar_name&order=<?= $disp ?>">
Registrar <?php if ($sort == 'registrar_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=webhost_name&order=<?= $disp ?>">
Web Host <?php if ($sort == 'webhost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=dnshost_name&order=<?= $disp ?>">
DNS Host <?php if ($sort == 'dnshost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=mailhost_name&order=<?= $disp ?>">
Mail Host <?php if ($sort == 'mailhost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=domain_expire&order=<?= $disp ?>">
Expires <?php if ($sort == 'domain_expire') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$domain_id = intval($row['domain_id']);
$domain_name = escapeHtml($row['domain_name']);
$domain_description = escapeHtml($row['domain_description']);
$domain_expire = escapeHtml($row['domain_expire']);
$domain_expire_ago = timeAgo($domain_expire);
// Convert the expiry date to a timestamp
$domain_expire_timestamp = strtotime($row['domain_expire'] ?? '');
$current_timestamp = time(); // Get current timestamp
// Calculate the difference in days
$days_until_expiry = ($domain_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
// Determine the class based on the number of days until expiry
if ($days_until_expiry <= 0) {
$tr_class = "table-secondary";
} elseif ($days_until_expiry <= 14) {
$tr_class = "table-danger";
} elseif ($days_until_expiry <= 90) {
$tr_class = "table-warning";
} else {
$tr_class = '';
}
$domain_registrar_id = intval($row['registrar_id']);
$domain_webhost_id = intval($row['webhost_id']);
$domain_dnshost_id = intval($row['dnshost_id']);
$domain_mailhost_id = intval($row['mailhost_id']);
$domain_registrar_name = escapeHtml($row['registrar_name']);
$domain_webhost_name = escapeHtml($row['webhost_name']);
$domain_dnshost_name = escapeHtml($row['dnshost_name']);
$domain_mailhost_name = escapeHtml($row['mailhost_name']);
$domain_created_at = escapeHtml($row['domain_created_at']);
$domain_archived_at = escapeHtml($row['domain_archived_at']);
$client_id = intval($row['domain_client_id']);
$client_name = escapeHtml($row['client_name']);
// Add - if empty on the table
$domain_registrar_name_display = $domain_registrar_name ? "
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_registrar_id'>
$domain_registrar_name
</a>" : "-";
$domain_webhost_name_display = $domain_webhost_name ? "
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_webhost_id'>
$domain_webhost_name
</a>" : "-";
$domain_dnshost_name_display = $domain_dnshost_name ? "
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_dnshost_id'>
$domain_dnshost_name
</a>" : "-";
$domain_mailhost_name_display = $domain_mailhost_name ? "
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_mailhost_id'>
$domain_mailhost_name
</a>" : "-";
?>
<tr class="<?= $tr_class ?>">
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="domain_ids[]" value="<?= $domain_id ?>">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=domain_name&order=<?= $disp ?>">
Domain <?php if ($sort == 'domain_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=registrar_name&order=<?= $disp ?>">
Registrar <?php if ($sort == 'registrar_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=webhost_name&order=<?= $disp ?>">
Web Host <?php if ($sort == 'webhost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=dnshost_name&order=<?= $disp ?>">
DNS Host <?php if ($sort == 'dnshost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=mailhost_name&order=<?= $disp ?>">
Mail Host <?php if ($sort == 'mailhost_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=domain_expire&order=<?= $disp ?>">
Expires <?php if ($sort == 'domain_expire') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$domain_id = intval($row['domain_id']);
$domain_name = escapeHtml($row['domain_name']);
$domain_description = escapeHtml($row['domain_description']);
$domain_expire = escapeHtml($row['domain_expire']);
$domain_expire_ago = timeAgo($domain_expire);
// Convert the expiry date to a timestamp
$domain_expire_timestamp = strtotime($row['domain_expire'] ?? '');
$current_timestamp = time(); // Get current timestamp
// Calculate the difference in days
$days_until_expiry = ($domain_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
// Determine the class based on the number of days until expiry
if ($days_until_expiry <= 0) {
$tr_class = "table-secondary";
} elseif ($days_until_expiry <= 14) {
$tr_class = "table-danger";
} elseif ($days_until_expiry <= 90) {
$tr_class = "table-warning";
} else {
$tr_class = '';
}
$domain_registrar_id = intval($row['registrar_id']);
$domain_webhost_id = intval($row['webhost_id']);
$domain_dnshost_id = intval($row['dnshost_id']);
$domain_mailhost_id = intval($row['mailhost_id']);
$domain_registrar_name = escapeHtml($row['registrar_name']);
$domain_webhost_name = escapeHtml($row['webhost_name']);
$domain_dnshost_name = escapeHtml($row['dnshost_name']);
$domain_mailhost_name = escapeHtml($row['mailhost_name']);
$domain_created_at = escapeHtml($row['domain_created_at']);
$domain_archived_at = escapeHtml($row['domain_archived_at']);
$client_id = intval($row['domain_client_id']);
$client_name = escapeHtml($row['client_name']);
// Add - if empty on the table
$domain_registrar_name_display = $domain_registrar_name ? "
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_registrar_id'>
$domain_registrar_name
</a>" : "-";
$domain_webhost_name_display = $domain_webhost_name ? "
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_webhost_id'>
$domain_webhost_name
</a>" : "-";
$domain_dnshost_name_display = $domain_dnshost_name ? "
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_dnshost_id'>
$domain_dnshost_name
</a>" : "-";
$domain_mailhost_name_display = $domain_mailhost_name ? "
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_mailhost_id'>
$domain_mailhost_name
</a>" : "-";
?>
<tr class="<?= $tr_class ?>">
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="domain_ids[]" value="<?= $domain_id ?>">
</div>
</td>
<td class="">
<a class="text-dark ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/domain/domain_edit.php?<?= $client_url ?>&id=<?= $domain_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-globe me-3"></i>
<div class="flex-grow-1">
<div><?= $domain_name ?></div>
<div><small class="text-secondary"><?= $domain_description ?></small></div>
</div>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/domain/domain_edit.php?<?= $client_url ?>&id=<?= $domain_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-globe me-3"></i>
<div class="flex-grow-1">
<div><?= $domain_name ?></div>
<div><small class="text-secondary"><?= $domain_description ?></small></div>
</div>
</a>
</td>
<td><?= $domain_registrar_name_display ?></td>
<td><?= $domain_webhost_name_display ?></td>
<td><?= $domain_dnshost_name_display ?></td>
<td><?= $domain_mailhost_name_display ?></td>
<td>
<div><?= $domain_expire ?: '-' ?></div>
<?php if (!empty($domain_expire)) { ?>
<div><small><?= $domain_expire_ago ?></small></div>
<?php } ?>
</td>
<?php if (!$client_url) { ?>
<td><a href="domains.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
</div>
</a>
</td>
<td><?= $domain_registrar_name_display ?></td>
<td><?= $domain_webhost_name_display ?></td>
<td><?= $domain_dnshost_name_display ?></td>
<td><?= $domain_mailhost_name_display ?></td>
<td>
<div><?= $domain_expire ?: '-' ?></div>
<?php if (!empty($domain_expire)) { ?>
<div><small><?= $domain_expire_ago ?></small></div>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/domain/domain_edit.php?<?= $client_url ?>&id=<?= $domain_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</td>
<?php if (!$client_url) { ?>
<td><a href="domains.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/domain/domain_edit.php?<?= $client_url ?>&id=<?= $domain_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?refresh_domain=<?= $domain_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-sync-alt me-2"></i>Refresh Records
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($domain_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_domain=<?= $domain_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?refresh_domain=<?= $domain_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-sync-alt me-2"></i>Refresh Records
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_domain=<?= $domain_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_domain=<?= $domain_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($domain_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_domain=<?= $domain_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_domain=<?= $domain_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_domain=<?= $domain_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</div>
</td>
</tr>
</div>
</td>
</tr>
<?php
}
?>
<?php
}
?>
</tbody>
</table>
</tbody>
</table>
</form>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</form>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -63,8 +63,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-shopping-cart me-2"></i>Expenses</h3>
<div class="card-tools">
<div class="btn-group">
@@ -80,9 +80,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Expenses">
@@ -127,11 +127,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01' || $account_filter || $vendor_filter || $category_filter) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01' || $account_filter || $vendor_filter || $category_filter) { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -139,8 +139,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<label>Vendor</label>
<div>
<label class="form-label">Vendor</label>
<select class="form-select select2" name="vendor" onchange="this.form.submit()">
<option value="">- All Vendors -</option>
@@ -160,8 +160,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<label>Category</label>
<div>
<label class="form-label">Category</label>
<select class="form-select select2" name="category" onchange="this.form.submit()">
<option value="">- All Categories -</option>
@@ -180,8 +180,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<label>Account</label>
<div>
<label class="form-label">Account</label>
<select class="form-select select2" name="account" onchange="this.form.submit()">
<option value="">- All Accounts -</option>
@@ -202,159 +202,158 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=expense_date&order=<?= $disp ?>">
Date <?php if ($sort == 'expense_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
/
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=expense_description&order=<?= $disp ?>">
Description <?php if ($sort == 'expense_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=vendor_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=expense_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'expense_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=account_name&order=<?= $disp ?>">
Account <?php if ($sort == 'account_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$expense_id = intval($row['expense_id']);
$expense_date = escapeHtml($row['expense_date']);
$expense_amount = floatval($row['expense_amount']);
$expense_currency_code = escapeHtml($row['expense_currency_code']);
$expense_description = escapeHtml($row['expense_description']);
$expense_receipt = escapeHtml($row['expense_receipt']);
$expense_reference = escapeHtml($row['expense_reference']);
$expense_created_at = escapeHtml($row['expense_created_at']);
$expense_vendor_id = intval($row['expense_vendor_id']);
$vendor_name = escapeHtml($row['vendor_name']);
$expense_category_id = intval($row['expense_category_id']);
$category_name = escapeHtml($row['category_name']);
$account_name = escapeHtml($row['account_name']);
$expense_account_id = intval($row['expense_account_id']);
$client_name = escapeHtml($row['client_name']);
if(empty($client_name)) {
$client_name_display = "-";
} else {
$client_name_display = $client_name;
}
$expense_client_id = intval($row['expense_client_id']);
if (empty($expense_receipt)) {
$receipt_attached = "";
} else {
$path_info = pathinfo($expense_receipt);
$ext = $path_info['extension'];
$receipt_attached = "<a class='text-secondary me-2' target='_blank' href='../uploads/expenses/$expense_receipt' download='$expense_date-$vendor_name-$category_name-$expense_id.$ext'><i class='fa fa-file'></i></a>";
}
?>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="expense_ids[]" value="<?= $expense_id ?>">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=expense_date&order=<?= $disp ?>">
Date <?php if ($sort == 'expense_date') { echo $order_icon; } ?>
<td>
<?= $receipt_attached ?>
<a class="text-dark ajax-modal" href="#" title="Created: <?= $expense_created_at ?>"
data-modal-size="lg"
data-modal-url="modals/expense/expense_edit.php?id=<?= $expense_id ?>">
<?= $expense_date ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
/
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=expense_description&order=<?= $disp ?>">
Description <?php if ($sort == 'expense_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=vendor_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=expense_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'expense_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=account_name&order=<?= $disp ?>">
Account <?php if ($sort == 'account_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</td>
<td>
<?= $category_name ?>
<div class="text-secondary"><small><?= truncate($expense_description, 60) ?></small></div>
</td>
<td><?= $vendor_name ?></td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $expense_amount, $expense_currency_code) ?></td>
<td><?= $account_name ?></td>
<td><?= $client_name_display ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php
if (!empty($expense_receipt)) { ?>
<a class="dropdown-item" href="<?= "../uploads/expenses/$expense_receipt" ?>" download="<?= "$expense_date-$vendor_name-$category_name-$expense_id.pdf" ?>">
<i class="fas fa-fw fa-download me-2"></i>Download
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/expense/expense_edit.php?id=<?= $expense_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/expense/expense_copy.php?id=<?= $expense_id ?>">
<i class="fas fa-fw fa-copy me-2"></i>Copy
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/expense/expense_refund.php?id=<?= $expense_id ?>">
<i class="fas fa-fw fa-undo-alt me-2"></i>Refund
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_expense=<?= $expense_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
</thead>
<tbody>
<?php
}
?>
while ($row = mysqli_fetch_assoc($sql)) {
$expense_id = intval($row['expense_id']);
$expense_date = escapeHtml($row['expense_date']);
$expense_amount = floatval($row['expense_amount']);
$expense_currency_code = escapeHtml($row['expense_currency_code']);
$expense_description = escapeHtml($row['expense_description']);
$expense_receipt = escapeHtml($row['expense_receipt']);
$expense_reference = escapeHtml($row['expense_reference']);
$expense_created_at = escapeHtml($row['expense_created_at']);
$expense_vendor_id = intval($row['expense_vendor_id']);
$vendor_name = escapeHtml($row['vendor_name']);
$expense_category_id = intval($row['expense_category_id']);
$category_name = escapeHtml($row['category_name']);
$account_name = escapeHtml($row['account_name']);
$expense_account_id = intval($row['expense_account_id']);
$client_name = escapeHtml($row['client_name']);
if(empty($client_name)) {
$client_name_display = "-";
} else {
$client_name_display = $client_name;
}
$expense_client_id = intval($row['expense_client_id']);
if (empty($expense_receipt)) {
$receipt_attached = "";
} else {
$path_info = pathinfo($expense_receipt);
$ext = $path_info['extension'];
$receipt_attached = "<a class='text-secondary me-2' target='_blank' href='../uploads/expenses/$expense_receipt' download='$expense_date-$vendor_name-$category_name-$expense_id.$ext'><i class='fa fa-file'></i></a>";
}
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="expense_ids[]" value="<?= $expense_id ?>">
</div>
</td>
<td>
<?= $receipt_attached ?>
<a class="text-dark ajax-modal" href="#" title="Created: <?= $expense_created_at ?>"
data-modal-size="lg"
data-modal-url="modals/expense/expense_edit.php?id=<?= $expense_id ?>">
<?= $expense_date ?>
</a>
</td>
<td>
<?= $category_name ?>
<div class="text-secondary"><small><?= truncate($expense_description, 60) ?></small></div>
</td>
<td><?= $vendor_name ?></td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $expense_amount, $expense_currency_code) ?></td>
<td><?= $account_name ?></td>
<td><?= $client_name_display ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php
if (!empty($expense_receipt)) { ?>
<a class="dropdown-item" href="<?= "../uploads/expenses/$expense_receipt" ?>" download="<?= "$expense_date-$vendor_name-$category_name-$expense_id.pdf" ?>">
<i class="fas fa-fw fa-download me-2"></i>Download
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/expense/expense_edit.php?id=<?= $expense_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/expense/expense_copy.php?id=<?= $expense_id ?>">
<i class="fas fa-fw fa-copy me-2"></i>Copy
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/expense/expense_refund.php?id=<?= $expense_id ?>">
<i class="fas fa-fw fa-undo-alt me-2"></i>Refund
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_expense=<?= $expense_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="/js/bulk_actions.js"></script>

View File

@@ -676,7 +676,7 @@ $num_root_items = intval($row_root_files['num']) + intval($row_root_docs['num'])
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive-sm">
<table class="table border">
<table class="table border mb-0">
<thead class="table-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="bg-light checkbox-column">

View File

@@ -161,8 +161,8 @@ $summary_total_income = floatval($row['total_income']);
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-hand-holding-usd me-2"></i>Income</h3>
<div class="card-tools">
<?php if (lookupUserPermission("module_sales") >= 2) { ?>
@@ -187,21 +187,21 @@ $summary_total_income = floatval($row['total_income']);
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Income">
<button class="btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="col-md-2">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<select class="form-select select2" name="type" onchange="this.form.submit()">
<option value="">- All Types -</option>
<?php foreach ($income_types_array as $income_type_option) { ?>
@@ -211,7 +211,7 @@ $summary_total_income = floatval($row['total_income']);
</div>
</div>
<div class="col-md-2">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<select class="form-select select2" name="category" onchange="this.form.submit()">
<option value="">- All Categories -</option>
@@ -234,7 +234,7 @@ $summary_total_income = floatval($row['total_income']);
</div>
</div>
<div class="col-md-2">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<select class="form-select select2" name="account" onchange="this.form.submit()">
<option value="">- All Accounts -</option>
@@ -278,7 +278,7 @@ $summary_total_income = floatval($row['total_income']);
</div>
</div>
<?php if (lookupUserPermission("module_sales") >= 3 && lookupUserPermission("module_financial") >= 3) { ?>
<div class="row">
<div class="row g-3">
<div class="col-12">
<div class="btn-group float-end">
<div class="dropdown mt-3" id="bulkActionButton" hidden>
@@ -309,11 +309,11 @@ $summary_total_income = floatval($row['total_income']);
</div>
</div>
<?php } ?>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date'] ?? '') ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -323,227 +323,226 @@ $summary_total_income = floatval($row['total_income']);
</div>
</div>
</form>
<hr>
</div>
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-primary">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_payments, $session_company_currency) ?></h3>
<p>Invoice Payments</p>
</div>
<div class="icon">
<i class="fa fa-credit-card"></i>
</div>
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-primary">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_payments, $session_company_currency) ?></h3>
<p>Invoice Payments</p>
</div>
<div class="icon">
<i class="fa fa-credit-card"></i>
</div>
</div>
<!-- ./col -->
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-info">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_revenues, $session_company_currency) ?></h3>
<p>Other Revenue</p>
</div>
<div class="icon">
<i class="fa fa-hand-holding-usd"></i>
</div>
</div>
</div>
<!-- ./col -->
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-success">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_income, $session_company_currency) ?></h3>
<p>Total Income</p>
</div>
<div class="icon">
<i class="fa fa-balance-scale"></i>
</div>
</div>
</div>
<!-- ./col -->
</div>
<!-- ./col -->
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<?php if (lookupUserPermission("module_sales") >= 3 && lookupUserPermission("module_financial") >= 3) { ?>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_date&order=<?= $disp ?>">
Date <?php if ($sort == 'income_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_type&order=<?= $disp ?>">
Type <?php if ($sort == 'income_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_source&order=<?= $disp ?>">
Source <?php if ($sort == 'income_source') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_category&order=<?= $disp ?>">
Category <?php if ($sort == 'income_category') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_client&order=<?= $disp ?>">
Client <?php if ($sort == 'income_client') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'income_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_method&order=<?= $disp ?>">
Method <?php if ($sort == 'income_method') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_reference&order=<?= $disp ?>">
Reference <?php if ($sort == 'income_reference') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_account&order=<?= $disp ?>">
Account <?php if ($sort == 'income_account') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-info">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_revenues, $session_company_currency) ?></h3>
<p>Other Revenue</p>
</div>
<div class="icon">
<i class="fa fa-hand-holding-usd"></i>
</div>
</div>
</div>
<!-- ./col -->
while ($row = mysqli_fetch_assoc($sql)) {
$income_type = escapeHtml($row['income_type']);
$income_id = intval($row['income_id']);
$income_date = escapeHtml($row['income_date']);
$income_invoice_id = intval($row['income_invoice_id']);
$income_source = escapeHtml($row['income_source']);
$income_category = escapeHtml($row['income_category']);
$income_client_id = intval($row['income_client_id']);
$income_client = escapeHtml($row['income_client']);
$income_amount = floatval($row['income_amount']);
$income_currency_code = escapeHtml($row['income_currency_code']);
$income_method = escapeHtml($row['income_method']);
$income_reference = escapeHtml($row['income_reference']);
if (empty($income_reference)) {
$income_reference_display = "-";
} else {
$income_reference_display = $income_reference;
}
$income_account = escapeHtml($row['income_account']);
$income_account_archived = escapeHtml($row['income_account_archived']);
if (empty($income_account_archived)) {
$income_account_archived_display = "";
} else {
$income_account_archived_display = "Archived - ";
}
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-success">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_income, $session_company_currency) ?></h3>
<p>Total Income</p>
</div>
<div class="icon">
<i class="fa fa-balance-scale"></i>
</div>
</div>
</div>
<!-- ./col -->
</div>
// Each type keeps its own edit modal and delete handler
if ($income_type == 'Payment') {
$income_edit_modal = "modals/payment/payment_edit.php?id=$income_id";
$income_delete_action = "delete_payment=$income_id";
$income_type_badge = "bg-primary";
} else {
$income_edit_modal = "modals/revenue/revenue_edit.php?id=$income_id";
$income_delete_action = "delete_revenue=$income_id";
$income_type_badge = "bg-info";
}
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<?php if (lookupUserPermission("module_sales") >= 3 && lookupUserPermission("module_financial") >= 3) { ?>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_date&order=<?= $disp ?>">
Date <?php if ($sort == 'income_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_type&order=<?= $disp ?>">
Type <?php if ($sort == 'income_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_source&order=<?= $disp ?>">
Source <?php if ($sort == 'income_source') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_category&order=<?= $disp ?>">
Category <?php if ($sort == 'income_category') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_client&order=<?= $disp ?>">
Client <?php if ($sort == 'income_client') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'income_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_method&order=<?= $disp ?>">
Method <?php if ($sort == 'income_method') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_reference&order=<?= $disp ?>">
Reference <?php if ($sort == 'income_reference') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=income_account&order=<?= $disp ?>">
Account <?php if ($sort == 'income_account') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
?>
<tr>
<?php if (lookupUserPermission("module_sales") >= 3 && lookupUserPermission("module_financial") >= 3) { ?>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="income_ids[]" value="<?= $income_type ?>-<?= $income_id ?>">
</div>
</td>
<?php } ?>
<td>
<a class="ajax-modal" href="#"
data-modal-size = "lg"
data-modal-url = "<?= $income_edit_modal ?>">
<?= $income_date ?>
</a>
</td>
<td><span class="badge <?= $income_type_badge ?>"><?= $income_type ?></span></td>
<td>
<?php if ($income_type == 'Payment' && $income_invoice_id) { ?>
<a href="invoice.php?<?= $client_url ?>invoice_id=<?= $income_invoice_id ?>">
<?= $income_source ?>
</a>
<?php } else { ?>
<?= $income_source === '' ? '-' : $income_source ?>
<?php } ?>
</td>
<td><?= $income_category === '' ? '-' : $income_category ?></td>
<?php if (!$client_url) { ?>
<td>
<?php if ($income_client_id) { ?>
<a href="income.php?client_id=<?= $income_client_id ?>"><?= $income_client ?></a>
<?php } else { ?>
-
<?php } ?>
</td>
<?php } ?>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $income_amount, $income_currency_code) ?></td>
<td><?= $income_method ?></td>
<td><?= $income_reference_display ?></td>
<td><?= "$income_account_archived_display$income_account" ?></td>
<td>
<?php if (lookupUserPermission("module_sales") >= 3) { ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size = "lg"
data-modal-url = "<?= $income_edit_modal ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?<?= $income_delete_action ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
<?php } ?>
</td>
</tr>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$income_type = escapeHtml($row['income_type']);
$income_id = intval($row['income_id']);
$income_date = escapeHtml($row['income_date']);
$income_invoice_id = intval($row['income_invoice_id']);
$income_source = escapeHtml($row['income_source']);
$income_category = escapeHtml($row['income_category']);
$income_client_id = intval($row['income_client_id']);
$income_client = escapeHtml($row['income_client']);
$income_amount = floatval($row['income_amount']);
$income_currency_code = escapeHtml($row['income_currency_code']);
$income_method = escapeHtml($row['income_method']);
$income_reference = escapeHtml($row['income_reference']);
if (empty($income_reference)) {
$income_reference_display = "-";
} else {
$income_reference_display = $income_reference;
}
$income_account = escapeHtml($row['income_account']);
$income_account_archived = escapeHtml($row['income_account_archived']);
if (empty($income_account_archived)) {
$income_account_archived_display = "";
} else {
$income_account_archived_display = "Archived - ";
}
// Each type keeps its own edit modal and delete handler
if ($income_type == 'Payment') {
$income_edit_modal = "modals/payment/payment_edit.php?id=$income_id";
$income_delete_action = "delete_payment=$income_id";
$income_type_badge = "bg-primary";
} else {
$income_edit_modal = "modals/revenue/revenue_edit.php?id=$income_id";
$income_delete_action = "delete_revenue=$income_id";
$income_type_badge = "bg-info";
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
<tr>
<?php if (lookupUserPermission("module_sales") >= 3 && lookupUserPermission("module_financial") >= 3) { ?>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="income_ids[]" value="<?= $income_type ?>-<?= $income_id ?>">
</div>
</td>
<?php } ?>
<td>
<a class="ajax-modal" href="#"
data-modal-size = "lg"
data-modal-url = "<?= $income_edit_modal ?>">
<?= $income_date ?>
</a>
</td>
<td><span class="badge <?= $income_type_badge ?>"><?= $income_type ?></span></td>
<td>
<?php if ($income_type == 'Payment' && $income_invoice_id) { ?>
<a href="invoice.php?<?= $client_url ?>invoice_id=<?= $income_invoice_id ?>">
<?= $income_source ?>
</a>
<?php } else { ?>
<?= $income_source === '' ? '-' : $income_source ?>
<?php } ?>
</td>
<td><?= $income_category === '' ? '-' : $income_category ?></td>
<?php if (!$client_url) { ?>
<td>
<?php if ($income_client_id) { ?>
<a href="income.php?client_id=<?= $income_client_id ?>"><?= $income_client ?></a>
<?php } else { ?>
-
<?php } ?>
</td>
<?php } ?>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $income_amount, $income_currency_code) ?></td>
<td><?= $income_method ?></td>
<td><?= $income_reference_display ?></td>
<td><?= "$income_account_archived_display$income_account" ?></td>
<td>
<?php if (lookupUserPermission("module_sales") >= 3) { ?>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size = "lg"
data-modal-url = "<?= $income_edit_modal ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?<?= $income_delete_action ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
<?php } ?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="/js/bulk_actions.js"></script>

View File

@@ -161,8 +161,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-invoice me-2"></i>Invoices</h3>
<div class="card-tools">
<div class="btn-group">
@@ -183,15 +183,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="card-header py-3">
<form autocomplete="off">
<input type="hidden" name="status" value="<?php if (isset($_GET['status'])) { echo escapeHtml($_GET['status']); } ?>">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="mb-3 mb-md-0">
<div>
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(escapeHtml($q));} ?>" placeholder="Search Invoices">
<button class="btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter"><i class="fas fa-filter"></i></button>
@@ -200,7 +200,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-3">
<div class="mb-3 mb-md-0">
<div>
<select class="form-select select2" name="category" onchange="this.form.submit()">
<option value="">- All Categories -</option>
@@ -242,11 +242,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -256,215 +256,214 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_number&order=<?= $disp ?>">
Number <?php if ($sort == 'invoice_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_scope&order=<?= $disp ?>">
Scope <?php if ($sort == 'invoice_scope') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'invoice_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_date&order=<?= $disp ?>">
Date <?php if ($sort == 'invoice_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_due&order=<?= $disp ?>">
Due <?php if ($sort == 'invoice_due') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_status&order=<?= $disp ?>">
Status <?php if ($sort == 'invoice_status') { echo $order_icon; } ?>
</a>
</th>
<th>Recurring</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$invoice_id = intval($row['invoice_id']);
$invoice_prefix = escapeHtml($row['invoice_prefix']);
$invoice_number = escapeHtml($row['invoice_number']);
$invoice_scope = escapeHtml($row['invoice_scope']);
if (empty($invoice_scope)) {
$invoice_scope_display = "-";
} else {
$invoice_scope_display = $invoice_scope;
}
$invoice_status = escapeHtml($row['invoice_status']);
$invoice_date = escapeHtml($row['invoice_date']);
$invoice_due = escapeHtml($row['invoice_due']);
$invoice_discount = floatval($row['invoice_discount_amount']);
$invoice_amount = floatval($row['invoice_amount']);
$invoice_currency_code = escapeHtml($row['invoice_currency_code']);
$invoice_created_at = escapeHtml($row['invoice_created_at']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$category_id = intval($row['category_id']);
$category_name = escapeHtml($row['category_name']);
$client_currency_code = escapeHtml($row['client_currency_code']);
$client_net_terms = intval($row['client_net_terms']);
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
$recurring_invoice_id = intval($row['recurring_invoice_id']);
$recurring_invoice_prefix = escapeHtml($row['recurring_invoice_prefix']);
$recurring_invoice_number = escapeHtml($row['recurring_invoice_number']);
if($recurring_invoice_id) {
$recurring_invoice_display = "<i class='fas fa-fw fa-redo-alt text-secondary me-1'></i><a href='recurring_invoice.php?recurring_invoice_id=$recurring_invoice_id'>$recurring_invoice_prefix$recurring_invoice_number</a>";
} else {
$recurring_invoice_display = "-";
}
$now = time();
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now) {
$overdue_color = "text-danger fw-bold";
} else {
$overdue_color = "";
}
$invoice_badge_color = getInvoiceBadgeColor($invoice_status);
// Saved Payment Methods
$sql_saved_payment_methods = mysqli_query($mysqli, "
SELECT 1 FROM client_saved_payment_methods
LEFT JOIN payment_providers
ON client_saved_payment_methods.saved_payment_provider_id = payment_providers.payment_provider_id
WHERE saved_payment_client_id = $client_id
AND payment_provider_active = 1;
");
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="invoice_ids[]" value="<?= $invoice_id ?>">
</div>
</td>
<td class="text-bold">
<a href="invoice.php?client_id=<?= $client_id ?>&invoice_id=<?= $invoice_id ?>">
<?= "$invoice_prefix$invoice_number" ?>
</a>
</td>
<td><?= $invoice_scope_display ?></td>
<?php if (!$client_url) { ?>
<td class="text-bold"><a href="invoices.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) ?></td>
<td><?= $invoice_date ?></td>
<td class="<?= $overdue_color ?>"><?= $invoice_due ?></td>
<td><?= $category_name ?></td>
<td>
<?php if ($invoice_status == 'Paid' || $invoice_status == 'Partial') { ?>
<a class="ajax-modal" href="#" title="View payments"
data-modal-url="modals/invoice/invoice_payments.php?invoice_id=<?= $invoice_id ?>">
<span class="p-2 badge text-bg-<?= $invoice_badge_color ?>">
<?= $invoice_status ?>
</span>
</a>
<?php } else { ?>
<span class="p-2 badge text-bg-<?= $invoice_badge_color ?>">
<?= $invoice_status ?>
</span>
<?php } ?>
</td>
<td><?= $recurring_invoice_display ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php if ($invoice_status !== 'Paid' && $invoice_status !== 'Cancelled' && $invoice_status !== 'Draft' && $invoice_status !== 'Non-Billable' && $invoice_amount != 0) { ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/payment/payment_add.php?id=<?= $invoice_id ?>">
<i class="fa fa-fw fa-credit-card me-2"></i>Add Payment
</a>
<div class="dropdown-divider"></div>
<?php if (mysqli_num_rows($sql_saved_payment_methods) > 0 && ($invoice_status === 'Sent' || $invoice_status === 'Viewed')) { ?>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/payment/payment_saved_method_add.php?id=<?= $invoice_id ?>"><i class="fas fa-fw fa-wallet me-2"></i>Pay with Saved Card</a>
<div class="dropdown-divider"></div>
<?php } ?>
<?php } ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/invoice/invoice_edit.php?id=<?= $invoice_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/invoice/invoice_copy.php?id=<?= $invoice_id ?>">
<i class="fas fa-fw fa-copy me-2"></i>Copy
</a>
<div class="dropdown-divider"></div>
<?php if (!empty($config_smtp_provider)) { ?>
<a class="dropdown-item" href="post.php?email_invoice=<?= $invoice_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-paper-plane me-2"></i>Send Email
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<?php if ($invoice_status == 'Draft') { ?>
<a class="dropdown-item" href="post.php?mark_invoice_sent=<?= $invoice_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-check me-2"></i>Mark Sent
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_invoice=<?= $invoice_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
</div>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_number&order=<?= $disp ?>">
Number <?php if ($sort == 'invoice_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_scope&order=<?= $disp ?>">
Scope <?php if ($sort == 'invoice_scope') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'invoice_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_date&order=<?= $disp ?>">
Date <?php if ($sort == 'invoice_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_due&order=<?= $disp ?>">
Due <?php if ($sort == 'invoice_due') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=invoice_status&order=<?= $disp ?>">
Status <?php if ($sort == 'invoice_status') { echo $order_icon; } ?>
</a>
</th>
<th>Recurring</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$invoice_id = intval($row['invoice_id']);
$invoice_prefix = escapeHtml($row['invoice_prefix']);
$invoice_number = escapeHtml($row['invoice_number']);
$invoice_scope = escapeHtml($row['invoice_scope']);
if (empty($invoice_scope)) {
$invoice_scope_display = "-";
} else {
$invoice_scope_display = $invoice_scope;
}
$invoice_status = escapeHtml($row['invoice_status']);
$invoice_date = escapeHtml($row['invoice_date']);
$invoice_due = escapeHtml($row['invoice_due']);
$invoice_discount = floatval($row['invoice_discount_amount']);
$invoice_amount = floatval($row['invoice_amount']);
$invoice_currency_code = escapeHtml($row['invoice_currency_code']);
$invoice_created_at = escapeHtml($row['invoice_created_at']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$category_id = intval($row['category_id']);
$category_name = escapeHtml($row['category_name']);
$client_currency_code = escapeHtml($row['client_currency_code']);
$client_net_terms = intval($row['client_net_terms']);
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
$recurring_invoice_id = intval($row['recurring_invoice_id']);
$recurring_invoice_prefix = escapeHtml($row['recurring_invoice_prefix']);
$recurring_invoice_number = escapeHtml($row['recurring_invoice_number']);
if($recurring_invoice_id) {
$recurring_invoice_display = "<i class='fas fa-fw fa-redo-alt text-secondary me-1'></i><a href='recurring_invoice.php?recurring_invoice_id=$recurring_invoice_id'>$recurring_invoice_prefix$recurring_invoice_number</a>";
} else {
$recurring_invoice_display = "-";
}
$now = time();
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now) {
$overdue_color = "text-danger fw-bold";
} else {
$overdue_color = "";
}
$invoice_badge_color = getInvoiceBadgeColor($invoice_status);
// Saved Payment Methods
$sql_saved_payment_methods = mysqli_query($mysqli, "
SELECT 1 FROM client_saved_payment_methods
LEFT JOIN payment_providers
ON client_saved_payment_methods.saved_payment_provider_id = payment_providers.payment_provider_id
WHERE saved_payment_client_id = $client_id
AND payment_provider_active = 1;
");
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="invoice_ids[]" value="<?= $invoice_id ?>">
</div>
</td>
<td class="text-bold">
<a href="invoice.php?client_id=<?= $client_id ?>&invoice_id=<?= $invoice_id ?>">
<?= "$invoice_prefix$invoice_number" ?>
</a>
</td>
<td><?= $invoice_scope_display ?></td>
<?php if (!$client_url) { ?>
<td class="text-bold"><a href="invoices.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) ?></td>
<td><?= $invoice_date ?></td>
<td class="<?= $overdue_color ?>"><?= $invoice_due ?></td>
<td><?= $category_name ?></td>
<td>
<?php if ($invoice_status == 'Paid' || $invoice_status == 'Partial') { ?>
<a class="ajax-modal" href="#" title="View payments"
data-modal-url="modals/invoice/invoice_payments.php?invoice_id=<?= $invoice_id ?>">
<span class="p-2 badge text-bg-<?= $invoice_badge_color ?>">
<?= $invoice_status ?>
</span>
</a>
<?php } else { ?>
<span class="p-2 badge text-bg-<?= $invoice_badge_color ?>">
<?= $invoice_status ?>
</span>
<?php } ?>
</td>
<td><?= $recurring_invoice_display ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php if ($invoice_status !== 'Paid' && $invoice_status !== 'Cancelled' && $invoice_status !== 'Draft' && $invoice_status !== 'Non-Billable' && $invoice_amount != 0) { ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/payment/payment_add.php?id=<?= $invoice_id ?>">
<i class="fa fa-fw fa-credit-card me-2"></i>Add Payment
</a>
<div class="dropdown-divider"></div>
<?php if (mysqli_num_rows($sql_saved_payment_methods) > 0 && ($invoice_status === 'Sent' || $invoice_status === 'Viewed')) { ?>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/payment/payment_saved_method_add.php?id=<?= $invoice_id ?>"><i class="fas fa-fw fa-wallet me-2"></i>Pay with Saved Card</a>
<div class="dropdown-divider"></div>
<?php } ?>
<?php } ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/invoice/invoice_edit.php?id=<?= $invoice_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/invoice/invoice_copy.php?id=<?= $invoice_id ?>">
<i class="fas fa-fw fa-copy me-2"></i>Copy
</a>
<div class="dropdown-divider"></div>
<?php if (!empty($config_smtp_provider)) { ?>
<a class="dropdown-item" href="post.php?email_invoice=<?= $invoice_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-paper-plane me-2"></i>Send Email
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<?php if ($invoice_status == 'Draft') { ?>
<a class="dropdown-item" href="post.php?mark_invoice_sent=<?= $invoice_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-check me-2"></i>Mark Sent
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_invoice=<?= $invoice_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -74,8 +74,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-map-marker-alt me-2"></i>Locations</h3>
<div class="card-tools">
<div class="btn-group">
@@ -99,23 +99,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Locations">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="col-md-3">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select onchange="this.form.submit()" class="form-select select2" name="tags[]" data-placeholder="- Select Tags -" multiple>
<?php
$sql_tags_filter = mysqli_query($mysqli, "
@@ -142,7 +142,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-2"></div>
<?php } else { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="client" onchange="this.form.submit()">
<option value="" <?php if ($client == "") { echo "selected"; } ?>>- All Clients -</option>
@@ -172,7 +172,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-3">
<div class="btn-group float-end">
<a href="?<?= $client_url ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
<div class="dropdown ms-2" id="bulkActionButton" hidden>
@@ -210,199 +210,198 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
</div>
<form id="bulkActions" action="post.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_name&order=<?= $disp ?>">
Name <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_address&order=<?= $disp ?>">
Address <?php if ($sort == 'location_address') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_phone&order=<?= $disp ?>">
Phone <?php if ($sort == 'location_phone') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_hours&order=<?= $disp ?>">
Hours <?php if ($sort == 'location_hours') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$location_id = intval($row['location_id']);
$location_name = escapeHtml($row['location_name']);
$location_description = escapeHtml($row['location_description']);
$location_address = escapeHtml($row['location_address']);
$location_city = escapeHtml($row['location_city']);
$location_state = escapeHtml($row['location_state']);
$location_zip = escapeHtml($row['location_zip']);
$location_country = escapeHtml($row['location_country']);
$full_address = formatAddress($location_address, $location_city, $location_state, $location_zip, $location_country, '<br>') ?: '-';
$location_phone_country_code = escapeHtml($row['location_phone_country_code']);
$location_phone = escapeHtml(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
if (empty($location_phone)) {
$location_phone_display = "-";
} else {
$location_phone_display = $location_phone;
}
$location_fax_country_code = escapeHtml($row['location_fax_country_code']);
$location_fax = escapeHtml(formatPhoneNumber($row['location_fax'], $location_fax_country_code));
if ($location_fax) {
$location_fax_display = "<div class='text-secondary'>Fax: $location_fax</div>";
} else {
$location_fax_display = '';
}
$location_hours = escapeHtml($row['location_hours']);
if (empty($location_hours)) {
$location_hours_display = "-";
} else {
$location_hours_display = $location_hours;
}
$location_photo = escapeHtml($row['location_photo']);
$location_notes = escapeHtml($row['location_notes']);
$location_created_at = escapeHtml($row['location_created_at']);
$location_archived_at = escapeHtml($row['location_archived_at']);
$location_contact_id = intval($row['location_contact_id']);
$location_primary = intval($row['location_primary']);
if ( $location_primary == 1 ) {
$location_primary_display = "<small class='text-success'><i class='fa fa-fw fa-check'></i> Primary</small>";
} else {
$location_primary_display = "";
}
// Tags
$location_tag_name_display_array = array();
$location_tag_id_array = array();
$sql_location_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, location_tags.tag_id, tag_name FROM location_tags LEFT JOIN tags ON location_tags.tag_id = tags.tag_id WHERE location_tags.location_id = $location_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_location_tags)) {
$location_tag_id = intval($row['tag_id']);
$location_tag_name = escapeHtml($row['tag_name']);
$location_tag_color = escapeHtml($row['tag_color']);
if (empty($location_tag_color)) {
$location_tag_color = "dark";
}
$location_tag_icon = escapeHtml($row['tag_icon']);
if (empty($location_tag_icon)) {
$location_tag_icon = "tag";
}
$location_tag_id_array[] = $location_tag_id;
$location_tag_name_display_array[] = "<a href='locations.php?$client_url tags[]=$location_tag_id'><span class='badge text-light p-1 me-1' style='background-color: $location_tag_color;'><i class='fa fa-fw fa-$location_tag_icon me-2'></i>$location_tag_name</span></a>";
}
$location_tags_display = implode('', $location_tag_name_display_array);
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="location_ids[]" value="<?= $location_id ?>">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_name&order=<?= $disp ?>">
Name <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_address&order=<?= $disp ?>">
Address <?php if ($sort == 'location_address') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_phone&order=<?= $disp ?>">
Phone <?php if ($sort == 'location_phone') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_hours&order=<?= $disp ?>">
Hours <?php if ($sort == 'location_hours') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$location_id = intval($row['location_id']);
$location_name = escapeHtml($row['location_name']);
$location_description = escapeHtml($row['location_description']);
$location_address = escapeHtml($row['location_address']);
$location_city = escapeHtml($row['location_city']);
$location_state = escapeHtml($row['location_state']);
$location_zip = escapeHtml($row['location_zip']);
$location_country = escapeHtml($row['location_country']);
$full_address = formatAddress($location_address, $location_city, $location_state, $location_zip, $location_country, '<br>') ?: '-';
$location_phone_country_code = escapeHtml($row['location_phone_country_code']);
$location_phone = escapeHtml(formatPhoneNumber($row['location_phone'], $location_phone_country_code));
if (empty($location_phone)) {
$location_phone_display = "-";
} else {
$location_phone_display = $location_phone;
}
$location_fax_country_code = escapeHtml($row['location_fax_country_code']);
$location_fax = escapeHtml(formatPhoneNumber($row['location_fax'], $location_fax_country_code));
if ($location_fax) {
$location_fax_display = "<div class='text-secondary'>Fax: $location_fax</div>";
} else {
$location_fax_display = '';
}
$location_hours = escapeHtml($row['location_hours']);
if (empty($location_hours)) {
$location_hours_display = "-";
} else {
$location_hours_display = $location_hours;
}
$location_photo = escapeHtml($row['location_photo']);
$location_notes = escapeHtml($row['location_notes']);
$location_created_at = escapeHtml($row['location_created_at']);
$location_archived_at = escapeHtml($row['location_archived_at']);
$location_contact_id = intval($row['location_contact_id']);
$location_primary = intval($row['location_primary']);
if ( $location_primary == 1 ) {
$location_primary_display = "<small class='text-success'><i class='fa fa-fw fa-check'></i> Primary</small>";
} else {
$location_primary_display = "";
}
// Tags
$location_tag_name_display_array = array();
$location_tag_id_array = array();
$sql_location_tags = mysqli_query($mysqli, "SELECT tag_color, tag_icon, location_tags.tag_id, tag_name FROM location_tags LEFT JOIN tags ON location_tags.tag_id = tags.tag_id WHERE location_tags.location_id = $location_id ORDER BY tag_name ASC");
while ($row = mysqli_fetch_assoc($sql_location_tags)) {
$location_tag_id = intval($row['tag_id']);
$location_tag_name = escapeHtml($row['tag_name']);
$location_tag_color = escapeHtml($row['tag_color']);
if (empty($location_tag_color)) {
$location_tag_color = "dark";
}
$location_tag_icon = escapeHtml($row['tag_icon']);
if (empty($location_tag_icon)) {
$location_tag_icon = "tag";
}
$location_tag_id_array[] = $location_tag_id;
$location_tag_name_display_array[] = "<a href='locations.php?$client_url tags[]=$location_tag_id'><span class='badge text-light p-1 me-1' style='background-color: $location_tag_color;'><i class='fa fa-fw fa-$location_tag_icon me-2'></i>$location_tag_name</span></a>";
}
$location_tags_display = implode('', $location_tag_name_display_array);
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="location_ids[]" value="<?= $location_id ?>">
</div>
</td>
<td>
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/location/location_edit.php?id=<?= $location_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-map-marker-alt me-2"></i>
<div class="flex-grow-1">
<div <?php if($location_primary) { echo "class='text-bold'"; } ?>><?= $location_name ?></div>
<div><small class="text-secondary"><?= $location_description ?></small></div>
<div><?= $location_primary_display ?></div>
<?php
if (!empty($location_tags_display)) { ?>
<div class="mt-1">
<?= $location_tags_display ?>
</div>
<?php } ?>
</div>
</div>
</a>
</td>
<td>
<a href="//maps.<?= $session_map_source ?>.com?q=<?= "$location_address $location_zip" ?>"
target="_blank"><?= $full_address ?>
</a>
</td>
<td>
<?= $location_phone_display ?>
<?= $location_fax_display ?>
</td>
<td><?= $location_hours_display ?></td>
<?php if (!$client_url) { ?>
<td><a href="locations.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/location/location_edit.php?id=<?= $location_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3 && $location_primary == 0) { ?>
<?php if ($location_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_location=<?= $location_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_location=<?= $location_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_location=<?= $location_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<td>
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/location/location_edit.php?id=<?= $location_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-map-marker-alt me-2"></i>
<div class="flex-grow-1">
<div <?php if($location_primary) { echo "class='text-bold'"; } ?>><?= $location_name ?></div>
<div><small class="text-secondary"><?= $location_description ?></small></div>
<div><?= $location_primary_display ?></div>
<?php
if (!empty($location_tags_display)) { ?>
<div class="mt-1">
<?= $location_tags_display ?>
</div>
<?php } ?>
</div>
</div>
</td>
</tr>
</a>
</td>
<td>
<a href="//maps.<?= $session_map_source ?>.com?q=<?= "$location_address $location_zip" ?>"
target="_blank"><?= $full_address ?>
</a>
</td>
<td>
<?= $location_phone_display ?>
<?= $location_fax_display ?>
</td>
<td><?= $location_hours_display ?></td>
<?php if (!$client_url) { ?>
<td><a href="locations.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/location/location_edit.php?id=<?= $location_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3 && $location_primary == 0) { ?>
<?php if ($location_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_location=<?= $location_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_location=<?= $location_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_location=<?= $location_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php } ?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -75,8 +75,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-network-wired me-2"></i>Networks</h3>
<div class="card-tools">
<div class="btn-group">
@@ -100,16 +100,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Networks">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -173,7 +173,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-6">
<div class="btn-group float-end">
<a href="?<?= $client_url ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
<div class="dropdown ms-2" id="bulkActionButton" hidden>
@@ -192,171 +192,170 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive">
</div>
<div class="table-responsive">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_name&order=<?= $disp ?>">
Name <?php if ($sort == 'network_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_name&order=<?= $disp ?>">
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_vlan&order=<?= $disp ?>">
VLAN <?php if ($sort == 'network_vlan') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network&order=<?= $disp ?>">
Network (CIDR) <?php if ($sort == 'network') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_gateway&order=<?= $disp ?>">
Gateway <?php if ($sort == 'network_gateway') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_dhcp_range&order=<?= $disp ?>">
IP Range <?php if ($sort == 'network_dhcp_range') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_primary_dns&order=<?= $disp ?>">
DNS <?php if ($sort == 'network_primary_dns') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$network_id = intval($row['network_id']);
$network_name = escapeHtml($row['network_name']);
$network_description = escapeHtml($row['network_description']);
$network_vlan = intval($row['network_vlan']);
if ($network_vlan) {
$network_vlan_display = $network_vlan;
} else {
$network_vlan_display = "-";
}
$network = escapeHtml($row['network']);
$network_gateway = escapeHtml($row['network_gateway']);
$network_primary_dns = escapeHtml($row['network_primary_dns']);
$network_secondary_dns = escapeHtml($row['network_secondary_dns']);
if ($network_primary_dns) {
$network_dns_display = "$network_primary_dns<div class='text-secondary mt-1'>$network_secondary_dns</div>";
} else {
$network_dns_display = "-";
}
$network_dhcp_range = escapeHtml($row['network_dhcp_range']);
if (empty($network_dhcp_range)) {
$network_dhcp_range_display = "-";
} else {
$network_dhcp_range_display = $network_dhcp_range;
}
$network_location_id = intval($row['network_location_id']);
$location_name = escapeHtml($row['location_name']);
if (empty($location_name)) {
$location_name_display = "-";
} else {
$location_name_display = $location_name;
}
$network_archived_at = escapeHtml($row['network_archived_at']);
?>
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="network_ids[]" value="<?= $network_id ?>">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_name&order=<?= $disp ?>">
Name <?php if ($sort == 'network_name') { echo $order_icon; } ?>
<td>
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/network/network_edit.php?id=<?= $network_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-network-wired me-2"></i>
<div class="flex-grow-1">
<div><?= $network_name ?></div>
<div><small class="text-secondary"><?= $network_description ?></small></div>
</div>
</div>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=location_name&order=<?= $disp ?>">
Location <?php if ($sort == 'location_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_vlan&order=<?= $disp ?>">
VLAN <?php if ($sort == 'network_vlan') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network&order=<?= $disp ?>">
Network (CIDR) <?php if ($sort == 'network') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_gateway&order=<?= $disp ?>">
Gateway <?php if ($sort == 'network_gateway') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_dhcp_range&order=<?= $disp ?>">
IP Range <?php if ($sort == 'network_dhcp_range') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=network_primary_dns&order=<?= $disp ?>">
DNS <?php if ($sort == 'network_primary_dns') { echo $order_icon; } ?>
</a>
</th>
</td>
<td><?= $location_name_display ?></td>
<td class="font-monospace"><?= $network_vlan_display ?></td>
<td class="font-monospace"><?= $network ?></td>
<td class="font-monospace"><?= $network_gateway ?></td>
<td class="font-monospace"><?= $network_dhcp_range_display ?></td>
<td class="font-monospace"><?= $network_dns_display ?></td>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<td><a href="networks.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$network_id = intval($row['network_id']);
$network_name = escapeHtml($row['network_name']);
$network_description = escapeHtml($row['network_description']);
$network_vlan = intval($row['network_vlan']);
if ($network_vlan) {
$network_vlan_display = $network_vlan;
} else {
$network_vlan_display = "-";
}
$network = escapeHtml($row['network']);
$network_gateway = escapeHtml($row['network_gateway']);
$network_primary_dns = escapeHtml($row['network_primary_dns']);
$network_secondary_dns = escapeHtml($row['network_secondary_dns']);
if ($network_primary_dns) {
$network_dns_display = "$network_primary_dns<div class='text-secondary mt-1'>$network_secondary_dns</div>";
} else {
$network_dns_display = "-";
}
$network_dhcp_range = escapeHtml($row['network_dhcp_range']);
if (empty($network_dhcp_range)) {
$network_dhcp_range_display = "-";
} else {
$network_dhcp_range_display = $network_dhcp_range;
}
$network_location_id = intval($row['network_location_id']);
$location_name = escapeHtml($row['location_name']);
if (empty($location_name)) {
$location_name_display = "-";
} else {
$location_name_display = $location_name;
}
$network_archived_at = escapeHtml($row['network_archived_at']);
?>
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="network_ids[]" value="<?= $network_id ?>">
</div>
</td>
<td>
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/network/network_edit.php?id=<?= $network_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-network-wired me-2"></i>
<div class="flex-grow-1">
<div><?= $network_name ?></div>
<div><small class="text-secondary"><?= $network_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $location_name_display ?></td>
<td class="font-monospace"><?= $network_vlan_display ?></td>
<td class="font-monospace"><?= $network ?></td>
<td class="font-monospace"><?= $network_gateway ?></td>
<td class="font-monospace"><?= $network_dhcp_range_display ?></td>
<td class="font-monospace"><?= $network_dns_display ?></td>
<?php if (!$client_url) { ?>
<td><a href="networks.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/network/network_edit.php?id=<?= $network_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/network/network_edit.php?id=<?= $network_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($network_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_network=<?= $network_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_network=<?= $network_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_network=<?= $network_id ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($network_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_network=<?= $network_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_network=<?= $network_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_network=<?= $network_id ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
</div>
</td>
</tr>
</div>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</tbody>
</table>
</form>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</form>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -82,7 +82,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<div class="table-responsive-sm">
<table class="table table-hover">
<table class="table table-hover mb-0">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>

View File

@@ -55,8 +55,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw <?= $type_icon ?> me-2"></i><?= $type_display ?></h3>
<div class="card-tools">
<div class="btn-group">
@@ -85,20 +85,20 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="card-header py-3">
<form autocomplete="off">
<input type="hidden" name="archived" value="<?= $archived ?>">
<input type="hidden" name="type" value="<?= $type_filter ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-sm-4">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(escapeHtml($q));} ?>" placeholder="Search <?= $type_display ?>">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="col-sm-3">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<select class="form-select select2" name="category" onchange="this.form.submit()">
<option value="">- All Categories -</option>
@@ -123,14 +123,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-md-5">
<div class="btn-toolbar mb-3 float-end">
<div class="btn-toolbar justify-content-md-end">
<div class="btn-group">
<div class="btn-group me-2">
<a href="?type=service" class="btn btn-<?php if ($type_filter == 'service'){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-wrench"></i><span class="d-none d-sm-inline ms-2">Service</span></a>
<a href="?type=product" class="btn btn-<?php if ($type_filter == 'product'){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-cube"></i><span class="d-none d-sm-inline ms-2">Product</span></a>
<a href="?type=service" class="btn btn-<?php if ($type_filter == 'service'){ echo"primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-wrench"></i><span class="d-none d-sm-inline ms-2">Service</span></a>
<a href="?type=product" class="btn btn-<?php if ($type_filter == 'product'){ echo"primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-cube"></i><span class="d-none d-sm-inline ms-2">Product</span></a>
</div>
<a href="?<?= $url_query_strings_sort ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
<div class="dropdown ms-2" id="bulkActionButton" hidden>
@@ -168,167 +168,166 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
</div>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_name&order=<?= $disp ?>">
Name <?php if ($sort == 'product_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_description&order=<?= $disp ?>">
Description <?php if ($sort == 'product_description') { echo $order_icon; } ?>
</a>
</th>
<?php if ($type_filter == 'product') { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_qty&order=<?= $disp ?>">
QTY <?php if ($sort == 'product_qty') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_location&order=<?= $disp ?>">
Location <?php if ($sort == 'product_location') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=tax_name&order=<?= $disp ?>">
Tax Name <?php if ($sort == 'tax_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=tax_percent&order=<?= $disp ?>">
Tax Rate <?php if ($sort == 'tax_percent') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_price&order=<?= $disp ?>">
Price <?php if ($sort == 'product_price') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$product_id = intval($row['product_id']);
$product_name = escapeHtml($row['product_name']);
$product_description = escapeHtml($row['product_description']);
if (empty($product_description)) {
$product_description_display = "-";
} else {
$product_description_display = "<div style='white-space:pre-line'>$product_description</div>";
}
$product_qty = intval($row['product_qty']);
$product_code = escapeHtml($row['product_code']);
$product_location = escapeHtml($row['product_location']) ?: '-';
$product_price = floatval($row['product_price']);
$product_currency_code = escapeHtml($row['product_currency_code']);
$product_created_at = escapeHtml($row['product_created_at']);
$product_archived_at = escapeHtml($row['product_archived_at']);
$category_id = intval($row['category_id']);
$category_name = escapeHtml($row['category_name']);
$product_tax_id = intval($row['product_tax_id']);
$tax_name = escapeHtml($row['tax_name']) ?: '-';
$tax_percent = floatval($row['tax_percent']);
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="product_ids[]" value="<?= $product_id ?>">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_name&order=<?= $disp ?>">
Name <?php if ($sort == 'product_name') { echo $order_icon; } ?>
<td>
<a class="text-dark text-bold ajax-modal" href="#"
data-modal-url="modals/product/product_edit.php?id=<?= $product_id ?>">
<?= $product_name; ?>
<?php if ($product_code) { echo "<div class='text-secondary'>$product_code</div>"; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_description&order=<?= $disp ?>">
Description <?php if ($sort == 'product_description') { echo $order_icon; } ?>
</a>
</th>
</td>
<td><?= $category_name ?></td>
<td><?= $product_description_display ?></td>
<?php if ($type_filter == 'product') { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_qty&order=<?= $disp ?>">
QTY <?php if ($sort == 'product_qty') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_location&order=<?= $disp ?>">
Location <?php if ($sort == 'product_location') { echo $order_icon; } ?>
</a>
</th>
<td><?= $product_qty ?></td>
<td><?= $product_location ?></td>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=tax_name&order=<?= $disp ?>">
Tax Name <?php if ($sort == 'tax_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=tax_percent&order=<?= $disp ?>">
Tax Rate <?php if ($sort == 'tax_percent') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=product_price&order=<?= $disp ?>">
Price <?php if ($sort == 'product_price') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
<td><?= $tax_name ?></td>
<td><?= $tax_percent ?>%</td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $product_price, $product_currency_code) ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php if ($type_filter == 'product') { ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/product/product_stock_add.php?id=<?= $product_id ?>">
<i class="fas fa-fw fa-box-open me-2"></i>Add Stock
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/product/product_edit.php?id=<?= $product_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($product_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info" href="post.php?restore_product=<?= $product_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_product=<?= $product_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_product=<?= $product_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$product_id = intval($row['product_id']);
$product_name = escapeHtml($row['product_name']);
$product_description = escapeHtml($row['product_description']);
if (empty($product_description)) {
$product_description_display = "-";
} else {
$product_description_display = "<div style='white-space:pre-line'>$product_description</div>";
}
$product_qty = intval($row['product_qty']);
$product_code = escapeHtml($row['product_code']);
$product_location = escapeHtml($row['product_location']) ?: '-';
$product_price = floatval($row['product_price']);
$product_currency_code = escapeHtml($row['product_currency_code']);
$product_created_at = escapeHtml($row['product_created_at']);
$product_archived_at = escapeHtml($row['product_archived_at']);
$category_id = intval($row['category_id']);
$category_name = escapeHtml($row['category_name']);
$product_tax_id = intval($row['product_tax_id']);
$tax_name = escapeHtml($row['tax_name']) ?: '-';
$tax_percent = floatval($row['tax_percent']);
}
?>
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="product_ids[]" value="<?= $product_id ?>">
</div>
</td>
<td>
<a class="text-dark text-bold ajax-modal" href="#"
data-modal-url="modals/product/product_edit.php?id=<?= $product_id ?>">
<?= $product_name; ?>
<?php if ($product_code) { echo "<div class='text-secondary'>$product_code</div>"; } ?>
</a>
</td>
<td><?= $category_name ?></td>
<td><?= $product_description_display ?></td>
<?php if ($type_filter == 'product') { ?>
<td><?= $product_qty ?></td>
<td><?= $product_location ?></td>
<?php } ?>
<td><?= $tax_name ?></td>
<td><?= $tax_percent ?>%</td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $product_price, $product_currency_code) ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php if ($type_filter == 'product') { ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/product/product_stock_add.php?id=<?= $product_id ?>">
<i class="fas fa-fw fa-box-open me-2"></i>Add Stock
</a>
<div class="dropdown-divider"></div>
<?php } ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/product/product_edit.php?id=<?= $product_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($product_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info" href="post.php?restore_product=<?= $product_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_product=<?= $product_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_product=<?= $product_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<script src="/js/bulk_actions.js"></script>

View File

@@ -49,8 +49,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-project-diagram me-2"></i>Projects</h3>
<?php if (lookupUserPermission("module_support") >= 2) { ?>
<div class="card-tools">
@@ -59,31 +59,31 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="status" value="<?= $status ?>">
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo stripslashes(escapeHtml($q));} ?>" placeholder="Search Projects">
<button class="btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="col-sm-8">
<div class="btn-toolbar float-end">
<div class="btn-toolbar justify-content-md-end">
<div class="btn-group me-2">
<a href="?<?= $client_url ?>status=0" class="btn btn-<?php if ($status == 0){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-open me-2"></i>Open</a>
<a href="?<?= $client_url ?>status=1" class="btn btn-<?php if ($status == 1){ echo "primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-closed me-2"></i>Closed</a>
<a href="?<?= $client_url ?>status=0" class="btn btn-<?php if ($status == 0){ echo"primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-open me-2"></i>Open</a>
<a href="?<?= $client_url ?>status=1" class="btn btn-<?php if ($status == 1){ echo"primary"; } else { echo "default"; } ?>"><i class="fa fa-fw fa-door-closed me-2"></i>Closed</a>
</div>
<div class="btn-group">
<a href="?<?= $url_query_strings_sort ?>&archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if ($archived == 1) { echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if ($archived == 1) { echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
</div>
@@ -91,11 +91,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -105,201 +105,200 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-striped table-hover table-borderless">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_number&order=<?= $disp ?>">
Number <?php if ($sort == 'project_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_name&order=<?= $disp ?>">
Project <?php if ($sort == 'project_name') { echo $order_icon; } ?>
</a>
</th>
<th>Tickets / Tasks</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_due&order=<?= $disp ?>">
Due <?php if ($sort == 'project_due') { echo $order_icon; } ?>
</a>
</th>
<?php if ($status == 1) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_completed_at&order=<?= $disp ?>">
Completed
</a>
</th>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Manager
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_created_at&order=<?= $disp ?>">
Created
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive">
<table class="table table-striped table-hover table-borderless mb-0">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_number&order=<?= $disp ?>">
Number <?php if ($sort == 'project_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_name&order=<?= $disp ?>">
Project <?php if ($sort == 'project_name') { echo $order_icon; } ?>
</a>
</th>
<th>Tickets / Tasks</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_due&order=<?= $disp ?>">
Due <?php if ($sort == 'project_due') { echo $order_icon; } ?>
</a>
</th>
<?php if ($status == 1) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_completed_at&order=<?= $disp ?>">
Completed
</a>
</th>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Manager
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=project_created_at&order=<?= $disp ?>">
Created
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql_projects)) {
$project_id = intval($row['project_id']);
$project_prefix = escapeHtml($row['project_prefix']);
$project_number = intval($row['project_number']);
$project_name = escapeHtml($row['project_name']);
$project_description = escapeHtml($row['project_description']);
$project_due = escapeHtml($row['project_due']);
$project_created_at = escapeHtml($row['project_created_at']);
$project_created_at_display = date("Y-m-d", strtotime($project_created_at));
$project_updated_at = escapeHtml($row['project_updated_at']);
$project_completed_at = escapeHtml($row['project_completed_at']);
$project_completed_at_display = date("Y-m-d", strtotime($project_completed_at));
$project_archived_at = escapeHtml($row['project_archived_at']);
while ($row = mysqli_fetch_assoc($sql_projects)) {
$project_id = intval($row['project_id']);
$project_prefix = escapeHtml($row['project_prefix']);
$project_number = intval($row['project_number']);
$project_name = escapeHtml($row['project_name']);
$project_description = escapeHtml($row['project_description']);
$project_due = escapeHtml($row['project_due']);
$project_created_at = escapeHtml($row['project_created_at']);
$project_created_at_display = date("Y-m-d", strtotime($project_created_at));
$project_updated_at = escapeHtml($row['project_updated_at']);
$project_completed_at = escapeHtml($row['project_completed_at']);
$project_completed_at_display = date("Y-m-d", strtotime($project_completed_at));
$project_archived_at = escapeHtml($row['project_archived_at']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
if ($client_name) {
$client_name_display = "<a href='projects.php?client_id=$client_id'>$client_name</a>";
} else {
$client_name_display = "-";
}
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
if ($client_name) {
$client_name_display = "<a href='projects.php?client_id=$client_id'>$client_name</a>";
} else {
$client_name_display = "-";
}
$project_manager = intval($row['user_id']);
if ($project_manager) {
$project_manager_display = escapeHtml($row['user_name']);
} else {
$project_manager_display = "-";
}
$project_manager = intval($row['user_id']);
if ($project_manager) {
$project_manager_display = escapeHtml($row['user_name']);
} else {
$project_manager_display = "-";
}
// Get Tasks and Tickets Stats
// Get Tickets
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('ticket_id') AS count FROM tickets WHERE ticket_project_id = $project_id"));
$ticket_count = $row['count'];
// Get Tasks and Tickets Stats
// Get Tickets
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('ticket_id') AS count FROM tickets WHERE ticket_project_id = $project_id"));
$ticket_count = $row['count'];
// Get Closed Ticket Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('ticket_id') AS count FROM tickets WHERE ticket_project_id = $project_id AND ticket_closed_at IS NOT NULL"));
$closed_ticket_count = $row['count'];
// Get Closed Ticket Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('ticket_id') AS count FROM tickets WHERE ticket_project_id = $project_id AND ticket_closed_at IS NOT NULL"));
$closed_ticket_count = $row['count'];
// Ticket Closed Percent
if($ticket_count) {
$tickets_closed_percent = round(($closed_ticket_count / $ticket_count) * 100);
}
// Get All Tasks
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('task_id') AS count FROM tickets, tasks WHERE ticket_id = task_ticket_id AND ticket_project_id = $project_id"));
$task_count = $row['count'];
// Ticket Closed Percent
if($ticket_count) {
$tickets_closed_percent = round(($closed_ticket_count / $ticket_count) * 100);
}
// Get All Tasks
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('task_id') AS count FROM tickets, tasks WHERE ticket_id = task_ticket_id AND ticket_project_id = $project_id"));
$task_count = $row['count'];
// Get Completed Task Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('task_id') AS count FROM tickets, tasks WHERE ticket_id = task_ticket_id AND ticket_project_id = $project_id AND task_completed_at IS NOT NULL"));
$completed_task_count = $row['count'];
// Tasks Completed Percent
if($task_count) {
$tasks_completed_percent = round(($completed_task_count / $task_count) * 100);
}
?>
<tr>
<td>
<a class="text-dark" href="project.php?<?= $client_url ?>project_id=<?= $project_id ?>">
<?= "$project_prefix$project_number" ?>
</a>
</td>
<td>
<a class="text-dark" href="project.php?project_id=<?= $project_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-project-diagram me-3"></i>
<div class="flex-grow-1">
<div><?= $project_name ?></div>
<div><small class="text-secondary"><?= $project_description ?></small></div>
</div>
</div>
</a>
</td>
<td>
<?php if($ticket_count) { ?>
<div class="progress" style="height: 20px;">
<i class="fa fas fa-fw fa-life-ring me-2"></i>
<div class="progress-bar bg-primary" style="width: <?= $tickets_closed_percent ?>%;"><?= $closed_ticket_count ?> / <?= $ticket_count ?></div>
</div>
<?php } else { echo "<div>-</div>"; } ?>
<?php if($task_count) { ?>
<div class="progress mt-2" style="height: 20px;">
<i class="fa fas fa-fw fa-tasks me-2"></i>
<div class="progress-bar bg-secondary" style="width: <?= $tasks_completed_percent ?>%;"><?= $completed_task_count ?> / <?= $task_count ?></div>
</div>
<?php } ?>
</td>
<td><?= $project_due ?></td>
<?php if ($status == 1) { ?>
<td><?= $project_completed_at_display ?></td>
<?php } ?>
<td><?= $project_manager_display ?></td>
<td><?= $project_created_at_display ?></td>
<?php if (!$client_url) { ?>
<td><?= $client_name_display ?></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php if (empty($project_completed_at)) { ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url = "modals/project/project_edit.php?id=<?= $project_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php } ?>
<?php if (!empty($project_completed_at) && lookupUserPermission("module_support" >= 2)) { ?>
<div class="dropdown-divider"></div>
<?php if (empty($project_archived_at)) { ?>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_project=<?= $project_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } else { ?>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_project=<?= $project_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if (lookupUserPermission("module_support" >= 3)) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project=<?= $project_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Delete
</a>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
// Get Completed Task Count
$row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT COUNT('task_id') AS count FROM tickets, tasks WHERE ticket_id = task_ticket_id AND ticket_project_id = $project_id AND task_completed_at IS NOT NULL"));
$completed_task_count = $row['count'];
// Tasks Completed Percent
if($task_count) {
$tasks_completed_percent = round(($completed_task_count / $task_count) * 100);
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
<tr>
<td>
<a class="text-dark" href="project.php?<?= $client_url ?>project_id=<?= $project_id ?>">
<?= "$project_prefix$project_number" ?>
</a>
</td>
<td>
<a class="text-dark" href="project.php?project_id=<?= $project_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-project-diagram me-3"></i>
<div class="flex-grow-1">
<div><?= $project_name ?></div>
<div><small class="text-secondary"><?= $project_description ?></small></div>
</div>
</div>
</a>
</td>
<td>
<?php if($ticket_count) { ?>
<div class="progress" style="height: 20px;">
<i class="fa fas fa-fw fa-life-ring me-2"></i>
<div class="progress-bar bg-primary" style="width: <?= $tickets_closed_percent ?>%;"><?= $closed_ticket_count ?> / <?= $ticket_count ?></div>
</div>
<?php } else { echo "<div>-</div>"; } ?>
<?php if($task_count) { ?>
<div class="progress mt-2" style="height: 20px;">
<i class="fa fas fa-fw fa-tasks me-2"></i>
<div class="progress-bar bg-secondary" style="width: <?= $tasks_completed_percent ?>%;"><?= $completed_task_count ?> / <?= $task_count ?></div>
</div>
<?php } ?>
</td>
<td><?= $project_due ?></td>
<?php if ($status == 1) { ?>
<td><?= $project_completed_at_display ?></td>
<?php } ?>
<td><?= $project_manager_display ?></td>
<td><?= $project_created_at_display ?></td>
<?php if (!$client_url) { ?>
<td><?= $client_name_display ?></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php if (empty($project_completed_at)) { ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url = "modals/project/project_edit.php?id=<?= $project_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php } ?>
<?php if (!empty($project_completed_at) && lookupUserPermission("module_support" >= 2)) { ?>
<div class="dropdown-divider"></div>
<?php if (empty($project_archived_at)) { ?>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_project=<?= $project_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } else { ?>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_project=<?= $project_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if (lookupUserPermission("module_support" >= 3)) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project=<?= $project_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Delete
</a>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
</div>
<?php

View File

@@ -36,8 +36,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-comment-dollar me-2"></i>Quotes</h3>
<div class="card-tools">
<?php if (lookupUserPermission("module_sales") >= 2) { ?>
@@ -57,12 +57,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Quotes">
@@ -76,11 +76,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -90,168 +90,167 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_number&order=<?= $disp ?>">
Number <?php if ($sort == 'quote_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_scope&order=<?= $disp ?>">
Scope <?php if ($sort == 'quote_scope') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'quote_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_date&order=<?= $disp ?>">
Date <?php if ($sort == 'quote_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_expire&order=<?= $disp ?>">
Expire <?php if ($sort == 'quote_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_status&order=<?= $disp ?>">
Status <?php if ($sort == 'quote_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_number&order=<?= $disp ?>">
Number <?php if ($sort == 'quote_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_scope&order=<?= $disp ?>">
Scope <?php if ($sort == 'quote_scope') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'quote_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_date&order=<?= $disp ?>">
Date <?php if ($sort == 'quote_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_expire&order=<?= $disp ?>">
Expire <?php if ($sort == 'quote_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=quote_status&order=<?= $disp ?>">
Status <?php if ($sort == 'quote_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$quote_id = intval($row['quote_id']);
$quote_prefix = escapeHtml($row['quote_prefix']);
$quote_number = intval($row['quote_number']);
$quote_scope = escapeHtml($row['quote_scope']);
if (empty($quote_scope)) {
$quote_scope_display = "-";
} else {
$quote_scope_display = $quote_scope;
}
$quote_status = escapeHtml($row['quote_status']);
$quote_date = escapeHtml($row['quote_date']);
$quote_expire = escapeHtml($row['quote_expire']);
$quote_amount = floatval($row['quote_amount']);
$quote_discount = floatval($row['quote_discount_amount']);
$quote_currency_code = escapeHtml($row['quote_currency_code']);
$quote_created_at = escapeHtml($row['quote_created_at']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$client_currency_code = escapeHtml($row['client_currency_code']);
$category_id = intval($row['category_id']);
$category_name = escapeHtml($row['category_name']);
$client_net_terms = intval($row['client_net_terms']);
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
if ($quote_status == "Sent") {
$quote_badge_color = "warning";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {
$quote_badge_color = "success";
} elseif ($quote_status == "Declined") {
$quote_badge_color = "danger";
} elseif ($quote_status == "Invoiced") {
$quote_badge_color = "info";
} else {
$quote_badge_color = "secondary";
}
?>
<tr>
<td class="text-bold">
<a href="quote.php?client_id=<?= $client_id ?>&quote_id=<?= $quote_id ?>">
<?= "$quote_prefix$quote_number" ?>
</a>
</td>
<td><?= $quote_scope_display ?></td>
<?php if (!$client_url) { ?>
<td class="text-bold">
<a href="quotes.php?client_id=<?= $client_id ?>"><?= $client_name ?></a>
</td>
<?php } ?>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $quote_amount, $quote_currency_code) ?></td>
<td><?= $quote_date ?></td>
<td><?= $quote_expire ?></td>
<td><?= $category_name ?></td>
<td>
<span class="p-2 badge text-bg-<?= $quote_badge_color ?>">
<?= $quote_status ?>
</span>
</td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/quote/quote_edit.php?id=<?= $quote_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if (lookupUserPermission("module_sales") >= 2) { ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/quote/quote_copy.php?id=<?= $quote_id ?>">
<i class="fas fa-fw fa-copy me-2"></i>Copy
</a>
<?php if (!empty($config_smtp_provider)) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?email_quote=<?= $quote_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-paper-plane me-2"></i>Email
</a>
<?php } ?>
<?php if (lookupUserPermission("module_sales") >= 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_quote=<?= $quote_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$quote_id = intval($row['quote_id']);
$quote_prefix = escapeHtml($row['quote_prefix']);
$quote_number = intval($row['quote_number']);
$quote_scope = escapeHtml($row['quote_scope']);
if (empty($quote_scope)) {
$quote_scope_display = "-";
} else {
$quote_scope_display = $quote_scope;
}
$quote_status = escapeHtml($row['quote_status']);
$quote_date = escapeHtml($row['quote_date']);
$quote_expire = escapeHtml($row['quote_expire']);
$quote_amount = floatval($row['quote_amount']);
$quote_discount = floatval($row['quote_discount_amount']);
$quote_currency_code = escapeHtml($row['quote_currency_code']);
$quote_created_at = escapeHtml($row['quote_created_at']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$client_currency_code = escapeHtml($row['client_currency_code']);
$category_id = intval($row['category_id']);
$category_name = escapeHtml($row['category_name']);
$client_net_terms = intval($row['client_net_terms']);
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
if ($quote_status == "Sent") {
$quote_badge_color = "warning";
} elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
} elseif ($quote_status == "Accepted") {
$quote_badge_color = "success";
} elseif ($quote_status == "Declined") {
$quote_badge_color = "danger";
} elseif ($quote_status == "Invoiced") {
$quote_badge_color = "info";
} else {
$quote_badge_color = "secondary";
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<tr>
<td class="text-bold">
<a href="quote.php?client_id=<?= $client_id ?>&quote_id=<?= $quote_id ?>">
<?= "$quote_prefix$quote_number" ?>
</a>
</td>
<td><?= $quote_scope_display ?></td>
<?php if (!$client_url) { ?>
<td class="text-bold">
<a href="quotes.php?client_id=<?= $client_id ?>"><?= $client_name ?></a>
</td>
<?php } ?>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $quote_amount, $quote_currency_code) ?></td>
<td><?= $quote_date ?></td>
<td><?= $quote_expire ?></td>
<td><?= $category_name ?></td>
<td>
<span class="p-2 badge text-bg-<?= $quote_badge_color ?>">
<?= $quote_status ?>
</span>
</td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/quote/quote_edit.php?id=<?= $quote_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if (lookupUserPermission("module_sales") >= 2) { ?>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/quote/quote_copy.php?id=<?= $quote_id ?>">
<i class="fas fa-fw fa-copy me-2"></i>Copy
</a>
<?php if (!empty($config_smtp_provider)) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?email_quote=<?= $quote_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-paper-plane me-2"></i>Email
</a>
<?php } ?>
<?php if (lookupUserPermission("module_sales") >= 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_quote=<?= $quote_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -32,17 +32,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-redo-alt me-2"></i>Recurring Expenses</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/recurring_expense/recurring_expense_add.php" data-modal-size="lg"><i class="fas fa-plus"></i><span class="d-none d-lg-inline ms-2">New Recurring Expense</span></button>
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Recurring Expenses">
@@ -53,11 +53,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-sm-8">
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -67,152 +67,151 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_next_date&order=<?= $disp ?>">
Next Date <?php if ($sort == 'recurring_expense_next_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
/
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_description&order=<?= $disp ?>">
Description <?php if ($sort == 'recurring_expense_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=vendor_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'recurring_expense_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_frequency&order=<?= $disp ?>">
Frequency <?php if ($sort == 'recurring_expense_frequency') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_last_sent&order=<?= $disp ?>">
Last Billed <?php if ($sort == 'recurring_expense_last_sent') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=account_name&order=<?= $disp ?>">
Account <?php if ($sort == 'account_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$recurring_expense_id = intval($row['recurring_expense_id']);
$recurring_expense_frequency = intval($row['recurring_expense_frequency']);
if($recurring_expense_frequency == 1) {
$recurring_expense_frequency_display = "Monthly";
} else {
$recurring_expense_frequency_display = "Annually";
}
$recurring_expense_day = intval($row['recurring_expense_day']);
$recurring_expense_month = intval($row['recurring_expense_month']);
$recurring_expense_last_sent = escapeHtml($row['recurring_expense_last_sent']);
if(empty($recurring_expense_last_sent)) {
$recurring_expense_last_sent_display = "-";
} else {
$recurring_expense_last_sent_display = $recurring_expense_last_sent;
}
$recurring_expense_next_date = escapeHtml($row['recurring_expense_next_date']);
$recurring_expense_next_month = date('n', strtotime($row['recurring_expense_next_date']));
$recurring_expense_status = intval($row['recurring_expense_status']);
$recurring_expense_description = escapeHtml($row['recurring_expense_description']);
$recurring_expense_amount = floatval($row['recurring_expense_amount']);
$recurring_expense_payment_method = escapeHtml($row['recurring_expense_payment_method']);
$recurring_expense_reference = escapeHtml($row['recurring_expense_reference']);
$recurring_expense_currency_code = escapeHtml($row['recurring_expense_currency_code']);
$recurring_expense_created_at = escapeHtml($row['recurring_expense_created_at']);
$recurring_expense_vendor_id = intval($row['recurring_expense_vendor_id']);
$vendor_name = escapeHtml($row['vendor_name']);
$recurring_expense_category_id = intval($row['recurring_expense_category_id']);
$category_name = escapeHtml($row['category_name']);
$account_name = escapeHtml($row['account_name']);
$recurring_expense_account_id = intval($row['recurring_expense_account_id']);
$client_name = escapeHtml($row['client_name']);
if(empty($client_name)) {
$client_name_display = "-";
} else {
$client_name_display = $client_name;
}
$recurring_expense_client_id = intval($row['recurring_expense_client_id']);
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-size = "lg"
data-modal-url = "modals/recurring_expense/recurring_expense_edit.php?id=<?= $recurring_expense_id ?>">
<?= $recurring_expense_next_date ?>
</a>
</td>
<td>
<?= $category_name ?>
<div class="text-secondary"><small><?= truncate($recurring_expense_description, 60) ?></small></div>
</td>
<td><?= $vendor_name ?></td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $recurring_expense_amount, $recurring_expense_currency_code) ?></td>
<td><?= $recurring_expense_frequency_display ?></td>
<td><?= $recurring_expense_last_sent_display ?></td>
<td><?= $account_name ?></td>
<td><?= $client_name_display ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/recurring_expense/recurring_expense_edit.php?id=<?= $recurring_expense_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_recurring_expense=<?= $recurring_expense_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_next_date&order=<?= $disp ?>">
Next Date <?php if ($sort == 'recurring_expense_next_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
/
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_description&order=<?= $disp ?>">
Description <?php if ($sort == 'recurring_expense_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=vendor_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'recurring_expense_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_frequency&order=<?= $disp ?>">
Frequency <?php if ($sort == 'recurring_expense_frequency') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_expense_last_sent&order=<?= $disp ?>">
Last Billed <?php if ($sort == 'recurring_expense_last_sent') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=account_name&order=<?= $disp ?>">
Account <?php if ($sort == 'account_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$recurring_expense_id = intval($row['recurring_expense_id']);
$recurring_expense_frequency = intval($row['recurring_expense_frequency']);
if($recurring_expense_frequency == 1) {
$recurring_expense_frequency_display = "Monthly";
} else {
$recurring_expense_frequency_display = "Annually";
}
$recurring_expense_day = intval($row['recurring_expense_day']);
$recurring_expense_month = intval($row['recurring_expense_month']);
$recurring_expense_last_sent = escapeHtml($row['recurring_expense_last_sent']);
if(empty($recurring_expense_last_sent)) {
$recurring_expense_last_sent_display = "-";
} else {
$recurring_expense_last_sent_display = $recurring_expense_last_sent;
}
$recurring_expense_next_date = escapeHtml($row['recurring_expense_next_date']);
$recurring_expense_next_month = date('n', strtotime($row['recurring_expense_next_date']));
$recurring_expense_status = intval($row['recurring_expense_status']);
$recurring_expense_description = escapeHtml($row['recurring_expense_description']);
$recurring_expense_amount = floatval($row['recurring_expense_amount']);
$recurring_expense_payment_method = escapeHtml($row['recurring_expense_payment_method']);
$recurring_expense_reference = escapeHtml($row['recurring_expense_reference']);
$recurring_expense_currency_code = escapeHtml($row['recurring_expense_currency_code']);
$recurring_expense_created_at = escapeHtml($row['recurring_expense_created_at']);
$recurring_expense_vendor_id = intval($row['recurring_expense_vendor_id']);
$vendor_name = escapeHtml($row['vendor_name']);
$recurring_expense_category_id = intval($row['recurring_expense_category_id']);
$category_name = escapeHtml($row['category_name']);
$account_name = escapeHtml($row['account_name']);
$recurring_expense_account_id = intval($row['recurring_expense_account_id']);
$client_name = escapeHtml($row['client_name']);
if(empty($client_name)) {
$client_name_display = "-";
} else {
$client_name_display = $client_name;
}
$recurring_expense_client_id = intval($row['recurring_expense_client_id']);
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-size = "lg"
data-modal-url = "modals/recurring_expense/recurring_expense_edit.php?id=<?= $recurring_expense_id ?>">
<?= $recurring_expense_next_date ?>
</a>
</td>
<td>
<?= $category_name ?>
<div class="text-secondary"><small><?= truncate($recurring_expense_description, 60) ?></small></div>
</td>
<td><?= $vendor_name ?></td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $recurring_expense_amount, $recurring_expense_currency_code) ?></td>
<td><?= $recurring_expense_frequency_display ?></td>
<td><?= $recurring_expense_last_sent_display ?></td>
<td><?= $account_name ?></td>
<td><?= $client_name_display ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/recurring_expense/recurring_expense_edit.php?id=<?= $recurring_expense_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_recurring_expense=<?= $recurring_expense_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -51,8 +51,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-redo-alt me-2"></i>Recurring Invoices</h3>
<?php if (lookupUserPermission("module_sales") >= 2) { ?>
<div class="card-tools">
@@ -72,15 +72,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="status" value="<?= $status_filter ?>">
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group mb-3 mb-sm-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo strip_tags(escapeHtml($q));} ?>" placeholder="Search Recurring Invoices">
<button class="btn btn-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@@ -96,9 +96,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<div>
<label>Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
@@ -109,178 +109,178 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_number&order=<?= $disp ?>">
Number <?php if ($sort == 'recurring_invoice_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_next_date&order=<?= $disp ?>">
Next Date <?php if ($sort == 'recurring_invoice_next_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_scope&order=<?= $disp ?>">
Scope <?php if ($sort == 'recurring_invoice_scope') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'recurring_invoice_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_frequency&order=<?= $disp ?>">
Frequency <?php if ($sort == 'recurring_invoice_frequency') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_last_sent&order=<?= $disp ?>">
Last Sent <?php if ($sort == 'recurring_invoice_last_sent') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_payment_recurring_invoice_id&order=<?= $disp ?>">
Auto Pay <?php if ($sort == 'recurring_payment_recurring_invoice_id') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_status&order=<?= $disp ?>">
Status <?php if ($sort == 'recurring_invoice_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$recurring_invoice_id = intval($row['recurring_invoice_id']);
$recurring_invoice_prefix = escapeHtml($row['recurring_invoice_prefix']);
$recurring_invoice_number = intval($row['recurring_invoice_number']);
$recurring_invoice_scope = escapeHtml($row['recurring_invoice_scope']);
$recurring_invoice_frequency = escapeHtml($row['recurring_invoice_frequency']);
$recurring_invoice_status = escapeHtml($row['recurring_invoice_status']);
$recurring_invoice_discount = floatval($row['recurring_invoice_discount_amount']);
$recurring_invoice_last_sent = $row['recurring_invoice_last_sent'];
if ($recurring_invoice_last_sent == 0) {
$recurring_invoice_last_sent = "-";
}
$recurring_invoice_next_date = escapeHtml($row['recurring_invoice_next_date']);
$recurring_invoice_amount = floatval($row['recurring_invoice_amount']);
$recurring_invoice_currency_code = escapeHtml($row['recurring_invoice_currency_code']);
$recurring_invoice_created_at = escapeHtml($row['recurring_invoice_created_at']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$client_currency_code = escapeHtml($row['client_currency_code']);
$category_id = intval($row['category_id']);
$category_name = escapeHtml($row['category_name']);
if ($recurring_invoice_status == 1) {
$status = "Active";
$status_badge_color = "success";
} else {
$status = "Inactive";
$status_badge_color = "secondary";
}
$recurring_payment_id = intval($row['recurring_payment_id']);
$recurring_payment_recurring_invoice_id = intval($row['recurring_payment_recurring_invoice_id']);
$recurring_payment_saved_payment_id = intval($row['recurring_payment_saved_payment_id']);
?>
<tr>
<td class="text-bold">
<a href="recurring_invoice.php?client_id=<?= $client_id ?>&recurring_invoice_id=<?= $recurring_invoice_id ?>">
<?= "$recurring_invoice_prefix$recurring_invoice_number" ?>
</a>
</td>
<td class="text-bold"><?= $recurring_invoice_next_date ?></td>
<td><?= $recurring_invoice_scope ?></td>
<?php if (!$client_url) { ?>
<td class="text-bold"><a href="recurring_invoices.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code) ?></td>
<td><?= ucwords($recurring_invoice_frequency) ?>ly</td>
<td><?= $recurring_invoice_last_sent ?></td>
<td><?= $category_name ?></td>
<td>
<?php $sql_saved_payments = mysqli_query($mysqli, "SELECT saved_payment_description, saved_payment_id FROM client_saved_payment_methods WHERE saved_payment_client_id = $client_id");
if (mysqli_num_rows($sql_saved_payments) > 0) { ?>
<form class="form" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<input type="hidden" name="set_recurring_payment" value="1">
<input type="hidden" name="recurring_invoice_id" value="<?= $recurring_invoice_id ?>">
<select class="form-select select2" name="saved_payment_id" onchange="this.form.submit()">
<option value="0">Disabled</option>
<?php
while ($row = mysqli_fetch_assoc($sql_saved_payments)) {
$saved_payment_id = intval($row['saved_payment_id']);
$saved_payment_description = escapeHtml($row['saved_payment_description']);
?>
<option <?php if ($recurring_payment_saved_payment_id == $saved_payment_id) { echo "selected"; } ?> value="<?= $saved_payment_id ?>"><?= $saved_payment_description ?></option>
<?php } ?>
</select>
</form>
<?php } else { ?>
No Cards on File
<?php } ?>
</td>
<td>
<span class="p-2 badge text-bg-<?= $status_badge_color ?>">
<?= $status ?>
</span>
</td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/recurring_invoice/recurring_invoice_edit.php?id=<?= $recurring_invoice_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($status !== 'Active') { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_recurring_invoice=<?= $recurring_invoice_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_number&order=<?= $disp ?>">
Number <?php if ($sort == 'recurring_invoice_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_next_date&order=<?= $disp ?>">
Next Date <?php if ($sort == 'recurring_invoice_next_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_scope&order=<?= $disp ?>">
Scope <?php if ($sort == 'recurring_invoice_scope') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'recurring_invoice_amount') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_frequency&order=<?= $disp ?>">
Frequency <?php if ($sort == 'recurring_invoice_frequency') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_last_sent&order=<?= $disp ?>">
Last Sent <?php if ($sort == 'recurring_invoice_last_sent') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_payment_recurring_invoice_id&order=<?= $disp ?>">
Auto Pay <?php if ($sort == 'recurring_payment_recurring_invoice_id') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=recurring_invoice_status&order=<?= $disp ?>">
Status <?php if ($sort == 'recurring_invoice_status') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$recurring_invoice_id = intval($row['recurring_invoice_id']);
$recurring_invoice_prefix = escapeHtml($row['recurring_invoice_prefix']);
$recurring_invoice_number = intval($row['recurring_invoice_number']);
$recurring_invoice_scope = escapeHtml($row['recurring_invoice_scope']);
$recurring_invoice_frequency = escapeHtml($row['recurring_invoice_frequency']);
$recurring_invoice_status = escapeHtml($row['recurring_invoice_status']);
$recurring_invoice_discount = floatval($row['recurring_invoice_discount_amount']);
$recurring_invoice_last_sent = $row['recurring_invoice_last_sent'];
if ($recurring_invoice_last_sent == 0) {
$recurring_invoice_last_sent = "-";
}
$recurring_invoice_next_date = escapeHtml($row['recurring_invoice_next_date']);
$recurring_invoice_amount = floatval($row['recurring_invoice_amount']);
$recurring_invoice_currency_code = escapeHtml($row['recurring_invoice_currency_code']);
$recurring_invoice_created_at = escapeHtml($row['recurring_invoice_created_at']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$client_currency_code = escapeHtml($row['client_currency_code']);
$category_id = intval($row['category_id']);
$category_name = escapeHtml($row['category_name']);
if ($recurring_invoice_status == 1) {
$status = "Active";
$status_badge_color = "success";
} else {
$status = "Inactive";
$status_badge_color = "secondary";
}
$recurring_payment_id = intval($row['recurring_payment_id']);
$recurring_payment_recurring_invoice_id = intval($row['recurring_payment_recurring_invoice_id']);
$recurring_payment_saved_payment_id = intval($row['recurring_payment_saved_payment_id']);
?>
<tr>
<td class="text-bold">
<a href="recurring_invoice.php?client_id=<?= $client_id ?>&recurring_invoice_id=<?= $recurring_invoice_id ?>">
<?= "$recurring_invoice_prefix$recurring_invoice_number" ?>
</a>
</td>
<td class="text-bold"><?= $recurring_invoice_next_date ?></td>
<td><?= $recurring_invoice_scope ?></td>
<?php if (!$client_url) { ?>
<td class="text-bold"><a href="recurring_invoices.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code) ?></td>
<td><?= ucwords($recurring_invoice_frequency) ?>ly</td>
<td><?= $recurring_invoice_last_sent ?></td>
<td><?= $category_name ?></td>
<td>
<?php $sql_saved_payments = mysqli_query($mysqli, "SELECT saved_payment_description, saved_payment_id FROM client_saved_payment_methods WHERE saved_payment_client_id = $client_id");
if (mysqli_num_rows($sql_saved_payments) > 0) { ?>
<form class="form" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<input type="hidden" name="set_recurring_payment" value="1">
<input type="hidden" name="recurring_invoice_id" value="<?= $recurring_invoice_id ?>">
<select class="form-select select2" name="saved_payment_id" onchange="this.form.submit()">
<option value="0">Disabled</option>
<?php
while ($row = mysqli_fetch_assoc($sql_saved_payments)) {
$saved_payment_id = intval($row['saved_payment_id']);
$saved_payment_description = escapeHtml($row['saved_payment_description']);
?>
<option <?php if ($recurring_payment_saved_payment_id == $saved_payment_id) { echo "selected"; } ?> value="<?= $saved_payment_id ?>"><?= $saved_payment_description ?></option>
<?php } ?>
</select>
</form>
<?php } else { ?>
No Cards on File
<?php } ?>
</td>
<td>
<span class="p-2 badge text-bg-<?= $status_badge_color ?>">
<?= $status ?>
</span>
</td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/recurring_invoice/recurring_invoice_edit.php?id=<?= $recurring_invoice_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($status !== 'Active') { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_recurring_invoice=<?= $recurring_invoice_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -87,8 +87,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-redo-alt me-2"></i>Recurring Tickets</h3>
<?php if (lookupUserPermission("module_support") >= 2) { ?>
<div class='card-tools'>
@@ -99,22 +99,22 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Recurring Tickets">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<div>
<select class="form-select select2" name="category" onchange="this.form.submit()">
<option value="">- All Categories -</option>
@@ -133,7 +133,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<div>
<select class="form-select select2" name="assigned_agent" onchange="this.form.submit()">
<option value="">- All Agents -</option>
@@ -152,7 +152,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<div>
<select class="form-select select2" name="billable" onchange="this.form.submit()">
<option value="">- Billable Status -</option>
<option <?php if ($billable_filter == 1) { echo "selected"; } ?> value="1">Billable</option>
@@ -212,171 +212,170 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
</div>
<div class="table-responsive">
<div class="table-responsive">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="<?php if (!$num_rows[0]) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_next_run&order=<?= $disp ?>">
Next Run Date <?php if ($sort == 'recurring_ticket_next_run') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_subject&order=<?= $disp ?>">
Subject <?php if ($sort == 'recurring_ticket_subject') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_priority&order=<?= $disp ?>">
Priority <?php if ($sort == 'recurring_ticket_priority') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_frequency&order=<?= $disp ?>">
Frequency <?php if ($sort == 'recurring_ticket_frequency') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_billable&order=<?= $disp ?>">
Billable <?php if ($sort == 'recurring_ticket_billable') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Agent <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<?php if (lookupUserPermission("module_support") >= 2) { ?>
<th class="text-center">Action</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$recurring_ticket_id = intval($row['recurring_ticket_id']);
$recurring_ticket_client_id = intval($row['client_id']);
$recurring_ticket_subject = escapeHtml($row['recurring_ticket_subject']);
$recurring_ticket_priority = escapeHtml($row['recurring_ticket_priority']);
$recurring_ticket_frequency = escapeHtml($row['recurring_ticket_frequency']);
$recurring_ticket_next_run = escapeHtml($row['recurring_ticket_next_run']);
$recurring_ticket_billable = intval($row['recurring_ticket_billable']);
if ($recurring_ticket_billable) {
$recurring_ticket_billable_display = "<i class='fas fa-fw fa-check text-success'></i>";
} else {
$recurring_ticket_billable_display = "-";
}
$recurring_ticket_category = escapeHtml($row['category_name']) ?: '-';
$recurring_ticket_client_name = escapeHtml($row['client_name']);
$assigned_to = escapeHtml($row['user_name']) ?: '-';
$recurring_ticket_template_name = escapeHtml($row['ticket_template_name']);
$recurring_ticket_task_count = intval($row['recurring_ticket_task_count']);
?>
<table class="table table-striped table-borderless table-hover">
<thead class="<?php if (!$num_rows[0]) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
<input class="form-check-input bulk-select" type="checkbox" name="recurring_ticket_ids[]" value="<?= $recurring_ticket_id ?>">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_next_run&order=<?= $disp ?>">
Next Run Date <?php if ($sort == 'recurring_ticket_next_run') { echo $order_icon; } ?>
<td class="text-bold"><?= $recurring_ticket_next_run ?></td>
<td>
<a class="ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/recurring_ticket/recurring_ticket_edit.php?id=<?= $recurring_ticket_id ?>">
<?= $recurring_ticket_subject ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_subject&order=<?= $disp ?>">
Subject <?php if ($sort == 'recurring_ticket_subject') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=category_name&order=<?= $disp ?>">
Category <?php if ($sort == 'category_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_priority&order=<?= $disp ?>">
Priority <?php if ($sort == 'recurring_ticket_priority') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_frequency&order=<?= $disp ?>">
Frequency <?php if ($sort == 'recurring_ticket_frequency') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=recurring_ticket_billable&order=<?= $disp ?>">
Billable <?php if ($sort == 'recurring_ticket_billable') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Agent <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<?php if ($recurring_ticket_template_name) { ?>
<span title="Template: <?= $recurring_ticket_template_name ?>"
<i class='fas fa-puzzle-piece text-secondary ms-1'></i>
</span>
<?php } ?>
<?php if ($recurring_ticket_task_count) { ?>
<span title="Adds <?= $recurring_ticket_task_count ?> Tasks">
<i class="fas fa-fw fa-tasks me-1"></i><?= $recurring_ticket_task_count ?>
</span>
<?php } ?>
</td>
<td><?= $recurring_ticket_category ?></td>
<td><?= $recurring_ticket_priority ?></td>
<td><?= $recurring_ticket_frequency ?></td>
<td class="text-center"><?= $recurring_ticket_billable_display ?></td>
<td><?= $assigned_to ?></td>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
<th><a href="recurring_tickets.php?client_id=<?= $recurring_ticket_client_id ?>"><?= $recurring_ticket_client_name ?></a>
</th>
<?php } ?>
<?php if (lookupUserPermission("module_support") >= 2) { ?>
<th class="text-center">Action</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$recurring_ticket_id = intval($row['recurring_ticket_id']);
$recurring_ticket_client_id = intval($row['client_id']);
$recurring_ticket_subject = escapeHtml($row['recurring_ticket_subject']);
$recurring_ticket_priority = escapeHtml($row['recurring_ticket_priority']);
$recurring_ticket_frequency = escapeHtml($row['recurring_ticket_frequency']);
$recurring_ticket_next_run = escapeHtml($row['recurring_ticket_next_run']);
$recurring_ticket_billable = intval($row['recurring_ticket_billable']);
if ($recurring_ticket_billable) {
$recurring_ticket_billable_display = "<i class='fas fa-fw fa-check text-success'></i>";
} else {
$recurring_ticket_billable_display = "-";
}
$recurring_ticket_category = escapeHtml($row['category_name']) ?: '-';
$recurring_ticket_client_name = escapeHtml($row['client_name']);
$assigned_to = escapeHtml($row['user_name']) ?: '-';
$recurring_ticket_template_name = escapeHtml($row['ticket_template_name']);
$recurring_ticket_task_count = intval($row['recurring_ticket_task_count']);
?>
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="recurring_ticket_ids[]" value="<?= $recurring_ticket_id ?>">
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/recurring_ticket/recurring_ticket_edit.php?id=<?= $recurring_ticket_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?force_recurring_ticket=<?= $recurring_ticket_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fa fa-fw fa-paper-plane text-secondary me-2"></i>Force Reoccur
</a>
<?php if (lookupUserPermission("module_support") == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_recurring_ticket=<?= $recurring_ticket_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
<td class="text-bold"><?= $recurring_ticket_next_run ?></td>
<td>
<a class="ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/recurring_ticket/recurring_ticket_edit.php?id=<?= $recurring_ticket_id ?>">
<?= $recurring_ticket_subject ?>
</a>
<?php if ($recurring_ticket_template_name) { ?>
<span title="Template: <?= $recurring_ticket_template_name ?>"
<i class='fas fa-puzzle-piece text-secondary ms-1'></i>
</span>
<?php } ?>
<?php if ($recurring_ticket_task_count) { ?>
<span title="Adds <?= $recurring_ticket_task_count ?> Tasks">
<i class="fas fa-fw fa-tasks me-1"></i><?= $recurring_ticket_task_count ?>
</span>
<?php } ?>
</td>
<td><?= $recurring_ticket_category ?></td>
<td><?= $recurring_ticket_priority ?></td>
<td><?= $recurring_ticket_frequency ?></td>
<td class="text-center"><?= $recurring_ticket_billable_display ?></td>
<td><?= $assigned_to ?></td>
<?php if (!$client_url) { ?>
<th><a href="recurring_tickets.php?client_id=<?= $recurring_ticket_client_id ?>"><?= $recurring_ticket_client_name ?></a>
</th>
<?php } ?>
<?php } ?>
<?php if (lookupUserPermission("module_support") >= 2) { ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="modals/recurring_ticket/recurring_ticket_edit.php?id=<?= $recurring_ticket_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?force_recurring_ticket=<?= $recurring_ticket_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fa fa-fw fa-paper-plane text-secondary me-2"></i>Force Reoccur
</a>
<?php if (lookupUserPermission("module_support") == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_recurring_ticket=<?= $recurring_ticket_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
<?php } ?>
</tr>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</tbody>
</table>
</table>
</form>
</div>
<?php require_once '../includes/filter_footer.php';
?>
</form>
</div>
<?php require_once '../includes/filter_footer.php';
?>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -47,8 +47,8 @@ $sql = mysqli_query(
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-stream me-2"></i>Services</h3>
<div class="card-tools">
<?php if (lookupUserPermission("module_support") >= 2) { ?>
@@ -57,15 +57,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Services">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -108,115 +108,114 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=service_name&order=<?= $disp ?>">
Name <?php if ($sort == 'service_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=service_category&order=<?= $disp ?>">
Category <?php if ($sort == 'service_category') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=service_importance&order=<?= $disp ?>">
Importance <?php if ($sort == 'service_importance') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=service_updated_at&order=<?= $disp ?>">
Updated <?php if ($sort == 'service_updated_at') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=service_name&order=<?= $disp ?>">
Name <?php if ($sort == 'service_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=service_category&order=<?= $disp ?>">
Category <?php if ($sort == 'service_category') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=service_importance&order=<?= $disp ?>">
Importance <?php if ($sort == 'service_importance') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=service_updated_at&order=<?= $disp ?>">
Updated <?php if ($sort == 'service_updated_at') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$service_id = intval($row['service_id']);
$service_name = escapeHtml($row['service_name']);
$service_description = escapeHtml($row['service_description']);
$service_category = escapeHtml($row['service_category']);
$service_importance = escapeHtml($row['service_importance']);
$service_backup = escapeHtml($row['service_backup']);
$service_notes = escapeHtml($row['service_notes']);
$service_created_at = escapeHtml($row['service_created_at']);
$service_updated_at = escapeHtml($row['service_updated_at']);
$service_review_due = escapeHtml($row['service_review_due']);
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$service_id = intval($row['service_id']);
$service_name = escapeHtml($row['service_name']);
$service_description = escapeHtml($row['service_description']);
$service_category = escapeHtml($row['service_category']);
$service_importance = escapeHtml($row['service_importance']);
$service_backup = escapeHtml($row['service_backup']);
$service_notes = escapeHtml($row['service_notes']);
$service_created_at = escapeHtml($row['service_created_at']);
$service_updated_at = escapeHtml($row['service_updated_at']);
$service_review_due = escapeHtml($row['service_review_due']);
?>
<tr>
<!-- Name/Category/Updated/Importance from DB -->
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-size="xl"
data-modal-url="modals/service/service.php?id=<?= $service_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-stream me-3"></i>
<div class="flex-grow-1">
<div><?= $service_name ?></div>
<div><small class="text-secondary"><?= $service_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $service_category ?></td>
<td><?= $service_importance ?></td>
<td><?= $service_updated_at ?></td>
<?php if (!$client_url) { ?>
<td><a href="services.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<!-- Action -->
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/service/service_edit.php?id=<?= $service_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if (lookupUserPermission("module_support") >= 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_service=<?= $service_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<tr>
<!-- Name/Category/Updated/Importance from DB -->
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-size="xl"
data-modal-url="modals/service/service.php?id=<?= $service_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-stream me-3"></i>
<div class="flex-grow-1">
<div><?= $service_name ?></div>
<div><small class="text-secondary"><?= $service_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $service_category ?></td>
<td><?= $service_importance ?></td>
<td><?= $service_updated_at ?></td>
<?php if (!$client_url) { ?>
<td><a href="services.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<!-- Action -->
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/service/service_edit.php?id=<?= $service_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if (lookupUserPermission("module_support") >= 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_service=<?= $service_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -79,8 +79,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-cube me-2"></i>Software & Licenses</h3>
<div class="card-tools">
<div class="btn-group">
@@ -104,16 +104,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Licenses">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -121,7 +121,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php if (!$client_url) { ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="client" onchange="this.form.submit()">
<option value="" <?php if ($client == "") { echo "selected"; } ?>>- All Clients -</option>
@@ -149,7 +149,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<?php } ?>
<div class="col-md-2">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<select class="form-select select2" name="expire_days" onchange="this.form.submit()">
<option value="" <?php if ($expire_days == "") { echo "selected"; } ?>>- Expiring In -</option>
<option value="expired" <?php if ($expire_days === "expired") { echo "selected"; } ?>>Expired</option>
@@ -169,7 +169,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="float-end">
<a href="?<?= $client_url ?>archived=<?php if($archived == 1){ echo 0; } else { echo 1; } ?>"
class="btn btn-<?php if($archived == 1){ echo "primary"; } else { echo "default"; } ?>">
class="btn btn-<?php if($archived == 1){ echo"primary"; } else { echo "default"; } ?>">
<i class="fa fa-fw fa-archive me-2"></i>Archived
</a>
</div>
@@ -177,181 +177,180 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_name&order=<?= $disp ?>">
Software <?php if ($sort == 'software_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_type&order=<?= $disp ?>">
Type <?php if ($sort == 'software_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_license_type&order=<?= $disp ?>">
License Type <?php if ($sort == 'software_license_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_seats&order=<?= $disp ?>">
Seats <?php if ($sort == 'software_seats') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_expire&order=<?= $disp ?>">
Expire <?php if ($sort == 'software_expire') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive">
<table class="table table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_name&order=<?= $disp ?>">
Software <?php if ($sort == 'software_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_type&order=<?= $disp ?>">
Type <?php if ($sort == 'software_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_license_type&order=<?= $disp ?>">
License Type <?php if ($sort == 'software_license_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_seats&order=<?= $disp ?>">
Seats <?php if ($sort == 'software_seats') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=software_expire&order=<?= $disp ?>">
Expire <?php if ($sort == 'software_expire') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$software_id = intval($row['software_id']);
$software_name = escapeHtml($row['software_name']);
$software_description = escapeHtml($row['software_description']);
$software_version = escapeHtml($row['software_version']);
$software_type = escapeHtml($row['software_type']);
$software_license_type = escapeHtml($row['software_license_type']) ?: '-';
$software_seats = escapeHtml($row['software_seats']);
$software_expire = escapeHtml($row['software_expire']);
$vendor_name = escapeHtml($row['vendor_name']);
$vendor_id = intval($row['vendor_id']);
if ($vendor_name) {
$vendor_display = "<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$vendor_id'>$vendor_name</a>";
while ($row = mysqli_fetch_assoc($sql)) {
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
$software_id = intval($row['software_id']);
$software_name = escapeHtml($row['software_name']);
$software_description = escapeHtml($row['software_description']);
$software_version = escapeHtml($row['software_version']);
$software_type = escapeHtml($row['software_type']);
$software_license_type = escapeHtml($row['software_license_type']) ?: '-';
$software_seats = escapeHtml($row['software_seats']);
$software_expire = escapeHtml($row['software_expire']);
$vendor_name = escapeHtml($row['vendor_name']);
$vendor_id = intval($row['vendor_id']);
if ($vendor_name) {
$vendor_display = "<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$vendor_id'>$vendor_name</a>";
} else {
$vendor_display = "<span class='text-muted'>N/A</span>";
}
if ($software_expire) {
$software_expire_ago = timeAgo($software_expire);
$software_expire_display = "<div>$software_expire</div><div><small>$software_expire_ago</small></div>";
// Convert the expiry date to a timestamp
$software_expire_timestamp = strtotime($row['software_expire']);
$current_timestamp = time(); // Get current timestamp
// Calculate the difference in days
$days_until_expiry = ($software_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
// Determine the class based on the number of days until expiry
if ($days_until_expiry <= 0) {
$tr_class = "table-secondary";
} elseif ($days_until_expiry <= 7) {
$tr_class = "table-danger";
} elseif ($days_until_expiry <= 45) {
$tr_class = "table-warning";
} else {
$vendor_display = "<span class='text-muted'>N/A</span>";
}
if ($software_expire) {
$software_expire_ago = timeAgo($software_expire);
$software_expire_display = "<div>$software_expire</div><div><small>$software_expire_ago</small></div>";
// Convert the expiry date to a timestamp
$software_expire_timestamp = strtotime($row['software_expire']);
$current_timestamp = time(); // Get current timestamp
// Calculate the difference in days
$days_until_expiry = ($software_expire_timestamp - $current_timestamp) / (60 * 60 * 24);
// Determine the class based on the number of days until expiry
if ($days_until_expiry <= 0) {
$tr_class = "table-secondary";
} elseif ($days_until_expiry <= 7) {
$tr_class = "table-danger";
} elseif ($days_until_expiry <= 45) {
$tr_class = "table-warning";
} else {
$tr_class = '';
}
} else {
$software_expire_display = "<span class='text-muted'>N/A</span>";
$tr_class = '';
}
$software_created_at = escapeHtml($row['software_created_at']);
$seat_count = 0;
// Asset Licenses
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
$asset_licenses_array = array();
while ($row = mysqli_fetch_assoc($asset_licenses_sql)) {
$asset_licenses_array[] = intval($row['asset_id']);
$seat_count = $seat_count + 1;
}
$asset_licenses = implode(',', $asset_licenses_array);
// Contact Licenses
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
$contact_licenses_array = array();
while ($row = mysqli_fetch_assoc($contact_licenses_sql)) {
$contact_licenses_array[] = intval($row['contact_id']);
$seat_count = $seat_count + 1;
}
$contact_licenses = implode(',', $contact_licenses_array);
?>
<tr class="<?= $tr_class ?>">
<td>
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/software/software_edit.php?id=<?= $software_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-cube me-3"></i>
<div class="flex-grow-1">
<div><?= "$software_name <span>$software_version</span>" ?></div>
<div><small class="text-secondary"><?= $software_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $software_type ?></td>
<td><?= $software_license_type ?></td>
<td><?= "$seat_count / $software_seats" ?></td>
<td><?= $software_expire_display ?></td>
<td><?= $vendor_display ?></td>
<?php if (!$client_url) { ?>
<td><a href="software.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/software/software_edit.php?id=<?= $software_id ?>"
>
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_software=<?= $software_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive and<br><small>Remove Licenses</small></a>
<?php if ($session_user_role == 3) { ?>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_software=<?= $software_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete and<br><small>Remove Licenses</small></a>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
} else {
$software_expire_display = "<span class='text-muted'>N/A</span>";
$tr_class = '';
}
?>
$software_created_at = escapeHtml($row['software_created_at']);
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
$seat_count = 0;
// Asset Licenses
$asset_licenses_sql = mysqli_query($mysqli, "SELECT asset_id FROM software_assets WHERE software_id = $software_id");
$asset_licenses_array = array();
while ($row = mysqli_fetch_assoc($asset_licenses_sql)) {
$asset_licenses_array[] = intval($row['asset_id']);
$seat_count = $seat_count + 1;
}
$asset_licenses = implode(',', $asset_licenses_array);
// Contact Licenses
$contact_licenses_sql = mysqli_query($mysqli, "SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
$contact_licenses_array = array();
while ($row = mysqli_fetch_assoc($contact_licenses_sql)) {
$contact_licenses_array[] = intval($row['contact_id']);
$seat_count = $seat_count + 1;
}
$contact_licenses = implode(',', $contact_licenses_array);
?>
<tr class="<?= $tr_class ?>">
<td>
<a class="text-dark ajax-modal" href="#" data-modal-url="modals/software/software_edit.php?id=<?= $software_id ?>">
<div class="d-flex">
<i class="fa fa-fw fa-2x fa-cube me-3"></i>
<div class="flex-grow-1">
<div><?= "$software_name <span>$software_version</span>" ?></div>
<div><small class="text-secondary"><?= $software_description ?></small></div>
</div>
</div>
</a>
</td>
<td><?= $software_type ?></td>
<td><?= $software_license_type ?></td>
<td><?= "$seat_count / $software_seats" ?></td>
<td><?= $software_expire_display ?></td>
<td><?= $vendor_display ?></td>
<?php if (!$client_url) { ?>
<td><a href="software.php?client_id=<?= $client_id ?>"><?= $client_name ?></a></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/software/software_edit.php?id=<?= $software_id ?>"
>
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_software=<?= $software_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive and<br><small>Remove Licenses</small></a>
<?php if ($session_user_role == 3) { ?>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_software=<?= $software_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete and<br><small>Remove Licenses</small></a>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -82,399 +82,397 @@ if ($tickets) {
?>
<div class="card card-dark">
<div class="card-body">
<div class="card">
<?php if (!$tickets) { ?>
<?php if (!$tickets) { ?>
<div class="text-center text-secondary py-5">
<i class="fas fa-fw fa-life-ring fa-2x mb-3"></i>
<p class="mb-1">No tickets match these filters.</p>
<?php if ($active_filters) { ?>
<a href="<?= escapeHtml('?' . http_build_query(array_filter(array('client_id' => $_GET['client_id'] ?? null, 'view' => 'list')))) ?>">Clear the filters</a>
<?php } ?>
</div>
<div class="text-center text-secondary py-5">
<i class="fas fa-fw fa-life-ring fa-2x mb-3"></i>
<p class="mb-1">No tickets match these filters.</p>
<?php if ($active_filters) { ?>
<a href="<?= escapeHtml('?' . http_build_query(array_filter(array('client_id' => $_GET['client_id'] ?? null, 'view' => 'list')))) ?>">Clear the filters</a>
<?php } ?>
</div>
<?php } else { ?>
<?php } else { ?>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<?php if (lookupUserPermission("module_support") >= 2) { ?>
<!-- Bulk actions - sits with the rows it acts on, and only appears once something is ticked -->
<div class="mb-2" id="bulkActionButton" hidden>
<div class="dropdown d-inline-block">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
<i class="fas fa-fw fa-layer-group me-2"></i><span id="selectedCount">0</span> selected
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_assign.php" data-bulk="true">
<i class="fas fa-fw fa-user-check me-2"></i>Assign Agent
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_edit_priority.php" data-bulk="true">
<i class="fas fa-fw fa-thermometer-half me-2"></i>Set Priority
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_edit_category.php" data-bulk="true">
<i class="fas fa-fw fa-layer-group me-2"></i>Set Category
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_add_project.php" data-bulk="true">
<i class="fas fa-fw fa-project-diagram me-2"></i>Set Project
</a>
<?php if (lookupUserPermission("module_support") >= 2) { ?>
<!-- Bulk actions - sits with the rows it acts on, and only appears once something is ticked -->
<div class="mb-2" id="bulkActionButton" hidden>
<div class="dropdown d-inline-block">
<button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
<i class="fas fa-fw fa-layer-group me-2"></i><span id="selectedCount">0</span> selected
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_assign.php" data-bulk="true">
<i class="fas fa-fw fa-user-check me-2"></i>Assign Agent
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_edit_priority.php" data-bulk="true">
<i class="fas fa-fw fa-thermometer-half me-2"></i>Set Priority
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_edit_category.php" data-bulk="true">
<i class="fas fa-fw fa-layer-group me-2"></i>Set Category
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_add_project.php" data-bulk="true">
<i class="fas fa-fw fa-project-diagram me-2"></i>Set Project
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_reply.php" data-modal-size="lg" data-bulk="true">
<i class="fas fa-fw fa-paper-plane me-2"></i>Update/Reply
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_merge.php" data-bulk="true">
<i class="fas fa-fw fa-clone me-2"></i>Merge
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_resolve.php" data-modal-size="lg" data-bulk="true">
<i class="fas fa-fw fa-check me-2"></i>Resolve
</a>
<?php if (lookupUserPermission("module_support") === 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_reply.php" data-modal-size="lg" data-bulk="true">
<i class="fas fa-fw fa-paper-plane me-2"></i>Update/Reply
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_merge.php" data-bulk="true">
<i class="fas fa-fw fa-clone me-2"></i>Merge
</a>
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_bulk_resolve.php" data-modal-size="lg" data-bulk="true">
<i class="fas fa-fw fa-check me-2"></i>Resolve
</a>
<?php if (lookupUserPermission("module_support") === 3) { ?>
<div class="dropdown-divider"></div>
<button class="dropdown-item text-danger text-bold confirm-link" type="submit" form="bulkActions" name="bulk_delete_tickets">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</button>
<?php } ?>
</div>
<button class="dropdown-item text-danger text-bold confirm-link" type="submit" form="bulkActions" name="bulk_delete_tickets">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</button>
<?php } ?>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark text-nowrap">
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" title="Select all on this page">
</div>
</td>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark text-nowrap">
<tr>
<td class="checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" title="Select all on this page">
</div>
</td>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_number&order=<?= $disp ?>">
Ticket <?php if ($sort == 'ticket_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_subject&order=<?= $disp ?>">
Subject <?php if ($sort == 'ticket_subject') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_number&order=<?= $disp ?>">
Ticket <?php if ($sort == 'ticket_number') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_subject&order=<?= $disp ?>">
Subject <?php if ($sort == 'ticket_subject') { echo $order_icon; } ?>
</a>
</th>
<th>
<?php if (!$client_url) { ?>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?> /
</a>
<?php } ?>
<a class="text-secondary <?php if ($client_url) { echo "text-dark"; } ?>" href="?<?= $url_query_strings_sort ?>&sort=contact_name&order=<?= $disp ?>">
Contact <?php if ($sort == 'contact_name') { echo $order_icon; } ?>
</a>
</th>
<?php if ($show_billing_column) { ?>
<th class="text-center">
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=ticket_billable&order=<?= $disp ?>">
Billing <?php if ($sort == 'ticket_billable') { echo $order_icon; } ?>
</a>
</th>
<th>
<?php if (!$client_url) { ?>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?> /
</a>
<?php } ?>
<a class="text-secondary <?php if ($client_url) { echo "text-dark"; } ?>" href="?<?= $url_query_strings_sort ?>&sort=contact_name&order=<?= $disp ?>">
Contact <?php if ($sort == 'contact_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_priority&order=<?= $disp ?>">
Priority <?php if ($sort == 'ticket_priority') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_status&order=<?= $disp ?>">
Status <?php if ($sort == 'ticket_status') { echo $order_icon; } ?>
</a>
</th>
<?php if ($sla_filter_in_use) { ?>
<th>SLA</th>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Assigned <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_updated_at&order=<?= $disp ?>">
Last Response <?php if ($sort == 'ticket_updated_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_created_at&order=<?= $disp ?>">
Created <?php if ($sort == 'ticket_created_at') { echo $order_icon; } ?>
</a>
</th>
</tr>
</thead>
<tbody>
<?php
<?php if ($show_billing_column) { ?>
<th class="text-center">
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=ticket_billable&order=<?= $disp ?>">
Billing <?php if ($sort == 'ticket_billable') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
foreach ($tickets as $ticket_id => $row) {
$ticket_prefix = escapeHtml($row['ticket_prefix']);
$ticket_number = intval($row['ticket_number']);
$ticket_subject = escapeHtml($row['ticket_subject']);
$ticket_priority = escapeHtml($row['ticket_priority']);
$ticket_status_name = escapeHtml($row['ticket_status_name']);
$ticket_status_color = escapeHtml($row['ticket_status_color']);
$ticket_billable = intval($row['ticket_billable']);
$ticket_scheduled_for = escapeHtml($row['ticket_schedule']);
$ticket_created_at = escapeHtml($row['ticket_created_at']);
$ticket_created_at_time_ago = timeAgo($row['ticket_created_at']);
$ticket_closed_at = escapeHtml($row['ticket_closed_at']);
$ticket_resolved_at = escapeHtml($row['ticket_resolved_at']);
$ticket_is_open = empty($ticket_resolved_at) && empty($ticket_closed_at);
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_priority&order=<?= $disp ?>">
Priority <?php if ($sort == 'ticket_priority') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_status&order=<?= $disp ?>">
Status <?php if ($sort == 'ticket_status') { echo $order_icon; } ?>
</a>
</th>
<?php if ($sla_filter_in_use) { ?>
<th>SLA</th>
<?php } ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Assigned <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_updated_at&order=<?= $disp ?>">
Last Response <?php if ($sort == 'ticket_updated_at') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=ticket_created_at&order=<?= $disp ?>">
Created <?php if ($sort == 'ticket_created_at') { echo $order_icon; } ?>
</a>
</th>
</tr>
</thead>
<tbody>
<?php
// SLA alert stages are maintained by cron/ticket_sla.php (1 = warned, 2 = breached)
$ticket_sla_alert_stage = max(intval($row['ticket_response_sla_alert_stage']), intval($row['ticket_resolution_sla_alert_stage']));
// Only an open ticket can be paused - Resolved and Closed pause the
// clock too, but what those tickets have is a verdict, not a pause
$ticket_sla_paused = $ticket_is_open && intval($row['ticket_status_pauses_sla']);
// A paused ticket isn't running down its clock, so drop the
// at-risk warning - a breach already recorded still stands
if ($ticket_sla_paused && $ticket_sla_alert_stage < 2) {
$ticket_sla_alert_stage = 0;
}
foreach ($tickets as $ticket_id => $row) {
$ticket_prefix = escapeHtml($row['ticket_prefix']);
$ticket_number = intval($row['ticket_number']);
$ticket_subject = escapeHtml($row['ticket_subject']);
$ticket_priority = escapeHtml($row['ticket_priority']);
$ticket_status_name = escapeHtml($row['ticket_status_name']);
$ticket_status_color = escapeHtml($row['ticket_status_color']);
$ticket_billable = intval($row['ticket_billable']);
$ticket_scheduled_for = escapeHtml($row['ticket_schedule']);
$ticket_created_at = escapeHtml($row['ticket_created_at']);
$ticket_created_at_time_ago = timeAgo($row['ticket_created_at']);
$ticket_closed_at = escapeHtml($row['ticket_closed_at']);
$ticket_resolved_at = escapeHtml($row['ticket_resolved_at']);
$ticket_is_open = empty($ticket_resolved_at) && empty($ticket_closed_at);
$project_id = intval($row['ticket_project_id']);
$client_id = intval($row['ticket_client_id']);
$client_name = escapeHtml($row['client_name']);
$contact_id = intval($row['contact_id']);
$contact_name = escapeHtml($row['contact_name']);
$has_client = $client_id ? "&client_id=$client_id" : "";
// SLA alert stages are maintained by cron/ticket_sla.php (1 = warned, 2 = breached)
$ticket_sla_alert_stage = max(intval($row['ticket_response_sla_alert_stage']), intval($row['ticket_resolution_sla_alert_stage']));
// Only an open ticket can be paused - Resolved and Closed pause the
// clock too, but what those tickets have is a verdict, not a pause
$ticket_sla_paused = $ticket_is_open && intval($row['ticket_status_pauses_sla']);
// A paused ticket isn't running down its clock, so drop the
// at-risk warning - a breach already recorded still stands
if ($ticket_sla_paused && $ticket_sla_alert_stage < 2) {
$ticket_sla_alert_stage = 0;
}
if ($ticket_priority == "Urgent") {
$ticket_priority_color = "dark";
} elseif ($ticket_priority == "High") {
$ticket_priority_color = "danger";
} elseif ($ticket_priority == "Medium") {
$ticket_priority_color = "warning";
$project_id = intval($row['ticket_project_id']);
$client_id = intval($row['ticket_client_id']);
$client_name = escapeHtml($row['client_name']);
$contact_id = intval($row['contact_id']);
$contact_name = escapeHtml($row['contact_name']);
$has_client = $client_id ? "&client_id=$client_id" : "";
if ($ticket_priority == "Urgent") {
$ticket_priority_color = "dark";
} elseif ($ticket_priority == "High") {
$ticket_priority_color = "danger";
} elseif ($ticket_priority == "Medium") {
$ticket_priority_color = "warning";
} else {
$ticket_priority_color = "info";
}
$ticket_assigned_to = intval($row['ticket_assigned_to']);
if (empty($ticket_assigned_to)) {
$ticket_assigned_to_display = $ticket_is_open ? "<span class='text-muted'>Unassigned</span>" : "<span>Unassigned</span>";
} else {
$ticket_assigned_to_display = escapeHtml($row['user_name']);
}
if (empty($contact_name)) {
$contact_display = "<span class='text-muted'>-</span>";
} else {
$contact_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a>";
}
$ticket_invoice_id = intval($row['ticket_invoice_id']);
$ticket_quote_id = intval($row['ticket_quote_id']);
// Last reply, from the batched lookup above
$ticket_reply_created_at = "";
$ticket_reply_created_at_time_ago = "Never";
$ticket_reply_by_display = "";
$ticket_reply_type = "Client"; // Un-replied tickets are waiting on us
if (isset($ticket_replies[$ticket_id])) {
$reply = $ticket_replies[$ticket_id];
$ticket_reply_type = escapeHtml($reply['ticket_reply_type']);
if ($ticket_reply_type == "Client") {
$ticket_reply_by_display = escapeHtml($reply['contact_name']);
} else {
$ticket_priority_color = "info";
$ticket_reply_by_display = escapeHtml($reply['user_name']);
}
$ticket_reply_created_at = escapeHtml($reply['ticket_reply_created_at']);
$ticket_reply_created_at_time_ago = timeAgo($reply['ticket_reply_created_at']);
}
$ticket_assigned_to = intval($row['ticket_assigned_to']);
if (empty($ticket_assigned_to)) {
$ticket_assigned_to_display = $ticket_is_open ? "<span class='text-muted'>Unassigned</span>" : "<span>Unassigned</span>";
} else {
$ticket_assigned_to_display = escapeHtml($row['user_name']);
}
// Task progress, from the batched lookup above
$task_count = isset($ticket_tasks[$ticket_id]) ? intval($ticket_tasks[$ticket_id]['task_count']) : 0;
$completed_task_count = isset($ticket_tasks[$ticket_id]) ? intval($ticket_tasks[$ticket_id]['completed_count']) : 0;
$tasks_completed_percent = $task_count ? round(($completed_task_count / $task_count) * 100) : 0;
if (empty($contact_name)) {
$contact_display = "<span class='text-muted'>-</span>";
} else {
$contact_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a>";
}
$ticket_invoice_id = intval($row['ticket_invoice_id']);
$ticket_quote_id = intval($row['ticket_quote_id']);
// Last reply, from the batched lookup above
$ticket_reply_created_at = "";
$ticket_reply_created_at_time_ago = "Never";
$ticket_reply_by_display = "";
$ticket_reply_type = "Client"; // Un-replied tickets are waiting on us
if (isset($ticket_replies[$ticket_id])) {
$reply = $ticket_replies[$ticket_id];
$ticket_reply_type = escapeHtml($reply['ticket_reply_type']);
if ($ticket_reply_type == "Client") {
$ticket_reply_by_display = escapeHtml($reply['contact_name']);
} else {
$ticket_reply_by_display = escapeHtml($reply['user_name']);
}
$ticket_reply_created_at = escapeHtml($reply['ticket_reply_created_at']);
$ticket_reply_created_at_time_ago = timeAgo($reply['ticket_reply_created_at']);
}
// Task progress, from the batched lookup above
$task_count = isset($ticket_tasks[$ticket_id]) ? intval($ticket_tasks[$ticket_id]['task_count']) : 0;
$completed_task_count = isset($ticket_tasks[$ticket_id]) ? intval($ticket_tasks[$ticket_id]['completed_count']) : 0;
$tasks_completed_percent = $task_count ? round(($completed_task_count / $task_count) * 100) : 0;
/*
* Row highlighting, in priority order. The title explains why the
* row is coloured - previously you just got a red row with no
* indication of which of several rules had fired.
*/
$row_class = '';
$row_title = '';
if ($ticket_is_open && $ticket_sla_alert_stage == 2) {
$row_class = 'table-danger';
$row_title = 'SLA breached';
} elseif ($ticket_is_open && $ticket_sla_alert_stage == 1) {
$row_class = 'table-warning';
$row_title = 'SLA at risk';
} elseif ($ticket_is_open && $ticket_reply_type == "Client") {
$row_class = 'table-warning';
$row_title = 'Waiting on a reply from us';
}
if ($ticket_is_open && $ticket_reply_created_at_time_ago == "Never") {
$row_class .= ' fw-bold';
$row_title = $row_title ? $row_title . ', not yet replied to' : 'Not yet replied to';
}
?>
<tr class="<?= trim($row_class) ?>" <?php if ($row_title) { ?>title="<?= $row_title ?>"<?php } ?>>
<td class="checkbox-column">
<!-- Ticket Bulk Select (for open tickets) -->
<?php if (empty($ticket_closed_at)) { ?>
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="ticket_ids[]" value="<?= $ticket_id ?>">
</div>
<?php } ?>
</td>
<!-- Ticket Number -->
<td>
<a href="ticket.php?ticket_id=<?= "$ticket_id$has_client" ?>">
<span class="badge rounded-pill bg-dark p-2"><?= "$ticket_prefix$ticket_number" ?></span>
</a>
</td>
<!-- Ticket Subject -->
<td>
<a href="ticket.php?ticket_id=<?= "$ticket_id$has_client" ?>"><?= $ticket_subject ?></a>
<?php if ($task_count) { ?>
<div class="d-flex align-items-center mt-1">
<div class="progress me-2" style="flex: 0 0 48px; height: 5px;" role="progressbar" aria-valuenow="<?= $tasks_completed_percent ?>" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar <?= $completed_task_count == $task_count ? 'bg-success' : 'bg-secondary' ?>" style="width: <?= $tasks_completed_percent ?>%;"></div>
</div>
<small class="text-muted"><?= "$completed_task_count / $task_count tasks" ?></small>
</div>
<?php } ?>
</td>
<!-- Ticket Client / Contact -->
<td>
<?php if (!$client_url) { ?>
<?php if ($client_id) { ?>
<div><a href="tickets.php?client_id=<?= $client_id ?>"><strong><?= $client_name ?></strong></a></div>
<?php } else { ?>
<!-- Tickets with no client rendered an empty bold link to client_id=0 -->
<div class="text-muted">No client</div>
<?php } ?>
<?php } ?>
<div><?= $contact_display ?></div>
</td>
<!-- Ticket Billing (if accounting enabled) -->
<?php if ($show_billing_column) { ?>
<td class="text-center">
<?php if ($ticket_invoice_id) { ?>
<a href="invoice.php?client_id=<?= $client_id ?>&invoice_id=<?= $ticket_invoice_id ?>"><span class="badge rounded-pill bg-success p-2">Invoiced</span></a>
<?php } elseif ($ticket_quote_id) { ?>
<a href="quote.php?client_id=<?= $client_id ?>&quote_id=<?= $ticket_quote_id ?>"><span class="badge rounded-pill bg-primary p-2">Quoted</span></a>
<?php } else { ?>
<a href="#" class="ajax-modal" data-modal-url="modals/ticket/ticket_billable.php?id=<?= $ticket_id ?>"
title="<?= $ticket_billable ? 'Billable - click to change' : 'Not billable - click to change' ?>">
<?php if ($ticket_billable) { ?>
<span class="badge rounded-pill bg-success p-2"><i class="fas fa-fw fa-dollar-sign"></i></span>
<?php } else { ?>
<span class="badge rounded-pill bg-secondary p-2"><i class="fas fa-fw fa-minus"></i></span>
<?php } ?>
</a>
<?php } ?>
</td>
<?php } ?>
<!-- Ticket Priority -->
<td>
<a href="#"
<?php if (lookupUserPermission("module_support") >= 2 && empty($ticket_closed_at)) { ?>
class="ajax-modal"
data-modal-url="modals/ticket/ticket_priority.php?id=<?= $ticket_id ?>"
<?php } ?>
>
<span class="p-2 badge rounded-pill text-bg-<?= $ticket_priority_color ?>"><?= $ticket_priority ?></span>
</a>
</td>
<!-- Ticket Status -->
<td>
<span class="badge rounded-pill text-light p-2" style="background-color: <?= $ticket_status_color ?>"><?= $ticket_status_name ?></span>
<?php if (!empty($ticket_scheduled_for)) { ?>
<div class="mt-1"><small class="text-secondary"><i class="fas fa-fw fa-calendar-check me-1"></i><?= $ticket_scheduled_for ?></small></div>
<?php } ?>
</td>
<!-- Ticket SLA state (only when SLAs are in use) -->
<?php if ($sla_filter_in_use) { ?>
<td class="text-nowrap">
<?php
if (!intval($row['ticket_sla_id'])) {
echo "<span class='text-muted'>-</span>";
} elseif ($ticket_sla_paused) {
echo "<span class='badge rounded-pill bg-secondary p-2' title='The resolution clock is paused in this status'><i class='fas fa-fw fa-pause'></i> Paused</span>";
} elseif ($ticket_sla_alert_stage == 2) {
echo "<span class='badge rounded-pill bg-danger p-2'><i class='fas fa-fw fa-stopwatch'></i> Breached</span>";
} elseif ($ticket_sla_alert_stage == 1) {
echo "<span class='badge rounded-pill bg-warning p-2'><i class='fas fa-fw fa-stopwatch'></i> At risk</span>";
} elseif (!$ticket_is_open) {
$sla_met = intval($row['ticket_response_sla_met'] ?? 0) && (is_null($row['ticket_resolution_due_at']) || intval($row['ticket_resolution_sla_met'] ?? 0));
echo $sla_met ? "<span class='badge rounded-pill bg-success p-2'>Met</span>" : "<span class='text-muted'>-</span>";
} else {
// Whichever clock is still running is the one worth showing
$sla_due_at = empty($row['ticket_first_response_at']) ? $row['ticket_response_due_at'] : $row['ticket_resolution_due_at'];
$sla_due_label = empty($row['ticket_first_response_at']) ? 'First response due' : 'Resolution due';
if (!empty($sla_due_at)) {
echo "<small class='text-secondary' title='" . escapeHtml($sla_due_label) . " " . escapeHtml($sla_due_at) . "'>" . timeAgo($sla_due_at) . "</small>";
} else {
echo "<span class='text-muted'>-</span>";
}
}
?>
</td>
<?php } ?>
<!-- Ticket Assigned agent -->
<td>
<a href="#"
<?php if (lookupUserPermission("module_support") >= 2 && empty($ticket_closed_at)) { ?>
class="ajax-modal"
data-modal-url="modals/ticket/ticket_assign.php?id=<?= $ticket_id ?>"
<?php } ?>
>
<?= $ticket_assigned_to_display ?>
</a>
</td>
<!-- Ticket Last Response -->
<td>
<div title="<?= $ticket_reply_created_at ?>"><?= $ticket_reply_created_at_time_ago ?></div>
<?php if ($ticket_reply_by_display) { ?>
<small class="text-secondary"><?= $ticket_reply_by_display ?><?php if ($ticket_reply_type == "Client") { echo " <i class='fas fa-fw fa-reply text-warning' title='Client replied last'></i>"; } ?></small>
<?php } ?>
</td>
<!-- Ticket Created At -->
<td>
<?= $ticket_created_at_time_ago ?>
<br>
<small class="text-secondary"><?= date("$config_date_format $config_time_format", strtotime($ticket_created_at)) ?></small>
</td>
</tr>
<?php
/*
* Row highlighting, in priority order. The title explains why the
* row is coloured - previously you just got a red row with no
* indication of which of several rules had fired.
*/
$row_class = '';
$row_title = '';
if ($ticket_is_open && $ticket_sla_alert_stage == 2) {
$row_class = 'table-danger';
$row_title = 'SLA breached';
} elseif ($ticket_is_open && $ticket_sla_alert_stage == 1) {
$row_class = 'table-warning';
$row_title = 'SLA at risk';
} elseif ($ticket_is_open && $ticket_reply_type == "Client") {
$row_class = 'table-warning';
$row_title = 'Waiting on a reply from us';
}
if ($ticket_is_open && $ticket_reply_created_at_time_ago == "Never") {
$row_class .= ' fw-bold';
$row_title = $row_title ? $row_title . ', not yet replied to' : 'Not yet replied to';
}
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
<tr class="<?= trim($row_class) ?>" <?php if ($row_title) { ?>title="<?= $row_title ?>"<?php } ?>>
<td class="checkbox-column">
<!-- Ticket Bulk Select (for open tickets) -->
<?php if (empty($ticket_closed_at)) { ?>
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="ticket_ids[]" value="<?= $ticket_id ?>">
</div>
<?php } ?>
</td>
<!-- Ticket Number -->
<td>
<a href="ticket.php?ticket_id=<?= "$ticket_id$has_client" ?>">
<span class="badge rounded-pill bg-dark p-2"><?= "$ticket_prefix$ticket_number" ?></span>
</a>
</td>
<!-- Ticket Subject -->
<td>
<a href="ticket.php?ticket_id=<?= "$ticket_id$has_client" ?>"><?= $ticket_subject ?></a>
<?php if ($task_count) { ?>
<div class="d-flex align-items-center mt-1">
<div class="progress me-2" style="flex: 0 0 48px; height: 5px;" role="progressbar" aria-valuenow="<?= $tasks_completed_percent ?>" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar <?= $completed_task_count == $task_count ? 'bg-success' : 'bg-secondary' ?>" style="width: <?= $tasks_completed_percent ?>%;"></div>
</div>
<small class="text-muted"><?= "$completed_task_count / $task_count tasks" ?></small>
</div>
<?php } ?>
</td>
<!-- Ticket Client / Contact -->
<td>
<?php if (!$client_url) { ?>
<?php if ($client_id) { ?>
<div><a href="tickets.php?client_id=<?= $client_id ?>"><strong><?= $client_name ?></strong></a></div>
<?php } else { ?>
<!-- Tickets with no client rendered an empty bold link to client_id=0 -->
<div class="text-muted">No client</div>
<?php } ?>
<?php } ?>
<div><?= $contact_display ?></div>
</td>
<!-- Ticket Billing (if accounting enabled) -->
<?php if ($show_billing_column) { ?>
<td class="text-center">
<?php if ($ticket_invoice_id) { ?>
<a href="invoice.php?client_id=<?= $client_id ?>&invoice_id=<?= $ticket_invoice_id ?>"><span class="badge rounded-pill bg-success p-2">Invoiced</span></a>
<?php } elseif ($ticket_quote_id) { ?>
<a href="quote.php?client_id=<?= $client_id ?>&quote_id=<?= $ticket_quote_id ?>"><span class="badge rounded-pill bg-primary p-2">Quoted</span></a>
<?php } else { ?>
<a href="#" class="ajax-modal" data-modal-url="modals/ticket/ticket_billable.php?id=<?= $ticket_id ?>"
title="<?= $ticket_billable ? 'Billable - click to change' : 'Not billable - click to change' ?>">
<?php if ($ticket_billable) { ?>
<span class="badge rounded-pill bg-success p-2"><i class="fas fa-fw fa-dollar-sign"></i></span>
<?php } else { ?>
<span class="badge rounded-pill bg-secondary p-2"><i class="fas fa-fw fa-minus"></i></span>
<?php } ?>
</a>
<?php } ?>
</td>
<?php } ?>
<!-- Ticket Priority -->
<td>
<a href="#"
<?php if (lookupUserPermission("module_support") >= 2 && empty($ticket_closed_at)) { ?>
class="ajax-modal"
data-modal-url="modals/ticket/ticket_priority.php?id=<?= $ticket_id ?>"
<?php } ?>
>
<span class="p-2 badge rounded-pill text-bg-<?= $ticket_priority_color ?>"><?= $ticket_priority ?></span>
</a>
</td>
<!-- Ticket Status -->
<td>
<span class="badge rounded-pill text-light p-2" style="background-color: <?= $ticket_status_color ?>"><?= $ticket_status_name ?></span>
<?php if (!empty($ticket_scheduled_for)) { ?>
<div class="mt-1"><small class="text-secondary"><i class="fas fa-fw fa-calendar-check me-1"></i><?= $ticket_scheduled_for ?></small></div>
<?php } ?>
</td>
<!-- Ticket SLA state (only when SLAs are in use) -->
<?php if ($sla_filter_in_use) { ?>
<td class="text-nowrap">
<?php
if (!intval($row['ticket_sla_id'])) {
echo "<span class='text-muted'>-</span>";
} elseif ($ticket_sla_paused) {
echo "<span class='badge rounded-pill bg-secondary p-2' title='The resolution clock is paused in this status'><i class='fas fa-fw fa-pause'></i> Paused</span>";
} elseif ($ticket_sla_alert_stage == 2) {
echo "<span class='badge rounded-pill bg-danger p-2'><i class='fas fa-fw fa-stopwatch'></i> Breached</span>";
} elseif ($ticket_sla_alert_stage == 1) {
echo "<span class='badge rounded-pill bg-warning p-2'><i class='fas fa-fw fa-stopwatch'></i> At risk</span>";
} elseif (!$ticket_is_open) {
$sla_met = intval($row['ticket_response_sla_met'] ?? 0) && (is_null($row['ticket_resolution_due_at']) || intval($row['ticket_resolution_sla_met'] ?? 0));
echo $sla_met ? "<span class='badge rounded-pill bg-success p-2'>Met</span>" : "<span class='text-muted'>-</span>";
} else {
// Whichever clock is still running is the one worth showing
$sla_due_at = empty($row['ticket_first_response_at']) ? $row['ticket_response_due_at'] : $row['ticket_resolution_due_at'];
$sla_due_label = empty($row['ticket_first_response_at']) ? 'First response due' : 'Resolution due';
if (!empty($sla_due_at)) {
echo "<small class='text-secondary' title='" . escapeHtml($sla_due_label) . " " . escapeHtml($sla_due_at) . "'>" . timeAgo($sla_due_at) . "</small>";
} else {
echo "<span class='text-muted'>-</span>";
}
}
?>
</td>
<?php } ?>
<!-- Ticket Assigned agent -->
<td>
<a href="#"
<?php if (lookupUserPermission("module_support") >= 2 && empty($ticket_closed_at)) { ?>
class="ajax-modal"
data-modal-url="modals/ticket/ticket_assign.php?id=<?= $ticket_id ?>"
<?php } ?>
>
<?= $ticket_assigned_to_display ?>
</a>
</td>
<!-- Ticket Last Response -->
<td>
<div title="<?= $ticket_reply_created_at ?>"><?= $ticket_reply_created_at_time_ago ?></div>
<?php if ($ticket_reply_by_display) { ?>
<small class="text-secondary"><?= $ticket_reply_by_display ?><?php if ($ticket_reply_type == "Client") { echo " <i class='fas fa-fw fa-reply text-warning' title='Client replied last'></i>"; } ?></small>
<?php } ?>
</td>
<!-- Ticket Created At -->
<td>
<?= $ticket_created_at_time_ago ?>
<br>
<small class="text-secondary"><?= date("$config_date_format $config_time_format", strtotime($ticket_created_at)) ?></small>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php"; ?>
<?php } ?>
</div>
</div>

View File

@@ -323,8 +323,8 @@ if ($date_filter_active) {
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-life-ring me-2"></i>Tickets
<small class="ms-3">
<a href="<?= ticketsFilterUrl(['state' => 'open', 'status' => null]) ?>" class="badge rounded-pill p-1 <?= (!$status_filter && $state == 'open') ? 'bg-light text-dark' : 'text-light' ?>"><strong><?= $total_tickets_open ?></strong> Open</a> |
@@ -350,7 +350,7 @@ if ($date_filter_active) {
<?php } ?>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
@@ -364,9 +364,9 @@ if ($date_filter_active) {
<input type="hidden" name="billing" value="<?= escapeHtml($billing_filter) ?>">
<?php } ?>
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="mb-3 mb-2 mb-sm-0">
<div>
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Tickets">
<button class="btn <?= $hidden_filter_count ? 'btn-warning' : 'btn-secondary' ?>" type="button" data-bs-toggle="collapse" data-bs-target="#advancedFilter" title="Filters">
@@ -395,10 +395,10 @@ if ($date_filter_active) {
</div>
</div>
<div class="collapse mt-3 <?php if ($hidden_filter_count) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if ($hidden_filter_count) { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3 mb-md-0">
<div>
<label>Status</label>
<select onchange="this.form.submit()" class="form-select select2" name="status[]" data-placeholder="Any status" multiple>
<?php
@@ -416,7 +416,7 @@ if ($date_filter_active) {
</div>
<div class="col-md-3">
<div class="mb-3 mb-md-0">
<div>
<label>Assigned to</label>
<select onchange="this.form.submit()" class="form-select select2" name="assigned">
<option value="">Anyone</option>
@@ -437,7 +437,7 @@ if ($date_filter_active) {
</div>
<div class="col-md-3">
<div class="mb-3 mb-md-0">
<div>
<label>Priority</label>
<select onchange="this.form.submit()" class="form-select select2" name="priority">
<option value="">Any priority</option>
@@ -449,7 +449,7 @@ if ($date_filter_active) {
</div>
<div class="col-md-3">
<div class="mb-3 mb-md-0">
<div>
<label>Category</label>
<select onchange="this.form.submit()" class="form-select select2" name="category">
<option value="">Any category</option>
@@ -471,7 +471,7 @@ if ($date_filter_active) {
<div class="row mt-3">
<div class="col-md-3">
<div class="mb-3 mb-md-0">
<div>
<label>Project</label>
<select onchange="this.form.submit()" class="form-select select2" name="project">
<option value="">Any project</option>
@@ -492,7 +492,7 @@ if ($date_filter_active) {
<?php if ($show_billing_column) { ?>
<div class="col-md-3">
<div class="mb-3 mb-md-0">
<div>
<label>Billing</label>
<select class="form-select select2" name="billing" onchange="this.form.submit()">
<option value="">Any</option>
@@ -506,7 +506,7 @@ if ($date_filter_active) {
<?php if ($sla_filter_in_use) { ?>
<div class="col-md-3">
<div class="mb-3 mb-md-0">
<div>
<label>SLA</label>
<select class="form-select select2" name="sla" onchange="this.form.submit()">
<option value="">Any SLA state</option>
@@ -519,7 +519,7 @@ if ($date_filter_active) {
<?php } ?>
<div class="col-md-3">
<div class="mb-3 mb-md-0">
<div>
<label>Created</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date'] ?? '') ?>">

View File

@@ -217,8 +217,8 @@ if ($account_filter) {
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-list-alt me-2"></i>Transactions</h3>
<?php if ($account_filter) { ?>
<div class="card-tools">
@@ -227,12 +227,12 @@ if ($account_filter) {
<?php } ?>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-end">
<div class="col-sm-3">
<div class="mb-3">
<label>Search</label>
<div>
<label class="form-label">Search</label>
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Transactions">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@@ -240,8 +240,8 @@ if ($account_filter) {
</div>
</div>
<div class="col-sm-3">
<div class="mb-3">
<label>Account</label>
<div>
<label class="form-label">Account</label>
<select class="form-select select2" name="account" onchange="this.form.submit()">
<option value="">- Select an Account -</option>
@@ -270,8 +270,8 @@ if ($account_filter) {
</div>
</div>
<div class="col-sm-3">
<div class="mb-3">
<label>Type</label>
<div>
<label class="form-label">Type</label>
<select class="form-select select2" name="type" onchange="this.form.submit()">
<option value="">- All Types -</option>
@@ -283,8 +283,8 @@ if ($account_filter) {
</div>
</div>
<div class="col-sm-3">
<div class="mb-3">
<label>Category</label>
<div>
<label class="form-label">Category</label>
<select class="form-select select2" name="category" onchange="this.form.submit()">
<option value="">- All Categories -</option>
@@ -303,10 +303,10 @@ if ($account_filter) {
</div>
</div>
</div>
<div class="row">
<div class="row g-3">
<div class="col-sm-3">
<div class="mb-3 mb-md-0">
<label>Client</label>
<div>
<label class="form-label">Client</label>
<select class="form-select select2" name="client" onchange="this.form.submit()">
<option value="">- All Clients -</option>
@@ -325,8 +325,8 @@ if ($account_filter) {
</div>
</div>
<div class="col-sm-3">
<div class="mb-3 mb-md-0">
<label>Payment Method</label>
<div>
<label class="form-label">Payment Method</label>
<select class="form-select select2" name="payment_method" onchange="this.form.submit()">
<option value="">- All Methods -</option>
@@ -344,8 +344,8 @@ if ($account_filter) {
</div>
</div>
<div class="col-sm-3">
<div class="mb-3 mb-md-0">
<label>Amount Range</label>
<div>
<label class="form-label">Amount Range</label>
<div class="input-group">
<input type="number" step="0.01" min="0" class="form-control" name="amount_min" value="<?= $amount_min_filter ?>" placeholder="Min" onchange="this.form.submit()">
<input type="number" step="0.01" min="0" class="form-control" name="amount_max" value="<?= $amount_max_filter ?>" placeholder="Max" onchange="this.form.submit()">
@@ -353,8 +353,8 @@ if ($account_filter) {
</div>
</div>
<div class="col-sm-3">
<div class="mb-3 mb-md-0">
<label>Date Range</label>
<div>
<label class="form-label">Date Range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -363,181 +363,181 @@ if ($account_filter) {
</div>
</div>
</form>
<hr>
</div>
<?php if ($account_filter) { ?>
<?php if ($account_filter) { ?>
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-success">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_in, $account_currency_code) ?></h3>
<p>Money In</p>
</div>
<div class="icon">
<i class="fa fa-hand-holding-usd"></i>
</div>
<div class="row">
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-success">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_in, $account_currency_code) ?></h3>
<p>Money In</p>
</div>
<div class="icon">
<i class="fa fa-hand-holding-usd"></i>
</div>
</div>
<!-- ./col -->
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-danger">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_out, $account_currency_code) ?></h3>
<p>Money Out</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
</div>
<!-- ./col -->
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box <?php if ($summary_total_net < 0) { echo "bg-danger"; } else { echo "bg-primary"; } ?>">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_net, $account_currency_code) ?></h3>
<p>Net</p>
</div>
<div class="icon">
<i class="fa fa-balance-scale"></i>
</div>
</div>
</div>
<!-- ./col -->
</div>
<!-- ./col -->
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transaction_date&order=<?= $disp ?>">
Date <?php if ($sort == 'transaction_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transaction_type&order=<?= $disp ?>">
Type <?php if ($sort == 'transaction_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transaction_category&order=<?= $disp ?>">
Category <?php if ($sort == 'transaction_category') { echo $order_icon; } ?>
</a>
/
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=transaction_description&order=<?= $disp ?>">
Description <?php if ($sort == 'transaction_description') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transaction_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'transaction_amount') { echo $order_icon; } ?>
</a>
</th>
<?php if ($balance_visible) { ?>
<th class="text-end">Balance</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box bg-danger">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_out, $account_currency_code) ?></h3>
<p>Money Out</p>
</div>
<div class="icon">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
</div>
<!-- ./col -->
while ($row = mysqli_fetch_assoc($sql)) {
$transaction_id = intval($row['transaction_id']);
$transaction_transfer_id = intval($row['transaction_transfer_id']);
$transaction_invoice_id = intval($row['transaction_invoice_id']);
$transaction_type = escapeHtml($row['transaction_type']);
$transaction_date = escapeHtml($row['transaction_date']);
$transaction_description = escapeHtml($row['transaction_description']);
$transaction_category = escapeHtml($row['transaction_category']);
$transaction_other_account = escapeHtml($row['transaction_other_account']);
$transaction_amount = floatval($row['transaction_amount']);
$transaction_balance = floatval($row['transaction_balance']);
$transaction_currency_code = escapeHtml($row['transaction_currency_code']);
<div class="col-lg-4 col-md-6 col-sm-12">
<!-- small box -->
<div class="small-box <?php if ($summary_total_net < 0) { echo "bg-danger"; } else { echo "bg-primary"; } ?>">
<div class="inner">
<h3><?= numfmt_format_currency($currency_format, $summary_total_net, $account_currency_code) ?></h3>
<p>Net</p>
</div>
<div class="icon">
<i class="fa fa-balance-scale"></i>
</div>
</div>
</div>
<!-- ./col -->
</div>
// Category cell display - transfers show the other account instead of a category
if ($transaction_type == 'Transfer In') {
$transaction_category_display = "<i class='fas fa-fw fa-arrow-left text-secondary me-1'></i>From $transaction_other_account";
} elseif ($transaction_type == 'Transfer Out') {
$transaction_category_display = "<i class='fas fa-fw fa-arrow-right text-secondary me-1'></i>To $transaction_other_account";
} else {
$transaction_category_display = $transaction_category;
}
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transaction_date&order=<?= $disp ?>">
Date <?php if ($sort == 'transaction_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transaction_type&order=<?= $disp ?>">
Type <?php if ($sort == 'transaction_type') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transaction_category&order=<?= $disp ?>">
Category <?php if ($sort == 'transaction_category') { echo $order_icon; } ?>
</a>
/
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=transaction_description&order=<?= $disp ?>">
Description <?php if ($sort == 'transaction_description') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transaction_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'transaction_amount') { echo $order_icon; } ?>
</a>
</th>
<?php if ($balance_visible) { ?>
<th class="text-end">Balance</th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php
// Badge color based on type
if ($transaction_type == 'Revenue' || $transaction_type == 'Payment') {
$transaction_badge_color = "success";
} elseif ($transaction_type == 'Expense') {
$transaction_badge_color = "danger";
} else {
$transaction_badge_color = "secondary";
}
while ($row = mysqli_fetch_assoc($sql)) {
$transaction_id = intval($row['transaction_id']);
$transaction_transfer_id = intval($row['transaction_transfer_id']);
$transaction_invoice_id = intval($row['transaction_invoice_id']);
$transaction_type = escapeHtml($row['transaction_type']);
$transaction_date = escapeHtml($row['transaction_date']);
$transaction_description = escapeHtml($row['transaction_description']);
$transaction_category = escapeHtml($row['transaction_category']);
$transaction_other_account = escapeHtml($row['transaction_other_account']);
$transaction_amount = floatval($row['transaction_amount']);
$transaction_balance = floatval($row['transaction_balance']);
$transaction_currency_code = escapeHtml($row['transaction_currency_code']);
// Amount text color
if ($transaction_amount < 0) {
$transaction_amount_color = "text-danger";
} else {
$transaction_amount_color = "text-success";
}
// Balance text color
if ($transaction_balance < 0) {
$transaction_balance_color = "text-danger";
} else {
$transaction_balance_color = "";
}
// Route the date link to the right edit modal based on type
if ($transaction_type == 'Transfer In' || $transaction_type == 'Transfer Out') {
$transaction_modal_url = "modals/transfer/transfer_edit.php?id=$transaction_transfer_id";
} elseif ($transaction_type == 'Expense') {
$transaction_modal_url = "modals/expense/expense_edit.php?id=$transaction_id";
} elseif ($transaction_type == 'Revenue') {
$transaction_modal_url = "modals/revenue/revenue_edit.php?id=$transaction_id";
} else {
$transaction_modal_url = "";
}
?>
<tr>
<td>
<?php if ($transaction_type == 'Payment') { ?>
<a class="text-bold" href="invoice.php?invoice_id=<?= $transaction_invoice_id ?>">
<?= $transaction_date ?>
</a>
<?php } else { ?>
<a class="text-bold ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="<?= $transaction_modal_url ?>">
<?= $transaction_date ?>
</a>
<?php } ?>
</td>
<td><span class="badge text-bg-<?= $transaction_badge_color ?>"><?= $transaction_type ?></span></td>
<td>
<?= $transaction_category_display ?>
<div class="text-secondary"><small><?= truncate($transaction_description, 60) ?></small></div>
</td>
<td class="text-end font-monospace <?= $transaction_amount_color ?>"><?= numfmt_format_currency($currency_format, $transaction_amount, $transaction_currency_code) ?></td>
<?php if ($balance_visible) { ?>
<td class="text-end font-monospace <?= $transaction_balance_color ?>"><?= numfmt_format_currency($currency_format, $transaction_balance, $transaction_currency_code) ?></td>
<?php } ?>
</tr>
<?php
// Category cell display - transfers show the other account instead of a category
if ($transaction_type == 'Transfer In') {
$transaction_category_display = "<i class='fas fa-fw fa-arrow-left text-secondary me-1'></i>From $transaction_other_account";
} elseif ($transaction_type == 'Transfer Out') {
$transaction_category_display = "<i class='fas fa-fw fa-arrow-right text-secondary me-1'></i>To $transaction_other_account";
} else {
$transaction_category_display = $transaction_category;
}
// Badge color based on type
if ($transaction_type == 'Revenue' || $transaction_type == 'Payment') {
$transaction_badge_color = "success";
} elseif ($transaction_type == 'Expense') {
$transaction_badge_color = "danger";
} else {
$transaction_badge_color = "secondary";
}
// Amount text color
if ($transaction_amount < 0) {
$transaction_amount_color = "text-danger";
} else {
$transaction_amount_color = "text-success";
}
// Balance text color
if ($transaction_balance < 0) {
$transaction_balance_color = "text-danger";
} else {
$transaction_balance_color = "";
}
// Route the date link to the right edit modal based on type
if ($transaction_type == 'Transfer In' || $transaction_type == 'Transfer Out') {
$transaction_modal_url = "modals/transfer/transfer_edit.php?id=$transaction_transfer_id";
} elseif ($transaction_type == 'Expense') {
$transaction_modal_url = "modals/expense/expense_edit.php?id=$transaction_id";
} elseif ($transaction_type == 'Revenue') {
$transaction_modal_url = "modals/revenue/revenue_edit.php?id=$transaction_id";
} else {
$transaction_modal_url = "";
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
<tr>
<td>
<?php if ($transaction_type == 'Payment') { ?>
<a class="text-bold" href="invoice.php?invoice_id=<?= $transaction_invoice_id ?>">
<?= $transaction_date ?>
</a>
<?php } else { ?>
<a class="text-bold ajax-modal" href="#"
data-modal-size="lg"
data-modal-url="<?= $transaction_modal_url ?>">
<?= $transaction_date ?>
</a>
<?php } ?>
</td>
<td><span class="badge text-bg-<?= $transaction_badge_color ?>"><?= $transaction_type ?></span></td>
<td>
<?= $transaction_category_display ?>
<div class="text-secondary"><small><?= truncate($transaction_description, 60) ?></small></div>
</td>
<td class="text-end font-monospace <?= $transaction_amount_color ?>"><?= numfmt_format_currency($currency_format, $transaction_amount, $transaction_currency_code) ?></td>
<?php if ($balance_visible) { ?>
<td class="text-end font-monospace <?= $transaction_balance_color ?>"><?= numfmt_format_currency($currency_format, $transaction_balance, $transaction_currency_code) ?></td>
<?php } ?>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php"; ?>
<?php } else { ?>
@@ -545,7 +545,6 @@ if ($account_filter) {
<?php } ?>
</div>
</div>
<?php

View File

@@ -44,17 +44,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fas fa-fw fa-exchange-alt me-2"></i>Transfers</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/transfer/transfer_add.php"><i class="fas fa-plus me-2"></i>New Transfer</button>
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="row">
<div class="card-header py-3">
<form autocomplete="off">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Transfers">
@@ -63,11 +63,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01' || $account_from_filter || $account_to_filter ) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01' || $account_from_filter || $account_to_filter ) { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -75,8 +75,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<label>Account From</label>
<div>
<label class="form-label">Account From</label>
<select class="form-select select2" name="account_from" onchange="this.form.submit()">
<option value="">- All Accounts -</option>
@@ -95,8 +95,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="col-sm-2">
<div class="mb-3">
<label>Account To</label>
<div>
<label class="form-label">Account To</label>
<select class="form-select select2" name="account_to" onchange="this.form.submit()">
<option value="">- All Accounts -</option>
@@ -117,133 +117,132 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_date&order=<?= $disp ?>">
Date <?php if ($sort == 'transfer_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_account_from&order=<?= $disp ?>">
From Account <?php if ($sort == 'transfer_account_from') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_account_to&order=<?= $disp ?>">
To Account <?php if ($sort == 'transfer_account_to') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_method&order=<?= $disp ?>">
Method <?php if ($sort == 'transfer_method') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_notes&order=<?= $disp ?>">
Notes <?php if ($sort == 'transfer_notes') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'transfer_amount') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_date&order=<?= $disp ?>">
Date <?php if ($sort == 'transfer_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_account_from&order=<?= $disp ?>">
From Account <?php if ($sort == 'transfer_account_from') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_account_to&order=<?= $disp ?>">
To Account <?php if ($sort == 'transfer_account_to') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_method&order=<?= $disp ?>">
Method <?php if ($sort == 'transfer_method') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_notes&order=<?= $disp ?>">
Notes <?php if ($sort == 'transfer_notes') { echo $order_icon; } ?>
</a>
</th>
<th class="text-end">
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=transfer_amount&order=<?= $disp ?>">
Amount <?php if ($sort == 'transfer_amount') { echo $order_icon; } ?>
</a>
</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$transfer_id = intval($row['transfer_id']);
$transfer_date = escapeHtml($row['transfer_date']);
$transfer_account_from = intval($row['transfer_account_from']);
$transfer_account_to = intval($row['transfer_account_to']);
$transfer_amount = floatval($row['transfer_amount']);
$transfer_method = escapeHtml($row['transfer_method']);
if($transfer_method) {
$transfer_method_display = $transfer_method;
} else {
$transfer_method_display = "-";
}
$transfer_notes = escapeHtml($row['transfer_notes']);
if(empty($transfer_notes)) {
$transfer_notes_display = "-";
} else {
$transfer_notes_display = nl2br($transfer_notes);
}
$transfer_created_at = escapeHtml($row['transfer_created_at']);
$expense_id = intval($row['transfer_expense_id']);
$revenue_id = intval($row['transfer_revenue_id']);
while ($row = mysqli_fetch_assoc($sql)) {
$transfer_id = intval($row['transfer_id']);
$transfer_date = escapeHtml($row['transfer_date']);
$transfer_account_from = intval($row['transfer_account_from']);
$transfer_account_to = intval($row['transfer_account_to']);
$transfer_amount = floatval($row['transfer_amount']);
$transfer_method = escapeHtml($row['transfer_method']);
if($transfer_method) {
$transfer_method_display = $transfer_method;
} else {
$transfer_method_display = "-";
}
$transfer_notes = escapeHtml($row['transfer_notes']);
if(empty($transfer_notes)) {
$transfer_notes_display = "-";
} else {
$transfer_notes_display = nl2br($transfer_notes);
}
$transfer_created_at = escapeHtml($row['transfer_created_at']);
$expense_id = intval($row['transfer_expense_id']);
$revenue_id = intval($row['transfer_revenue_id']);
$sql_from = mysqli_query($mysqli, "SELECT account_archived_at, account_name FROM accounts WHERE account_id = $transfer_account_from");
$row = mysqli_fetch_assoc($sql_from);
$account_name_from = escapeHtml($row['account_name']);
$account_from_archived_at = escapeHtml($row['account_archived_at']);
if (empty($account_from_archived_at)) {
$account_from_archived_display = "";
} else {
$account_from_archived_display = "Archived - ";
}
$sql_to = mysqli_query($mysqli, "SELECT account_archived_at, account_name FROM accounts WHERE account_id = $transfer_account_to");
$row = mysqli_fetch_assoc($sql_to);
$account_name_to = escapeHtml($row['account_name']);
$account_to_archived_at = escapeHtml($row['account_archived_at']);
if (empty($account_to_archived_at)) {
$account_to_archived_display = "";
} else {
$account_to_archived_display = "Archived - ";
}
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url = "modals/transfer/transfer_edit.php?id=<?= $transfer_id ?>">
<?= $transfer_date ?>
</a>
</td>
<td><?= "$account_from_archived_display$account_name_from" ?></td>
<td><?= "$account_to_archived_display$account_name_to" ?></td>
<td><?= $transfer_method_display ?></td>
<td><?= $transfer_notes_display ?></td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $transfer_amount, $session_company_currency) ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url = "modals/transfer/transfer_edit.php?id=<?= $transfer_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_transfer=<?= $transfer_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
$sql_from = mysqli_query($mysqli, "SELECT account_archived_at, account_name FROM accounts WHERE account_id = $transfer_account_from");
$row = mysqli_fetch_assoc($sql_from);
$account_name_from = escapeHtml($row['account_name']);
$account_from_archived_at = escapeHtml($row['account_archived_at']);
if (empty($account_from_archived_at)) {
$account_from_archived_display = "";
} else {
$account_from_archived_display = "Archived - ";
}
$sql_to = mysqli_query($mysqli, "SELECT account_archived_at, account_name FROM accounts WHERE account_id = $transfer_account_to");
$row = mysqli_fetch_assoc($sql_to);
$account_name_to = escapeHtml($row['account_name']);
$account_to_archived_at = escapeHtml($row['account_archived_at']);
if (empty($account_to_archived_at)) {
$account_to_archived_display = "";
} else {
$account_to_archived_display = "Archived - ";
}
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url = "modals/transfer/transfer_edit.php?id=<?= $transfer_id ?>">
<?= $transfer_date ?>
</a>
</td>
<td><?= "$account_from_archived_display$account_name_from" ?></td>
<td><?= "$account_to_archived_display$account_name_to" ?></td>
<td><?= $transfer_method_display ?></td>
<td><?= $transfer_notes_display ?></td>
<td class="text-end font-monospace"><?= numfmt_format_currency($currency_format, $transfer_amount, $session_company_currency) ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#"
data-modal-url = "modals/transfer/transfer_edit.php?id=<?= $transfer_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_transfer=<?= $transfer_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -33,8 +33,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2"><i class="fa fa-route me-2"></i>Trips</h3>
<div class="card-tools">
<div class="btn-group">
@@ -52,12 +52,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
<div class="card-body">
<form class="mb-4" autocomplete="off">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<div class="row">
<div class="row g-2 align-items-end">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Trips">
@@ -70,11 +70,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="collapse mt-3 <?php if (isset($_GET['dtf']) && $_GET['dtf'] !== '1970-01-01') { echo"show"; } ?>" id="advancedFilter">
<div class="row g-3">
<div class="col-md-3">
<div class="mb-3">
<label>Date range</label>
<div>
<label class="form-label">Date range</label>
<input type="text" id="dateFilter" class="form-control" autocomplete="off">
<input type="hidden" name="canned_date" id="canned_date" value="<?= escapeHtml($_GET['canned_date']) ?? '' ?>">
<input type="hidden" name="dtf" id="dtf" value="<?= escapeHtml($dtf ?? '') ?>">
@@ -84,137 +84,136 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</form>
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_date&order=<?= $disp ?>">
Date <?php if ($sort == 'trip_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Driver <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_purpose&order=<?= $disp ?>">
Purpose <?php if ($sort == 'trip_purpose') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_source&order=<?= $disp ?>">
Source <?php if ($sort == 'trip_source') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_destination&order=<?= $disp ?>">
Destination <?php if ($sort == 'trip_destination') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_miles&order=<?= $disp ?>">
Miles <?php if ($sort == 'trip_miles') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$trip_id = intval($row['trip_id']);
$trip_date = escapeHtml($row['trip_date']);
$trip_purpose = escapeHtml($row['trip_purpose']);
$trip_source = escapeHtml($row['trip_source']);
$trip_destination = escapeHtml($row['trip_destination']);
$trip_miles = number_format(floatval($row['trip_miles']),1);
$trip_user_id = intval($row['trip_user_id']);
$trip_created_at = escapeHtml($row['trip_created_at']);
$trip_archived_at = escapeHtml($row['trip_archived_at']);
$round_trip = escapeHtml($row['round_trip']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
if (empty($client_name)) {
$client_name_display = "-";
} else {
$client_name_display = "<a href='trips.php?client_id=$client_id'>$client_name</a>";
}
if ($round_trip == 1) {
$round_trip_display = "<i class='fa fa-fw fa-sync-alt text-secondary'></i>";
} else {
$round_trip_display = "";
}
$user_name = escapeHtml($row['user_name']);
if (empty($user_name)) {
$user_name_display = "-";
} else {
$user_name_display = $user_name;
}
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/trip/trip_edit.php?<?= $client_url ?>&id=<?= $trip_id ?>">
<?= $trip_date ?>
</a>
</td>
<td><?= $user_name_display ?></td>
<td><?= $trip_purpose ?></td>
<td><?= $trip_source ?></td>
<td><?= $trip_destination ?></td>
<td><?= "<span class='text-end font-monospace'>$trip_miles</span> $round_trip_display" ?></td>
<?php if (!$client_url) { ?>
<td><?= $client_name_display ?></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="//maps.google.com?q=<?= $trip_source ?> to <?= $trip_destination ?>" target="_blank">
<i class="fa fa-fw fa-map-marker-alt me-2"></i>Map it<i class="fa fa-fw fa-external-link-alt ms-2"></i>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/trip/trip_edit.php?<?= $client_url ?>&id=<?= $trip_id ?>">
<i class="fa fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/trip/trip_copy.php?<?= $client_url ?>&id=<?= $trip_id ?>">
<i class="fa fa-fw fa-copy me-2"></i>Copy
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_trip=<?= $trip_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fa fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_date&order=<?= $disp ?>">
Date <?php if ($sort == 'trip_date') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=user_name&order=<?= $disp ?>">
Driver <?php if ($sort == 'user_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_purpose&order=<?= $disp ?>">
Purpose <?php if ($sort == 'trip_purpose') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_source&order=<?= $disp ?>">
Source <?php if ($sort == 'trip_source') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_destination&order=<?= $disp ?>">
Destination <?php if ($sort == 'trip_destination') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=trip_miles&order=<?= $disp ?>">
Miles <?php if ($sort == 'trip_miles') { echo $order_icon; } ?>
</a>
</th>
<?php if (!$client_url) { ?>
<th>
<a class="text-dark" href="?<?= $url_query_strings_sort ?>&sort=client_name&order=<?= $disp ?>">
Client <?php if ($sort == 'client_name') { echo $order_icon; } ?>
</a>
</th>
<?php } ?>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$trip_id = intval($row['trip_id']);
$trip_date = escapeHtml($row['trip_date']);
$trip_purpose = escapeHtml($row['trip_purpose']);
$trip_source = escapeHtml($row['trip_source']);
$trip_destination = escapeHtml($row['trip_destination']);
$trip_miles = number_format(floatval($row['trip_miles']),1);
$trip_user_id = intval($row['trip_user_id']);
$trip_created_at = escapeHtml($row['trip_created_at']);
$trip_archived_at = escapeHtml($row['trip_archived_at']);
$round_trip = escapeHtml($row['round_trip']);
$client_id = intval($row['client_id']);
$client_name = escapeHtml($row['client_name']);
if (empty($client_name)) {
$client_name_display = "-";
} else {
$client_name_display = "<a href='trips.php?client_id=$client_id'>$client_name</a>";
}
if ($round_trip == 1) {
$round_trip_display = "<i class='fa fa-fw fa-sync-alt text-secondary'></i>";
} else {
$round_trip_display = "";
}
$user_name = escapeHtml($row['user_name']);
if (empty($user_name)) {
$user_name_display = "-";
} else {
$user_name_display = $user_name;
}
?>
<tr>
<td>
<a class="text-dark ajax-modal" href="#"
data-modal-url="modals/trip/trip_edit.php?<?= $client_url ?>&id=<?= $trip_id ?>">
<?= $trip_date ?>
</a>
</td>
<td><?= $user_name_display ?></td>
<td><?= $trip_purpose ?></td>
<td><?= $trip_source ?></td>
<td><?= $trip_destination ?></td>
<td><?= "<span class='text-end font-monospace'>$trip_miles</span> $round_trip_display" ?></td>
<?php if (!$client_url) { ?>
<td><?= $client_name_display ?></td>
<?php } ?>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="//maps.google.com?q=<?= $trip_source ?> to <?= $trip_destination ?>" target="_blank">
<i class="fa fa-fw fa-map-marker-alt me-2"></i>Map it<i class="fa fa-fw fa-external-link-alt ms-2"></i>
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/trip/trip_edit.php?<?= $client_url ?>&id=<?= $trip_id ?>">
<i class="fa fa-fw fa-edit me-2"></i>Edit
</a>
<a class="dropdown-item ajax-modal" href="#"
data-modal-url="modals/trip/trip_copy.php?<?= $client_url ?>&id=<?= $trip_id ?>">
<i class="fa fa-fw fa-copy me-2"></i>Copy
</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_trip=<?= $trip_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fa fa-fw fa-trash me-2"></i>Delete
</a>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php require_once "../includes/filter_footer.php";
?>
</div>
<?php

View File

@@ -34,8 +34,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
?>
<div class="card card-dark">
<div class="card-header py-2">
<div class="card">
<div class="card-header bg-dark py-2">
<h3 class="card-title mt-2">
<i class="fas fa-fw fa-building me-2"></i>Vendors
</h3>
@@ -61,16 +61,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="card-body">
<div class="card-header py-3">
<form autocomplete="off">
<?php if ($client_url) { ?>
<input type="hidden" name="client_id" value="<?= $client_id ?>">
<?php } ?>
<input type="hidden" name="archived" value="<?= $archived ?>">
<div class="row">
<div class="row g-2 align-items-center">
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Vendors">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@@ -110,178 +110,178 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
</div>
</form>
<hr>
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
</div>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_description&order=<?= $disp ?>">
Description <?php if ($sort == 'vendor_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_contact_name&order=<?= $disp ?>">
Contact <?php if ($sort == 'vendor_contact_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_website&order=<?= $disp ?>">
Website <?php if ($sort == 'vendor_website') { echo $order_icon; } ?>
</a>
</th>
<th></th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
<form id="bulkActions" action="post.php" method="post">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
while ($row = mysqli_fetch_assoc($sql)) {
$vendor_id = intval($row['vendor_id']);
$vendor_name = escapeHtml($row['vendor_name']);
$vendor_description = escapeHtml($row['vendor_description']);
if ($vendor_description) {
$vendor_description_display = $vendor_description;
} else {
$vendor_description_display = "-";
}
$vendor_account_number = escapeHtml($row['vendor_account_number']);
if ($vendor_account_number) {
$vendor_account_number_display = "<div class='text-secondary'>Account #: <span class='font-monospace'>$vendor_account_number</span></div>";
} else {
$vendor_account_number_display = '';
}
$vendor_contact_name = escapeHtml($row['vendor_contact_name']);
if ($vendor_contact_name) {
$vendor_contact_name_display = $vendor_contact_name;
} else {
$vendor_contact_name_display = "-";
}
$vendor_phone_country_code = escapeHtml($row['vendor_phone_country_code']);
$vendor_phone = escapeHtml(formatPhoneNumber($row['vendor_phone'], $vendor_phone_country_code));
$vendor_extension = escapeHtml($row['vendor_extension']);
$vendor_email = escapeHtml($row['vendor_email']);
$vendor_website = escapeHtml($row['vendor_website']);
if ($vendor_website) {
$vendor_website_display = "<a href='https://$vendor_website' target='_blank'>$vendor_website <i class='fa fa-external-link-alt'></i></a><button type='button' class='btn btn-sm clipboardjs' data-clipboard-text='$vendor_website'><i class='far fa-copy text-secondary'></i></button>";
} else {
$vendor_website_display = "-";
}
$vendor_hours = escapeHtml($row['vendor_hours']);
$vendor_sla = escapeHtml($row['vendor_sla']);
$vendor_code = escapeHtml($row['vendor_code']);
$vendor_notes = escapeHtml($row['vendor_notes']);
$vendor_created_at = escapeHtml($row['vendor_created_at']);
$vendor_archived_at = escapeHtml($row['vendor_archived_at']);
$vendor_template_id = intval($row['vendor_template_id']);
$vendor_template_name = escapeHtml($row['vendor_template_name']);
if ($vendor_template_id) {
$vendor_template_display = "<div class='text-secondary' title='Base Vendor Template'><i class='fas fa-puzzle-piece me-1'></i>$vendor_template_name</div>";
} else {
$vendor_template_display = "";
}
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover mb-0">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?> text-nowrap">
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input" id="selectAllCheckbox" type="checkbox" onclick="checkAll(this)">
</div>
</td>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_name&order=<?= $disp ?>">
Vendor <?php if ($sort == 'vendor_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_description&order=<?= $disp ?>">
Description <?php if ($sort == 'vendor_description') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_contact_name&order=<?= $disp ?>">
Contact <?php if ($sort == 'vendor_contact_name') { echo $order_icon; } ?>
</a>
</th>
<th>
<a class="text-secondary" href="?<?= $url_query_strings_sort ?>&sort=vendor_website&order=<?= $disp ?>">
Website <?php if ($sort == 'vendor_website') { echo $order_icon; } ?>
</a>
</th>
<th></th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<?php
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="vendor_ids[]" value="<?= $vendor_id ?>">
</div>
</td>
<td>
<a class="ajax-modal" href="#" data-modal-url="modals/vendor/vendor_edit.php?id=<?= $vendor_id ?>">
<div class="d-flex">
<i class="fas fa-fw fa-2x fa-building text-dark me-2"></i>
<div class="flex-grow-1">
<div><?= $vendor_name ?></div>
<div><small><?= $vendor_account_number_display ?><small></div>
</div>
</div>
</a>
</td>
<td>
<?= $vendor_description_display ?>
</td>
<td>
<?php
if (!empty($vendor_contact_name)) { ?>
<i class="fa fa-fw fa-user text-secondary me-2 mb-2"></i><?= $vendor_contact_name_display ?>
<br>
<?php } else {
echo $vendor_contact_name_display;
}
if (!empty($vendor_phone)) { ?>
<i class="fa fa-fw fa-phone text-secondary me-2 mb-2"></i><?= $vendor_phone ?>
<br>
<?php }
if (!empty($vendor_email)) { ?>
<i class="fa fa-fw fa-envelope text-secondary me-2 mb-2"></i><?= $vendor_email ?>
<br>
<?php } ?>
</td>
<td><?= $vendor_website_display ?></td>
<td><?= $vendor_template_display ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/vendor/vendor_edit.php?id=<?= $vendor_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($vendor_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_vendor=<?= $vendor_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_vendor=<?= $vendor_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_vendor=<?= $vendor_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
while ($row = mysqli_fetch_assoc($sql)) {
$vendor_id = intval($row['vendor_id']);
$vendor_name = escapeHtml($row['vendor_name']);
$vendor_description = escapeHtml($row['vendor_description']);
if ($vendor_description) {
$vendor_description_display = $vendor_description;
} else {
$vendor_description_display = "-";
}
$vendor_account_number = escapeHtml($row['vendor_account_number']);
if ($vendor_account_number) {
$vendor_account_number_display = "<div class='text-secondary'>Account #: <span class='font-monospace'>$vendor_account_number</span></div>";
} else {
$vendor_account_number_display = '';
}
$vendor_contact_name = escapeHtml($row['vendor_contact_name']);
if ($vendor_contact_name) {
$vendor_contact_name_display = $vendor_contact_name;
} else {
$vendor_contact_name_display = "-";
}
$vendor_phone_country_code = escapeHtml($row['vendor_phone_country_code']);
$vendor_phone = escapeHtml(formatPhoneNumber($row['vendor_phone'], $vendor_phone_country_code));
$vendor_extension = escapeHtml($row['vendor_extension']);
$vendor_email = escapeHtml($row['vendor_email']);
$vendor_website = escapeHtml($row['vendor_website']);
if ($vendor_website) {
$vendor_website_display = "<a href='https://$vendor_website' target='_blank'>$vendor_website <i class='fa fa-external-link-alt'></i></a><button type='button' class='btn btn-sm clipboardjs' data-clipboard-text='$vendor_website'><i class='far fa-copy text-secondary'></i></button>";
} else {
$vendor_website_display = "-";
}
$vendor_hours = escapeHtml($row['vendor_hours']);
$vendor_sla = escapeHtml($row['vendor_sla']);
$vendor_code = escapeHtml($row['vendor_code']);
$vendor_notes = escapeHtml($row['vendor_notes']);
$vendor_created_at = escapeHtml($row['vendor_created_at']);
$vendor_archived_at = escapeHtml($row['vendor_archived_at']);
$vendor_template_id = intval($row['vendor_template_id']);
$vendor_template_name = escapeHtml($row['vendor_template_name']);
if ($vendor_template_id) {
$vendor_template_display = "<div class='text-secondary' title='Base Vendor Template'><i class='fas fa-puzzle-piece me-1'></i>$vendor_template_name</div>";
} else {
$vendor_template_display = "";
}
?>
<tr>
<td class="bg-light checkbox-column">
<div class="form-check">
<input class="form-check-input bulk-select" type="checkbox" name="vendor_ids[]" value="<?= $vendor_id ?>">
</div>
</td>
<td>
<a class="ajax-modal" href="#" data-modal-url="modals/vendor/vendor_edit.php?id=<?= $vendor_id ?>">
<div class="d-flex">
<i class="fas fa-fw fa-2x fa-building text-dark me-2"></i>
<div class="flex-grow-1">
<div><?= $vendor_name ?></div>
<div><small><?= $vendor_account_number_display ?><small></div>
</div>
</div>
</a>
</td>
<td>
<?= $vendor_description_display ?>
</td>
<td>
<?php
if (!empty($vendor_contact_name)) { ?>
<i class="fa fa-fw fa-user text-secondary me-2 mb-2"></i><?= $vendor_contact_name_display ?>
<br>
<?php } else {
echo $vendor_contact_name_display;
}
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php";
if (!empty($vendor_phone)) { ?>
<i class="fa fa-fw fa-phone text-secondary me-2 mb-2"></i><?= $vendor_phone ?>
<br>
<?php }
if (!empty($vendor_email)) { ?>
<i class="fa fa-fw fa-envelope text-secondary me-2 mb-2"></i><?= $vendor_email ?>
<br>
<?php } ?>
</td>
<td><?= $vendor_website_display ?></td>
<td><?= $vendor_template_display ?></td>
<td>
<div class="dropdown dropstart text-center">
<button class="btn btn-secondary btn-sm" type="button" data-bs-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/vendor/vendor_edit.php?id=<?= $vendor_id ?>">
<i class="fas fa-fw fa-edit me-2"></i>Edit
</a>
<?php if ($session_user_role == 3) { ?>
<?php if ($vendor_archived_at) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-info confirm-link" href="post.php?restore_vendor=<?= $vendor_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-redo me-2"></i>Restore
</a>
<?php if ($config_destructive_deletes_enable) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?delete_vendor=<?= $vendor_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-trash me-2"></i>Delete
</a>
<?php } ?>
<?php } else { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger confirm-link" href="post.php?archive_vendor=<?= $vendor_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
<i class="fas fa-fw fa-archive me-2"></i>Archive
</a>
<?php } ?>
<?php } ?>
</div>
</div>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</form>
<?php require_once "../includes/filter_footer.php";
?>
</div>
</div>
<script src="../js/bulk_actions.js"></script>

View File

@@ -550,8 +550,8 @@ a:not(.dropdown-item):not(.btn-app):not(.nav-link):not(.brand-link):not(.page-li
.py-3 is a 16px jump that makes the bar noticeably chunky. Bootstrap has no
step between the two, hence the named rule. */
.card-footer.itflow-filter-footer {
padding-top: .75rem;
padding-bottom: .75rem;
padding-top: .5rem;
padding-bottom: .5rem;
}
/* --- Primary button follows the theme -----------------------------------

View File

@@ -18,7 +18,7 @@ if ($total_found_rows > 5) {
<div class="card-footer itflow-filter-footer">
<div class="row align-items-center g-2">
<div class="col-sm">
<div class="col-auto col-sm">
<form action="post.php" method="post">
<div class="d-flex align-items-center">
<select onchange="this.form.submit()" class="form-select form-select-sm w-auto" name="change_records_per_page" aria-label="Records per page">
@@ -29,7 +29,7 @@ if ($total_found_rows > 5) {
<option <?php if ($user_config_records_per_page == 100) { echo "selected"; } ?> >100</option>
<option <?php if ($user_config_records_per_page == 500) { echo "selected"; } ?> >500</option>
</select>
<span class="text-muted small ms-2">per page</span>
<span class="text-muted small ms-2 d-none d-sm-inline">per page</span>
</div>
</form>
</div>
@@ -53,13 +53,13 @@ if ($total_found_rows > 5) {
// Now output something like "Showing X to Y of Z records"
?>
<div class="col-sm">
<div class="col col-sm">
<p class="text-center mb-0">
Showing <strong><?= $start ?></strong> to <strong><?= $end ?></strong> of <strong><?= $total_found_rows ?></strong> records
</p>
</div>
<div class="col-sm">
<ul class="pagination justify-content-sm-end mb-0">
<div class="col-12 col-sm">
<ul class="pagination justify-content-center justify-content-sm-end mb-0">
<?php