mirror of
https://github.com/itflow-org/itflow
synced 2026-11-22 04:17:24 +00:00
Tickets: booked work has an end - the Schedule window has How long from 15 minutes to a day and an Agent picker that gives the ticket to someone else and takes it off the old agent's calendar; New Ticket's Schedule and a recurring ticket's Book the work for take a length; the calendar draws each booking at its length and dragging its bottom edge changes it after asking; the booking email, calendar file, ticket and guest page show the end; the double-booking warning lists the agent's tickets and timed events that overlap the booking instead of anything within two hours; database 3.8.2 adds tickets.ticket_schedule_end and recurring_tickets.recurring_ticket_schedule_minutes; 26.11.9 changelog entries
This commit is contained in:
@@ -164,7 +164,7 @@
|
||||
function saved(json) {
|
||||
itflowToast(json.message, 'success');
|
||||
if (json.conflicts && json.conflicts.length) {
|
||||
itflowToast('Same agent, within two hours: ' + json.conflicts.join('; '), 'warning');
|
||||
itflowToast('The same agent already has work then: ' + json.conflicts.join('; '), 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
moved(info);
|
||||
},
|
||||
eventResize: function (info) {
|
||||
moved(info);
|
||||
moved(info, true);
|
||||
},
|
||||
|
||||
// A ticket from To schedule
|
||||
@@ -301,23 +301,26 @@
|
||||
|
||||
// ---------- moving things ----------
|
||||
|
||||
function moved(info) {
|
||||
function moved(info, resized) {
|
||||
const event = info.event;
|
||||
const props = event.extendedProps || {};
|
||||
const start = event.start;
|
||||
const end = event.end;
|
||||
|
||||
if (props.kind === 'ticket') {
|
||||
// Its end dragged (resized), or the whole booking moved
|
||||
confirmDialog({
|
||||
title: 'Move ' + event.title.split(' ')[0] + ' to ' + words(start, false) + '?',
|
||||
title: resized && end
|
||||
? 'Book ' + event.title.split(' ')[0] + ' until ' + end.toLocaleTimeString([], {hour: 'numeric', minute: '2-digit'}) + '?'
|
||||
: 'Move ' + event.title.split(' ')[0] + ' to ' + words(start, false) + '?',
|
||||
text: 'The agent and the contact are emailed the new time, as when it is rescheduled on the ticket.',
|
||||
confirmButtonText: 'Move it'
|
||||
confirmButtonText: resized ? 'Change it' : 'Move it'
|
||||
}).then(function (result) {
|
||||
if (!result.isConfirmed) {
|
||||
info.revert();
|
||||
return;
|
||||
}
|
||||
post({kind: 'ticket', id: props.ticket_id, start: ymdhm(start), all_day: event.allDay ? 1 : 0}, function (json) {
|
||||
post({kind: 'ticket', id: props.ticket_id, start: ymdhm(start), end: end && !event.allDay ? ymdhm(end) : '', all_day: event.allDay ? 1 : 0}, function (json) {
|
||||
saved(json);
|
||||
calendar.refetchEvents();
|
||||
}, function (error) {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// The ticket's Schedule dialog (agent/modals/ticket/ticket_edit_schedule.php):
|
||||
// as a day is picked, what the assigned agent already has on it - their other
|
||||
// scheduled tickets and the events they are on - so a visit is not booked on
|
||||
// top of another. Wrapped in an IIFE because the modal can open more than once.
|
||||
// as a day and an agent are picked, what that agent already has on it - their
|
||||
// other scheduled tickets and the events they are on - so a visit is not booked
|
||||
// on top of another. Wrapped in an IIFE because the modal can open more than once.
|
||||
|
||||
(function () {
|
||||
|
||||
const panel = document.getElementById('scheduleAgentDay');
|
||||
const field = document.getElementById('scheduleDateTime');
|
||||
const tech = document.getElementById('scheduleTech');
|
||||
if (!panel || !field) {
|
||||
return;
|
||||
}
|
||||
@@ -17,14 +18,21 @@
|
||||
|
||||
function load() {
|
||||
const date = (field.value || '').slice(0, 10);
|
||||
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
|
||||
// The agent picked in the dialog - nobody, nothing to show
|
||||
if (tech) {
|
||||
const option = tech.options[tech.selectedIndex];
|
||||
panel.dataset.user = tech.value;
|
||||
panel.dataset.name = option ? (option.dataset.name || option.textContent.trim()) : '';
|
||||
}
|
||||
if (!/^\d{4}-\d{2}-\d{2}$/.test(date) || !parseInt(panel.dataset.user, 10)) {
|
||||
panel.hidden = true;
|
||||
shown = '';
|
||||
return;
|
||||
}
|
||||
if (date === shown) {
|
||||
if (date + '/' + panel.dataset.user === shown) {
|
||||
return;
|
||||
}
|
||||
shown = date;
|
||||
shown = date + '/' + panel.dataset.user;
|
||||
const day = new Date(date + 'T12:00:00');
|
||||
title.textContent = panel.dataset.name + "'s day - " + day.toLocaleDateString(undefined, {weekday: 'short', month: 'short', day: 'numeric'});
|
||||
open.href = 'calendar.php?date=' + date;
|
||||
@@ -62,6 +70,9 @@
|
||||
|
||||
field.addEventListener('change', load);
|
||||
field.addEventListener('input', load);
|
||||
if (tech) {
|
||||
tech.addEventListener('change', load);
|
||||
}
|
||||
load();
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user