Files
itflow/agent/modals/calendar/calendar_event_edit.php
johnnyq 3ec52974db Calendar modernization: calendar page rebuilt to load only the dates on screen with show or hide toggles for each calendar and for built-in sources (scheduled tickets, project start and due dates, service reviews, recurring tickets, renewals, invoices due), a filter for one agent, quick looks on click, drag to reschedule tickets and events that do not repeat, and a To schedule panel for dragging open unscheduled tickets onto the calendar; events get a shared add/edit form with repeats every N days/weeks/months/years with an optional end date and single skipped occurrences, a client site, location or meeting link, agents, client contacts and guest emails as attendees, iCalendar invitations with updates and cancellations sent to invited attendees, an event quick look with map and join links, .ics download and resend; each agent gets a personal subscription link for their schedule (their own or the whole team, busy only option, respects role and client access, stops when the account is disabled) with setup help for Google, Outlook, Apple, Nextcloud and Thunderbird; shared calendar feeds and invites now publish timed events with TZID and VTIMEZONE so repeating events keep their time across DST, with INTERVAL, UNTIL and EXDATE support; managing calendars is limited to admins; ticket schedule logic moved into functions/ticket.php and shared with the calendar, the schedule dialog shows the assigned agent's day, and ticket visit calendar files are rebuilt without zapcal as one-hour published events; mail queue sends invitations and cancellations as a text/calendar part and other calendar files as invite.ics; dashboard schedule shows only events the agent is on or added, client overview Coming up and client sidebar count use upcoming events, sites and contacts get New event shortcuts, demo data uses repeating events and attendees; database update 2.8.8 adds event repeat interval, until, skip, sequence and created by, attendee user and invited at, user_calendar_feeds, and widens email_queue.email_cal_str to text
2026-10-15 19:17:17 -04:00

64 lines
2.8 KiB
PHP

<?php
/*
* Edit Event - everything the new event form has. Saving with "Email the
* change" sends the update to the people who have it in their calendar, the
* invitation to anyone added, and the cancellation to anyone taken off.
*/
require_once '../../../includes/modal_header.php';
$form = calendarEventForModal($_GET['id'] ?? 0);
$event_id = intval($form['event_id']);
$form_client_id = intval($form['event_client_id']);
$form_locked_client = false;
$form_attendees = ['agents' => [], 'contacts' => [], 'emails' => []];
$form_invited = false;
foreach (calendarEventAttendees($event_id) as $attendee) {
if ($attendee['kind'] === 'agent') {
$form_attendees['agents'][] = intval($attendee['attendee_user_id']);
} elseif ($attendee['kind'] === 'contact') {
$form_attendees['contacts'][] = intval($attendee['attendee_contact_id']);
} else {
$form_attendees['emails'][] = $attendee['email'];
}
if (!empty($attendee['attendee_invited_at'])) {
$form_invited = true;
}
}
$repeats = calendarEventRepeats($form);
ob_start();
?>
<div class="modal-header bg-dark">
<h5 class="modal-title text-truncate"><i class="fas fa-fw fa-circle me-2 small" style="color:<?= escapeHtml(calendarColor($form['calendar_color'])) ?>"></i><?= escapeHtml($form['event_title']) ?></h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<form action="post.php" method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?= $_SESSION['csrf_token'] ?>">
<input type="hidden" name="event_id" value="<?= $event_id ?>">
<div class="modal-body">
<?php if ($repeats) { ?>
<div class="alert alert-info py-2 small"><i class="fas fa-fw fa-redo me-1"></i>This changes every occurrence. To drop a single one, use <strong>Skip this one</strong> on it.</div>
<?php } ?>
<?php require 'calendar_event_form.php'; ?>
</div>
<div class="modal-footer">
<a class="btn btn-outline-danger me-auto confirm-link" href="post.php?delete_event=<?= $event_id ?>&csrf_token=<?= $_SESSION['csrf_token'] ?>"
data-confirm-title="Delete <?= escapeHtml($form['event_title']) ?>?" data-confirm-button="Delete"
<?php if ($form_invited) { ?>data-confirm-text="Everyone who was sent the invitation is emailed the cancellation."<?php } ?>>
<i class="fas fa-trash-alt me-2"></i><?= $repeats ? 'Delete series' : 'Delete' ?>
</a>
<button type="submit" name="edit_event" class="btn btn-primary text-bold"><i class="fas fa-check me-2"></i>Save</button>
<button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fa fa-times me-2"></i>Cancel</button>
</div>
</form>
<script src="/agent/js/calendar_event_modal.js"></script>
<?php
require_once '../../../includes/modal_footer.php';