feat: prefill calendar form when setting workorder appointment
When a WorkorderCompany user sets or reschedules an appointment date, the calendar is now opened in a new tab pre-filled with workorder data (subject, type, location, times, description, customer contact, Pusnik as calendar user, Ziga Harc as attendee). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1474,6 +1474,31 @@ $(document).ready(function () {
|
||||
{
|
||||
$('#customer-info-type').val('1').trigger('change');
|
||||
}
|
||||
if (localsorageEvent.calendar_user_name) {
|
||||
const calUserName = localsorageEvent.calendar_user_name.toLowerCase();
|
||||
const calUserOption = $('#calendar-users option').filter(function () {
|
||||
return $(this).text().trim().toLowerCase().includes(calUserName);
|
||||
}).first();
|
||||
if (calUserOption.length) {
|
||||
$('#calendar-users').val(calUserOption.val()).trigger('change');
|
||||
}
|
||||
}
|
||||
if (localsorageEvent.attendee_names && localsorageEvent.attendee_names.length) {
|
||||
const attendeeValues = [];
|
||||
localsorageEvent.attendee_names.forEach(function (attendeeName) {
|
||||
const nameLower = attendeeName.toLowerCase();
|
||||
const opt = $('#calendar-attendees option').filter(function () {
|
||||
return $(this).text().trim().toLowerCase().includes(nameLower);
|
||||
}).first();
|
||||
if (opt.length) {
|
||||
attendeeValues.push(opt.val());
|
||||
} else {
|
||||
$('#calendar-attendees').append(new Option(attendeeName, attendeeName, true, true));
|
||||
attendeeValues.push(attendeeName);
|
||||
}
|
||||
});
|
||||
$('#calendar-attendees').val(attendeeValues).trigger('change');
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user