mirror of https://github.com/itflow-org/itflow
Update Calendar to show past scheduled tickets as different colors based on status.
This commit is contained in:
parent
c72a4a2413
commit
6e14406364
|
|
@ -125,13 +125,29 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||
}
|
||||
|
||||
//Tickets Scheduled
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN tickets ON client_id = ticket_client_id WHERE ticket_schedule IS NOT NULL");
|
||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN tickets ON client_id = ticket_client_id LEFT JOIN users ON ticket_assigned_to = ticket_client_id WHERE ticket_schedule IS NOT NULL");
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
$event_id = intval($row['ticket_id']);
|
||||
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " " . $row['ticket_subject']);
|
||||
if (!empty($username)) {
|
||||
$username = "Unassigned";
|
||||
} else {
|
||||
$username = $row['user_name'];
|
||||
}
|
||||
|
||||
if (strtotime($row['ticket_schedule']) < time()) {
|
||||
if ($row['ticket_status'] == 'Scheduled') {
|
||||
$event_color = "red";
|
||||
}else {
|
||||
$event_color = "green";
|
||||
}
|
||||
} else {
|
||||
$event_color = "grey";
|
||||
}
|
||||
|
||||
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " " . $row['ticket_subject'] . " [" . $username . "]");
|
||||
$event_start = json_encode($row['ticket_schedule']);
|
||||
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'red', url: 'ticket.php?ticket_id=$event_id' },";
|
||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?ticket_id=$event_id' },";
|
||||
}
|
||||
|
||||
//Vendors Added Created
|
||||
|
|
|
|||
|
|
@ -539,7 +539,54 @@ function sendSingleEmail($config_smtp_host, $config_smtp_username, $config_smtp_
|
|||
// Content
|
||||
$mail->isHTML(true); // Set email format to HTML
|
||||
$mail->Subject = "$subject"; // Subject
|
||||
$mail->Body = "$body"; // Content
|
||||
$mail->Body = "<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
color: #333;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.email-container {
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
padding: 20px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.header {
|
||||
font-size: 18px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.link-button {
|
||||
display: inline-block;
|
||||
background-color: #007bff;
|
||||
color: #ffffff;
|
||||
padding: 10px 20px;
|
||||
text-decoration: none;
|
||||
border-radius: 5px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.footer {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-top: 20px;
|
||||
border-top: 1px solid #ddd;
|
||||
padding-top: 10px;
|
||||
}
|
||||
.no-reply {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class='email-container'>
|
||||
$body
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"; // Content
|
||||
|
||||
// Attachments - todo
|
||||
//$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
|
||||
|
|
@ -983,25 +1030,31 @@ function calculateInvoiceBalance($mysqli, $invoice_id) {
|
|||
|
||||
}
|
||||
|
||||
function createCalendarEvent($datetime, $title, $description, $location) {
|
||||
//Use The Zap Cal PHP Library to create a calendar event and return the ics feed
|
||||
|
||||
function createiCalStr($datetime, $title, $description, $location) {
|
||||
require_once "plugins/zapcal/zapcallib.php";
|
||||
|
||||
// Create the iCal object
|
||||
$cal_event = new ZCiCal();
|
||||
|
||||
$event = new ZCiCalNode("VEVENT", $cal_event->curnode);
|
||||
|
||||
|
||||
// Set the method to REQUEST to indicate an invite
|
||||
$event->addNode(new ZCiCalDataNode("METHOD:REQUEST"));
|
||||
$event->addNode(new ZCiCalDataNode("SUMMARY:" . $title));
|
||||
$event->addNode(new ZCiCalDataNode("DTSTART:" . ZCiCal::fromSqlDateTime($datetime)));
|
||||
// Assuming the end time is the same as start time.
|
||||
// Todo: adjust this for actual duration
|
||||
$event->addNode(new ZCiCalDataNode("DTEND:" . ZCiCal::fromSqlDateTime($datetime)));
|
||||
$event->addNode(new ZCiCalDataNode("DTSTAMP:" . ZCiCal::fromSqlDateTime()));
|
||||
$uid = date('Y-m-d-H-i-s') . "@" . $_SERVER['SERVER_NAME'];
|
||||
$event->addNode(new ZCiCalDataNode("UID:" . $uid));
|
||||
$event->addNode(new ZCiCalDataNode("LOCATION:" . $location));
|
||||
$event->addNode(new ZCiCalDataNode("DESCRIPTION:" . $description));
|
||||
// Todo: add organizer details
|
||||
// $event->addNode(new ZCiCalDataNode("ORGANIZER;CN=Organizer Name:MAILTO:organizer@example.com"));
|
||||
|
||||
// Export the iCal object to a string
|
||||
$ics_feed = $cal_event->export();
|
||||
|
||||
|
||||
return $ics_feed;
|
||||
}
|
||||
|
|
|
|||
479
post/ticket.php
479
post/ticket.php
File diff suppressed because it is too large
Load Diff
|
|
@ -59,6 +59,7 @@ if (isset($_GET['ticket_id'])) {
|
|||
$ticket_priority = nullable_htmlentities($row['ticket_priority']);
|
||||
$ticket_billable = intval($row['ticket_billable']);
|
||||
$ticket_scheduled_for = nullable_htmlentities($row['ticket_schedule']);
|
||||
$ticket_onsite = nullable_htmlentities($row['ticket_onsite']);
|
||||
|
||||
//Set Ticket Bage Color based of priority
|
||||
if ($ticket_priority == "High") {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,13 @@
|
|||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Onsite</label>
|
||||
<select class="form-control" name="onsite">
|
||||
<option value="0" <?php if ($ticket_onsite == 0) echo "selected"; ?>>No</option>
|
||||
<option value="1" <?php if ($ticket_onsite == 1) echo "selected"; ?>>Yes</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer bg-white">
|
||||
|
|
|
|||
Loading…
Reference in New Issue