Merge branch 'spidev' into 'master'

Kalender

See merge request fronk/thetool!752
This commit is contained in:
Daniel Spitzer
2024-11-19 14:31:33 +00:00
5 changed files with 238 additions and 138 deletions

View File

@@ -248,22 +248,24 @@ endforeach;
</div>
</h5>
<div class="calendar-side-borders-sub-inner data-origin-2">
<div class="form-check text-left ml-2" data-origin="2">
<input data-calendar_id="999" class="form-check-input calendar-check"
name="form-check-input"
type="checkbox" value="">
<input data-calendar_id="999" type="color"
class="form-control-color color-input"
value="<?= ($Calendar_colors[999]['bgcolor']) ?: $specialCalendarColors[999] ?>"
title="Hintergrundfarbe">
<input data-calendar_id="999" type="color"
class="form-control-color color-text-input"
value="<?= ($Calendar_colors[999]['txtcolor']) ? $Calendar_colors[999]['txtcolor'] : '#ffffff' ?>"
title="Textfarbe">
<label class="calendar-side-label" for="" style="margin-top:2px;">
Abwesenheiten
</label>
</div>
<!-- <div style="display:none">-->
<!-- <div class="form-check text-left ml-2" data-origin="2">-->
<!-- <input data-calendar_id="999" class="form-check-input calendar-check"-->
<!-- name="form-check-input"-->
<!-- type="checkbox" value="">-->
<!-- <input data-calendar_id="999" type="color"-->
<!-- class="form-control-color color-input"-->
<!-- value="--><?php //= ($Calendar_colors[999]['bgcolor']) ?: $specialCalendarColors[999] ?><!--"-->
<!-- title="Hintergrundfarbe">-->
<!-- <input data-calendar_id="999" type="color"-->
<!-- class="form-control-color color-text-input"-->
<!-- value="--><?php //= ($Calendar_colors[999]['txtcolor']) ? $Calendar_colors[999]['txtcolor'] : '#ffffff' ?><!--"-->
<!-- title="Textfarbe">-->
<!-- <label class="calendar-side-label" for="" style="margin-top:2px;">-->
<!-- Abwesenheiten-->
<!-- </label>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-check text-left ml-2" data-origin="2">
<input data-calendar_id="998" class="form-check-input calendar-check"
name="form-check-input"

View File

@@ -212,6 +212,8 @@ class CalendarController extends mfBaseController
$timerecordingemployees = TimerecordingEmployeeModel::getAll();
$standardCalendarColors = CalendarModel::$standardCalendarColors;
$specialCalendarColors = CalendarModel::$specialCalendarColors;
$this->layout()->set("timerecordingemployees", $timerecordingemployees);
$this->layout()->set("standardCalendarColors", $standardCalendarColors);
$this->layout()->set("specialCalendarColors", $specialCalendarColors);

View File

