Kalender Anpassungen

- Kalender Termin Kopierfeature
This commit is contained in:
Daniel Spitzer
2025-06-09 12:10:16 +02:00
parent 630af363f9
commit 488457ccd8
3 changed files with 113 additions and 11 deletions

View File

@@ -120,7 +120,8 @@ endforeach;
class="fa-duotone fa-solid fa-phone-volume fa-calendar-call fa-calendar-call-search"></i>
</button>
<button title="Abgesagte Termine" data-eventcancelled="1"
class="btn btn-light btn-light-search"><i class="fa-duotone fa-solid fa-calendar-symbol fa-calendar-circle-exclamation"></i>
class="btn btn-light btn-light-search"><i
class="fa-duotone fa-solid fa-calendar-symbol fa-calendar-circle-exclamation"></i>
</button>
@@ -664,16 +665,20 @@ endforeach;
<label for="location" class="col-form-label fw-medium">Kunde</label>
<div class="form-check ml-3" style="margin-top: 7px;display:inline-block">
<div class="d-inline-block">
<input class="form-check-input eventmodal-checkbox hide-cancelled" type="checkbox" value=""
<input class="form-check-input eventmodal-checkbox hide-cancelled" type="checkbox"
value=""
id="customer-info-check">
<label class="form-check-label fw-medium checkbox-label hide-cancelled" for="customer-info-check">
<label class="form-check-label fw-medium checkbox-label hide-cancelled"
for="customer-info-check">
Info senden
</label>
</div>
<div class="d-inline-block">
<input class="form-check-input eventmodal-checkbox show-cancelled" type="checkbox" value=""
<input class="form-check-input eventmodal-checkbox show-cancelled" type="checkbox"
value=""
id="customer-info-check-cancelled">
<label class="form-check-label fw-medium checkbox-label show-cancelled" for="customer-info-check-cancelled">
<label class="form-check-label fw-medium checkbox-label show-cancelled"
for="customer-info-check-cancelled">
Absage senden
</label>
</div>
@@ -689,7 +694,8 @@ endforeach;
</div>
</div>
<div class="d-inline-block ml-4">
<input class="form-check-input eventmodal-checkbox hide-cancelled" type="checkbox" value=""
<input class="form-check-input eventmodal-checkbox hide-cancelled" type="checkbox"
value=""
id="customer-info-reminder-check">
<label class="form-check-label fw-medium checkbox-label hide-cancelled"
for="customer-info-reminder-check">
@@ -754,6 +760,20 @@ endforeach;
</div>
</div>
<div class="delete-old-div">
<div class="row mt-2 mb-3 justify-content-center">
<div class="form-check" style="margin-top: 7px;">
<input style=" margin-top: 7px;" class="form-check-input eventmodal-checkbox" type="checkbox" value=""
id="delete-old-entry"> <label class="form-check-label fw-medium checkbox-label"
for="delete-old-entry">
<span style="color:#a20909;font-size: 17px;">Alten eintrag löschen</span>
</label>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success hide-cancelled" id="add-event">Hinzufügen</button>
@@ -766,16 +786,24 @@ endforeach;
Absagen
</button>
<button style="display:none" type="button" class="btn btn-success show-update hide-cancelled" id="update-event">
<button style="display:none" type="button" class="btn btn-success show-update hide-cancelled"
id="update-event">
Speichern
</button>
<button style="display:none" type="button" class="btn btn-primary show-update hide-cancelled" id="cancel-event">
<button style="display:none" type="button" class="btn btn-primary show-update hide-cancelled"
id="cancel-event">
Termin Absage
</button>
<button style="display:none" type="button" class="btn btn-danger show-update hide-cancelled" id="delete-event">
<button style="display:none" type="button" class="btn btn-primary show-update hide-cancelled"
id="copy-event">
Kopieren
</button>
<button style="display:none" type="button" class="btn btn-danger show-update hide-cancelled"
id="delete-event">
Löschen
</button>
<button style="display:none" type="button" class="btn btn-danger show-cancelled" id="cancelled-event">
<button style="display:none" type="button" class="btn btn-danger show-cancelled"
id="cancelled-event">
Absagen
</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>

View File

