Kalender
* Generelle Updates
This commit is contained in:
@@ -312,7 +312,7 @@ endforeach;
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade" id="EventModal" aria-labelledby="EventModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="EventModal" aria-labelledby="EventModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -435,25 +435,45 @@ endforeach;
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center mt-2">
|
||||
<div class="col-2">
|
||||
<label for="name" class="col-form-label fw-medium ">Kalender</label>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<select class="form-control form-select select2-multiple" id="calendar-users"
|
||||
name="calendar-users">
|
||||
<?php foreach ($CalArray as $key => $value) :
|
||||
if ($rights[$value] != "all") continue;
|
||||
if ($value != $Calendar[0]->go_calendar_id) : ?>
|
||||
<option value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php else : ?>
|
||||
<option data-mainuser="1" selected="selected"
|
||||
value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php endif;
|
||||
endforeach; ?>
|
||||
</select>
|
||||
<div id='relContainer' style='position:relative'>
|
||||
<select class="form-control form-select select2-multiple" id="calendar-users"
|
||||
name="calendar-users">
|
||||
<?php foreach ($CalArray as $key => $value) :
|
||||
if ($rights[$value] != "all") continue;
|
||||
if ($value != $Calendar[0]->go_calendar_id) : ?>
|
||||
<option value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php else : ?>
|
||||
<option data-mainuser="1" selected="selected"
|
||||
value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php endif;
|
||||
endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:none;" class="row justify-content-center mt-2 event-organizer-div">
|
||||
<div class="col-2">
|
||||
<label for="name" class="col-form-label fw-medium ">Organisator</label>
|
||||
</div>
|
||||
<div class="col-5">
|
||||
<span class="event-organizer"></span>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<label for="name" class="col-form-label fw-medium ">Status</label>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<span class="event-status"><i
|
||||
class="accepted-status fa-regular fa-circle-check fa-circle-info"></i></span><span
|
||||
class="event-accepted"> Offen</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row justify-content-center mt-2">
|
||||
<div class="col-2">
|
||||
<label for="name" class="col-form-label fw-medium ">Teilnehmer</label>
|
||||
@@ -462,15 +482,9 @@ endforeach;
|
||||
<select class="form-control form-select select2-multiple-tag" id="calendar-attendees"
|
||||
name="calendar-users[]"
|
||||
multiple="multiple">
|
||||
<option value=""></option>
|
||||
<?php foreach ($CalArray as $key => $value) :
|
||||
if ($rights[$value] != "all") continue;
|
||||
if ($value != $Calendar[0]->go_calendar_id) : ?>
|
||||
<option value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php else : ?>
|
||||
|
||||
<?php endif;
|
||||
endforeach; ?>
|
||||
<?php foreach ($CalArray as $key => $value) : ?>
|
||||
<option value="<?= $value ?>"><?= $key ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -560,10 +574,12 @@ endforeach;
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-success" id="add-event">Hinzufügen</button>
|
||||
<button style="display:none" type="button" class="btn btn-success show-attendee" id="add-event">
|
||||
<button style="display:none" type="button" data-event-action="accept"
|
||||
class="btn btn-success show-attendee">
|
||||
Zusagen
|
||||
</button>
|
||||
<button style="display:none" type="button" class="btn btn-danger show-attendee" id="add-event">
|
||||
<button style="display:none" type="button" data-event-action="decline"
|
||||
class="btn btn-danger show-attendee">
|
||||
Absagen
|
||||
</button>
|
||||
|
||||
@@ -593,6 +609,7 @@ endforeach;
|
||||
let requestAddressUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'getAddress']) ?>";
|
||||
let requestInsertUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'insertCalendarEvent']) ?>";
|
||||
let requestUpdateUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarEvent']) ?>";
|
||||
let requestUpdateStateUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarEventState']) ?>";
|
||||
let requestUpdateColorUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarColor']) ?>";
|
||||
let requestDeleteUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'deleteCalendarEvent']) ?>";
|
||||
let requestUpdateEventsUrl = "<?= self::getUrl("api/v1/calendar")?>/calendarStream?user=<?= $encryptedUser ?>";
|
||||
|
||||
@@ -176,6 +176,7 @@ class CalendarApicontroller extends mfBaseApicontroller
|
||||
$message[0]['attachment'] = $Calendarevent['data'][0]['attachment']['attachment'];
|
||||
$message[0]['attachments'] = $Calendarevent['data'][0]['attachments']['attachments'];
|
||||
$message[0]['calendar_name'] = $Calendarevent['data'][0]['calendar_name']['calendar_name'];
|
||||
$message[0]['isorganizer'] = $Calendarevent['data'][0]['isorganizer']['isorganizer'];
|
||||
$message[0]['mtime'] = $Calendarevent['data'][0]['mtime']['mtime'];
|
||||
$message[0]['mname'] = $Calendarevent['data'][0]['mname']['mname'];
|
||||
$message[0]['ctime'] = $Calendarevent['data'][0]['ctime']['ctime'];
|
||||
|
||||
@@ -77,6 +77,11 @@ class CalendarController extends mfBaseController
|
||||
}
|
||||
}
|
||||
die();
|
||||
|
||||
case "updateCalendarEventState" :
|
||||
$r = $this->request;
|
||||
$calendarEvents = CalendarModel::updateCalendarEventState($r, $this->me);
|
||||
die();
|
||||
case "getAddress":
|
||||
$r = $this->request;
|
||||
$this->getAddress($r);
|
||||
|
||||
@@ -192,6 +192,7 @@ class CalendarModel
|
||||
'cname' => array('cname' => $data['cname']),
|
||||
'mtime' => array('mtime' => date("d.m.Y H:i", $data['mtime'])),
|
||||
'mname' => array('mname' => $data['mname']),
|
||||
'isorganizer' => array('isorganizer' => $data['is_organizer']),
|
||||
'busy' => array('busy' => $data['busy']),
|
||||
);
|
||||
}
|
||||
@@ -243,9 +244,12 @@ class CalendarModel
|
||||
$calendar = self::search(array("user_id" => $me));
|
||||
|
||||
$dbcal = self::dbKalender();
|
||||
|
||||
|
||||
$res = $dbcal->select("cal_events", "id, uuid, calendar_id, user_id, start_time, end_time, timezone, all_day_event, name, description, location, repeat_end_time, reminder, ctime, mtime, muser_id, busy, status, resource_event_id, private, rrule, background, files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, is_organizer,event_type,customer,customer_info,customer_info_send,customer_info_reminder,busy,attendees,is_organizer", "1=1 AND id='" . $id . "' ORDER BY id");
|
||||
$Calendars = self::getAll();
|
||||
foreach ($Calendars as $key => $value) {
|
||||
$Allcalendar[$value->user->name] = $key;
|
||||
}
|
||||
$Allcalendar['Daniel Whoknows'] = 2;
|
||||
$res = $dbcal->select("cal_events", "id, uuid, calendar_id, user_id, start_time, end_time, timezone, all_day_event, name, description, location, repeat_end_time, reminder, ctime, mtime, muser_id, busy, status, resource_event_id, private, rrule, background, files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, is_organizer,event_type,customer,customer_info,customer_info_send,customer_info_reminder,busy,attendees,organizer,is_organizer,accepted", "1=1 AND id='" . $id . "' ORDER BY id");
|
||||
if ($dbcal->num_rows($res)) {
|
||||
$data = $dbcal->fetch_array($res);
|
||||
|
||||
@@ -298,6 +302,24 @@ class CalendarModel
|
||||
}
|
||||
$counter++;
|
||||
}
|
||||
$attendees = json_decode($data['attendees'], true);
|
||||
$organizer = json_decode($data['organizer'], true);
|
||||
foreach ($attendees as $key => $value) {
|
||||
|
||||
foreach ($value as $attendeekey => $attendee) {
|
||||
// echo $attendee['name'];
|
||||
if ($attendee['email'] == $organizer['email']) {
|
||||
|
||||
} elseif ($Allcalendar[$attendee['name']] && $Allcalendar[$attendee['name']] == $data['calendar_id']) {
|
||||
|
||||
} else if ($Allcalendar[$attendee['name']]) {
|
||||
$AttendeeArray[] = $Allcalendar[$attendee['name']];
|
||||
} else {
|
||||
$AttendeeArray[] = $attendee['email'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rows = array(
|
||||
'id' => array('id' => $data['id'], 'order' => $data['id']),
|
||||
'cstart' => array('cstart' => $starttime, 'order' => $data['ctime']),
|
||||
@@ -315,7 +337,9 @@ class CalendarModel
|
||||
'customer_info_send' => array('customer_info_send' => $data['customer_info_send']),
|
||||
'customer_info_reminder' => array('customer_info_reminder' => $data['customer_info_reminder']),
|
||||
'isorganizer' => array('isorganizer' => $data['is_organizer']),
|
||||
'attendees' => array('attendees' => $data['attendees']),
|
||||
'attendees' => array('attendees' => json_encode($AttendeeArray)),
|
||||
'organizer' => array('organizer' => $data['organizer']),
|
||||
'accepted' => array('accepted' => $data['accepted']),
|
||||
'attachment' => array('attachment' => $attachment, 'order' => $attachment),
|
||||
'attachments' => array('attachments' => $attachments, 'order' => $attachments)
|
||||
);
|
||||
@@ -336,6 +360,7 @@ class CalendarModel
|
||||
{
|
||||
|
||||
$db = self::dbKalender();
|
||||
|
||||
$json_data = json_decode($request, true);
|
||||
$data = [];
|
||||
$data['ms_event_id'] = $json_data['value'][0]['resourceData']['id'];
|
||||
@@ -508,6 +533,57 @@ class CalendarModel
|
||||
|
||||
}
|
||||
|
||||
public static function updateCalendarEventState($r, $me)
|
||||
{
|
||||
$id = ($r->id);
|
||||
$users = ($r->users);
|
||||
$eventAction = $r->eventAction;
|
||||
if ($eventAction == "accept") {
|
||||
$process = 'ae';
|
||||
$updateArray['busy'] = 1;
|
||||
} else if ($eventAction == "decline") {
|
||||
$process = "ce";
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach ($users as $key => $value) {
|
||||
$user_id = $value;
|
||||
}
|
||||
|
||||
$db = self::dbKalender();
|
||||
|
||||
$sql = "SELECT `cal_events`.id,microsoft_id,uuid,ms_user_id FROM `cal_events` INNER JOIN `cal_calendars` ON (`cal_calendars`.`id`=`cal_events`.`calendar_id`) WHERE `cal_events`.id = '" . $id . "' LIMIT 1";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
$result = $db->fetch_object($res);
|
||||
$microsoft_id = $result->microsoft_id;
|
||||
$cal_events_id = $result->uuid;
|
||||
$microsoft_user_id = $result->ms_user_id;
|
||||
}
|
||||
|
||||
|
||||
$acceptJson = array('time' => time(), 'user' => $me->name);
|
||||
$updateArray['accepted'] = json_encode($acceptJson);
|
||||
$db->update("cal_events", $updateArray, "id = '" . $id . "'");
|
||||
|
||||
$json_data = json_encode($updateArray);
|
||||
$data = [];
|
||||
$data['ms_user_id'] = $microsoft_user_id;
|
||||
$data['ms_event_id'] = $microsoft_id;
|
||||
$data['data'] = $json_data;
|
||||
$data['type'] = $process;
|
||||
$data['status'] = 'p';
|
||||
$data['edit'] = time();
|
||||
$data['create'] = time();
|
||||
$data['edit_by'] = 89;
|
||||
$data['create_by'] = 89;
|
||||
|
||||
$db->insert("TheTool_CalendarQueue", $data);
|
||||
}
|
||||
|
||||
public static function insertCalendarEvent($r, $me)
|
||||
{
|
||||
$description = ($r->description);
|
||||
@@ -523,6 +599,7 @@ class CalendarModel
|
||||
$busy = ($r->busy);
|
||||
$users = ($r->users);
|
||||
$customer_info_reminder_check = 0;
|
||||
$attendees = ($r->attendees);
|
||||
date_default_timezone_set('Europe/Berlin');
|
||||
header('Content-Type: application/json');
|
||||
foreach ($users as $key => $value) {
|
||||
@@ -561,10 +638,10 @@ class CalendarModel
|
||||
$customer_info_send = NULL;
|
||||
}
|
||||
|
||||
$data = array("start_time" => $start, 'end_time' => $end, 'name' => $title, 'description' => $description, 'location' => $location, 'calendar_id' => $user_id, 'uuid' => "a5eb79b3-fca7-5378-a09e-" . rand(100000000000, 999999999999), 'user_id' => 1, 'timezone' => 'Europe/Amsterdam', 'all_day_event' => 0, 'repeat_end_time' => 0, 'reminder' => $reminder, 'ctime' => time(), 'cname' => $me->name, 'mtime' => time(), 'mname' => $me->name, 'user_id' => 1, 'busy' => $busy, 'status' => 'CONFIRMED', 'resource_event_id' => 0, 'private' => 0, 'rrule' => '', 'background' => 'EBF1E2', 'files_folder_id' => 0, 'read_only' => 0, 'exception_for_event_id' => 0, 'recurrence_id' => 0, 'is_organizer' => 1, 'event_type' => $type, 'customer' => $customer, 'customer_info' => $customer_info, 'customer_info_send' => $customer_info_send, 'customer_info_reminder' => $customer_info_reminder_check);
|
||||
$dataarray = array("start_time" => $start, 'end_time' => $end, 'name' => $title, 'description' => $description, 'location' => $location, 'calendar_id' => $user_id, 'uuid' => "a5eb79b3-fca7-5378-a09e-" . rand(100000000000, 999999999999), 'user_id' => 1, 'timezone' => 'Europe/Amsterdam', 'all_day_event' => 0, 'repeat_end_time' => 0, 'reminder' => $reminder, 'ctime' => time(), 'cname' => $me->name, 'mtime' => time(), 'mname' => $me->name, 'user_id' => 1, 'busy' => $busy, 'status' => 'CONFIRMED', 'resource_event_id' => 0, 'private' => 0, 'rrule' => '', 'background' => 'EBF1E2', 'files_folder_id' => 0, 'read_only' => 0, 'exception_for_event_id' => 0, 'recurrence_id' => 0, 'is_organizer' => 1, 'event_type' => $type, 'customer' => $customer, 'customer_info' => $customer_info, 'customer_info_send' => $customer_info_send, 'customer_info_reminder' => $customer_info_reminder_check);
|
||||
|
||||
$db->insert("cal_events", $data);
|
||||
$event_id = $data['uuid'];
|
||||
$db->insert("cal_events", $dataarray);
|
||||
$event_id = $dataarray['uuid'];
|
||||
if ($newkey) {
|
||||
$res = $db->select("tmp_cal_events_attachments", "id,name,contentType,content,size,create_timestamp,edit_timestamp", "1=1 AND newkey='" . $newkey . "' ORDER BY id");
|
||||
if ($db->num_rows($res)) {
|
||||
@@ -579,8 +656,10 @@ class CalendarModel
|
||||
|
||||
|
||||
}
|
||||
$data['attachments'] = $attachments;
|
||||
$json_data = json_encode($data);
|
||||
if ($attendees)
|
||||
$dataarray['attendees'] = $attendees;
|
||||
$dataarray['attachments'] = $attachments;
|
||||
$json_data = json_encode($dataarray);
|
||||
|
||||
$data = [];
|
||||
$data['ms_user_id'] = $microsoft_user_id;
|
||||
@@ -701,7 +780,7 @@ class CalendarModel
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
public static function getAll($key = 'go_calendar_id')
|
||||
{
|
||||
$items = [];
|
||||
|
||||
@@ -710,7 +789,7 @@ class CalendarModel
|
||||
$res = $db->select("Calendar", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[$data->go_calendar_id] = new Calendar($data);
|
||||
$items[$data->{$key}] = new Calendar($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
@@ -554,4 +554,43 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion {
|
||||
.event-tentative {
|
||||
|
||||
border-left: 5px solid #df0000;
|
||||
}
|
||||
|
||||
.event-organizer {
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
padding-top: 8px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.fc .fc-highlight {
|
||||
background: rgb(31 161 0 / 30%);
|
||||
}
|
||||
|
||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||
background-color: #7392f1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.event-accepted {
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
padding-top: 8px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.event-status {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.accepted-status {
|
||||
font-size: 18px;
|
||||
vertical-align: text-bottom;
|
||||
padding-top: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.event-status .fa-circle-info:before {
|
||||
color: #0029ff;
|
||||
}
|
||||
@@ -80,6 +80,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
var resources = [];
|
||||
var category = "";
|
||||
var rights = false;
|
||||
var movable = false;
|
||||
var resourceCounter = 0;
|
||||
$.each($('.calendar-check'), function (index, value) {
|
||||
if ($(this).prop('checked')) {
|
||||
@@ -105,6 +106,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
} else {
|
||||
rights = false;
|
||||
}
|
||||
if (value.isorganizer.isorganizer == '1' && rights) {
|
||||
movable = true;
|
||||
} else {
|
||||
movable = false;
|
||||
}
|
||||
|
||||
userevents.push({
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
@@ -120,8 +127,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
textColor: value.txtColor.txtColor,
|
||||
backgroundColor: value.bgColor.bgColor,
|
||||
editable: rights,
|
||||
droppable: movable,
|
||||
startEditable: movable,
|
||||
durationEditable: movable,
|
||||
resizableFromStart: movable,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
@@ -144,6 +156,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
attachments: value.attachments.attachments,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
@@ -221,6 +234,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}, function (data) {
|
||||
|
||||
}).done(function (data) {
|
||||
// console.log(data);
|
||||
if (data.data.attachment.attachment) {
|
||||
let docs = "";
|
||||
$.each(data.data.attachments.attachments, function (index, value) {
|
||||
@@ -307,15 +321,52 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
}
|
||||
if (isOrganizer == "1") {
|
||||
$('.event-organizer-div').hide();
|
||||
$('.show-update').show();
|
||||
$('.show-attendee').hide();
|
||||
} else {
|
||||
const organizer = JSON.parse(data.data.organizer.organizer);
|
||||
$('.event-organizer-div').show();
|
||||
$('.event-organizer').text(organizer.name);
|
||||
$('.accepted-status').removeClass('fa-circle-check');
|
||||
$('.accepted-status').removeClass('fa-circle-info');
|
||||
let accepted = data.data.accepted.accepted;
|
||||
if (accepted) {
|
||||
const accept = JSON.parse(accepted);
|
||||
const datetime=new Date(accept.time * 1000);
|
||||
const germanDateTime = datetime.toLocaleString('de-DE');
|
||||
$('.accepted-status').addClass('fa-circle-check');
|
||||
$('.accepted-status').prop('title', accept.user + ' (' + germanDateTime + ')');
|
||||
$('.event-accepted').text('Akzeptiert');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.accepted-status').addClass('fa-circle-info');
|
||||
$('.accepted-status').prop('title', 'Termin wurde noch nicht bestätigt');
|
||||
$('.event-accepted').text('Offen');
|
||||
}
|
||||
$('.show-update').hide();
|
||||
$('.show-attendee').show();
|
||||
$('.show-attendee').data('id', info.event.id);
|
||||
}
|
||||
if (data.data.attendees.attendees) {
|
||||
let attendees = JSON.parse(data.data.attendees.attendees);
|
||||
$.each(attendees, function (index, value) {
|
||||
if (!Number.isInteger(value)) {
|
||||
var valueExists = $("#calendar-attendees option").filter(function () {
|
||||
return $(this).val() === value;
|
||||
}).length > 0;
|
||||
if (!valueExists) {
|
||||
$("#calendar-attendees").append(new Option(value, value, true, true))
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#calendar-attendees').val(attendees).trigger('change');
|
||||
}
|
||||
|
||||
});
|
||||
if (info.event.startEditable) {
|
||||
if (info.event.extendedProps.clickable) {
|
||||
let cestDate = new Date(info.event.startStr);
|
||||
let cestOffset = 0; // 2 Stunden in Minuten
|
||||
let utcTime = cestDate.getTime() - cestOffset * 60 * 1000;
|
||||
@@ -333,8 +384,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
cestDate = new Date(info.event.endStr);
|
||||
cestOffset = 0; // 2 Stunden in Minuten
|
||||
utcTime = cestDate.getTime() - cestOffset * 60 * 1000;
|
||||
|
||||
|
||||
utcTime = cestDate.getTime() - cestOffset * 60 * 1000;
|
||||
if (info.event.allDay) {
|
||||
utcTime = utcTime - 60;
|
||||
}
|
||||
utcDate = new Date(utcTime);
|
||||
year = utcDate.getUTCFullYear();
|
||||
month = String(utcDate.getUTCMonth() + 1).padStart(2, '0');
|
||||
@@ -359,7 +414,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
$('#allday').change();
|
||||
|
||||
$('#end-time').val('');
|
||||
$('#end-date').val(StartformattedDate);
|
||||
$('#end-date').val(EndformattedDate);
|
||||
$('#start-time').val('');
|
||||
} else {
|
||||
$('#end-date').val(EndformattedDate);
|
||||
@@ -386,19 +441,22 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
},
|
||||
eventDidMount: function (info) {
|
||||
var eventstart = new Date(info.event.start);
|
||||
|
||||
var eventend = new Date(info.event.end);
|
||||
|
||||
// console.log(info);
|
||||
var eventstart = new Date(info.event.startStr);
|
||||
var eventend = new Date(info.event.endStr);
|
||||
|
||||
var title;
|
||||
if (!info.event.allDay) {
|
||||
eventstart = eventstart.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
|
||||
eventend = eventend.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
|
||||
eventstart = String(eventstart.getUTCHours()).padStart(2, '0') + ':' + String(eventstart.getUTCMinutes()).padStart(2, '0');
|
||||
eventend = String(eventend.getUTCHours()).padStart(2, '0') + ':' + String(eventend.getUTCMinutes()).padStart(2, '0');
|
||||
title = '<div class="tooltip-description text-center">von ' + eventstart + ' bis ' + eventend + '</div>';
|
||||
} else {
|
||||
eventstart = eventstart.toLocaleDateString();
|
||||
eventend = eventend.toLocaleDateString();
|
||||
eventstart = String(eventstart.getUTCDate()).padStart(2, '0') + '.' + String(eventstart.getUTCMonth() + 1).padStart(2, '0') + '.' + eventstart.getUTCFullYear();
|
||||
eventend = String(eventend.getUTCDate()).padStart(2, '0') + '.' + String(eventend.getUTCMonth() + 1).padStart(2, '0') + '.' + eventend.getUTCFullYear();
|
||||
if (eventend == "NaN.NaN.NaN") {
|
||||
eventend = eventstart;
|
||||
}
|
||||
// console.log(eventend);
|
||||
title = '<div class="tooltip-description text-center">Ganztägig von ' + eventstart + ' bis ' + eventend + ' </div>';
|
||||
}
|
||||
|
||||
@@ -604,12 +662,19 @@ if (typeof (EventSource) !== 'undefined') {
|
||||
jsondata.forEach(function (event) {
|
||||
var cevent = calendar.getEventById(event.cal_events_id);
|
||||
var rights = false;
|
||||
var movable = false;
|
||||
if (event.calendar_id in calendarRights) {
|
||||
if (calendarRights[event.calendar_id] == 'all') {
|
||||
rights = true;
|
||||
} else {
|
||||
rights = false;
|
||||
}
|
||||
if (event.isorganizer == '1' && rights) {
|
||||
movable = true;
|
||||
} else {
|
||||
movable = false;
|
||||
}
|
||||
|
||||
}
|
||||
if (event.change_type == '2' && cevent) {
|
||||
if (cevent) {
|
||||
@@ -629,9 +694,10 @@ if (typeof (EventSource) !== 'undefined') {
|
||||
classNames: ['cal-class-group-' + event.calendar_id, 'cal-class-id-' + event.cal_events_id],
|
||||
attachment: event.attachment,
|
||||
attachments: event.attachments,
|
||||
editable: rights,
|
||||
editable: movable,
|
||||
resourceId: event.calendar_id,
|
||||
calendar_name: event.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: event.mtime,
|
||||
mname: event.mname,
|
||||
ctime: event.ctime,
|
||||
@@ -657,6 +723,7 @@ if (typeof (EventSource) !== 'undefined') {
|
||||
calendar_id: event.calendar_id_check,
|
||||
resourceId: event.calendar_id,
|
||||
calendar_name: event.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: event.mtime,
|
||||
mname: event.mname,
|
||||
ctime: event.ctime,
|
||||
@@ -683,9 +750,10 @@ if (typeof (EventSource) !== 'undefined') {
|
||||
classNames: ['cal-class-group-' + event.calendar_id, 'cal-class-id-' + event.cal_events_id],
|
||||
attachment: event.attachment,
|
||||
attachments: event.attachments,
|
||||
editable: rights,
|
||||
editable: movable,
|
||||
resourceId: event.calendar_id,
|
||||
calendar_name: event.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: event.mtime,
|
||||
mname: event.mname,
|
||||
ctime: event.ctime,
|
||||
@@ -711,6 +779,7 @@ if (typeof (EventSource) !== 'undefined') {
|
||||
calendar_id: event.calendar_id_check,
|
||||
resourceId: event.calendar_id,
|
||||
calendar_name: event.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: event.mtime,
|
||||
mname: event.mname,
|
||||
ctime: event.ctime,
|
||||
@@ -774,11 +843,14 @@ $(document).ready(function () {
|
||||
$('#customer-info-check-info').empty();
|
||||
$('#customer-info-type').val('1');
|
||||
$('#customer').val('');
|
||||
$('.event-organizer-div').hide();
|
||||
$('#calendar-attendees').val('').trigger('change');
|
||||
$('.customer-div').hide();
|
||||
$('#EventModalLabel span').text('Termin erstellen');
|
||||
$('#EventModalLabel .fa-calendar-symbol').addClass('fa-calendar-circle-plus');
|
||||
$('#EventModalLabel .fa-calendar-symbol').removeClass('fa-calendar-lines-pen');
|
||||
$('#EventModalLabel').data('id', '');
|
||||
$('.show-attendee').data('id', '');
|
||||
$('.eventmodal-input').val('');
|
||||
$('.eventmodal-input').prop('disabled', false);
|
||||
$('.eventmodal-checkbox').prop('checked', false);
|
||||
@@ -876,6 +948,7 @@ $(document).ready(function () {
|
||||
description: description,
|
||||
attachments: attachments,
|
||||
users: users,
|
||||
attendees: $('#calendar-attendees').val(),
|
||||
customer: customer,
|
||||
customer_info_check: customer_info_check,
|
||||
customer_info_text: customer_info_text,
|
||||
@@ -969,6 +1042,7 @@ $(document).ready(function () {
|
||||
description: description,
|
||||
attachments: attachments,
|
||||
users: users,
|
||||
attendees: $('#calendar-attendees').val(),
|
||||
customer: customer,
|
||||
customer_info_check: customer_info_check,
|
||||
customer_info_text: customer_info_text,
|
||||
@@ -983,6 +1057,35 @@ $(document).ready(function () {
|
||||
$('#EventModal').modal('hide');
|
||||
});
|
||||
|
||||
$("body").on("click", ".show-attendee", function (e) {
|
||||
let eventAction = $(this).data("event-action");
|
||||
let eventactionGerman;
|
||||
let id = $(this).data('id');
|
||||
let users = [];
|
||||
$('#calendar-users > option:selected').each(function () {
|
||||
users.push($(this).val());
|
||||
});
|
||||
if (eventAction === "accept") {
|
||||
eventactionGerman = "zusagen";
|
||||
} else if (eventAction === "decline") {
|
||||
eventactionGerman = "absagen";
|
||||
}
|
||||
if (confirm('Termin ' + eventactionGerman + '?')) {
|
||||
$.post(requestUpdateStateUrl, {
|
||||
id: id,
|
||||
eventAction: eventAction,
|
||||
users: users
|
||||
}, function (data) {
|
||||
|
||||
}).done(function (data) {
|
||||
});
|
||||
$('#EventModal').modal('hide');
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('body').on('click', '#delete-event', function () {
|
||||
var id = $(this).data('id');
|
||||
var users = [];
|
||||
@@ -1373,6 +1476,7 @@ Xinon GMbH`;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("body").on("keyup", ".cal-group-name-input", function (e) {
|
||||
if (e.keyCode === 13) {
|
||||
let groupname = $.trim($(this).val());
|
||||
@@ -1490,14 +1594,15 @@ Xinon GMbH`;
|
||||
}
|
||||
$('.select2-multiple').select2(
|
||||
{
|
||||
|
||||
dropdownParent: jQuery('#relContainer')
|
||||
}
|
||||
);
|
||||
|
||||
$('.select2-multiple-tag').select2(
|
||||
{
|
||||
tags: true,
|
||||
tokenSeparators: [',', ' ']
|
||||
tokenSeparators: [',', ' '],
|
||||
dropdownParent: jQuery('#relContainer')
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1533,6 +1638,7 @@ Xinon GMbH`;
|
||||
var resources = [];
|
||||
var category = "";
|
||||
var rights = false;
|
||||
var movable = false;
|
||||
var resourceCounter = 0;
|
||||
$.each($('.calendar-check'), function (index, value) {
|
||||
if ($(this).prop('checked')) {
|
||||
@@ -1558,6 +1664,11 @@ Xinon GMbH`;
|
||||
} else {
|
||||
rights = false;
|
||||
}
|
||||
if (value.isorganizer.isorganizer == '1' && rights) {
|
||||
movable = true;
|
||||
} else {
|
||||
movable = false;
|
||||
}
|
||||
userevents.push({
|
||||
id: value.id.id,
|
||||
start: value.cstart.cstart,
|
||||
@@ -1572,9 +1683,10 @@ Xinon GMbH`;
|
||||
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
|
||||
textColor: value.txtColor.txtColor,
|
||||
backgroundColor: value.bgColor.bgColor,
|
||||
editable: rights,
|
||||
editable: movable,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: rights,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
@@ -1597,6 +1709,7 @@ Xinon GMbH`;
|
||||
attachments: value.attachments.attachments,
|
||||
resourceId: value.calendar_id.calendar_id,
|
||||
calendar_name: value.calendar_name.calendar_name,
|
||||
clickable: false,
|
||||
mtime: value.mtime.mtime,
|
||||
mname: value.mname.mname,
|
||||
ctime: value.ctime.ctime,
|
||||
|
||||
Reference in New Issue
Block a user