@@ -155,6 +155,7 @@ class CalendarModel
$visibleCalendars = $r->visibleCalendars;
if ($visibleCalendars) {
$where .= " AND calendar_id IN (" . implode(",", $visibleCalendars) . ")";
$whereTimeRecording = " AND `Calendar`.`go_calendar_id` IN (" . implode(",", $visibleCalendars) . ")";
}
$sql = "SELECT `cal_events`.id, uuid, calendar_id, `cal_events`.user_id, start_time, end_time, timezone, all_day_event, `cal_events`.name,`cal_calendars`.name calendar_name, description, location, repeat_end_time, reminder, ctime,cname, mtime,mname, muser_id, busy, status, resource_event_id, private, rrule, `cal_events`.background, `cal_events`.files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, is_organizer,event_type,busy,recurrence FROM cal_events INNER JOIN `cal_calendars` ON (`cal_calendars`.`id`=`cal_events`.`calendar_id`) WHERE 1=1 $where ";
@@ -231,7 +232,7 @@ class CalendarModel
}
if ($calenderRights[$data['calendar_id']]) {
$rights = $calenderRights[$data['calendar_id']];
$CalendarUsers[$data['calendar_id']] = $data['calendar_name'];
$rows[] = array(
'id' => array('id' => $data['id']),
'cstart' => array('cstart' => $starttime),
@@ -257,9 +258,59 @@ class CalendarModel
'mname' => array('mname' => $data['mname']),
'isorganizer' => array('isorganizer' => $data['is_organizer']),
'busy' => array('busy' => $data['busy']),
'timerecording' => array('timerecording' => 0),
);
}
}
$db = FronkDB::singleton();
$sql = "SELECT `Timerecording`.`id`, `Timerecording`.`start` start_time, `Timerecording`.`end` end_time,`Calendar`.`go_calendar_id` calendar_id,`TimerecordingCategory`.`name`,`TimerecordingCategory`.`id` CategoryId,`Timerecording`.`create` ctime,`Timerecording`.`edit` mtime FROM `Timerecording`
INNER JOIN `TimerecordingCategory` ON `TimerecordingCategory`.`id`=`Timerecording`.`timerecordingCategory_id`
INNER JOIN `Calendar` ON `Calendar`.`user_id`=`Timerecording`.`user_id`
WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourday`!='7' AND `TimerecordingCategory`.`hourday`!='5' $whereTimeRecording";
$res = $db->query($sql);
if ($db->num_rows($res)) {
while ($data = $db->fetch_array($res)) {
if ($calendarColors[$data['calendar_id']]['bgcolor']) {
$bgcolor = $calendarColors[$data['calendar_id']]['bgcolor'];
$txtcolor = $calendarColors[$data['calendar_id']]['txtcolor'];
} else {
$bgcolor = $standardCalendarColors[$colorCounter];
$txtcolor = "#000";
$colorCounter++;
}
if ($data['CategoryId'] != 11) {
$starttime = date("Y-m-d", $data['start_time']);
$endtime = date("Y-m-d", $data['end_time']);
if ($starttime != $endtime) {
$endtime = $data['end_time'] + 86400;
$endtime = date("Y-m-d", $endtime);
}
} else {
$starttime = date("Y-m-d H:i", $data['start_time']);
$endtime = date("Y-m-d H:i", $data['end_time']);
}
$rows[] = array(
'id' => array('id' => "9999" . $data['id']),
'category' => array('category' => $data['name']),
'ccategory' => array('ccategory' => $data['name']),
'cstart' => array('cstart' => $starttime),
'cend' => array('cend' => $endtime),
'calendar_id' => array('calendar_id' => $data['calendar_id']),
'ctime' => array('ctime' => date("d.m.Y H:i", $data['ctime'])),
'cname' => array('cname' => $CalendarUsers[$data['calendar_id']]),
'mtime' => array('mtime' => date("d.m.Y H:i", $data['mtime'])),
'mname' => array('mname' => $CalendarUsers[$data['calendar_id']]),
'description' => array('description' => ""),
'bgColor' => array('bgColor' => $bgcolor),
'txtColor' => array('txtColor' => $txtcolor),
'timerecording' => array('timerecording' => 1),
'calendar_name' => array('calendar_name' => $CalendarUsers[$data['calendar_id']]),
);
}
}
$json['success'] = true;
$json['data'] = $rows;
} else {

View File

@@ -462,7 +462,7 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion {
}
.event-search-result {
box-shadow: 0px 0px 3px 3px #48ff00 !important;
box-shadow: 0px 0px 3px 3px #f2ff00 !important;
}
.search-div .select2 {

View File

@@ -101,88 +101,110 @@ document.addEventListener('DOMContentLoaded', function () {
$.each(json.data, function (index, value) {
rrule = null;
duration = null;
rruleflag = false;
category = value.ccategory.ccategory;
if (value.rrule.rrule) {
rrule = value.rrule.rrule;
duration = value.duration.duration;
rruleflag = true;
if (!value.timerecording.timerecording) {
rrule = null;
duration = null;
rruleflag = false;
category = value.ccategory.ccategory;
if (value.rrule.rrule) {
rrule = value.rrule.rrule;
duration = value.duration.duration;
rruleflag = true;
}
}
if (value.calendar_id.calendar_id in calendarRights) {
if (calendarRights[value.calendar_id.calendar_id] == 'all') {
rights = true;
if (value.calendar_id.calendar_id in calendarRights) {
if (calendarRights[value.calendar_id.calendar_id] == 'all') {
rights = true;
} else {
rights = false;
}
if (value.isorganizer.isorganizer == '1' && rights) {
movable = true;
} else {
movable = false;
}
let event = {
id: value.id.id,
start: value.cstart.cstart,
end: value.cend.cend,
title: category,
description: value.description.description,
location: value.location.location,
attachment: value.attachment.attachment,
attachments: value.attachments.attachments,
calendar_id: value.calendar_id,
event_type: value.event_type.event_type,
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,
rruleflag: rruleflag,
rrule: rrule,
duration: duration,
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,
cname: value.cname.cname,
busy: value.busy.busy
};
userevents.push(event);
if (value.rrule.rrule) {
}
} else {
rights = false;
}
if (value.isorganizer.isorganizer == '1' && rights) {
movable = true;
} else {
movable = false;
otherevents.push({
id: value.id.id,
start: value.cstart.cstart,
end: value.cend.cend,
title: category,
description: category,
color: 'red',
editable: false,
rruleflag: rruleflag,
rrule: rrule,
calendar_id: value.calendar_id,
event_type: value.event_type.event_type,
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
attachment: value.attachment.attachment,
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,
cname: value.cname.cname,
busy: value.busy.busy
});
}
} else {
let event = {
id: value.id.id,
start: value.cstart.cstart,
end: value.cend.cend,
title: category,
title: value.category.category,
description: value.description.description,
location: value.location.location,
attachment: value.attachment.attachment,
attachments: value.attachments.attachments,
calendar_id: value.calendar_id,
event_type: value.event_type.event_type,
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,
rruleflag: rruleflag,
rrule: rrule,
duration: duration,
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,
cname: value.cname.cname,
busy: value.busy.busy
editable: false,
};
userevents.push(event);
if (value.rrule.rrule) {
}
} else {
otherevents.push({
id: value.id.id,
start: value.cstart.cstart,
end: value.cend.cend,
title: category,
description: category,
color: 'red',
editable: false,
rruleflag: rruleflag,
rrule: rrule,
calendar_id: value.calendar_id,
event_type: value.event_type.event_type,
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
attachment: value.attachment.attachment,
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,
cname: value.cname.cname,
busy: value.busy.busy
});
}
});
@@ -205,8 +227,7 @@ document.addEventListener('DOMContentLoaded', function () {
schedulerLicenseKey: 'CC-Attribution-NonCommercial-NoDerivatives',
timeZone: 'UTC',
locale: 'de',
resourceAreaWidth: '220px',
themeSystem: 'bootstrap4',
snapDuration: '00:15:00',
selectable: true,
@@ -1762,82 +1783,105 @@ Xinon GMbH`;
$.each(json.data, function (index, value) {
rrule = null;
duration = null;
rruleflag = false;
category = value.ccategory.ccategory;
if (value.rrule.rrule) {
rrule = value.rrule.rrule;
duration = value.duration.duration;
rruleflag = true;
if (!value.timerecording.timerecording) {
rrule = null;
duration = null;
rruleflag = false;
category = value.ccategory.ccategory;
if (value.rrule.rrule) {
rrule = value.rrule.rrule;
duration = value.duration.duration;
rruleflag = true;
}
if (value.calendar_id.calendar_id in calendarRights) {
if (calendarRights[value.calendar_id.calendar_id] == 'all') {
rights = true;
} else {
rights = false;
}
if (value.isorganizer.isorganizer == '1' && rights) {
movable = true;
if (value.calendar_id.calendar_id in calendarRights) {
if (calendarRights[value.calendar_id.calendar_id] == 'all') {
rights = true;
} else {
rights = false;
}
if (value.isorganizer.isorganizer == '1' && rights) {
movable = true;
} else {
movable = false;
}
userevents.push({
id: value.id.id,
start: value.cstart.cstart,
end: value.cend.cend,
title: category,
description: value.description.description,
location: value.location.location,
attachment: value.attachment.attachment,
attachments: value.attachments.attachments,
calendar_id: value.calendar_id,
event_type: value.event_type.event_type,
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
textColor: value.txtColor.txtColor,
backgroundColor: value.bgColor.bgColor,
editable: movable,
rruleflag: rruleflag,
rrule: rrule,
duration: duration,
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,
cname: value.cname.cname,
busy: value.busy.busy
});
} else {
movable = false;
otherevents.push({
id: value.id.id,
start: value.cstart.cstart,
end: value.cend.cend,
title: category,
description: category,
color: 'red',
editable: false,
rruleflag: rruleflag,
rrule: rrule,
duration: duration,
calendar_id: value.calendar_id,
event_type: value.event_type.event_type,
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
attachment: value.attachment.attachment,
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,
cname: value.cname.cname,
busy: value.busy.busy
});
}
userevents.push({
} else {
let event = {
id: value.id.id,
start: value.cstart.cstart,
end: value.cend.cend,
title: category,
title: value.category.category,
description: value.description.description,
location: value.location.location,
attachment: value.attachment.attachment,
attachments: value.attachments.attachments,
calendar_id: value.calendar_id,
event_type: value.event_type.event_type,
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
textColor: value.txtColor.txtColor,
backgroundColor: value.bgColor.bgColor,
editable: movable,
rruleflag: rruleflag,
rrule: rrule,
duration: duration,
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,
cname: value.cname.cname,
busy: value.busy.busy
});
} else {
otherevents.push({
id: value.id.id,
start: value.cstart.cstart,
end: value.cend.cend,
title: category,
description: category,
color: 'red',
editable: false,
rruleflag: rruleflag,
rrule: rrule,
duration: duration,
calendar_id: value.calendar_id,
event_type: value.event_type.event_type,
classNames: ['cal-class-group-' + value.calendar_id.calendar_id, 'cal-class-id-' + value.id.id],
attachment: value.attachment.attachment,
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,
cname: value.cname.cname,
busy: value.busy.busy
});
};
userevents.push(event);
}
});
calendar.addEventSource(userevents);
if (visibleCalendars.includes(998)) {
@@ -1851,5 +1895,6 @@ Xinon GMbH`;
});
}
})
;