mirror of
https://github.com/itflow-org/itflow
synced 2026-08-16 20:45:12 +00:00
Retire v1 Ticket and merge into 1 add ticket
This commit is contained in:
@@ -317,7 +317,7 @@ if (isset($_GET['get_client_contacts'])) {
|
|||||||
|
|
||||||
$contact_sql = mysqli_query(
|
$contact_sql = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT contact_id, contact_name, contact_primary, contact_important, contact_technical FROM contacts
|
"SELECT contact_id, contact_name, contact_title, contact_email, contact_primary, contact_important, contact_technical FROM contacts
|
||||||
LEFT JOIN clients on contact_client_id = client_id
|
LEFT JOIN clients on contact_client_id = client_id
|
||||||
WHERE contacts.contact_archived_at IS NULL AND contact_client_id = $client_id
|
WHERE contacts.contact_archived_at IS NULL AND contact_client_id = $client_id
|
||||||
$access_permission_query
|
$access_permission_query
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<?php if (lookupUserPermission("module_support") >= 2) { ?>
|
<?php if (lookupUserPermission("module_support") >= 2) { ?>
|
||||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add_v2.php?client_id=<?= $client_id ?>" data-modal-size="lg">
|
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add.php?client_id=<?= $client_id ?>" data-modal-size="lg">
|
||||||
<i class="fas fa-fw fa-life-ring mr-2"></i>New Ticket
|
<i class="fas fa-fw fa-life-ring mr-2"></i>New Ticket
|
||||||
</a>
|
</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|||||||
@@ -87,19 +87,24 @@ function refreshDropdown(dropdown) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-applies the value the modal was opened with (e.g. ticket_add_v2.php?project_id=4),
|
// Re-applies the value the modal was opened with (e.g. ticket_add.php?project_id=4),
|
||||||
// which can only be selected once the options it refers to exist
|
// which can only be selected once the options it refers to exist
|
||||||
function applyPreselection(dropdown) {
|
function applyPreselection(dropdown) {
|
||||||
|
|
||||||
// '0' is the "none selected" value every one of these dropdowns uses, and is
|
if (!hasPreselection(dropdown)) {
|
||||||
// truthy as a string - so it has to be excluded explicitly
|
|
||||||
if (!dropdown || !dropdown.dataset.selected || dropdown.dataset.selected === '0') {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dropdown.value = dropdown.dataset.selected;
|
dropdown.value = dropdown.dataset.selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// True when the modal was opened with a specific value for this dropdown.
|
||||||
|
// '0' is the "none selected" value every one of these dropdowns uses, and is
|
||||||
|
// truthy as a string - so it has to be excluded explicitly.
|
||||||
|
function hasPreselection(dropdown) {
|
||||||
|
return Boolean(dropdown && dropdown.dataset.selected && dropdown.dataset.selected !== '0');
|
||||||
|
}
|
||||||
|
|
||||||
// Adds an optgroup to a dropdown and returns it, so options can be appended into it
|
// Adds an optgroup to a dropdown and returns it, so options can be appended into it
|
||||||
function appendOptionGroup(dropdown, label) {
|
function appendOptionGroup(dropdown, label) {
|
||||||
|
|
||||||
@@ -144,10 +149,11 @@ function buildAssetLabel(asset) {
|
|||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate client contacts
|
// Populate client contacts - one request feeds both the contact picker and the
|
||||||
|
// watchers list, as both are built from the same set of people
|
||||||
function populateContactsDropdown(client_id) {
|
function populateContactsDropdown(client_id) {
|
||||||
|
|
||||||
if (!document.getElementById("contactSelect")) {
|
if (!document.getElementById("contactSelect") && !document.getElementById("watchersSelect")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,22 +170,46 @@ function populateContactsDropdown(client_id) {
|
|||||||
const contacts = response.contacts || [];
|
const contacts = response.contacts || [];
|
||||||
|
|
||||||
// Contacts dropdown
|
// Contacts dropdown
|
||||||
const contactSelectDropdown = resetDropdown("contactSelect", '- Contact -', '0');
|
const contactSelectDropdown = resetDropdown("contactSelect", '- No One -', '0');
|
||||||
|
|
||||||
|
// Watchers is a tags field - any address can be typed in, these are just the handy ones
|
||||||
|
const watchersDropdown = resetDropdown("watchersSelect", null, null);
|
||||||
|
|
||||||
// Populate dropdown
|
// Populate dropdown
|
||||||
contacts.forEach(contact => {
|
contacts.forEach(contact => {
|
||||||
var appendText = "";
|
var appendText = "";
|
||||||
if (contact.contact_primary == "1") {
|
if (contact.contact_title) {
|
||||||
appendText = " (Primary)";
|
appendText = " - " + contact.contact_title;
|
||||||
} else if (contact.contact_technical == "1") {
|
}
|
||||||
appendText = " (Technical)";
|
if (contact.contact_primary == "1") {
|
||||||
|
appendText = appendText + " (Primary)";
|
||||||
|
} else if (contact.contact_technical == "1") {
|
||||||
|
appendText = appendText + " (Technical)";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contactSelectDropdown) {
|
||||||
|
contactSelectDropdown[contactSelectDropdown.length] = new Option(contact.contact_name + appendText, contact.contact_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (watchersDropdown && contact.contact_email) {
|
||||||
|
watchersDropdown[watchersDropdown.length] = new Option(contact.contact_email, contact.contact_email);
|
||||||
}
|
}
|
||||||
contactSelectDropdown[contactSelectDropdown.length] = new Option(contact.contact_name + appendText, contact.contact_id);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Default to the client's primary contact unless the modal was opened for a
|
||||||
|
// specific one. Contacts arrive primary-first.
|
||||||
|
if (contactSelectDropdown && !hasPreselection(contactSelectDropdown)) {
|
||||||
|
const primaryContact = contacts.find(contact => contact.contact_primary == "1");
|
||||||
|
|
||||||
|
if (primaryContact) {
|
||||||
|
contactSelectDropdown.value = primaryContact.contact_id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
applyPreselection(contactSelectDropdown);
|
applyPreselection(contactSelectDropdown);
|
||||||
|
|
||||||
refreshDropdown(contactSelectDropdown);
|
refreshDropdown(contactSelectDropdown);
|
||||||
|
refreshDropdown(watchersDropdown);
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ require_once '../../../includes/modal_header.php';
|
|||||||
|
|
||||||
$client_id = intval($_GET['client_id'] ?? 0);
|
$client_id = intval($_GET['client_id'] ?? 0);
|
||||||
$contact_id = intval($_GET['contact_id'] ?? 0);
|
$contact_id = intval($_GET['contact_id'] ?? 0);
|
||||||
$asset_id = intval($_GET['asset_id'] ?? 0);
|
|
||||||
$project_id = intval($_GET['project_id'] ?? 0);
|
$project_id = intval($_GET['project_id'] ?? 0);
|
||||||
|
$asset_id = intval($_GET['asset_id'] ?? 0);
|
||||||
|
|
||||||
if ($client_id) {
|
if ($client_id) {
|
||||||
enforceClientAccess();
|
enforceClientAccess();
|
||||||
@@ -15,72 +15,76 @@ ob_start();
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="modal-header bg-dark">
|
<div class="modal-header bg-dark">
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>New Ticket (v1)</h5>
|
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>New Ticket</h5>
|
||||||
<button type="button" class="close text-white" data-dismiss="modal">
|
<button type="button" class="close text-white" data-dismiss="modal">
|
||||||
<span>×</span>
|
<span>×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
||||||
|
<!-- Hidden/System fields -->
|
||||||
<?php if (isset($_GET['project_id'])) { ?>
|
<?php if ($client_id) { ?>
|
||||||
<input type="hidden" name="project_id" value="<?= intval($_GET['project_id']) ?>">
|
<input type="hidden" name="client_id" id="clientIdHidden" value="<?= $client_id ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
<input type="hidden" name="billable" value="0">
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
|
|
||||||
<?php if (isset($_GET['client_id'])) { ?>
|
<!-- Nav -->
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="pill" href="#pills-ticket-details"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
|
<a class="nav-link active" data-toggle="pill" href="#pills-add-details"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-ticket-contacts"><i class="fa fa-fw fa-users mr-2"></i>Contact</a>
|
<a class="nav-link" data-toggle="pill" href="#pills-add-relationships"><i class="fa fa-fw fa-desktop mr-2"></i>Assignment</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
</ul>
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-ticket-assignment"><i class="fa fa-fw fa-desktop mr-2"></i>Assignment</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
|
<!-- Content -->
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
<div class="tab-pane fade show active" id="pills-ticket-details">
|
<!-- Ticket details -->
|
||||||
|
<div class="tab-pane fade show active" id="pills-add-details">
|
||||||
|
|
||||||
<?php if ($client_id) { ?>
|
<!-- Ticket client/contact -->
|
||||||
<input type="hidden" name="client_id" value="<?= $client_id ?>">
|
<div class="row">
|
||||||
<?php } else { ?>
|
<div class="col">
|
||||||
|
<div class="form-group">
|
||||||
<div class="form-group">
|
<label>Client <strong class="text-danger">*</strong></label>
|
||||||
<label>Client <strong class="text-danger">*</strong> / <span class="text-secondary">Use Primary Contact</label>
|
<div class="input-group">
|
||||||
<div class="input-group">
|
<div class="input-group-prepend">
|
||||||
<div class="input-group-prepend">
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="client_id" required>
|
|
||||||
<option value="">- Client -</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql)) {
|
|
||||||
$client_id_select = intval($row['client_id']);
|
|
||||||
$client_name = escapeHtml($row['client_name']); ?>
|
|
||||||
<option value="<?= $client_id_select ?>"><?= $client_name ?></option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
<div class="input-group-append">
|
|
||||||
<div class="input-group-text">
|
|
||||||
<input type="checkbox" name="use_primary_contact" value="1">
|
|
||||||
</div>
|
</div>
|
||||||
|
<select class="form-control select2" name="client_id" id="changeClientSelect" required <?php if ($client_id) { echo "disabled"; } ?>>
|
||||||
|
<option value="">- Select a Client -</option>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_lead = 0 AND client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
|
||||||
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
|
$client_id_select = intval($row['client_id']);
|
||||||
|
$client_name = escapeHtml($row['client_name']); ?>
|
||||||
|
|
||||||
|
<option value="<?= $client_id_select ?>" <?php if ($client_id == $client_id_select) {echo "selected"; } ?>><?= $client_name ?></option>
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col">
|
||||||
<?php } ?>
|
<div class="form-group">
|
||||||
|
<label>Contact </label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="contact_id" id="contactSelect" data-selected="<?= $contact_id ?>">
|
||||||
|
<option value="0">- No One -</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Template</label>
|
<label>Template</label>
|
||||||
@@ -91,7 +95,7 @@ ob_start();
|
|||||||
<select class="form-control select2" id="ticket_template_select" name="ticket_template_id" required>
|
<select class="form-control select2" id="ticket_template_select" name="ticket_template_id" required>
|
||||||
<option value="0">- Choose a Template -</option>
|
<option value="0">- Choose a Template -</option>
|
||||||
<?php
|
<?php
|
||||||
$sql_ticket_templates = mysqli_query($mysqli, "
|
$sql_ticket_templates = mysqli_query($mysqli, "
|
||||||
SELECT tt.ticket_template_id,
|
SELECT tt.ticket_template_id,
|
||||||
tt.ticket_template_name,
|
tt.ticket_template_name,
|
||||||
tt.ticket_template_subject,
|
tt.ticket_template_subject,
|
||||||
@@ -105,19 +109,19 @@ ob_start();
|
|||||||
ORDER BY tt.ticket_template_name ASC
|
ORDER BY tt.ticket_template_name ASC
|
||||||
");
|
");
|
||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_ticket_templates)) {
|
while ($row = mysqli_fetch_assoc($sql_ticket_templates)) {
|
||||||
$ticket_template_id_select = intval($row['ticket_template_id']);
|
$ticket_template_id_select = intval($row['ticket_template_id']);
|
||||||
$ticket_template_name_select = escapeHtml($row['ticket_template_name']);
|
$ticket_template_name_select = escapeHtml($row['ticket_template_name']);
|
||||||
$ticket_template_subject_select = escapeHtml($row['ticket_template_subject']);
|
$ticket_template_subject_select = escapeHtml($row['ticket_template_subject']);
|
||||||
$ticket_template_details_select = escapeHtml($row['ticket_template_details']);
|
$ticket_template_details_select = escapeHtml($row['ticket_template_details']);
|
||||||
$task_count = intval($row['task_count']);
|
$task_count = intval($row['task_count']);
|
||||||
?>
|
?>
|
||||||
<option value="<?= $ticket_template_id_select ?>"
|
<option value="<?= $ticket_template_id_select ?>"
|
||||||
data-subject="<?= $ticket_template_subject_select ?>"
|
data-subject="<?= $ticket_template_subject_select ?>"
|
||||||
data-details="<?= $ticket_template_details_select ?>">
|
data-details="<?= $ticket_template_details_select ?>">
|
||||||
<?= $ticket_template_name_select ?> (<?= $task_count ?> tasks)
|
<?= $ticket_template_name_select ?> (<?= $task_count ?> tasks)
|
||||||
</option>
|
</option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -169,7 +173,6 @@ ob_start();
|
|||||||
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
||||||
$category_id = intval($row['category_id']);
|
$category_id = intval($row['category_id']);
|
||||||
$category_name = escapeHtml($row['category_name']);
|
$category_name = escapeHtml($row['category_name']);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<option value="<?= $category_id ?>"><?= $category_name ?></option>
|
<option value="<?= $category_id ?>"><?= $category_name ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@@ -177,7 +180,7 @@ ob_start();
|
|||||||
</select>
|
</select>
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button class="btn btn-secondary ajax-modal" type="button"
|
<button class="btn btn-secondary ajax-modal" type="button"
|
||||||
data-modal-url="../admin/modals/category/category_add.php?category=Ticket">
|
data-modal-url="../admin/modals/category/category_add.php?category=Ticket">
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
<i class="fas fa-fw fa-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -196,21 +199,18 @@ ob_start();
|
|||||||
<span class="input-group-text"><i class="fa fa-fw fa-user-check"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-user-check"></i></span>
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="assigned_to">
|
<select class="form-control select2" name="assigned_to">
|
||||||
<option value="0">Not Assigned</option>
|
<option value="0">- Unassigned -</option>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sql = mysqli_query(
|
$sql = mysqli_query(
|
||||||
$mysqli,
|
$mysqli,
|
||||||
"SELECT user_id, user_name FROM users
|
"SELECT user_id, user_name FROM users
|
||||||
WHERE user_type = 1
|
WHERE user_type = 1 AND user_status = 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
||||||
AND user_status = 1
|
|
||||||
AND user_archived_at IS NULL
|
|
||||||
ORDER BY user_name ASC"
|
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_assoc($sql)) {
|
while ($row = mysqli_fetch_assoc($sql)) {
|
||||||
$user_id = intval($row['user_id']);
|
$user_id = intval($row['user_id']);
|
||||||
$user_name = escapeHtml($row['user_name']); ?>
|
$user_name = escapeHtml($row['user_name']); ?>
|
||||||
<option <?php if ($session_user_id == $user_id) { echo "selected"; } ?> value="<?= $user_id ?>"><?= $user_name ?></option>
|
<option value="<?= $user_id ?>"><?= $user_name ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@@ -229,244 +229,114 @@ ob_start();
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Watchers</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="watchers[]" id="watchersSelect" data-tags="true" data-placeholder="Enter or select email address" multiple>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php if ($config_module_enable_accounting) { ?>
|
<?php if ($config_module_enable_accounting) { ?>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="custom-control custom-switch">
|
<div class="custom-control custom-switch">
|
||||||
<input type="checkbox" class="custom-control-input" name="billable" <?php if ($config_ticket_default_billable == 1) { echo "checked"; } ?> value="1" id="billableSwitch">
|
<input type="checkbox" class="custom-control-input" name="billable" <?php if ($config_ticket_default_billable == 1) { echo "checked"; } ?> value="1" id="billable">
|
||||||
<label class="custom-control-label" for="billableSwitch">Mark Billable</label>
|
<label class="custom-control-label" for="billable">Mark Billable</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($client_id) { ?>
|
<div class="tab-pane fade" id="pills-add-relationships">
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-ticket-contacts">
|
<div class="form-group">
|
||||||
|
<label>Project</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="project_id" id="projectSelect" data-selected="<?= $project_id ?>">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="hidden" name="client_id" value="<?= $client_id ?>">
|
<div class="form-group">
|
||||||
|
<label>Asset</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="asset_id" id="assetSelect" data-selected="<?= $asset_id ?>">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Contact</label>
|
<label>Additional Assets</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="additional_assets[]" id="additionalAssetsSelect" data-placeholder="- Select Additional Assets -" multiple>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Location</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="location_id" id="locationSelect">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
|
||||||
|
<div class="col">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Vendor</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
||||||
|
</div>
|
||||||
|
<select class="form-control select2" name="vendor_id" id="vendorSelect">
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="contact_id">
|
|
||||||
<option value="0">- No One -</option>
|
|
||||||
<?php
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT contact_id, contact_name, contact_title, contact_primary, contact_technical FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL ORDER BY contact_primary DESC, contact_technical DESC, contact_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql)) {
|
|
||||||
$contact_id_select = intval($row['contact_id']);
|
|
||||||
$contact_name_select = escapeHtml($row['contact_name']);
|
|
||||||
$contact_primary_select = intval($row['contact_primary']);
|
|
||||||
if($contact_primary_select == 1) {
|
|
||||||
$contact_primary_display = " (Primary)";
|
|
||||||
} else {
|
|
||||||
$contact_primary_display = "";
|
|
||||||
}
|
|
||||||
$contact_technical_select = intval($row['contact_technical']);
|
|
||||||
if($contact_technical_select == 1) {
|
|
||||||
$contact_technical_display = " (Technical)";
|
|
||||||
} else {
|
|
||||||
$contact_technical_display = "";
|
|
||||||
}
|
|
||||||
$contact_title_select = escapeHtml($row['contact_title']);
|
|
||||||
if($contact_title_select) {
|
|
||||||
$contact_title_display = " - $contact_title_select";
|
|
||||||
} else {
|
|
||||||
$contact_title_display = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
<option value="<?= $contact_id_select ?>"
|
|
||||||
<?php
|
|
||||||
if ($contact_id == $contact_id_select) {
|
|
||||||
echo "selected";
|
|
||||||
} elseif (!$contact_id && $contact_primary_select == 1) {
|
|
||||||
echo "selected";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
>
|
|
||||||
<?= "$contact_name_select$contact_title_display$contact_primary_display$contact_technical_display" ?>
|
|
||||||
</option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="col">
|
||||||
<label>Watchers</label>
|
<div class="form-group">
|
||||||
<div class="input-group">
|
<label>Vendor Ticket Number</label>
|
||||||
<div class="input-group-prepend">
|
<div class="input-group">
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-envelope"></i></span>
|
<div class="input-group-prepend">
|
||||||
|
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
||||||
|
</div>
|
||||||
|
<input type="text" class="form-control" name="vendor_ticket_number" placeholder="Vendor ticket number">
|
||||||
</div>
|
</div>
|
||||||
<select class="form-control select2" name="watchers[]" data-tags="true" data-placeholder="Enter or select email address" multiple>
|
|
||||||
<option value=""></option>
|
|
||||||
<?php
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT contact_email FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL AND contact_email IS NOT NULL ORDER BY contact_email ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql)) {
|
|
||||||
$contact_email = escapeHtml($row['contact_email']);
|
|
||||||
?>
|
|
||||||
<option><?= $contact_email ?></option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-ticket-assignment">
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Primary Asset</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="asset_id">
|
|
||||||
<option value="0">- None -</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, contact_name FROM assets LEFT JOIN contacts ON contact_id = asset_contact_id WHERE asset_client_id = $client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_assets)) {
|
|
||||||
$asset_id_select = intval($row['asset_id']);
|
|
||||||
$asset_name_select = escapeHtml($row['asset_name']);
|
|
||||||
$asset_contact_name_select = escapeHtml($row['contact_name']);
|
|
||||||
?>
|
|
||||||
<option value="<?= $asset_id_select ?>"
|
|
||||||
<?php if ($asset_id == $asset_id_select) { echo "selected"; }?>
|
|
||||||
><?= "$asset_name_select - $asset_contact_name_select" ?></option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Additional Assets</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="additional_assets[]" data-tags="true" data-placeholder="- Select Additional Assets -" multiple>
|
|
||||||
<option value=""></option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, contact_name FROM assets LEFT JOIN contacts ON contact_id = asset_contact_id WHERE asset_client_id = $client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_assets)) {
|
|
||||||
$asset_id_select = intval($row['asset_id']);
|
|
||||||
$asset_name_select = escapeHtml($row['asset_name']);
|
|
||||||
$asset_contact_name_select = escapeHtml($row['contact_name']);
|
|
||||||
?>
|
|
||||||
<option value="<?= $asset_id_select ?>">
|
|
||||||
<?= "$asset_name_select - $asset_contact_name_select" ?>
|
|
||||||
</option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Location</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="location_id">
|
|
||||||
<option value="0">- None -</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql_locations = mysqli_query($mysqli, "SELECT location_id, location_name FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL ORDER BY location_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_locations)) {
|
|
||||||
$location_id_select = intval($row['location_id']);
|
|
||||||
$location_name_select = escapeHtml($row['location_name']);
|
|
||||||
?>
|
|
||||||
<option value="<?= $location_id_select ?>"><?= $location_name_select ?></option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="col">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Vendor</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="vendor_id">
|
|
||||||
<option value="0">- None -</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql_vendors = mysqli_query($mysqli, "SELECT vendor_id, vendor_name FROM vendors WHERE vendor_client_id = $client_id AND vendor_archived_at IS NULL ORDER BY vendor_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_vendors)) {
|
|
||||||
$vendor_id_select = intval($row['vendor_id']);
|
|
||||||
$vendor_name_select = escapeHtml($row['vendor_name']); ?>
|
|
||||||
<option value="<?= $vendor_id_select ?>"><?= $vendor_name_select ?></option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Vendor Ticket Number</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="vendor_ticket_number" placeholder="Vendor ticket number">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Project</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="project_id">
|
|
||||||
<option value="0">- Select Project -</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql_projects = mysqli_query($mysqli, "SELECT project_id, project_name FROM projects WHERE project_client_id = $client_id AND project_completed_at IS NULL AND project_archived_at IS NULL ORDER BY project_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_projects)) {
|
|
||||||
$project_id_select = intval($row['project_id']);
|
|
||||||
$project_name_select = escapeHtml($row['project_name']); ?>
|
|
||||||
<option <?php if ($project_id == $project_id_select) { echo "selected"; } ?> value="<?= $project_id_select ?>"><?= $project_name_select ?></option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="submit" name="add_ticket" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create</button>
|
<button type="submit" name="add_ticket" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create Ticket</button>
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Ticket Templates -->
|
<!-- Ticket Templates -->
|
||||||
@@ -491,6 +361,11 @@ $(document).on('change', '#ticket_template_select', function () {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- Ticket Client/Contact JS -->
|
||||||
|
<link rel="stylesheet" href="/libs/jquery-ui/jquery-ui.min.css">
|
||||||
|
<script src="/libs/jquery-ui/jquery-ui.min.js"></script>
|
||||||
|
<script src="/agent/js/tickets_add_modal.js"></script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once '../../../includes/modal_footer.php';
|
require_once '../../../includes/modal_footer.php';
|
||||||
|
|||||||
@@ -1,350 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once '../../../includes/modal_header.php';
|
|
||||||
|
|
||||||
$client_id = intval($_GET['client_id'] ?? 0);
|
|
||||||
$contact_id = intval($_GET['contact_id'] ?? 0);
|
|
||||||
$project_id = intval($_GET['project_id'] ?? 0);
|
|
||||||
|
|
||||||
if ($client_id) {
|
|
||||||
enforceClientAccess();
|
|
||||||
}
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
|
|
||||||
?>
|
|
||||||
<div class="modal-header bg-dark">
|
|
||||||
<h5 class="modal-title"><i class="fas fa-fw fa-life-ring mr-2"></i>New Ticket (v2)</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="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
|
|
||||||
<!-- Hidden/System fields -->
|
|
||||||
<?php if ($client_id) { ?>
|
|
||||||
<input type="hidden" name="client_id" id="clientIdHidden" value="<?= $client_id ?>">
|
|
||||||
<?php } ?>
|
|
||||||
<input type="hidden" name="billable" value="0">
|
|
||||||
|
|
||||||
<div class="modal-body">
|
|
||||||
|
|
||||||
<!-- Nav -->
|
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link active" data-toggle="pill" href="#pills-add-details"><i class="fa fa-fw fa-life-ring mr-2"></i>Details</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link" data-toggle="pill" href="#pills-add-relationships"><i class="fa fa-fw fa-desktop mr-2"></i>Assignment</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<!-- Content -->
|
|
||||||
<div class="tab-content">
|
|
||||||
|
|
||||||
<!-- Ticket details -->
|
|
||||||
<div class="tab-pane fade show active" id="pills-add-details">
|
|
||||||
|
|
||||||
<!-- Ticket client/contact -->
|
|
||||||
<?php if ($contact_id) { ?>
|
|
||||||
<input type="hidden" name="contact_id" value="<?= $contact_id ?>">
|
|
||||||
<?php } else { ?>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Client <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-user"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="client_id" id="changeClientSelect" required <?php if ($client_id) { echo "disabled"; } ?>>
|
|
||||||
<option value="">- Select a Client -</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_lead = 0 AND client_archived_at IS NULL $access_permission_query ORDER BY client_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql)) {
|
|
||||||
$client_id_select = intval($row['client_id']);
|
|
||||||
$client_name = escapeHtml($row['client_name']); ?>
|
|
||||||
|
|
||||||
<option value="<?= $client_id_select ?>" <?php if ($client_id == $client_id_select) {echo "selected"; } ?>><?= $client_name ?></option>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Contact </label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-user"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="contact_id" id="contactSelect">
|
|
||||||
<option value="">No Contact</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Template</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-cube"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" id="ticket_template_select" name="ticket_template_id" required>
|
|
||||||
<option value="0">- Choose a Template -</option>
|
|
||||||
<?php
|
|
||||||
$sql_ticket_templates = mysqli_query($mysqli, "
|
|
||||||
SELECT tt.ticket_template_id,
|
|
||||||
tt.ticket_template_name,
|
|
||||||
tt.ticket_template_subject,
|
|
||||||
tt.ticket_template_details,
|
|
||||||
COUNT(ttt.task_template_id) as task_count
|
|
||||||
FROM ticket_templates tt
|
|
||||||
LEFT JOIN task_templates ttt
|
|
||||||
ON tt.ticket_template_id = ttt.task_template_ticket_template_id
|
|
||||||
WHERE tt.ticket_template_archived_at IS NULL
|
|
||||||
GROUP BY tt.ticket_template_id
|
|
||||||
ORDER BY tt.ticket_template_name ASC
|
|
||||||
");
|
|
||||||
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_ticket_templates)) {
|
|
||||||
$ticket_template_id_select = intval($row['ticket_template_id']);
|
|
||||||
$ticket_template_name_select = escapeHtml($row['ticket_template_name']);
|
|
||||||
$ticket_template_subject_select = escapeHtml($row['ticket_template_subject']);
|
|
||||||
$ticket_template_details_select = escapeHtml($row['ticket_template_details']);
|
|
||||||
$task_count = intval($row['task_count']);
|
|
||||||
?>
|
|
||||||
<option value="<?= $ticket_template_id_select ?>"
|
|
||||||
data-subject="<?= $ticket_template_subject_select ?>"
|
|
||||||
data-details="<?= $ticket_template_details_select ?>">
|
|
||||||
<?= $ticket_template_name_select ?> (<?= $task_count ?> tasks)
|
|
||||||
</option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Subject <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-tag"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" id="subjectInput" name="subject" placeholder="Subject" maxlength="500" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<textarea class="form-control tinymceTicket" id="detailsInput" name="details"></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Priority <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-thermometer-half"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="priority" required>
|
|
||||||
<option>Low</option>
|
|
||||||
<option>Medium</option>
|
|
||||||
<option>High</option>
|
|
||||||
<option>Urgent</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Category</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-layer-group"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="category_id">
|
|
||||||
<option value="0">- Not Categorized -</option>
|
|
||||||
<?php
|
|
||||||
$sql_categories = mysqli_query($mysqli, "SELECT category_id, category_name FROM categories WHERE category_type = 'Ticket' AND category_archived_at IS NULL ORDER BY category_name ASC");
|
|
||||||
while ($row = mysqli_fetch_assoc($sql_categories)) {
|
|
||||||
$category_id = intval($row['category_id']);
|
|
||||||
$category_name = escapeHtml($row['category_name']);
|
|
||||||
?>
|
|
||||||
<option value="<?= $category_id ?>"><?= $category_name ?></option>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</select>
|
|
||||||
<div class="input-group-append">
|
|
||||||
<button class="btn btn-secondary ajax-modal" type="button"
|
|
||||||
data-modal-url="../admin/modals/category/category_add.php?category=Ticket">
|
|
||||||
<i class="fas fa-fw fa-plus"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Assign to</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-user-check"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="assigned_to">
|
|
||||||
<option value="0">- Unassigned -</option>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$sql = mysqli_query(
|
|
||||||
$mysqli,
|
|
||||||
"SELECT user_id, user_name FROM users
|
|
||||||
WHERE user_type = 1 AND user_status = 1 AND user_archived_at IS NULL ORDER BY user_name ASC"
|
|
||||||
);
|
|
||||||
while ($row = mysqli_fetch_assoc($sql)) {
|
|
||||||
$user_id = intval($row['user_id']);
|
|
||||||
$user_name = escapeHtml($row['user_name']); ?>
|
|
||||||
<option value="<?= $user_id ?>"><?= $user_name ?></option>
|
|
||||||
<?php } ?>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php if ($config_module_enable_accounting) { ?>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="custom-control custom-switch">
|
|
||||||
<input type="checkbox" class="custom-control-input" name="billable" <?php if ($config_ticket_default_billable == 1) { echo "checked"; } ?> value="1" id="billable">
|
|
||||||
<label class="custom-control-label" for="billable">Mark Billable</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tab-pane fade" id="pills-add-relationships">
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Project</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-project-diagram"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="project_id" id="projectSelect" data-selected="<?= $project_id ?>">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Asset</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="asset_id" id="assetSelect">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Additional Assets</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-desktop"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="additional_assets[]" id="additionalAssetsSelect" data-placeholder="- Select Additional Assets -" multiple>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Location</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-map-marker-alt"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="location_id" id="locationSelect">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Vendor</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-building"></i></span>
|
|
||||||
</div>
|
|
||||||
<select class="form-control select2" name="vendor_id" id="vendorSelect">
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Vendor Ticket Number</label>
|
|
||||||
<div class="input-group">
|
|
||||||
<div class="input-group-prepend">
|
|
||||||
<span class="input-group-text"><i class="fa fa-fw fa-tag"></i></span>
|
|
||||||
</div>
|
|
||||||
<input type="text" class="form-control" name="vendor_ticket_number" placeholder="Vendor ticket number">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="submit" name="add_ticket" class="btn btn-primary text-bold"><i class="fas fa-check mr-2"></i>Create Ticket</button>
|
|
||||||
<button type="button" class="btn btn-light" data-dismiss="modal"><i class="fas fa-times mr-2"></i>Cancel</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- Ticket Templates -->
|
|
||||||
<script>
|
|
||||||
$(document).on('change', '#ticket_template_select', function () {
|
|
||||||
const $opt = $(this).find(':selected');
|
|
||||||
const templateSubject = $opt.data('subject') || '';
|
|
||||||
const templateDetails = $opt.data('details') || '';
|
|
||||||
|
|
||||||
$('#subjectInput').val(templateSubject);
|
|
||||||
|
|
||||||
if (window.tinymce) {
|
|
||||||
const editor = tinymce.get('detailsInput');
|
|
||||||
if (editor) {
|
|
||||||
editor.setContent(templateDetails);
|
|
||||||
} else {
|
|
||||||
$('#detailsInput').val(templateDetails);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$('#detailsInput').val(templateDetails);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- Ticket Client/Contact JS -->
|
|
||||||
<link rel="stylesheet" href="/libs/jquery-ui/jquery-ui.min.css">
|
|
||||||
<script src="/libs/jquery-ui/jquery-ui.min.js"></script>
|
|
||||||
<script src="/agent/js/tickets_add_modal.js"></script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
require_once '../../../includes/modal_footer.php';
|
|
||||||
@@ -196,7 +196,7 @@ $sql_categories_filter = mysqli_query(
|
|||||||
<?php if (lookupUserPermission("module_support") >= 2) { ?>
|
<?php if (lookupUserPermission("module_support") >= 2) { ?>
|
||||||
<div class="card-tools">
|
<div class="card-tools">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/ticket/ticket_add_v2.php?<?= $client_url ?>" data-modal-size="lg">
|
<button type="button" class="btn btn-primary ajax-modal" data-modal-url="modals/ticket/ticket_add.php?<?= $client_url ?>" data-modal-size="lg">
|
||||||
<i class="fas fa-plus"></i><span class="d-none d-lg-inline ml-2">New Ticket</span>
|
<i class="fas fa-plus"></i><span class="d-none d-lg-inline ml-2">New Ticket</span>
|
||||||
</button>
|
</button>
|
||||||
<?php if ($num_rows[0] > 0) { ?>
|
<?php if ($num_rows[0] > 0) { ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user