mirror of https://github.com/itflow-org/itflow
Recurring tickets bugfixes
This commit is contained in:
parent
f9a5ca1ef8
commit
dfce95a67b
|
|
@ -3,14 +3,13 @@
|
||||||
|
|
||||||
const clientSelectDropdown = document.getElementById("changeClientSelect"); // Define client selector
|
const clientSelectDropdown = document.getElementById("changeClientSelect"); // Define client selector
|
||||||
|
|
||||||
// If the client selector is disabled, we must be on client_recurring_tickets.php instead. Trigger the contact list update.
|
// // If the client selector is disabled, we must be on client_recurring_tickets.php instead. Trigger the contact list update.
|
||||||
if (clientSelectDropdown.disabled) {
|
if (clientSelectDropdown.disabled) {
|
||||||
|
|
||||||
let client_id = $(clientSelectDropdown).find(':selected').val();
|
let client_id = $(clientSelectDropdown).find(':selected').val();
|
||||||
|
|
||||||
// Update the contacts dropdown list
|
// Update the contacts dropdown list
|
||||||
populateContactsDropdown(client_id);
|
populateContactsDropdown(client_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listener for client selection. Populate contact select when a client is selected
|
// Listener for client selection. Populate contact select when a client is selected
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ function populateRecurringTicketEditModal(client_id, ticket_id) {
|
||||||
// If we get a response from post.php, parse it as JSON
|
// If we get a response from post.php, parse it as JSON
|
||||||
const response = JSON.parse(data);
|
const response = JSON.parse(data);
|
||||||
|
|
||||||
// Access the ticket info, and all potential assets
|
// Access the ticket info, agents and all potential assets
|
||||||
const contacts = response.contacts;
|
const contacts = response.contacts;
|
||||||
const ticket = response.ticket[0];
|
const ticket = response.ticket[0];
|
||||||
const assets = response.assets;
|
|
||||||
const agents = response.agents;
|
const agents = response.agents;
|
||||||
|
const assets = response.assets;
|
||||||
|
|
||||||
// Populate the scheduled ticket modal fields
|
// Populate the scheduled ticket modal fields
|
||||||
document.getElementById("editHeader").innerText = " Edit Recurring ticket: " + ticket.scheduled_ticket_subject;
|
document.getElementById("editHeader").innerText = " Edit Recurring ticket: " + ticket.scheduled_ticket_subject;
|
||||||
|
|
@ -23,6 +23,28 @@ function populateRecurringTicketEditModal(client_id, ticket_id) {
|
||||||
document.getElementById("editTicketNextRun").value = ticket.scheduled_ticket_next_run;
|
document.getElementById("editTicketNextRun").value = ticket.scheduled_ticket_next_run;
|
||||||
tinyMCE.get('editTicketDetails').setContent(ticket.scheduled_ticket_details);
|
tinyMCE.get('editTicketDetails').setContent(ticket.scheduled_ticket_details);
|
||||||
|
|
||||||
|
// Agent assignment dropdown
|
||||||
|
var agentDropdown = document.getElementById("editTicketAgent");
|
||||||
|
|
||||||
|
// Clear agent dropdown
|
||||||
|
var i, L = agentDropdown.options.length -1;
|
||||||
|
for(i = L; i >= 0; i--) {
|
||||||
|
agentDropdown.remove(i);
|
||||||
|
}
|
||||||
|
agentDropdown[agentDropdown.length] = new Option('- Agent -', '0');
|
||||||
|
|
||||||
|
|
||||||
|
// Populate dropdown
|
||||||
|
agents.forEach(agent => {
|
||||||
|
if(parseInt(agent.user_id) == parseInt(ticket.scheduled_ticket_assigned_to)){
|
||||||
|
// Selected agent
|
||||||
|
agentDropdown[agentDropdown.length] = new Option(agent.user_name, agent.user_id, true, true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
agentDropdown[agentDropdown.length] = new Option(agent.user_name, agent.user_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Contact dropdown
|
// Contact dropdown
|
||||||
var contactDropdown = document.getElementById("editTicketContact");
|
var contactDropdown = document.getElementById("editTicketContact");
|
||||||
|
|
||||||
|
|
@ -62,48 +84,28 @@ function populateRecurringTicketEditModal(client_id, ticket_id) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Asset dropdown
|
// Asset dropdown
|
||||||
var assetDropdown = document.getElementById("editTicketAssetId");
|
if (assets && assets.length > 0) {
|
||||||
|
var assetDropdown = document.getElementById("editTicketAssetId");
|
||||||
|
|
||||||
// Clear asset dropdown
|
// Clear asset dropdown
|
||||||
var i, L = assetDropdown.options.length -1;
|
var i, L = assetDropdown.options.length -1;
|
||||||
for(i = L; i >= 0; i--) {
|
for(i = L; i >= 0; i--) {
|
||||||
assetDropdown.remove(i);
|
assetDropdown.remove(i);
|
||||||
|
}
|
||||||
|
assetDropdown[assetDropdown.length] = new Option('- Asset -', '0');
|
||||||
|
|
||||||
|
// Populate dropdown
|
||||||
|
assets.forEach(asset => {
|
||||||
|
if(parseInt(asset.asset_id) == parseInt(ticket.scheduled_ticket_asset_id)){
|
||||||
|
// Selected asset
|
||||||
|
assetDropdown[assetDropdown.length] = new Option(asset.asset_name, asset.asset_id, true, true);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
assetDropdown[assetDropdown.length] = new Option(asset.asset_name, asset.asset_id);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
assetDropdown[assetDropdown.length] = new Option('- Asset -', '0');
|
|
||||||
|
|
||||||
// Populate dropdown
|
|
||||||
assets.forEach(asset => {
|
|
||||||
if(parseInt(asset.asset_id) == parseInt(ticket.scheduled_ticket_asset_id)){
|
|
||||||
// Selected asset
|
|
||||||
assetDropdown[assetDropdown.length] = new Option(asset.asset_name, asset.asset_id, true, true);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
assetDropdown[assetDropdown.length] = new Option(asset.asset_name, asset.asset_id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Agent dropdown
|
|
||||||
var agentDropdown = document.getElementById("editTicketAgent");
|
|
||||||
|
|
||||||
// Clear agent dropdown
|
|
||||||
var i, L = agentDropdown.options.length -1;
|
|
||||||
for(i = L; i >= 0; i--) {
|
|
||||||
agentDropdown.remove(i);
|
|
||||||
}
|
|
||||||
agentDropdown[agentDropdown.length] = new Option('- Agent -', '0');
|
|
||||||
|
|
||||||
|
|
||||||
// Populate dropdown
|
|
||||||
agents.forEach(agent => {
|
|
||||||
if(parseInt(agent.user_id) == parseInt(ticket.scheduled_ticket_assigned_to)){
|
|
||||||
// Selected agent
|
|
||||||
agentDropdown[agentDropdown.length] = new Option(agent.user_name, agent.user_id, true, true);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
agentDropdown[agentDropdown.length] = new Option(agent.user_name, agent.user_id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<form action="post.php" method="post" autocomplete="off">
|
<form action="post.php" method="post" autocomplete="off">
|
||||||
|
<?php if (isset($client_id)) { ?>
|
||||||
|
<input type="hidden" name="client" value="<?php echo $client_id; ?>>">
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<div class="modal-body bg-white">
|
<div class="modal-body bg-white">
|
||||||
|
|
||||||
<ul class="nav nav-pills nav-justified mb-3">
|
<ul class="nav nav-pills nav-justified mb-3">
|
||||||
|
|
@ -111,7 +115,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Contact <strong class="text-danger">*</strong></label>
|
<label>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>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue