mirror of
https://github.com/itflow-org/itflow
synced 2026-03-06 13:54:51 +00:00
Merged Client and Global Calendar into one code base seperated them with some header logic
This commit is contained in:
@@ -1,7 +1,17 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "includes/inc_all.php";
|
// If client_id is in URI then show client Side Bar and client header
|
||||||
|
if (isset($_GET['client_id'])) {
|
||||||
|
require_once "includes/inc_all_client.php";
|
||||||
|
$client_event_query = "WHERE event_client_id = $client_id";
|
||||||
|
$client_query = "WHERE client_id = $client_id";
|
||||||
|
$client_url = "&client_id=$client_id";
|
||||||
|
} else {
|
||||||
|
require_once "includes/inc_all.php";
|
||||||
|
$client_event_query = '';
|
||||||
|
$client_query = '';
|
||||||
|
$client_url = '';
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_GET['calendar_id'])) {
|
if (isset($_GET['calendar_id'])) {
|
||||||
$calendar_selected_id = intval($_GET['calendar_id']);
|
$calendar_selected_id = intval($_GET['calendar_id']);
|
||||||
@@ -70,12 +80,11 @@ if (isset($_GET['calendar_id'])) {
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once "modals/calendar_event_add_modal.php";
|
require_once "modals/calendar_event_add_modal.php";
|
||||||
|
|
||||||
require_once "modals/calendar_add_modal.php";
|
require_once "modals/calendar_add_modal.php";
|
||||||
|
|
||||||
|
|
||||||
//loop through IDs and create a modal for each
|
//loop through IDs and create a modal for each
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id");
|
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['event_id']);
|
$event_id = intval($row['event_id']);
|
||||||
$event_title = nullable_htmlentities($row['event_title']);
|
$event_title = nullable_htmlentities($row['event_title']);
|
||||||
@@ -149,7 +158,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
},
|
},
|
||||||
events: [
|
events: [
|
||||||
<?php
|
<?php
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id");
|
$sql = mysqli_query($mysqli, "SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['event_id']);
|
$event_id = intval($row['event_id']);
|
||||||
$event_title = json_encode($row['event_title']);
|
$event_title = json_encode($row['event_title']);
|
||||||
@@ -163,7 +172,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Invoices Created
|
//Invoices Created
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN invoices ON client_id = invoice_client_id");
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN invoices ON client_id = invoice_client_id $client_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['invoice_id']);
|
$event_id = intval($row['invoice_id']);
|
||||||
$scope = strval($row['invoice_scope']);
|
$scope = strval($row['invoice_scope']);
|
||||||
@@ -174,24 +183,25 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
$event_start = json_encode($row['invoice_date']);
|
$event_start = json_encode($row['invoice_date']);
|
||||||
|
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'blue', url: 'invoice.php?invoice_id=$event_id' },";
|
echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'blue', url: 'invoice.php?invoice_id=$event_id$client_url' },";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Quotes Created
|
//Quotes Created
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN quotes ON client_id = quote_client_id");
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN quotes ON client_id = quote_client_id $client_query");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['quote_id']);
|
$event_id = intval($row['quote_id']);
|
||||||
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
|
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
|
||||||
$event_start = json_encode($row['quote_date']);
|
$event_start = json_encode($row['quote_date']);
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'purple', url: 'quote.php?quote_id=$event_id' },";
|
echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'purple', url: 'quote.php?quote_id=$event_id$client_url' },";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Tickets Created
|
//Tickets Created
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients
|
||||||
LEFT JOIN tickets ON client_id = ticket_client_id
|
LEFT JOIN tickets ON client_id = ticket_client_id
|
||||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||||
LEFT JOIN users ON ticket_assigned_to = user_id"
|
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||||
|
$client_query"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['ticket_id']);
|
$event_id = intval($row['ticket_id']);
|
||||||
@@ -218,13 +228,14 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
$event_color = "black";
|
$event_color = "black";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', 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$client_url' },";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recurring Tickets
|
// Recurring Tickets
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients
|
||||||
LEFT JOIN scheduled_tickets ON client_id = scheduled_ticket_client_id
|
LEFT JOIN scheduled_tickets ON client_id = scheduled_ticket_client_id
|
||||||
LEFT JOIN users ON scheduled_ticket_assigned_to = user_id"
|
LEFT JOIN users ON scheduled_ticket_assigned_to = user_id
|
||||||
|
$client_query"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['scheduled_ticket_id']);
|
$event_id = intval($row['scheduled_ticket_id']);
|
||||||
@@ -241,7 +252,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
$event_title = json_encode("R Ticket ($frequency) - " . $row['scheduled_ticket_subject'] . " " . $username);
|
$event_title = json_encode("R Ticket ($frequency) - " . $row['scheduled_ticket_subject'] . " " . $username);
|
||||||
$event_start = json_encode($row['scheduled_ticket_next_run']);
|
$event_start = json_encode($row['scheduled_ticket_next_run']);
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'client_recurring_tickets.php?client_id=$client_id' },";
|
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'recurring_tickets.php?client_id=$client_id$client_url' },";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Tickets Scheduled
|
//Tickets Scheduled
|
||||||
@@ -249,7 +260,7 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
LEFT JOIN tickets ON client_id = ticket_client_id
|
LEFT JOIN tickets ON client_id = ticket_client_id
|
||||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||||
LEFT JOIN users ON ticket_assigned_to = user_id
|
LEFT JOIN users ON ticket_assigned_to = user_id
|
||||||
WHERE ticket_schedule IS NOT NULL"
|
$client_query AND ticket_schedule IS NOT NULL"
|
||||||
);
|
);
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['ticket_id']);
|
$event_id = intval($row['ticket_id']);
|
||||||
@@ -276,28 +287,30 @@ while ($row = mysqli_fetch_array($sql)) {
|
|||||||
$event_start = json_encode($row['ticket_schedule']);
|
$event_start = json_encode($row['ticket_schedule']);
|
||||||
|
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', 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$client_url' },";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Vendors Added Created
|
//Vendors Added Created
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN vendors ON client_id = vendor_client_id WHERE vendor_template = 0");
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN vendors ON client_id = vendor_client_id $client_query AND vendor_template = 0 ");
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_id = intval($row['vendor_id']);
|
$event_id = intval($row['vendor_id']);
|
||||||
$client_id = intval($row['client_id']);
|
$client_id = intval($row['client_id']);
|
||||||
$event_title = json_encode("Vendor : '" . $row['vendor_name'] . "' created");
|
$event_title = json_encode("Vendor : '" . $row['vendor_name'] . "' created");
|
||||||
$event_start = json_encode($row['vendor_created_at']);
|
$event_start = json_encode($row['vendor_created_at']);
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'brown', url: 'client_vendors.php?client_id=$client_id' },";
|
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'brown', url: 'vendors.php?$client_url' },";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Clients Added
|
if (!isset($_GET['client_id'])) {
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients");
|
//Clients Added
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
$sql = mysqli_query($mysqli, "SELECT * FROM clients");
|
||||||
$event_id = intval($row['client_id']);
|
while ($row = mysqli_fetch_array($sql)) {
|
||||||
$event_title = json_encode("Client: '" . $row['client_name'] . "' created");
|
$event_id = intval($row['client_id']);
|
||||||
$event_start = json_encode($row['client_created_at']);
|
$event_title = json_encode("Client: '" . $row['client_name'] . "' created");
|
||||||
|
$event_start = json_encode($row['client_created_at']);
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'brown', url: 'client_overview.php?client_id=$event_id' },";
|
echo "{ id: $event_id, title: $event_title, start: $event_start, color: 'brown', url: 'client_overview.php?client_id=$event_id' },";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
],
|
],
|
||||||
@@ -1,282 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
require_once "includes/inc_all_client.php";
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($_GET['calendar_id'])) {
|
|
||||||
$calendar_selected_id = intval($_GET['calendar_id']);
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!-- So that when hovering over a created event it turns into a hand instead of cursor -->
|
|
||||||
<style>
|
|
||||||
.fc-event {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="card">
|
|
||||||
<div id='calendar'></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once "modals/calendar_event_add_modal.php";
|
|
||||||
|
|
||||||
require_once "modals/calendar_add_modal.php";
|
|
||||||
|
|
||||||
|
|
||||||
//loop through IDs and create a modal for each
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$event_id = intval($row['event_id']);
|
|
||||||
$event_title = nullable_htmlentities($row['event_title']);
|
|
||||||
$event_description = nullable_htmlentities($row['event_description']);
|
|
||||||
$event_location = nullable_htmlentities($row['event_location']);
|
|
||||||
$event_start = nullable_htmlentities($row['event_start']);
|
|
||||||
$event_end = nullable_htmlentities($row['event_end']);
|
|
||||||
$event_repeat = nullable_htmlentities($row['event_repeat']);
|
|
||||||
$calendar_id = intval($row['calendar_id']);
|
|
||||||
$calendar_name = nullable_htmlentities($row['calendar_name']);
|
|
||||||
$calendar_color = nullable_htmlentities($row['calendar_color']);
|
|
||||||
|
|
||||||
require "modals/calendar_event_edit_modal.php";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script src='plugins/fullcalendar/dist/index.global.js'></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
var calendarEl = document.getElementById('calendar');
|
|
||||||
|
|
||||||
var calendar = new FullCalendar.Calendar(calendarEl, {
|
|
||||||
themeSystem: 'bootstrap',
|
|
||||||
defaultView: 'dayGridMonth',
|
|
||||||
customButtons: {
|
|
||||||
addEvent: {
|
|
||||||
text: 'Add Event',
|
|
||||||
bootstrapFontAwesome: 'fa fa-plus',
|
|
||||||
click: function() {
|
|
||||||
$("#addCalendarEventModal").modal();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
addCalendar: {
|
|
||||||
text: 'Add Calendar',
|
|
||||||
bootstrapFontAwesome: 'fa fa-calendar-plus',
|
|
||||||
click: function() {
|
|
||||||
$("#addCalendarModal").modal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
headerToolbar: {
|
|
||||||
left: 'prev,next today',
|
|
||||||
center: 'title',
|
|
||||||
right: 'dayGridMonth,timeGridWeek,timeGridDay,listMonth addEvent addCalendar'
|
|
||||||
},
|
|
||||||
<?php if (!$session_mobile) {
|
|
||||||
?>aspectRatio: 2.5,
|
|
||||||
<?php } else { ?>
|
|
||||||
aspectRatio: 0.7,
|
|
||||||
<?php } ?>
|
|
||||||
navLinks: true, // can click day/week names to navigate views
|
|
||||||
selectable: true,
|
|
||||||
height: '90vh',
|
|
||||||
|
|
||||||
selectMirror: true,
|
|
||||||
eventClick: function(editEvent) {
|
|
||||||
$('#editEventModal' + editEvent.event.id).modal();
|
|
||||||
},
|
|
||||||
dayMaxEvents: true, // allow "more" link when too many events
|
|
||||||
views: {
|
|
||||||
timeGrid: {
|
|
||||||
dayMaxEventRows: 3, // adjust to 6 only for timeGridWeek/timeGridDay
|
|
||||||
expandRows: true,
|
|
||||||
nowIndicator: true,
|
|
||||||
eventMaxStack: 1,
|
|
||||||
},
|
|
||||||
dayGrid: {
|
|
||||||
dayMaxEvents: 3, // adjust to 6 only for timeGridWeek/timeGridDay
|
|
||||||
expandRows: true,
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
events: [
|
|
||||||
<?php
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$event_id = intval($row['event_id']);
|
|
||||||
$event_title = json_encode($row['event_title']);
|
|
||||||
$event_start = json_encode($row['event_start']);
|
|
||||||
$event_end = json_encode($row['event_end']);
|
|
||||||
$calendar_id = intval($row['calendar_id']);
|
|
||||||
$calendar_name = json_encode($row['calendar_name']);
|
|
||||||
$calendar_color = json_encode($row['calendar_color']);
|
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, end: $event_end, color: $calendar_color },";
|
|
||||||
}
|
|
||||||
|
|
||||||
//Invoices Created
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN invoices ON client_id = invoice_client_id WHERE client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$event_id = intval($row['invoice_id']);
|
|
||||||
$scope = strval($row['invoice_scope']);
|
|
||||||
if (empty($scope)) {
|
|
||||||
$scope = "Not Set";
|
|
||||||
}
|
|
||||||
$event_title = json_encode($row['invoice_prefix'] . $row['invoice_number'] . " created -scope: " . $scope);
|
|
||||||
$event_start = json_encode($row['invoice_date']);
|
|
||||||
|
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'blue', url: 'invoice.php?client_id=$client_id&invoice_id=$event_id' },";
|
|
||||||
}
|
|
||||||
|
|
||||||
//Quotes Created
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients LEFT JOIN quotes ON client_id = quote_client_id WHERE client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$event_id = intval($row['quote_id']);
|
|
||||||
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
|
|
||||||
$event_start = json_encode($row['quote_date']);
|
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, display: 'list-item', color: 'purple', url: 'quote.php?client_id=$client_id"e_id=$event_id' },";
|
|
||||||
}
|
|
||||||
|
|
||||||
//Tickets Created
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients
|
|
||||||
LEFT JOIN tickets ON client_id = ticket_client_id
|
|
||||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
|
||||||
LEFT JOIN users ON ticket_assigned_to = user_id
|
|
||||||
WHERE client_id = $client_id");
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$event_id = intval($row['ticket_id']);
|
|
||||||
$ticket_status = intval($row['ticket_status']);
|
|
||||||
$ticket_status_name = strval($row['ticket_status_name']);
|
|
||||||
$username = $row['user_name'];
|
|
||||||
if (empty($username)) {
|
|
||||||
$username = "";
|
|
||||||
} else {
|
|
||||||
//Limit to characters and add ...
|
|
||||||
$username = "[". substr($row['user_name'], 0, 9) . "...]";
|
|
||||||
}
|
|
||||||
|
|
||||||
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " created - " . $row['ticket_subject'] . " " . $username . "{" . $ticket_status_name . "}");
|
|
||||||
$event_start = json_encode($row['ticket_created_at']);
|
|
||||||
|
|
||||||
if ($ticket_status == 1) {
|
|
||||||
$event_color = "red";
|
|
||||||
} elseif ($ticket_status == 2) {
|
|
||||||
$event_color = "blue";
|
|
||||||
} elseif ($ticket_status == 3) {
|
|
||||||
$event_color = "grey";
|
|
||||||
} else {
|
|
||||||
$event_color = "black";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?client_id=$client_id&ticket_id=$event_id' },";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recurring Tickets
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients
|
|
||||||
LEFT JOIN scheduled_tickets ON client_id = scheduled_ticket_client_id
|
|
||||||
LEFT JOIN users ON scheduled_ticket_assigned_to = user_id"
|
|
||||||
);
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$event_id = intval($row['scheduled_ticket_id']);
|
|
||||||
$client_id = intval($row['client_id']);
|
|
||||||
$username = $row['user_name'];
|
|
||||||
$frequency = $row['scheduled_ticket_frequency'];
|
|
||||||
if (empty($username)) {
|
|
||||||
$username = "";
|
|
||||||
} else {
|
|
||||||
//Limit to characters and add ...
|
|
||||||
$username = "[". substr($row['user_name'], 0, 9) . "...]";
|
|
||||||
}
|
|
||||||
|
|
||||||
$event_title = json_encode("R Ticket ($frequency) - " . $row['scheduled_ticket_subject'] . " " . $username);
|
|
||||||
$event_start = json_encode($row['scheduled_ticket_next_run']);
|
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'client_recurring_tickets.php?client_id=$client_id' },";
|
|
||||||
}
|
|
||||||
|
|
||||||
//Tickets Scheduled
|
|
||||||
$sql = mysqli_query($mysqli, "SELECT * FROM clients
|
|
||||||
LEFT JOIN tickets ON client_id = ticket_client_id
|
|
||||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
|
||||||
LEFT JOIN users ON ticket_assigned_to = user_id
|
|
||||||
WHERE ticket_schedule IS NOT NULL AND client_id = $client_id"
|
|
||||||
);
|
|
||||||
while ($row = mysqli_fetch_array($sql)) {
|
|
||||||
$event_id = intval($row['ticket_id']);
|
|
||||||
$username = $row['user_name'];
|
|
||||||
if (empty($username)) {
|
|
||||||
$username = "";
|
|
||||||
} else {
|
|
||||||
//Limit to characters and add ...
|
|
||||||
$username = substr($row['user_name'], 0, 9) . "...";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strtotime($row['ticket_schedule']) < time()) {
|
|
||||||
if (!empty($row['ticket_schedule'])) {
|
|
||||||
$event_color = "red";
|
|
||||||
} else {
|
|
||||||
$event_color = "green";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$event_color = "grey";
|
|
||||||
}
|
|
||||||
|
|
||||||
$ticket_status_name = strval($row['ticket_status_name']);
|
|
||||||
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " scheduled - " . $row['ticket_subject'] . " [" . $username . "]{" . $ticket_status_name . "}");
|
|
||||||
$event_start = json_encode($row['ticket_schedule']);
|
|
||||||
|
|
||||||
|
|
||||||
echo "{ id: $event_id, title: $event_title, start: $event_start, color: '$event_color', url: 'ticket.php?client_id=$client_id&ticket_id=$event_id' },";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
],
|
|
||||||
eventClick: function(editEvent) {
|
|
||||||
$('#editEventModal'+editEvent.event.id).modal();
|
|
||||||
},
|
|
||||||
eventOrder: 'allDay,start,-duration,title',
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
calendar.render();
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- Automatically set new event end date to 1 hr after start date -->
|
|
||||||
<script>
|
|
||||||
// Function - called when user leaves field (onblur)
|
|
||||||
function updateIncrementEndTime() {
|
|
||||||
|
|
||||||
// Get the start date
|
|
||||||
let start = document.getElementById("event_add_start").value;
|
|
||||||
|
|
||||||
// Create a date object
|
|
||||||
let new_end = new Date(start);
|
|
||||||
|
|
||||||
// Get the time zone offset in minutes, convert it to milliseconds
|
|
||||||
let offsetInMilliseconds = new_end.getTimezoneOffset() * 60 * 1000;
|
|
||||||
|
|
||||||
// Adjust the date by the time zone offset before adding an hour
|
|
||||||
new_end = new Date(new_end.getTime() - offsetInMilliseconds);
|
|
||||||
|
|
||||||
// Set the end date to 1 hr in the future
|
|
||||||
new_end.setHours(new_end.getHours() + 1);
|
|
||||||
|
|
||||||
// Get the date back as a string, with the milliseconds trimmed off
|
|
||||||
new_end = new_end.toISOString().replace(/.\d+Z$/g, "");
|
|
||||||
|
|
||||||
// Update the end date field
|
|
||||||
document.getElementById("event_add_end").value = new_end;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
require_once "includes/footer.php";
|
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="client_events.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_events.php") { echo "active"; } ?>">
|
<a href="calendar.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "calendar.php") { echo "active"; } ?>">
|
||||||
<i class="nav-icon fas fa-calendar-alt"></i>
|
<i class="nav-icon fas fa-calendar-alt"></i>
|
||||||
<p>
|
<p>
|
||||||
Calendar
|
Calendar
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="calendar_events.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "calendar_events.php") { echo "active"; } ?>">
|
<a href="calendar.php" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "calendar.php") { echo "active"; } ?>">
|
||||||
<i class="nav-icon fas fa-calendar-alt"></i>
|
<i class="nav-icon fas fa-calendar-alt"></i>
|
||||||
<p>Calendar</p>
|
<p>Calendar</p>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
|||||||
?>
|
?>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="text-bold"><a href="invoice.php?invoice_id=<?php echo $invoice_id; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td>
|
<td class="text-bold"><a href="invoice.php?invoice_id=<?php echo $invoice_id; ?><?php if (isset($_GET['client_id'])) { echo "&client_id=$client_id"; } ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></td>
|
||||||
<td><?php echo $invoice_scope_display; ?></td>
|
<td><?php echo $invoice_scope_display; ?></td>
|
||||||
<?php if(!isset($_GET['client_id'])) { ?>
|
<?php if(!isset($_GET['client_id'])) { ?>
|
||||||
<td class="text-bold"><a href="invoices.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
<td class="text-bold"><a href="invoices.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></td>
|
||||||
|
|||||||
Reference in New Issue
Block a user