@@ -959,8 +959,11 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
$data['create'] = time();
$data['edit_by'] = 89;
$data['create_by'] = 89;
$db->insert("TheTool_CalendarQueue", $data);
if ($r->delete_old_entry) {
CalendarModel::deleteCalendarOldEvent($r->delete_old_entry);
die();
}
}
public static function insertCalendarEventAttachmentTemp($name, $contantType, $content, $size, $newkey)
@@ -1021,6 +1024,36 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
die();
}
public static function deleteCalendarOldEvent($id)
{
date_default_timezone_set('Europe/Berlin');
header('Content-Type: application/json');
$db = self::dbKalender();
$res = $db->select("cal_events", 'id,microsoft_id,user_id,calendar_id', "id = '" . $id . "' LIMIT 1");
if ($db->num_rows($res)) {
$result = $db->fetch_object($res);
$rescal = $db->select("cal_calendars", "id,ms_user_id", "id = '" . $result->calendar_id . "' LIMIT 1");
if ($db->num_rows($res)) {
$resultcal = $db->fetch_object($rescal);
$microsoft_user_id = $resultcal->ms_user_id;
var_dump($resultcal);
}
$data = [];
$data['ms_user_id'] = $microsoft_user_id;
$data['ms_event_id'] = $result->microsoft_id;
$data['type'] = 'd';
$data['status'] = 'p';
$data['edit'] = time();
$data['create'] = time();
$data['edit_by'] = 89;
$data['create_by'] = 89;
$db->insert("TheTool_CalendarQueue", $data);
}
$db->delete("cal_events", "id = '" . $id . "'");
die();
}
public static function cancelCalendarEvent($r, $me)
{
$id = $r->id;

View File

@@ -722,6 +722,7 @@ document.addEventListener('DOMContentLoaded', function () {
$('#location').val(info.event.extendedProps.location);
// $('#description').val(info.event.extendedProps.description);
$('#delete-event').data('id', info.event.id);
$('#copy-event').data('id', info.event.id);
$('#update-event').data('id', info.event.id);
$('#cancel-event').data('id', info.event.id);
$('#cancelled-event').data('id', info.event.id);
@@ -1295,6 +1296,9 @@ $(document).ready(function () {
$(document).off('focusin.modal');
$('.hide-cancelled').show();
$('.show-cancelled').hide();
$('#delete-old-entry').val('');
$('#delete-old-entry').prop('checked', false);
$('.delete-old-div').hide();
$('#name-col').removeClass('col-9').addClass('col-6');
$('.attachment-div').empty();
$('#reminder').val('NULL');
@@ -1424,6 +1428,11 @@ $(document).ready(function () {
if ($('#allday').is(':checked')) {
allday = 1;
}
let delete_old_entry = '';
if ($('#delete-old-entry').is(':checked')) {
delete_old_entry = $('#delete-old-entry').val()
}
if ($('#customer-info-check').is(':checked')) {
customer_info_check = 1;
}
@@ -1483,6 +1492,7 @@ $(document).ready(function () {
customer_info_type: customer_info_type,
customer_info_type_text: customer_info_type_text,
customer_info_reminder_check: customer_info_reminder_check,
delete_old_entry: delete_old_entry,
newkey: newkey
}, function (data) {
@@ -1722,6 +1732,37 @@ $(document).ready(function () {
$('#EventModal').modal('hide');
}
});
$('body').on('click', '#copy-event', function () {
let id = $(this).data('id');
$('#EventModalLabel .fa-calendar-symbol').addClass('fa-calendar-circle-plus');
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-lines-pen');
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-circle-exclamation');
$('#EventModalLabel span').text('Termin erstellen');
$('#calendar-users').prop("disabled", false);
if ($('#update-event').is(':visible')) {
$('#delete-old-entry').val(id);
$('.delete-old-div').show();
} else {
var $input = $('#name');
var text = $input.val();
var pos = text.indexOf(':');
if (pos !== -1) {
var neuerText = text.substring(pos + 1).trim();
$input.val(neuerText);
}
$('#busy').val('1');
}
$('.hide-cancelled').show();
$('.show-cancelled').hide();
$('.show-update').hide();
$('.show-attendee').hide();
$('.event-organizer-div').hide();
if ($('#type').val() != 5) {
$('.ticket-div').hide();
}
});
$('body').on('change', '#allday', function () {
if ($(this).is(':checked')) {