mirror of https://github.com/itflow-org/itflow
Added the ability to Add ticket templates to project templates and also to remove ticket templates from project templates
This commit is contained in:
parent
5370a70ab8
commit
dbe5525046
|
|
@ -93,21 +93,21 @@ if (isset($_GET['project_template_id'])) {
|
|||
<i class="fas fa-fw fa-ellipsis-v"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectModal<?php echo $project_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editProjectTemplateModal<?php echo $project_template_id; ?>">
|
||||
<i class="fas fa-fw fa-edit mr-2"></i>Edit Template
|
||||
</a>
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addProjectTicketModal">
|
||||
<i class="fas fa-fw fa-life-ring mr-2"></i>Add Ticket
|
||||
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addProjectTemplateTicketTemplateModal">
|
||||
<i class="fas fa-fw fa-life-ring mr-2"></i>Add Ticket 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=<?php echo $project_id; ?>">
|
||||
<a class="dropdown-item text-danger text-bold confirm-link" href="post.php?archive_project_template=<?php echo $project_template_id; ?>">
|
||||
<i class="fas fa-fw fa-archive mr-2"></i>Archive
|
||||
</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=<?php echo $project_id; ?>">
|
||||
<a class="dropdown-item text-danger confirm-link" href="post.php?delete_project_template=<?php echo $project_template_id; ?>">
|
||||
<i class="fas fa-fw fa-trash mr-2"></i>Delete
|
||||
</a>
|
||||
<?php } ?>
|
||||
|
|
@ -134,6 +134,7 @@ if (isset($_GET['project_template_id'])) {
|
|||
<th>Template Name</th>
|
||||
<th>Description</th>
|
||||
<th>Ticket Subject</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -158,6 +159,11 @@ if (isset($_GET['project_template_id'])) {
|
|||
</td>
|
||||
<td><?php echo $ticket_template_description; ?></td>
|
||||
<td><?php echo $ticket_template_subject; ?></td>
|
||||
<td>
|
||||
<a href="post.php?remove_ticket_template_from_project_template=<?php echo $ticket_template_id; ?>" class="btn btn-default btn-sm confirm-link">
|
||||
<i class="fa fa-fw fa-times"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
|
|
@ -172,6 +178,7 @@ if (isset($_GET['project_template_id'])) {
|
|||
<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">
|
||||
|
|
@ -190,6 +197,7 @@ if (isset($_GET['project_template_id'])) {
|
|||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- End Task TemplatesCard -->
|
||||
|
||||
</div> <!-- End col-3 -->
|
||||
|
|
@ -199,6 +207,7 @@ if (isset($_GET['project_template_id'])) {
|
|||
<?php
|
||||
|
||||
require_once "admin_project_template_edit_modal.php";
|
||||
require_once "admin_project_template_ticket_template_add_modal.php";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
<div class="modal" id="addProjectTemplateTicketTemplateModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content bg-dark">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>Adding Ticket Template</h5>
|
||||
<button type="button" class="close text-white" data-dismiss="modal">
|
||||
<span>×</span>
|
||||
</button>
|
||||
</div>
|
||||
<form action="post.php" method="post" autocomplete="off">
|
||||
<input type="hidden" name="project_template_id" value="<?php echo $project_template_id; ?>">
|
||||
<div class="modal-body bg-white">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Ticket Template<strong class="text-danger">*</strong></label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text"><i class="fa fa-fw fa-life-ring"></i></span>
|
||||
</div>
|
||||
<select class="form-control select2" name="ticket_template_id" required>
|
||||
<option value="">- Select a Ticket Template -</option>
|
||||
<?php
|
||||
|
||||
$sql_ticket_templates_select = mysqli_query($mysqli, "SELECT * FROM ticket_templates WHERE ticket_template_project_template_id != $project_template_id AND ticket_template_archived_at IS NULL");
|
||||
while ($row = mysqli_fetch_array($sql_ticket_templates_select)) {
|
||||
$ticket_template_id_select = intval($row['ticket_template_id']);
|
||||
$ticket_template_subject_select = nullable_htmlentities($row['ticket_template_subject']);
|
||||
?>
|
||||
<option value="<?php echo $ticket_template_id_select; ?>"><?php echo $ticket_template_subject_select; ?></option>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
<button type="submit" name="add_ticket_template_to_project_template" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Add</button>
|
||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -42,6 +42,37 @@ if (isset($_POST['edit_project_template'])) {
|
|||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_POST['add_ticket_template_to_project_template'])) {
|
||||
|
||||
validateTechRole();
|
||||
$project_template_id = intval($_POST['project_template_id']);
|
||||
$ticket_template_id = intval($_POST['ticket_template_id']);
|
||||
|
||||
mysqli_query($mysqli, "UPDATE ticket_templates SET ticket_template_project_template_id = $project_template_id WHERE ticket_template_id = $ticket_template_id");
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Project Template', log_action = 'Edit', log_description = '$session_name added a ticket template to project template', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $project_template_id");
|
||||
|
||||
$_SESSION['alert_message'] = "You added a ticket template to the project template";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_GET['remove_ticket_template_from_project_template'])) {
|
||||
|
||||
validateTechRole();
|
||||
$ticket_template_id = intval($_GET['remove_ticket_template_from_project_template']);
|
||||
|
||||
mysqli_query($mysqli, "UPDATE ticket_templates SET ticket_template_project_template_id = 0 WHERE ticket_template_id = $ticket_template_id");
|
||||
|
||||
// Logging
|
||||
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Project Template', log_action = 'Edit', log_description = '$session_name removed a ticket template from a project template', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id, log_entity_id = $ticket_template_id");
|
||||
|
||||
$_SESSION['alert_message'] = "You removed ticket template from the project template";
|
||||
|
||||
header("Location: " . $_SERVER["HTTP_REFERER"]);
|
||||
}
|
||||
|
||||
if (isset($_GET['delete_project_template'])) {
|
||||
|
||||
validateTechRole();
|
||||
|
|
|
|||
Loading…
Reference in New Issue