mirror of
https://github.com/itflow-org/itflow
synced 2026-07-23 00:40:45 +00:00
Remove _details and use singular filename for certain objects
This commit is contained in:
@@ -1,137 +1,70 @@
|
||||
<?php
|
||||
|
||||
// Default Column Sort by Filter
|
||||
$sort = "document_template_name";
|
||||
$order = "ASC";
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM document_templates
|
||||
LEFT JOIN users ON document_template_created_by = user_id
|
||||
WHERE user_name LIKE '%$q%' OR document_template_name LIKE '%$q%'
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
//Initialize the HTML Purifier to prevent XSS
|
||||
require "../libs/htmlpurifier/HTMLPurifier.standalone.php";
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
||||
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||
$purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
if (isset($_GET['document_template_id'])) {
|
||||
$document_template_id = intval($_GET['document_template_id']);
|
||||
}
|
||||
|
||||
$sql_document = mysqli_query($mysqli, "SELECT * FROM document_templates WHERE document_template_id = $document_template_id LIMIT 1");
|
||||
|
||||
if (mysqli_num_rows($sql_document) == 0) {
|
||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||
require_once "../includes/footer.php";
|
||||
exit();
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($sql_document);
|
||||
|
||||
$document_template_name = escapeHtml($row['document_template_name']);
|
||||
$document_template_description = escapeHtml($row['document_template_description']);
|
||||
$document_template_content = $purifier->purify($row['document_template_content']);
|
||||
$document_template_created_at = escapeHtml($row['document_template_created_at']);
|
||||
$document_template_updated_at = escapeHtml($row['document_template_updated_at']);
|
||||
|
||||
?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="../">Home</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="users.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="document_template.php">Document Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-file-alt mr-2"></i><?php echo $document_template_name; ?></li>
|
||||
</ol>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-alt mr-2"></i>Document Templates</h3>
|
||||
<div class="card-header">
|
||||
|
||||
<h3 class="card-title mt-1"><i class="fa fa-fw fa-file-alt mr-2"></i><?php echo $document_template_name; ?></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">
|
||||
<i class="fas fa-plus mr-2"></i>New Template
|
||||
<button type="button" class="btn btn-tool ajax-modal"
|
||||
data-modal-size="xl"
|
||||
data-modal-url="modals/document_template/document_template_edit.php?id=<?= $document_template_id ?>">
|
||||
<i class="fas fa-edit mr-2"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<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">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_template_name&order=<?php echo $disp; ?>">
|
||||
Template Name <?php if ($sort == 'document_template_name') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_template_created_at&order=<?php echo $disp; ?>">
|
||||
Created <?php if ($sort == 'document_template_created_at') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_template_updated_at&order=<?php echo $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']) ?: '-';
|
||||
|
||||
?>
|
||||
|
||||
<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="media">
|
||||
<i class="fas fa-fw fa-2x fa-file-alt mr-2"></i>
|
||||
<div class="media-body">
|
||||
<div><?= $document_template_name ?></div>
|
||||
<div><small class="text-secondary"><?= $document_template_description ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $document_template_created_at; ?>
|
||||
<div class="text-secondary"><?php echo $document_template_created_by_name; ?></div>
|
||||
</td>
|
||||
<td><?php echo $document_template_updated_at; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="document_template_details.php?document_template_id=<?= $document_template_id ?>">
|
||||
<i class="fas fa-fw fa-eye mr-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 mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_document_template=<?php echo $document_template_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
<?php require_once "../includes/filter_footer.php"; ?>
|
||||
<div class="card-body prettyContent">
|
||||
<?php echo $document_template_content; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once "../includes/footer.php";
|
||||
<script src="../js/pretty_content.js"></script>
|
||||
|
||||
<?php
|
||||
require_once "../includes/footer.php";
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
|
||||
//Initialize the HTML Purifier to prevent XSS
|
||||
require "../libs/htmlpurifier/HTMLPurifier.standalone.php";
|
||||
|
||||
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
||||
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||
$purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
if (isset($_GET['document_template_id'])) {
|
||||
$document_template_id = intval($_GET['document_template_id']);
|
||||
}
|
||||
|
||||
$sql_document = mysqli_query($mysqli, "SELECT * FROM document_templates WHERE document_template_id = $document_template_id LIMIT 1");
|
||||
|
||||
if (mysqli_num_rows($sql_document) == 0) {
|
||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||
require_once "../includes/footer.php";
|
||||
exit();
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($sql_document);
|
||||
|
||||
$document_template_name = escapeHtml($row['document_template_name']);
|
||||
$document_template_description = escapeHtml($row['document_template_description']);
|
||||
$document_template_content = $purifier->purify($row['document_template_content']);
|
||||
$document_template_created_at = escapeHtml($row['document_template_created_at']);
|
||||
$document_template_updated_at = escapeHtml($row['document_template_updated_at']);
|
||||
|
||||
?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="../">Home</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="users.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="document_template.php">Document Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-file-alt mr-2"></i><?php echo $document_template_name; ?></li>
|
||||
</ol>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
|
||||
<h3 class="card-title mt-1"><i class="fa fa-fw fa-file-alt mr-2"></i><?php echo $document_template_name; ?></h3>
|
||||
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool ajax-modal"
|
||||
data-modal-size="xl"
|
||||
data-modal-url="modals/document_template/document_template_edit.php?id=<?= $document_template_id ?>">
|
||||
<i class="fas fa-edit mr-2"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body prettyContent">
|
||||
<?php echo $document_template_content; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="../js/pretty_content.js"></script>
|
||||
|
||||
<?php
|
||||
require_once "../includes/footer.php";
|
||||
137
admin/document_templates.php
Normal file
137
admin/document_templates.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
// Default Column Sort by Filter
|
||||
$sort = "document_template_name";
|
||||
$order = "ASC";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM document_templates
|
||||
LEFT JOIN users ON document_template_created_by = user_id
|
||||
WHERE user_name LIKE '%$q%' OR document_template_name LIKE '%$q%'
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fa fa-fw fa-file-alt mr-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">
|
||||
<i class="fas fa-plus mr-2"></i>New Template
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<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">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_template_name&order=<?php echo $disp; ?>">
|
||||
Template Name <?php if ($sort == 'document_template_name') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_template_created_at&order=<?php echo $disp; ?>">
|
||||
Created <?php if ($sort == 'document_template_created_at') { echo $order_icon; } ?>
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a class="text-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=document_template_updated_at&order=<?php echo $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']) ?: '-';
|
||||
|
||||
?>
|
||||
|
||||
<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="media">
|
||||
<i class="fas fa-fw fa-2x fa-file-alt mr-2"></i>
|
||||
<div class="media-body">
|
||||
<div><?= $document_template_name ?></div>
|
||||
<div><small class="text-secondary"><?= $document_template_description ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $document_template_created_at; ?>
|
||||
<div class="text-secondary"><?php echo $document_template_created_by_name; ?></div>
|
||||
</td>
|
||||
<td><?php echo $document_template_updated_at; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="document_template.php?document_template_id=<?= $document_template_id ?>">
|
||||
<i class="fas fa-fw fa-eye mr-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 mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger text-bold" href="post.php?delete_document_template=<?php echo $document_template_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
<?php require_once "../includes/filter_footer.php"; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once "../includes/footer.php";
|
||||
@@ -138,7 +138,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/admin/document_template.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['document_template.php', 'document_template_details.php']) ? 'active' : ''); ?>">
|
||||
<a href="/admin/document_template.php" class="nav-link <?php echo (in_array(basename($_SERVER['PHP_SELF']), ['document_template.php', 'document_template.php']) ? 'active' : ''); ?>">
|
||||
<i class="nav-icon fas fa-file-alt"></i>
|
||||
<p>Document Templates</p>
|
||||
</a>
|
||||
|
||||
@@ -1,140 +1,245 @@
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sort = "project_template_name";
|
||||
$order = "ASC";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM project_templates
|
||||
WHERE (project_template_name LIKE '%$q%' OR project_template_description LIKE '%$q%')
|
||||
AND project_template_archived_at IS NULL
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
if (isset($_GET['project_template_id'])) {
|
||||
$project_template_id = intval($_GET['project_template_id']);
|
||||
|
||||
$sql_project_templates = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM project_templates
|
||||
WHERE project_template_id = $project_template_id LIMIT 1"
|
||||
);
|
||||
|
||||
if (mysqli_num_rows($sql_project_templates) == 0) {
|
||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||
|
||||
require_once "../includes/footer.php";
|
||||
exit;
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($sql_project_templates);
|
||||
|
||||
$project_template_name = escapeHtml($row['project_template_name']);
|
||||
$project_template_description = escapeHtml($row['project_template_description']);
|
||||
$project_template_created_at = date("Y-m-d", strtotime($row['project_template_created_at']));
|
||||
$project_template_updated_at = escapeHtml($row['project_template_updated_at']);
|
||||
|
||||
// Get Associated Ticket Templates
|
||||
$sql_ticket_templates = mysqli_query($mysqli, "SELECT * 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 All Task Templates
|
||||
$sql_task_templates = mysqli_query($mysqli,
|
||||
"SELECT * 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);
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-project-diagram mr-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 mr-2"></i>New Project Template</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="row">
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_user.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="project_template.php">Project Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Project Template Details</li>
|
||||
</ol>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="input-group mb-3 mb-md-0">
|
||||
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Project Templates">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
<!-- Project Header -->
|
||||
<div class="card card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-project-diagram text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<h3 class="mb-0"><?php echo $project_template_name; ?><span class='badge badge-pill badge-info ml-2'>Template</span></h3>
|
||||
<div><small class="text-secondary"><?php echo $project_template_description; ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-life-ring text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<div>Ticket Templates</div>
|
||||
<h3 class="mb-0"><?php echo $ticket_template_count; ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-tasks text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<div>Task Templates</div>
|
||||
<h3 class="mb-0"><?php echo $task_template_count; ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<div class="btn-group float-right">
|
||||
<button type="button" class="btn btn-primary btn-sm ajax-modal" href="#" data-modal-url="modals/project_template/project_template_ticket_template_add.php?project_template_id=<?= $project_template_id ?>">
|
||||
<i class="fas fa-fw fa-plus mr-2"></i>Add Ticket Template
|
||||
</button>
|
||||
<div class="dropdown dropleft text-center ml-3">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<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 mr-2"></i>Edit Template
|
||||
</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?archive_project_template=<?php echo $project_template_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive (not yet implemented)
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project_template=<?php echo $project_template_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=project_template_name&order=<?php echo $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']);
|
||||
|
||||
// Get Ticket Template Count
|
||||
$sql_ticket_templates = mysqli_query($mysqli, "SELECT * 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 * 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_details.php?project_template_id=<?= $project_template_id ?>">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-project-diagram mr-3"></i>
|
||||
<div class="media-body">
|
||||
<div>
|
||||
<?= $project_template_name ?>
|
||||
</div>
|
||||
<div>
|
||||
<small class="text-secondary"><?= $project_template_description ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $ticket_template_count; ?></td>
|
||||
<td><?php echo $task_template_count; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" data-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 mr-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=<?php echo $project_template_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "../includes/filter_footer.php"; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
|
||||
<!-- Tickets card -->
|
||||
<?php if (mysqli_num_rows($sql_ticket_templates) > 0) { ?>
|
||||
<div class="card card-body card-outline card-dark mb-3">
|
||||
|
||||
<h5 class="text-secondary"><i class="fa fa-fw fa-life-ring mr-2"></i>Project Ticket Templates</h5>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover" id="ticket_templates">
|
||||
<thead class="text-dark">
|
||||
<tr>
|
||||
<th>Template Name</th>
|
||||
<th>Description</th>
|
||||
<th>Ticket Subject</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_assoc($sql_ticket_templates)) {
|
||||
$ticket_template_id = intval($row['ticket_template_id']);
|
||||
$ticket_template_order = intval($row['ticket_template_order']);
|
||||
$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']);
|
||||
$ticket_template_updated_at = escapeHtml($row['ticket_template_updated_at']);
|
||||
|
||||
?>
|
||||
|
||||
<tr data-task-id="<?php echo $ticket_template_id; ?>">
|
||||
<td>
|
||||
<a href="#" class="drag-handle"><i class="fas fa-bars text-muted mr-2"></i></a>
|
||||
<a href="ticket_template_details.php?ticket_template_id=<?php echo $ticket_template_id; ?>">
|
||||
<?php echo $ticket_template_name; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $ticket_template_description; ?></td>
|
||||
<td><?php echo $ticket_template_subject; ?></td>
|
||||
<td>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="project_template_id" value="<?php echo $project_template_id; ?>">
|
||||
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
|
||||
<button type="submit" class="btn btn-default btn-sm confirm-link"
|
||||
name="remove_ticket_template_from_project_template">
|
||||
<i class="fa fa-fw fa-times"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<!-- Task Templates Card -->
|
||||
<?php if (mysqli_num_rows($sql_task_templates) > 0) { ?>
|
||||
<div class="card card-body card-outline card-dark">
|
||||
<h5 class="text-secondary"><i class="fas fa-fw fa-tasks mr-2"></i>Project Task Templates</h5>
|
||||
<table class="table">
|
||||
<?php
|
||||
while($row = mysqli_fetch_assoc($sql_task_templates)){
|
||||
$task_template_id = intval($row['task_template_id']);
|
||||
$task_template_name = escapeHtml($row['task_template_name']);
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<i class="far fa-fw fa-check-square text-primary mr-3"></i>
|
||||
<?php echo $task_template_name; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- End Task TemplatesCard -->
|
||||
|
||||
</div> <!-- End col-3 -->
|
||||
|
||||
</div> <!-- End row -->
|
||||
|
||||
<script src="../libs/SortableJS/Sortable.min.js"></script>
|
||||
<script>
|
||||
new Sortable(document.querySelector('table#ticket_templates tbody'), {
|
||||
handle: '.drag-handle',
|
||||
animation: 150,
|
||||
onEnd: function (evt) {
|
||||
const rows = document.querySelectorAll('table#ticket_templates tbody tr');
|
||||
const positions = Array.from(rows).map((row, index) => ({
|
||||
id: row.dataset.taskId,
|
||||
order: index
|
||||
}));
|
||||
|
||||
$.post('/agent/ajax.php', {
|
||||
update_project_template_ticket_order: true,
|
||||
csrf_token: '<?= $_SESSION['csrf_token'] ?>',
|
||||
project_template_id: <?php echo $project_template_id; ?>,
|
||||
positions: positions
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
require_once "../includes/footer.php";
|
||||
|
||||
?>
|
||||
|
||||
<script src="js/pretty_content.js"></script>
|
||||
|
||||
@@ -1,245 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
|
||||
if (isset($_GET['project_template_id'])) {
|
||||
$project_template_id = intval($_GET['project_template_id']);
|
||||
|
||||
$sql_project_templates = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT * FROM project_templates
|
||||
WHERE project_template_id = $project_template_id LIMIT 1"
|
||||
);
|
||||
|
||||
if (mysqli_num_rows($sql_project_templates) == 0) {
|
||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||
|
||||
require_once "../includes/footer.php";
|
||||
exit;
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($sql_project_templates);
|
||||
|
||||
$project_template_name = escapeHtml($row['project_template_name']);
|
||||
$project_template_description = escapeHtml($row['project_template_description']);
|
||||
$project_template_created_at = date("Y-m-d", strtotime($row['project_template_created_at']));
|
||||
$project_template_updated_at = escapeHtml($row['project_template_updated_at']);
|
||||
|
||||
// Get Associated Ticket Templates
|
||||
$sql_ticket_templates = mysqli_query($mysqli, "SELECT * 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 All Task Templates
|
||||
$sql_task_templates = mysqli_query($mysqli,
|
||||
"SELECT * 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);
|
||||
|
||||
?>
|
||||
|
||||
<!-- Breadcrumbs-->
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="admin_user.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="project_template.php">Project Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active">Project Template Details</li>
|
||||
</ol>
|
||||
|
||||
<!-- Project Header -->
|
||||
<div class="card card-body">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-project-diagram text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<h3 class="mb-0"><?php echo $project_template_name; ?><span class='badge badge-pill badge-info ml-2'>Template</span></h3>
|
||||
<div><small class="text-secondary"><?php echo $project_template_description; ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-life-ring text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<div>Ticket Templates</div>
|
||||
<h3 class="mb-0"><?php echo $ticket_template_count; ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-3">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-tasks text-secondary mr-3"></i>
|
||||
<div class="media-body">
|
||||
<div>Task Templates</div>
|
||||
<h3 class="mb-0"><?php echo $task_template_count; ?></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<div class="btn-group float-right">
|
||||
<button type="button" class="btn btn-primary btn-sm ajax-modal" href="#" data-modal-url="modals/project_template/project_template_ticket_template_add.php?project_template_id=<?= $project_template_id ?>">
|
||||
<i class="fas fa-fw fa-plus mr-2"></i>Add Ticket Template
|
||||
</button>
|
||||
<div class="dropdown dropleft text-center ml-3">
|
||||
<button class="btn btn-secondary btn-sm" type="button" id="dropdownMenuButton" data-toggle="dropdown">
|
||||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<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 mr-2"></i>Edit Template
|
||||
</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?archive_project_template=<?php echo $project_template_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive (not yet implemented)
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($session_user_role == 3) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project_template=<?php echo $project_template_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
|
||||
<!-- Tickets card -->
|
||||
<?php if (mysqli_num_rows($sql_ticket_templates) > 0) { ?>
|
||||
<div class="card card-body card-outline card-dark mb-3">
|
||||
|
||||
<h5 class="text-secondary"><i class="fa fa-fw fa-life-ring mr-2"></i>Project Ticket Templates</h5>
|
||||
<div class="table-responsive-sm">
|
||||
<table class="table table-striped table-borderless table-hover" id="ticket_templates">
|
||||
<thead class="text-dark">
|
||||
<tr>
|
||||
<th>Template Name</th>
|
||||
<th>Description</th>
|
||||
<th>Ticket Subject</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
|
||||
while ($row = mysqli_fetch_assoc($sql_ticket_templates)) {
|
||||
$ticket_template_id = intval($row['ticket_template_id']);
|
||||
$ticket_template_order = intval($row['ticket_template_order']);
|
||||
$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']);
|
||||
$ticket_template_updated_at = escapeHtml($row['ticket_template_updated_at']);
|
||||
|
||||
?>
|
||||
|
||||
<tr data-task-id="<?php echo $ticket_template_id; ?>">
|
||||
<td>
|
||||
<a href="#" class="drag-handle"><i class="fas fa-bars text-muted mr-2"></i></a>
|
||||
<a href="ticket_template_details.php?ticket_template_id=<?php echo $ticket_template_id; ?>">
|
||||
<?php echo $ticket_template_name; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $ticket_template_description; ?></td>
|
||||
<td><?php echo $ticket_template_subject; ?></td>
|
||||
<td>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="project_template_id" value="<?php echo $project_template_id; ?>">
|
||||
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
|
||||
<button type="submit" class="btn btn-default btn-sm confirm-link"
|
||||
name="remove_ticket_template_from_project_template">
|
||||
<i class="fa fa-fw fa-times"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
|
||||
<!-- Task Templates Card -->
|
||||
<?php if (mysqli_num_rows($sql_task_templates) > 0) { ?>
|
||||
<div class="card card-body card-outline card-dark">
|
||||
<h5 class="text-secondary"><i class="fas fa-fw fa-tasks mr-2"></i>Project Task Templates</h5>
|
||||
<table class="table">
|
||||
<?php
|
||||
while($row = mysqli_fetch_assoc($sql_task_templates)){
|
||||
$task_template_id = intval($row['task_template_id']);
|
||||
$task_template_name = escapeHtml($row['task_template_name']);
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<i class="far fa-fw fa-check-square text-primary mr-3"></i>
|
||||
<?php echo $task_template_name; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- End Task TemplatesCard -->
|
||||
|
||||
</div> <!-- End col-3 -->
|
||||
|
||||
</div> <!-- End row -->
|
||||
|
||||
<script src="../libs/SortableJS/Sortable.min.js"></script>
|
||||
<script>
|
||||
new Sortable(document.querySelector('table#ticket_templates tbody'), {
|
||||
handle: '.drag-handle',
|
||||
animation: 150,
|
||||
onEnd: function (evt) {
|
||||
const rows = document.querySelectorAll('table#ticket_templates tbody tr');
|
||||
const positions = Array.from(rows).map((row, index) => ({
|
||||
id: row.dataset.taskId,
|
||||
order: index
|
||||
}));
|
||||
|
||||
$.post('/agent/ajax.php', {
|
||||
update_project_template_ticket_order: true,
|
||||
csrf_token: '<?= $_SESSION['csrf_token'] ?>',
|
||||
project_template_id: <?php echo $project_template_id; ?>,
|
||||
positions: positions
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
require_once "../includes/footer.php";
|
||||
|
||||
?>
|
||||
|
||||
<script src="js/pretty_content.js"></script>
|
||||
140
admin/project_templates.php
Normal file
140
admin/project_templates.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sort = "project_template_name";
|
||||
$order = "ASC";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS * FROM project_templates
|
||||
WHERE (project_template_name LIKE '%$q%' OR project_template_description LIKE '%$q%')
|
||||
AND project_template_archived_at IS NULL
|
||||
ORDER BY $sort $order LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-project-diagram mr-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 mr-2"></i>New Project Template</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="input-group mb-3 mb-md-0">
|
||||
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Project Templates">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
</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-secondary" href="?<?php echo $url_query_strings_sort; ?>&sort=project_template_name&order=<?php echo $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']);
|
||||
|
||||
// Get Ticket Template Count
|
||||
$sql_ticket_templates = mysqli_query($mysqli, "SELECT * 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 * 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_details.php?project_template_id=<?= $project_template_id ?>">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-project-diagram mr-3"></i>
|
||||
<div class="media-body">
|
||||
<div>
|
||||
<?= $project_template_name ?>
|
||||
</div>
|
||||
<div>
|
||||
<small class="text-secondary"><?= $project_template_description ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
<td><?php echo $ticket_template_count; ?></td>
|
||||
<td><?php echo $task_template_count; ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" data-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 mr-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=<?php echo $project_template_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "../includes/filter_footer.php"; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "../includes/footer.php";
|
||||
@@ -1,123 +1,162 @@
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sort = "ticket_template_name";
|
||||
$order = "ASC";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS *,
|
||||
COUNT(task_template_id) AS task_count
|
||||
FROM ticket_templates
|
||||
LEFT JOIN task_templates ON task_template_ticket_template_id = ticket_template_id
|
||||
WHERE (ticket_template_name LIKE '%$q%' OR ticket_template_description LIKE '%$q%')
|
||||
AND ticket_template_archived_at IS NULL
|
||||
GROUP BY ticket_template_id
|
||||
ORDER BY $sort $order
|
||||
LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
//Initialize the HTML Purifier to prevent XSS
|
||||
require "../libs/htmlpurifier/HTMLPurifier.standalone.php";
|
||||
|
||||
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
||||
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||
$purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
if (isset($_GET['ticket_template_id'])) {
|
||||
$ticket_template_id = intval($_GET['ticket_template_id']);
|
||||
}
|
||||
|
||||
$sql_ticket_template = mysqli_query($mysqli, "SELECT * FROM ticket_templates WHERE ticket_template_id = $ticket_template_id LIMIT 1");
|
||||
|
||||
if (mysqli_num_rows($sql_ticket_template) == 0) {
|
||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||
require_once "../includes/footer.php";
|
||||
exit();
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($sql_ticket_template);
|
||||
|
||||
$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_details = $purifier->purify($row['ticket_template_details']);
|
||||
$ticket_template_created_at = escapeHtml($row['ticket_template_created_at']);
|
||||
$ticket_template_updated_at = escapeHtml($row['ticket_template_updated_at']);
|
||||
|
||||
// Get Task Templates
|
||||
$sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE task_template_ticket_template_id = $ticket_template_id ORDER BY task_template_order ASC, task_template_id ASC");
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-life-ring mr-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 mr-2"></i>New Ticket Template</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="row">
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="../index.php">Home</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="users.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="ticket_template.php">Ticket Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-life-ring mr-2"></i><?php echo $ticket_template_name; ?></li>
|
||||
</ol>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="input-group mb-3 mb-md-0">
|
||||
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Ticket Templates">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mt-1"><?php echo $ticket_template_name; ?></h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool btn-sm" data-toggle="modal" data-target="#editTicketTemplateModal">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body prettyContent">
|
||||
<?php echo $ticket_template_details; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-tasks mr-2"></i>Tasks</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" name="task_name" placeholder="Create a task" required maxlength="200">
|
||||
<div class="input-group-append">
|
||||
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
</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-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="?<?php echo $url_query_strings_sort; ?>&sort=task_count&order=<?php echo $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="media">
|
||||
<i class="fa fa-fw fa-2x fa-life-ring mr-3"></i>
|
||||
<div class="media-body">
|
||||
<div>
|
||||
<a href="ticket_template_details.php?ticket_template_id=<?= $ticket_template_id ?>">
|
||||
<?= $ticket_template_name ?>
|
||||
</form>
|
||||
<table class="table table-sm" id="tasks">
|
||||
<?php
|
||||
while($row = mysqli_fetch_assoc($sql_task_templates)){
|
||||
$task_id = intval($row['task_template_id']);
|
||||
$task_name = escapeHtml($row['task_template_name']);
|
||||
$task_completion_estimate = intval($row['task_template_completion_estimate']);
|
||||
//$task_description = escapeHtml($row['task_template_description']);
|
||||
?>
|
||||
<tr data-task-id="<?php echo $task_id; ?>">
|
||||
<td>
|
||||
<a href="#" class="drag-handle"><i class="fas fa-bars text-muted mr-2"></i></a>
|
||||
<span class="text-dark"><?php echo $task_name; ?></span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="float-right">
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-light text-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item ajax-modal" href="#"
|
||||
data-modal-url="modals/ticket_template/ticket_template_task_edit.php?id=<?= $task_id ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_task_template=<?php echo $task_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash-alt mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
<div><small class="text-secondary"><?= $ticket_template_description ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
<td><?= $task_count ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" data-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 mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php require_once "../includes/filter_footer.php";
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="../js/pretty_content.js"></script>
|
||||
|
||||
<script src="../libs/SortableJS/Sortable.min.js"></script>
|
||||
<script>
|
||||
new Sortable(document.querySelector('table#tasks tbody'), {
|
||||
handle: '.drag-handle',
|
||||
animation: 150,
|
||||
onEnd: function (evt) {
|
||||
const rows = document.querySelectorAll('table#tasks tbody tr');
|
||||
const positions = Array.from(rows).map((row, index) => ({
|
||||
id: row.dataset.taskId,
|
||||
order: index
|
||||
}));
|
||||
|
||||
$.post('/agent/ajax.php', {
|
||||
update_task_templates_order: true,
|
||||
csrf_token: '<?= $_SESSION['csrf_token'] ?>',
|
||||
ticket_template_id: <?php echo $ticket_template_id; ?>,
|
||||
positions: positions
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "modals/ticket_template/ticket_template_edit.php";
|
||||
require_once "../includes/footer.php";
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
|
||||
//Initialize the HTML Purifier to prevent XSS
|
||||
require "../libs/htmlpurifier/HTMLPurifier.standalone.php";
|
||||
|
||||
$purifier_config = HTMLPurifier_Config::createDefault();
|
||||
$purifier_config->set('Cache.DefinitionImpl', null); // Disable cache by setting a non-existent directory or an invalid one
|
||||
$purifier_config->set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'http' => true, 'https' => true]);
|
||||
$purifier = new HTMLPurifier($purifier_config);
|
||||
|
||||
if (isset($_GET['ticket_template_id'])) {
|
||||
$ticket_template_id = intval($_GET['ticket_template_id']);
|
||||
}
|
||||
|
||||
$sql_ticket_template = mysqli_query($mysqli, "SELECT * FROM ticket_templates WHERE ticket_template_id = $ticket_template_id LIMIT 1");
|
||||
|
||||
if (mysqli_num_rows($sql_ticket_template) == 0) {
|
||||
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='javascript:history.back()'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
|
||||
require_once "../includes/footer.php";
|
||||
exit();
|
||||
}
|
||||
|
||||
$row = mysqli_fetch_assoc($sql_ticket_template);
|
||||
|
||||
$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_details = $purifier->purify($row['ticket_template_details']);
|
||||
$ticket_template_created_at = escapeHtml($row['ticket_template_created_at']);
|
||||
$ticket_template_updated_at = escapeHtml($row['ticket_template_updated_at']);
|
||||
|
||||
// Get Task Templates
|
||||
$sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE task_template_ticket_template_id = $ticket_template_id ORDER BY task_template_order ASC, task_template_id ASC");
|
||||
|
||||
?>
|
||||
|
||||
<ol class="breadcrumb d-print-none">
|
||||
<li class="breadcrumb-item">
|
||||
<a href="../index.php">Home</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="users.php">Admin</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item">
|
||||
<a href="ticket_template.php">Ticket Templates</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><i class="fas fa-life-ring mr-2"></i><?php echo $ticket_template_name; ?></li>
|
||||
</ol>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title mt-1"><?php echo $ticket_template_name; ?></h3>
|
||||
<div class="card-tools">
|
||||
<button type="button" class="btn btn-tool btn-sm" data-toggle="modal" data-target="#editTicketTemplateModal">
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body prettyContent">
|
||||
<?php echo $ticket_template_details; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header">
|
||||
<h5 class="card-title"><i class="fa fa-fw fa-tasks mr-2"></i>Tasks</h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||
<input type="hidden" name="ticket_template_id" value="<?php echo $ticket_template_id; ?>">
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm">
|
||||
<input type="text" class="form-control" name="task_name" placeholder="Create a task" required maxlength="200">
|
||||
<div class="input-group-append">
|
||||
<button type="submit" name="add_ticket_template_task" class="btn btn-primary"><i class="fas fa-fw fa-check"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table class="table table-sm" id="tasks">
|
||||
<?php
|
||||
while($row = mysqli_fetch_assoc($sql_task_templates)){
|
||||
$task_id = intval($row['task_template_id']);
|
||||
$task_name = escapeHtml($row['task_template_name']);
|
||||
$task_completion_estimate = intval($row['task_template_completion_estimate']);
|
||||
//$task_description = escapeHtml($row['task_template_description']);
|
||||
?>
|
||||
<tr data-task-id="<?php echo $task_id; ?>">
|
||||
<td>
|
||||
<a href="#" class="drag-handle"><i class="fas fa-bars text-muted mr-2"></i></a>
|
||||
<span class="text-dark"><?php echo $task_name; ?></span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="float-right">
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-light text-secondary btn-sm" type="button" data-toggle="dropdown">
|
||||
<i class="fas fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item ajax-modal" href="#"
|
||||
data-modal-url="modals/ticket_template/ticket_template_task_edit.php?id=<?= $task_id ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_task_template=<?php echo $task_id; ?>&csrf_token=<?php echo $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-trash-alt mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="../js/pretty_content.js"></script>
|
||||
|
||||
<script src="../libs/SortableJS/Sortable.min.js"></script>
|
||||
<script>
|
||||
new Sortable(document.querySelector('table#tasks tbody'), {
|
||||
handle: '.drag-handle',
|
||||
animation: 150,
|
||||
onEnd: function (evt) {
|
||||
const rows = document.querySelectorAll('table#tasks tbody tr');
|
||||
const positions = Array.from(rows).map((row, index) => ({
|
||||
id: row.dataset.taskId,
|
||||
order: index
|
||||
}));
|
||||
|
||||
$.post('/agent/ajax.php', {
|
||||
update_task_templates_order: true,
|
||||
csrf_token: '<?= $_SESSION['csrf_token'] ?>',
|
||||
ticket_template_id: <?php echo $ticket_template_id; ?>,
|
||||
positions: positions
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
require_once "modals/ticket_template/ticket_template_edit.php";
|
||||
require_once "../includes/footer.php";
|
||||
123
admin/ticket_templates.php
Normal file
123
admin/ticket_templates.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
// Default Column Sortby Filter
|
||||
$sort = "ticket_template_name";
|
||||
$order = "ASC";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
$sql = mysqli_query(
|
||||
$mysqli,
|
||||
"SELECT SQL_CALC_FOUND_ROWS *,
|
||||
COUNT(task_template_id) AS task_count
|
||||
FROM ticket_templates
|
||||
LEFT JOIN task_templates ON task_template_ticket_template_id = ticket_template_id
|
||||
WHERE (ticket_template_name LIKE '%$q%' OR ticket_template_description LIKE '%$q%')
|
||||
AND ticket_template_archived_at IS NULL
|
||||
GROUP BY ticket_template_id
|
||||
ORDER BY $sort $order
|
||||
LIMIT $record_from, $record_to"
|
||||
);
|
||||
|
||||
$num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
?>
|
||||
|
||||
<div class="card card-dark">
|
||||
<div class="card-header py-2">
|
||||
<h3 class="card-title mt-2"><i class="fas fa-fw fa-life-ring mr-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 mr-2"></i>New Ticket Template</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form autocomplete="off">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="input-group mb-3 mb-md-0">
|
||||
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo stripslashes(escapeHtml($q)); } ?>" placeholder="Search Ticket Templates">
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-8">
|
||||
</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-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="?<?php echo $url_query_strings_sort; ?>&sort=task_count&order=<?php echo $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="media">
|
||||
<i class="fa fa-fw fa-2x fa-life-ring mr-3"></i>
|
||||
<div class="media-body">
|
||||
<div>
|
||||
<a href="ticket_template_details.php?ticket_template_id=<?= $ticket_template_id ?>">
|
||||
<?= $ticket_template_name ?>
|
||||
</a>
|
||||
</div>
|
||||
<div><small class="text-secondary"><?= $ticket_template_description ?></small></div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
<td><?= $task_count ?></td>
|
||||
<td>
|
||||
<div class="dropdown dropleft text-center">
|
||||
<button class="btn btn-secondary btn-sm" data-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 mr-2"></i>Delete
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php require_once "../includes/filter_footer.php";
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
require_once "../includes/footer.php";
|
||||
@@ -560,7 +560,7 @@ if (isset($_GET['asset_id'])) {
|
||||
if ($connected_asset_name) {
|
||||
$connected_to_display = "<a class='ajax-modal' href='#'
|
||||
data-modal-size='lg'
|
||||
data-modal-url='modals/asset/asset_details.php?id=$connected_asset_id'>
|
||||
data-modal-url='modals/asset/asset.php?id=$connected_asset_id'>
|
||||
<strong><i class='fa fa-fw text-dark fa-$connected_asset_icon mr-1'></i>$connected_asset_name</strong> - $connected_interface_name
|
||||
</a>";
|
||||
} else {
|
||||
@@ -872,7 +872,7 @@ if (isset($_GET['asset_id'])) {
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div><a href="document_details.php?client_id=<?= $client_id; ?>&document_id=<?= $document_id; ?>"><?= $document_name; ?></a></div>
|
||||
<div><a href="document.php?client_id=<?= $client_id; ?>&document_id=<?= $document_id; ?>"><?= $document_name; ?></a></div>
|
||||
<div class="text-secondary"><?= $document_description; ?></div>
|
||||
</td>
|
||||
<td><?= $document_created_by ?></td>
|
||||
@@ -589,7 +589,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
}
|
||||
$contact_name = escapeHtml($row['contact_name']);
|
||||
if ($contact_name) {
|
||||
$contact_name_display = "<a class='ajax-modal' href='#' data-modal-url='modals/contact/contact_details.php?id=$asset_contact_id' data-modal-size='lg'>$contact_name $contact_archive_display</a>";
|
||||
$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 = "-";
|
||||
}
|
||||
@@ -638,7 +638,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a class="text-dark" href="asset_details.php?client_id=<?= $client_id ?>&asset_id=<?= $asset_id ?>">
|
||||
<a class="text-dark" href="asset.php?client_id=<?= $client_id ?>&asset_id=<?= $asset_id ?>">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-<?= $device_icon ?> mr-3 mt-1"></i>
|
||||
<div class="media-body">
|
||||
|
||||
@@ -257,7 +257,7 @@ $sql_asset_retired = mysqli_query(
|
||||
<td>
|
||||
<a href="#" class="ajax-modal"
|
||||
data-modal-size="lg"
|
||||
data-modal-url="modals/contact/contact_details.php?id=<?= $contact_id ?>">
|
||||
data-modal-url="modals/contact/contact.php?id=<?= $contact_id ?>">
|
||||
<div class="media">
|
||||
<?php if ($contact_photo) { ?>
|
||||
<span class="fa-stack fa-2x mr-2 text-center">
|
||||
@@ -330,7 +330,7 @@ $sql_asset_retired = mysqli_query(
|
||||
<td>
|
||||
<a href="#" class="ajax-modal"
|
||||
data-modal-size="lg"
|
||||
data-modal-url="modals/asset/asset_details.php?id=<?= $asset_id ?>">
|
||||
data-modal-url="modals/asset/asset.php?id=<?= $asset_id ?>">
|
||||
<i class="fas fa-fw fa-<?= $asset_icon ?> text-dark mr-1"></i><?= $asset_name ?>
|
||||
</a>
|
||||
</td>
|
||||
@@ -547,7 +547,7 @@ $sql_asset_retired = mysqli_query(
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-laptop text-secondary mr-1"></i>
|
||||
<a href="asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>">Asset Warranty: <?php echo $asset_name; ?></a>
|
||||
<a href="asset.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>">Asset Warranty: <?php echo $asset_name; ?></a>
|
||||
<span>-- <?php echo $asset_warranty_expire; ?> (<?php echo $asset_warranty_expire_human; ?>)</span>
|
||||
</p>
|
||||
|
||||
@@ -567,7 +567,7 @@ $sql_asset_retired = mysqli_query(
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-laptop text-secondary mr-1"></i>
|
||||
<a href="asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>">Asset Retire: <?php echo $asset_name; ?></a>
|
||||
<a href="asset.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>">Asset Retire: <?php echo $asset_name; ?></a>
|
||||
<span>-- <?php echo $asset_install_date; ?> (<?php echo $asset_install_date_human; ?>)</span>
|
||||
</p>
|
||||
|
||||
@@ -665,7 +665,7 @@ $sql_asset_retired = mysqli_query(
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-laptop text-secondary mr-1"></i>Asset Warranty:
|
||||
<a href="asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<a href="asset.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<span>-- <?php echo $asset_warranty_expire; ?> (<?php echo $asset_warranty_expire_human; ?>)</span>
|
||||
</p>
|
||||
|
||||
@@ -685,7 +685,7 @@ $sql_asset_retired = mysqli_query(
|
||||
?>
|
||||
<p class="mb-1">
|
||||
<i class="fa fa-fw fa-laptop text-secondary mr-1"></i>
|
||||
<a href="asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>">Asset Retire: <?php echo $asset_name; ?></a>
|
||||
<a href="asset.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>">Asset Retire: <?php echo $asset_name; ?></a>
|
||||
<span>-- <?php echo $asset_install_date; ?> (<?php echo $asset_install_date_human; ?>)</span>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -473,7 +473,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
if (!empty($contact_name)) { ?>
|
||||
<div class="text-bold">
|
||||
<i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i><a class="ajax-modal" href="#"
|
||||
data-modal-url="modals/contact/contact_details.php?client_id=<?= $client_id ?>&id=<?= $contact_id ?>" data-modal-size="lg"><?= $contact_name; ?>
|
||||
data-modal-url="modals/contact/contact.php?client_id=<?= $client_id ?>&id=<?= $contact_id ?>" data-modal-size="lg"><?= $contact_name; ?>
|
||||
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -437,7 +437,7 @@ if (isset($_GET['contact_id'])) {
|
||||
<i class="fa fa-fw text-secondary fa-<?= $device_icon ?> mr-1"></i>
|
||||
<a class="text-secondary ajax-modal" href="#"
|
||||
data-modal-size="lg"
|
||||
data-modal-url="modals/asset/asset_details.php?id=<?= $asset_id ?>">
|
||||
data-modal-url="modals/asset/asset.php?id=<?= $asset_id ?>">
|
||||
<?= $asset_name ?>
|
||||
<?php if ($asset_favorite) { echo "<i class='fas fa-fw fa-star text-warning' title='Favorite'></i>"; } ?>
|
||||
</a>
|
||||
@@ -989,7 +989,7 @@ if (isset($_GET['contact_id'])) {
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<div><a href="document_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><?php echo $document_name; ?></a></div>
|
||||
<div><a href="document.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>"><?php echo $document_name; ?></a></div>
|
||||
<div class="text-secondary"><?php echo $document_description; ?></div>
|
||||
</td>
|
||||
<td><?php echo $document_created_by; ?></td>
|
||||
@@ -409,7 +409,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$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_details.php?client_id=$client_id&contact_id=$contact_id#assets' class='mr-2 mb-1 badge badge-pill badge-dark p-2' title='Assets ($asset_count)'><i class='fas fa-fw fa-desktop mr-2'></i>$asset_count</a>";
|
||||
$asset_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#assets' class='mr-2 mb-1 badge badge-pill badge-dark p-2' title='Assets ($asset_count)'><i class='fas fa-fw fa-desktop mr-2'></i>$asset_count</a>";
|
||||
} else {
|
||||
$asset_count_display = '';
|
||||
}
|
||||
@@ -418,7 +418,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$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_details.php?client_id=$client_id&contact_id=$contact_id#credentials' class='mr-2 mb-1 badge badge-pill badge-secondary p-2' title='Credentials ($credential_count)'><i class='fas fa-fw fa-key mr-2'></i>$credential_count</a>";
|
||||
$credential_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#credentials' class='mr-2 mb-1 badge badge-pill badge-secondary p-2' title='Credentials ($credential_count)'><i class='fas fa-fw fa-key mr-2'></i>$credential_count</a>";
|
||||
} else {
|
||||
$credential_count_display = '';
|
||||
}
|
||||
@@ -427,7 +427,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$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_details.php?client_id=$client_id&contact_id=$contact_id#software' class='mr-2 mb-1 badge badge-pill badge-secondary p-2' title='Licenses ($software_count)'><i class='fas fa-fw fa-cube mr-2'></i>$software_count</a>";
|
||||
$software_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#software' class='mr-2 mb-1 badge badge-pill badge-secondary p-2' title='Licenses ($software_count)'><i class='fas fa-fw fa-cube mr-2'></i>$software_count</a>";
|
||||
} else {
|
||||
$software_count_display = '';
|
||||
}
|
||||
@@ -436,7 +436,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$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_details.php?client_id=$client_id&contact_id=$contact_id#tickets' class='mr-2 mb-1 badge badge-pill badge-secondary p-2' title='Tickets ($ticket_count)'><i class='fas fa-fw fa-life-ring mr-2'></i>$ticket_count</a>";
|
||||
$ticket_count_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id#tickets' class='mr-2 mb-1 badge badge-pill badge-secondary p-2' title='Tickets ($ticket_count)'><i class='fas fa-fw fa-life-ring mr-2'></i>$ticket_count</a>";
|
||||
} else {
|
||||
$ticket_count_display = '';
|
||||
}
|
||||
@@ -471,7 +471,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a class="text-dark" href="contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">
|
||||
<a class="text-dark" href="contact.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">
|
||||
<div class="media">
|
||||
<?php if ($contact_photo) { ?>
|
||||
<span class="fa-stack fa-2x mr-3 text-center">
|
||||
@@ -514,7 +514,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<i class="fas fa-ellipsis-h"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href="contact_details.php?<?= $client_url ?>contact_id=<?= $contact_id ?>">
|
||||
<a class="dropdown-item" href="contact.php?<?= $client_url ?>contact_id=<?= $contact_id ?>">
|
||||
<i class="fas fa-fw fa-eye mr-2"></i>Details
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/contact/contact_note_add.php?id=<?= $contact_id ?>">
|
||||
|
||||
@@ -373,7 +373,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
if ($credential_contact_id) {
|
||||
$credential_contact_display = "<a href='#' class='mr-2 mb-1 badge badge-pill badge-dark p-2 ajax-modal' title='$contact_name'
|
||||
data-modal-size='lg'
|
||||
data-modal-url='modals/contact/contact_details.php?id=$credential_contact_id'>
|
||||
data-modal-url='modals/contact/contact.php?id=$credential_contact_id'>
|
||||
<i class='fas fa-fw fa-user'></i></a>";
|
||||
} else {
|
||||
$credential_contact_display = '';
|
||||
@@ -382,7 +382,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
if ($credential_asset_id) {
|
||||
$credential_asset_display = "<a href='#' class='mr-2 mb-1 badge badge-pill badge-secondary p-2 ajax-modal' title='$asset_name' data-toggle=''
|
||||
data-modal-size='lg'
|
||||
data-modal-url='modals/asset/asset_details.php?id=$credential_asset_id'>
|
||||
data-modal-url='modals/asset/asset.php?id=$credential_asset_id'>
|
||||
<i class='fas fa-fw fa-desktop'></i></a>";
|
||||
} else {
|
||||
$credential_asset_display = '';
|
||||
|
||||
@@ -736,7 +736,7 @@ if ($user_config_dashboard_technical_enable == 1) {
|
||||
}
|
||||
|
||||
$ticket_priority_color = $ticket_priority == "High" ? "danger" : ($ticket_priority == "Medium" ? "warning" : "info");
|
||||
$contact_display = empty($contact_name) ? "-" : "<a href='contact_details.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a>";
|
||||
$contact_display = empty($contact_name) ? "-" : "<a href='contact.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a>";
|
||||
?>
|
||||
<tr class="<?php echo empty($ticket_updated_at) ? 'text-bold' : ''; ?>">
|
||||
<td>
|
||||
|
||||
@@ -259,7 +259,7 @@ $page_title = $row['document_name'];
|
||||
<div class="ml-2">
|
||||
<a class="ajax-modal" href="#"
|
||||
data-modal-size="lg"
|
||||
data-modal-url="modals/contact/contact_details.php?id=<?= $contact_id ?>">
|
||||
data-modal-url="modals/contact/contact.php?id=<?= $contact_id ?>">
|
||||
<?php echo $contact_name; ?></a>
|
||||
<a class="confirm-link float-right" href="post.php?unlink_contact_from_document&contact_id=<?php echo $contact_id; ?>&document_id=<?php echo $document_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
<i class="fas fa-fw fa-unlink text-secondary" title="Unlink Contact"></i>
|
||||
@@ -293,7 +293,7 @@ $page_title = $row['document_name'];
|
||||
<div class="ml-2">
|
||||
<a class="ajax-modal" href="#"
|
||||
data-modal-size="lg"
|
||||
data-modal-url="modals/asset/asset_details.php?id=<?= $asset_id ?>">
|
||||
data-modal-url="modals/asset/asset.php?id=<?= $asset_id ?>">
|
||||
<?php echo $asset_name; ?>
|
||||
</a>
|
||||
<a class="confirm-link float-right" href="post.php?unlink_asset_from_document&asset_id=<?php echo $asset_id; ?>&document_id=<?php echo $document_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
@@ -359,7 +359,7 @@ $page_title = $row['document_name'];
|
||||
|
||||
?>
|
||||
<div class="ml-2">
|
||||
<a class="ajax-modal" href="#" data-modal-url="modals/vendor/vendor_details.php?id=<?= $vendor_id ?>">
|
||||
<a class="ajax-modal" href="#" data-modal-url="modals/vendor/vendor.php?id=<?= $vendor_id ?>">
|
||||
<?php echo $vendor_name; ?>
|
||||
</a>
|
||||
<a class="confirm-link float-right" href="post.php?unlink_vendor_from_document&vendor_id=<?php echo $vendor_id; ?>&document_id=<?php echo $document_id; ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>">
|
||||
@@ -267,19 +267,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$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_details.php?id=$domain_registrar_id'>
|
||||
<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_details.php?id=$domain_webhost_id'>
|
||||
<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_details.php?id=$domain_dnshost_id'>
|
||||
<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_details.php?id=$domain_mailhost_id'>
|
||||
<a class='ajax-modal' href='#' data-modal-url='modals/vendor/vendor.php?id=$domain_mailhost_id'>
|
||||
$domain_mailhost_name
|
||||
</a>" : "-";
|
||||
|
||||
|
||||
@@ -866,7 +866,7 @@ $num_root_items = intval($row_root_files['num']) + intval($row_root_docs['num'])
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a href="document_details.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||
<a href="document.php?client_id=<?php echo $client_id; ?>&document_id=<?php echo $document_id; ?>">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-file-alt text-dark mr-3"></i>
|
||||
<div class="media-body">
|
||||
|
||||
@@ -241,7 +241,7 @@ if (isset($_GET['query'])) {
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>"><?php echo $contact_name; ?></a>
|
||||
<td><a href="contact.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>"><?php echo $contact_name; ?></a>
|
||||
<br><small class="text-secondary"><?php echo $contact_title; ?></small>
|
||||
</td>
|
||||
<td><?php echo $contact_email; ?></td>
|
||||
@@ -419,7 +419,7 @@ if (isset($_GET['query'])) {
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><a href="document_details.php?client_id=<?php echo $client_id ?>&document_id=<?php echo $document_id; ?>"><?php echo $document_name; ?></a></td>
|
||||
<td><a href="document.php?client_id=<?php echo $client_id ?>&document_id=<?php echo $document_id; ?>"><?php echo $document_name; ?></a></td>
|
||||
<td>
|
||||
<a href="documents.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
|
||||
</td>
|
||||
@@ -794,7 +794,7 @@ if (isset($_GET['query'])) {
|
||||
if (empty($contact_name)) {
|
||||
$contact_name_display = "-";
|
||||
}else{
|
||||
$contact_name_display = "<a href='contact_details.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a>";
|
||||
$contact_name_display = "<a href='contact.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a>";
|
||||
}
|
||||
$contact_archived_at = escapeHtml($row['contact_archived_at']);
|
||||
if (empty($contact_archived_at)) {
|
||||
@@ -806,7 +806,7 @@ if (isset($_GET['query'])) {
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-2"></i><a href="asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-2"></i><a href="asset.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
|
||||
<?php if(!empty($asset_uri)){ ?>
|
||||
<a href="<?php echo $asset_uri; ?>" target="_blank"><i class="fas fa-fw fa-external-link-alt ml-2"></i></a>
|
||||
<?php } ?>
|
||||
|
||||
@@ -49,7 +49,7 @@ $num_software = $row['num'];
|
||||
|
||||
<?php if (lookupUserPermission("module_support") >= 1) { ?>
|
||||
<li class="nav-item">
|
||||
<a href="contacts.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "contacts.php" || basename($_SERVER["PHP_SELF"]) == "contact_details.php") { echo "active"; } ?>">
|
||||
<a href="contacts.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "contacts.php" || basename($_SERVER["PHP_SELF"]) == "contact.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-address-book"></i>
|
||||
<p>
|
||||
Contacts
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="/agent/contacts.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "contacts.php" || basename($_SERVER["PHP_SELF"]) == "contact_details.php") { echo "active"; } ?>">
|
||||
<a href="/agent/contacts.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "contacts.php" || basename($_SERVER["PHP_SELF"]) == "contact.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-address-book"></i>
|
||||
<p>
|
||||
Contacts
|
||||
@@ -83,7 +83,7 @@
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a href="/agent/projects.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "projects.php" || basename($_SERVER["PHP_SELF"]) == "project_details.php") { echo "active"; } ?>">
|
||||
<a href="/agent/projects.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "projects.php" || basename($_SERVER["PHP_SELF"]) == "project.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-project-diagram"></i>
|
||||
<p>
|
||||
Projects
|
||||
@@ -128,7 +128,7 @@
|
||||
|
||||
<?php if (lookupUserPermission("module_support") >= 1) { ?>
|
||||
<li class="nav-item">
|
||||
<a href="/agent/assets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "assets.php" || basename($_SERVER["PHP_SELF"]) == "asset_details.php") { echo "active"; } ?>">
|
||||
<a href="/agent/assets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "assets.php" || basename($_SERVER["PHP_SELF"]) == "asset.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-desktop"></i>
|
||||
<p>
|
||||
Assets
|
||||
@@ -237,7 +237,7 @@
|
||||
|
||||
<!-- Allow files even without module_support for things like contracts, etc. ) -->
|
||||
<li class="nav-item">
|
||||
<a href="/agent/files.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "files.php" || basename($_SERVER["PHP_SELF"]) == "document_details.php") { echo "active"; } ?>">
|
||||
<a href="/agent/files.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "files.php" || basename($_SERVER["PHP_SELF"]) == "document.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-folder"></i>
|
||||
<p>
|
||||
Files
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="/agent/projects.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "projects.php" || basename($_SERVER["PHP_SELF"]) == "project_details.php") { echo "active"; } ?>">
|
||||
<a href="/agent/projects.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "projects.php" || basename($_SERVER["PHP_SELF"]) == "project.php") { echo "active"; } ?>">
|
||||
<i class="nav-icon fas fa-project-diagram"></i>
|
||||
<p>
|
||||
Projects
|
||||
|
||||
@@ -134,7 +134,7 @@ if (isset($_POST['add_document_from_template'])) {
|
||||
|
||||
flashAlert("Document <strong>$document_name</strong> created from template");
|
||||
|
||||
redirect("document_details.php?client_id=$client_id&document_id=$document_id");
|
||||
redirect("document.php?client_id=$client_id&document_id=$document_id");
|
||||
}
|
||||
|
||||
if (isset($_POST['edit_document'])) {
|
||||
@@ -238,7 +238,7 @@ if (isset($_POST['edit_document'])) {
|
||||
|
||||
flashAlert("Document <strong>$name</strong> edited, previous version kept");
|
||||
|
||||
redirect("document_details.php?client_id=$client_id&document_id=$document_id");
|
||||
redirect("document.php?client_id=$client_id&document_id=$document_id");
|
||||
|
||||
}
|
||||
|
||||
@@ -861,7 +861,7 @@ if (isset($_GET['delete_document'])) {
|
||||
// Determine redirect behavior
|
||||
// If there's a "from" parameter, we can use it to decide where to go
|
||||
if (isset($_GET['from']) && $_GET['from'] === 'document_details') {
|
||||
// User deleted from document_details.php
|
||||
// User deleted from document.php
|
||||
redirect("files.php?client_id=$client_id");
|
||||
} else {
|
||||
// Default behavior — redirect back to previous page
|
||||
|
||||
@@ -218,12 +218,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<a class="text-dark" href="project_details.php?<?php echo $client_url; ?>project_id=<?php echo $project_id; ?>">
|
||||
<a class="text-dark" href="project.php?<?php echo $client_url; ?>project_id=<?php echo $project_id; ?>">
|
||||
<?php echo "$project_prefix$project_number"; ?>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<a class="text-dark" href="project_details.php?project_id=<?php echo $project_id; ?>">
|
||||
<a class="text-dark" href="project.php?project_id=<?php echo $project_id; ?>">
|
||||
<div class="media">
|
||||
<i class="fa fa-fw fa-2x fa-project-diagram mr-3"></i>
|
||||
<div class="media-body">
|
||||
|
||||
@@ -252,7 +252,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$icon = $d['icon']; // already from getAssetIcon
|
||||
?>
|
||||
<i class="fa fa-<?php echo $icon; ?>"></i>
|
||||
<a href="asset_details.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $d['asset_id']; ?>"
|
||||
<a href="asset.php?client_id=<?php echo $client_id; ?>&asset_id=<?php echo $d['asset_id']; ?>"
|
||||
target="_blank">
|
||||
<?php echo $d['asset_name']; ?>
|
||||
<i class="fas fa-external-link-alt ml-1"></i>
|
||||
|
||||
@@ -207,7 +207,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
$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_details.php?id=$vendor_id'>$vendor_name</a>";
|
||||
$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>";
|
||||
}
|
||||
|
||||
@@ -1099,7 +1099,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<div>
|
||||
<i class="fa fa-fw fa-user text-secondary mr-2"></i><a href="#" class="ajax-modal"
|
||||
data-modal-size="lg"
|
||||
data-modal-url="modals/contact/contact_details.php?id=<?= $contact_id ?>"><strong><?= $contact_name ?></strong>
|
||||
data-modal-url="modals/contact/contact.php?id=<?= $contact_id ?>"><strong><?= $contact_name ?></strong>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -1187,7 +1187,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<div class="card-body p-3">
|
||||
<div>
|
||||
<a class="ajax-modal" href="#" data-modal-size="lg"
|
||||
data-modal-url="modals/asset/asset_details.php?<?= $client_url ?>&id=<?= $asset_id ?>">
|
||||
data-modal-url="modals/asset/asset.php?<?= $client_url ?>&id=<?= $asset_id ?>">
|
||||
<i class="fa fa-fw fa-<?php echo $asset_icon; ?> text-secondary mr-2"></i><strong><?php echo $asset_name; ?></strong>
|
||||
</a>
|
||||
</div>
|
||||
@@ -1200,7 +1200,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
?>
|
||||
<div class="mt-1">
|
||||
<a class="ajax-modal" href="#" data-modal-size="lg"
|
||||
data-modal-url="modals/asset/asset_details.php?<?= $client_url ?>&id=<?= $additional_asset_id ?>">
|
||||
data-modal-url="modals/asset/asset.php?<?= $client_url ?>&id=<?= $additional_asset_id ?>">
|
||||
<i class="fa fa-fw fa-<?php echo $additional_asset_icon; ?> text-secondary mr-2"></i><?php echo $additional_asset_name; ?>
|
||||
</a>
|
||||
<?php if (empty($ticket_closed_at)) { ?>
|
||||
@@ -1288,7 +1288,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
</div>
|
||||
<div class="card-body p-3">
|
||||
<div>
|
||||
<i class="fa fa-fw fa-project-diagram text-secondary mr-2"></i><a href="project_details.php?project_id=<?php echo $project_id; ?>" target="_blank"><strong><?= $project_name ?><i class="fa fa-fw fa-external-link-alt ml-1"></i></strong>
|
||||
<i class="fa fa-fw fa-project-diagram text-secondary mr-2"></i><a href="project.php?project_id=<?php echo $project_id; ?>" target="_blank"><strong><?= $project_name ?><i class="fa fa-fw fa-external-link-alt ml-1"></i></strong>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
if (empty($contact_name)) {
|
||||
$contact_display = "-";
|
||||
} else {
|
||||
$contact_display = "<div><a href='contact_details.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a></div>";
|
||||
$contact_display = "<div><a href='contact.php?client_id=$client_id&contact_id=$contact_id'>$contact_name</a></div>";
|
||||
}
|
||||
|
||||
$ticket_invoice_id = intval($row['ticket_invoice_id']);
|
||||
|
||||
Reference in New Issue
Block a user