Merge branch 'spidev' into 'master'

Kalender Updates

See merge request fronk/thetool!949
This commit is contained in:
Daniel Spitzer
2025-01-27 08:33:03 +00:00
10 changed files with 408 additions and 85 deletions

View File

@@ -77,8 +77,27 @@ endforeach;
<div class="card-body mb-3 ">
<div class="row ">
<div class="col-12">
<div class="float-left">
<h4 class="header-title">Kalender</h4>
<div class="float-left mb-2">
<h4 class="header-title d-inline-block mr-1">Filter:</h4>
<div class="d-inline-block">
<button title="Xinon Inbetriebnahmen"
class="btn btn-light btn-light-search top-search-filter" data-ctype="2"><img
class="logo-top-search" src='/img/xinon-logo.png'></button>
<button title="ESTMK Inbetriebnahmen"
class="btn btn-light btn-light-search top-search-filter" data-ctype="3"><img
class="logo-top-search"
src='/img/estmk_logo.png'>
</button>
<button title="SNOPP Inbetriebnahmen"
class="btn btn-light btn-light-search top-search-filter" data-ctype="4"><img
class="logo-top-search"
src='/img/snop-logo.png'>
</button>
<button title="Störungen" data-ctype="5"
class="btn btn-light btn-light-search top-search-filter"><i
class="fa-duotone fa-solid fa-triangle-exclamation fa-calendar-alert fa-calendar-alert-search"></i>
</button>
</div>
</div>
<?php if (!$rights) : ?>
<div class="alert alert-danger" role="alert">
@@ -86,7 +105,6 @@ endforeach;
</div>
<?php die(); endif; ?>
<div class="d-inline-block w-50 search-div" style="margin-top: -7px;">
<select id="jumpevent" class="jumpevent"></select>
</div>
@@ -96,13 +114,13 @@ endforeach;
</div>
</div>
<div clas="row">
</div>
<div class="row ">
<div id="calendar-side-div" class="col-12 col-lg-2">
<div class="calendar-side-borders-main">
<h3 class="no-movable" data-calendarid="<?= $Calendar[0]->go_calendar_id ?>" data-id="<?= $Calendar[0]->id ?>" id="calendar-id">Kalender
<h3 class="no-movable" data-calendarid="<?= $Calendar[0]->go_calendar_id ?>"
data-id="<?= $Calendar[0]->id ?>" id="calendar-id">Kalender
<div class="add-cal-group-div"><i title="Kalendergruppe hinzufügen"
class="fa-duotone fa-solid fa-rectangle-history-circle-plus"></i>
</div>
@@ -159,52 +177,11 @@ endforeach;
<?= ($CalendarAll[$calendar['calendar_id']]->user->name) ?: $specialCalendars[$calendar['calendar_id']] ?>
</label>
</div>
<?php endforeach;
// foreach ($Rights as $key => $calendar):
?>
<!---->
<!-- <div class="form-check text-left ml-2"-->
<!-- data-origin="-->
<?php //= $calendar['origin']
?><!--">-->
<!-- <input data-calendar_id="-->
<?php //= $calendar['calendar_id']
?><!--"-->
<!-- class="form-check-input calendar-check"-->
<!-- name="form-check-input" type="checkbox"-->
<!-- --><?php //= ($calendar['checked']) ? 'checked="checked"' : ''
?>
<!-- value="2">-->
<!-- <input-->
<!-- data-calendar_id="-->
<?php //= $calendar['calendar_id']
?><!--"-->
<!-- type="color"-->
<!-- class="form-control-color color-input"-->
<!-- value="-->
<?php //= $Calendar_colors[$key]['bgcolor']
?><!--"-->
<!-- title="Hintergrundfarbe">-->
<!-- <input data-calendar_id="-->
<?php //= $calendar['calendar_id']
?><!--"-->
<!-- type="color"-->
<!-- class="form-control-color color-text-input"-->
<!-- value="-->
<?php //= ($Calendar_colors[$key]['txtcolor']) ? $Calendar_colors[$key]['txtcolor'] : '#000000'
?><!--"-->
<!-- title="Textfarbe">-->
<!-- <label class="calendar-side-label" style="margin-top:2px;">-->
<!-- --><?php //= ($CalendarAll[$key]->user->name) ?: $specialCalendars[$calendar['calendar_id']]
?>
<!-- </label>-->
<!-- </div>-->
<!-- --><?php //endforeach;
?>
<?php endforeach; ?>
</div>
</div>
<?php endforeach;
// var_dump($Rights);
// var_dump($Rights);
?>
</div>
<?php else : ?>
@@ -393,7 +370,10 @@ endforeach;
<span title="Erinnerung" class="input-group-text spanwidht">Typ</span>
<select class="form-control form-select" aria-label="Default select" id="type">
<option value="1">Termin</option>
<option value="2">IBN</option>
<option value="2">IBN Xinon</option>
<option value="3">IBN ESTMK</option>
<option value="4">IBN SNOPP</option>
<option value="5">Störung</option>
</select>
</div>
</div>
@@ -565,7 +545,8 @@ endforeach;
</div>
<div class="d-inline-block ml-2">
<div class="dropdown">
<button style="padding: 1px 8px;" id="preview-button" class="btn btn-info dropdown-toggle"
<button style="padding: 1px 8px;" id="preview-button"
class="btn btn-info dropdown-toggle"
type="button" data-toggle="dropdown" aria-expanded="false">
Vorlagen
</button>
@@ -589,6 +570,7 @@ endforeach;
</div>
</div>
</div>
<div class="customer-div customer-info-div">
<div class="row mt-2 justify-content-center">
<div class="col-10">
@@ -606,6 +588,19 @@ endforeach;
</div>
</div>
</div>
<div class="ticket-div">
<div class="row mt-2 justify-content-center">
<div class="col-2">
<label for="location" class="col-form-label fw-medium">Ticket</label>
</div>
<div class="col-8">
<div id="relContainer3" style="position:relative">
<select id="ticket" class="jumpevent"></select>
</div>
</div>
</div>
</div>
<div id="documents" class="row mt-2 mb-2 justify-content-center">
<div class="col-10" id="attachments" data-newkey="">
<label class="col-form-label fw-medium">Anlagen</label>
@@ -660,6 +655,7 @@ endforeach;
let requestEventAttachmentTmpDeleteUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'deleteCalendarEventAttachmentTmp']) ?>";
let requestEventAttachmentUploadUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'uploadCalendarEventAttachment']) ?>";
let requestAddressUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'getAddress']) ?>";
let requestTicketUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'getTicket']) ?>";
let requestInsertUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'insertCalendarEvent']) ?>";
let requestUpdateUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarEvent']) ?>";
let requestUpdateStateUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarEventState']) ?>";

View File

@@ -493,11 +493,19 @@ class AddressModel {
if (array_key_exists("Controller!", $filter)) {
$termstring = trim($filter['search_term!']);
$xinon= $filter['xinon'];
$termExplode = explode(" ", $termstring);
if ($xinon == 1) {
foreach ($termExplode as $term) {
$wherestring .= " AND (`customer_number` LIKE '%" . $term . "%' OR `company` LIKE '%" . $term . "%' OR `firstname` LIKE '%" . $term . "%' OR `lastname` LIKE '%" . $term . "%' OR `street` LIKE '%" . $term . "%' OR `zip` LIKE '%" . $term . "%' OR `city` LIKE '%" . $term . "%') ";
}
$where .= " AND customer_number > 0 $wherestring";
$where .= " AND customer_number > 0 $wherestring";
} else {
foreach ($termExplode as $term) {
$wherestring .= " AND (`company` LIKE '%" . $term . "%' OR `firstname` LIKE '%" . $term . "%' OR `lastname` LIKE '%" . $term . "%' OR `street` LIKE '%" . $term . "%' OR `zip` LIKE '%" . $term . "%' OR `city` LIKE '%" . $term . "%') ";
}
$where .= " AND customer_number is NULL $wherestring";
}
}
// var_dump($filter, $where);exit;

View File

@@ -85,7 +85,10 @@ class CalendarController extends mfBaseController
case "getAddress":
$r = $this->request;
$this->getAddress($r);
die();
case "getTicket";
$r = $this->request;
$this->getTicket($r);
die();
case "insertCalendarEvent":
$r = $this->request;
@@ -247,7 +250,8 @@ class CalendarController extends mfBaseController
private function getAddress($r)
{
$address = AddressModel::search(array("Controller!" => 'Calendar', "search_term!" => $r->term), array('count' => '20'));
$xinon = $r->xinon;
$address = AddressModel::search(array("Controller!" => 'Calendar', "search_term!" => $r->term, "xinon" => $xinon), array('count' => '20'));
$mobiles = CalendarModel::$austrian_mobile_prefixes;
$prefixes = array('0043', '43 ', '43', '0');
foreach ($address as $key => $value) {
@@ -323,6 +327,32 @@ class CalendarController extends mfBaseController
echo trim($json);
die();
}
private function getTicket($r)
{
$project = new XinonProject();
$data=$project->searchSupportTickets($r->term);
foreach ($data as $key => $value) {
$rows[] = array(
'id' => $value['id'],
'text' => 'Ticket: '.$value['id']." ".$value['subject'],
'subject' => $value['subject'],
'mail' => $value['customField5'],
'mobilenumber' => $value['customField4'],
'location' => $value['customField3'],
'name' => $value['customField2']
);
}
$json['incomplete_results'] = false;
$json['total_count'] = count($rows);
$json['items'] = $rows;
$json = json_encode($json);
echo trim($json);
die();
}
protected function indexAction()
{

View File

@@ -42,7 +42,12 @@ class CalendarModel
'#dbbeb3', '#e9aebc', '#b5cae7', '#dec2d4', '#aebbd5',
'#e2baaf', '#b6ebd5', '#a9c4bb', '#d7d2c5', '#d7e3d4'
];
public static $eventCategories = array(
2 => 'Gelbe Kategorie', //Xinon IBN
3 => 'Grüne Kategorie', //ESTMK IBN
4 => 'Lila Kategorie', //Snopp IBN
5 => 'Rote Kategorie', //Störung
);
public static $specialCalendarColors = array(997 => '#bd0000', 998 => '#8000A3', 999 => '#08769b');
public static function convertToSummertime($timestamp)
@@ -174,10 +179,16 @@ class CalendarModel
$where = "";
}
$visibleCalendars = $r->visibleCalendars;
$visibleCalendarTypes = $r->visibleCalendarTypes;
if ($visibleCalendars) {
$where .= " AND calendar_id IN (" . implode(",", $visibleCalendars) . ")";
$whereTimeRecording = " AND `Calendar`.`go_calendar_id` IN (" . implode(",", $visibleCalendars) . ")";
}
if ($visibleCalendarTypes) {
$where .= " AND event_type IN (" . implode(",", $visibleCalendarTypes) . ")";
}
$sql = "SELECT `cal_events`.id,`cal_events`.categories, 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,rrule_events FROM cal_events INNER JOIN `cal_calendars` ON (`cal_calendars`.`id`=`cal_events`.`calendar_id`) WHERE 1=1 $where ";
$res = $dbcal->query($sql);
@@ -407,11 +418,10 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
$sql = "SELECT `id`,`name`,`customer_info_send`,`start_time`,`end_time`,`event_type` FROM `cal_events` WHERE `customer_info_reminder`= 1 AND `customer_info_send` IS NOT NULL AND `event_type` > 1 AND `start_time` BETWEEN $timecalcstart AND $timecalcend";
$res = $dbcal->query($sql);
while ($data = $dbcal->fetch_array($res))
{
while ($data = $dbcal->fetch_array($res)) {
$rows[] = array(
'id' => $data['id'],
'name' => $data['name'],
'name' => $data['name'],
'customer_info_send' => $data['customer_info_send'],
'start_time' => $data['start_time'],
'end_time' => $data['end_time'],
@@ -608,13 +618,15 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
header('Content-Type: application/json');
$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";
$sql = "SELECT `cal_events`.id,microsoft_id,uuid,ms_user_id,categories 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;
$categories = json_decode($result->categories, true);
}
$updateArray['start_time'] = $start;
@@ -643,13 +655,31 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
else
$updateArray['reminder'] = $reminder;
}
if ($type)
if ($type) {
$updateArray['event_type'] = $type;
$calEventCategories = self::$eventCategories;
foreach ($calEventCategories as $key => $value) {
$arraykey = array_search($value, $categories);
if (!empty($arraykey || $arraykey === 0)) {
unset($categories[$arraykey]);
}
}
if ($type > 1) {
$categories[] = $calEventCategories[$type];
$categories = array_values($categories);
}
if ($categories) {
$updateArray['categories'] = json_encode($categories);
} else
$updateArray['categories'] = NULL;
}
if (isset($busy))
$updateArray['busy'] = $busy;
if ($type == 2) {
if ($type == 2 || $type == 3 || $type == 4) {
if ($r->customer)
$updateArray['customer'] = $r->customer;
else
@@ -815,7 +845,15 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
if ($reminder == 'NULL') {
$reminder = NULL;
}
if ($type == 2) {
$calEventCategories = self::$eventCategories;
if ($type > 1) {
$categories[] = $calEventCategories[$type];
}
if ($categories) {
$categories = json_encode($categories);
} else
$categories = NULL;
if ($type == 2 || $type == 3 || $type == 4) {
$customer = $r->customer;
$customer_info_type = $r->customer_info_type;
$customer_info_text = $r->customer_info_text;
@@ -836,7 +874,7 @@ WHERE `TimerecordingCategory`.`hourday`!='1' AND `TimerecordingCategory`.`hourda
$customer_info_send = NULL;
}
$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' => $privateflag, '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' => $privateflag, 'rrule' => '', 'background' => 'EBF1E2', 'files_folder_id' => 0, 'read_only' => 0,'categories'=>$categories, '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", $dataarray);
$event_id = $dataarray['uuid'];

View File

@@ -9,7 +9,7 @@ class CalendarTemplateModel
public static $calendarTemplateEventTypes=array(
"1"=>"Termin",
"2"=>"IBN",
"2"=>"IBN Xinon",
"3"=>"IBN E-Stmk",
"4"=>"IBN Snopp",
"5"=>"Störungen"

View File

@@ -11,7 +11,7 @@
.fc-timegrid-event-short .fc-event-main-frame {
flex-direction: row;
overflow: hidden;
margin-left: 10px;
margin-left: 13px;
}
.fc-toolbar {
@@ -121,7 +121,7 @@
.tooltip[x-placement^="right"],
.popper[x-placement^="right"] {
margin-left: 5px;
margin-left: 0px;
}
.popper[x-placement^="right"] .popper__arrow,
@@ -130,7 +130,7 @@
border-left-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
left: -5px;
left: 0px;
top: calc(50% - 5px);
margin-left: 0;
margin-right: 0;
@@ -333,8 +333,10 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion {
.fc-event-type {
position: absolute;
top: 0;
top: 1px;
left: -4px;
opacity: 0.8;
filter: drop-shadow(1px 1px 1px #000);
}
.fc-event-recurrence {
@@ -673,4 +675,43 @@ thead .fc-day-today .fc-scrollgrid-sync-inner .fc-col-header-cell-cushion {
}
.cursor-alias{
cursor: alias;
}
.fa-calendar-alert
{
font-size: 15px;
vertical-align: top;
margin-top: -1px;
}
.fa-calendar-alert:after {
color: #ff0000;
opacity: 0.7;
}
.fa-calendar-alert:before {
color: #fff;
}
.fa-calendar-alert-search
{
font-size: 22px;
}
.logo-top-search
{
height: 20px;
vertical-align: top;
cursor: pointer;
}
.btn-light-search
{
border-color: #e5e5e5;
padding: 3px 6px;
}
.top-search-filter
{
filter:grayscale(100%);
}
.fc-event-time {
z-index: 100;
}

BIN
public/img/estmk_logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
public/img/snop-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
public/img/xinon-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -399,7 +399,9 @@ document.addEventListener('DOMContentLoaded', function () {
isOrganizer = data.data.isorganizer.isorganizer;
if (data.data.type.type == "1") {
$('.customer-div').hide();
} else if (data.data.type.type == "2") {
$('.ticket-div').hide();
} else if (data.data.type.type == "2" || data.data.type.type == "3" || data.data.type.type == "4") {
$('.ticket-div').hide();
$('.customer-div').show();
if (data.data.customer.customer) {
$('#customer').html('<option>' + data.data.customer.customer + '</option>');
@@ -467,6 +469,32 @@ document.addEventListener('DOMContentLoaded', function () {
html: true
});
}
} else if (data.data.type.type == "5") {
$('.ticket-div').show();
$('.customer-div').hide();
if (data.data.customer.customer) {
$('#customer').html('<option>' + data.data.customer.customer + '</option>');
} else {
$('#customer').html('<option></option>');
}
$('#ticket').select2({
placeholder: "Ticket",
minimumInputLength: 3,
dropdownParent: jQuery('#relContainer3'),
// dropdownParent: $('#EventModal'),
language: "de",
ajax: {
url: requestTicketUrl,
dataType: 'json',
delay: 250,
processResults: function (data) {
// Transforms the top-level key of the response object from 'items' to 'results'
return {
results: data.items
};
}
}
})
}
if (isOrganizer == "1") {
$('.event-organizer-div').hide();
@@ -649,7 +677,23 @@ document.addEventListener('DOMContentLoaded', function () {
if (info.event.extendedProps['event_type'] == '2') {
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><i class=\"fa-light fa-user-helmet-safety\"></i></div>");
// info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><i class=\"fa-light fa-user-helmet-safety\"></i></div>");
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><img style='height: 13px;vertical-align: top;' src='/img/xinon-logo.png'></div>");
}
if (info.event.extendedProps['event_type'] == '3') {
// info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><i class=\"fa-light fa-user-helmet-safety\"></i></div>");
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><img style='height: 13px;vertical-align: top;' src='/img/estmk_logo.png'></div>");
}
if (info.event.extendedProps['event_type'] == '4') {
// info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><i class=\"fa-light fa-user-helmet-safety\"></i></div>");
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><img style='height: 13px;vertical-align: top;' src='/img/snop-logo.png'></div>");
}
if (info.event.extendedProps['event_type'] == '5') {
// info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><i class=\"fa-light fa-user-helmet-safety\"></i></div>");
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-type\"><i class=\"fa-duotone fa-solid fa-triangle-exclamation fa-calendar-alert\"></i></div>");
}
if (info.event.extendedProps['privateflag'] == 1) {
info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "<div class=\"fc-event-private\"><i class=\"fa-regular fa-event-lock fa-lock\"></i></div>");
@@ -686,7 +730,7 @@ document.addEventListener('DOMContentLoaded', function () {
}
},
eventResize: function (info) {
info.event.remove();
let start = info.event.start.getTime();
const offsetstart = getOffset(start);
start = (start / 1000 + offsetstart) * 1000;
@@ -715,7 +759,7 @@ document.addEventListener('DOMContentLoaded', function () {
},
eventDrop: function (info) {
// sleep(2000).then(() => {
info.event.remove();
let start = info.event.start.getTime();
const offsetstart = getOffset(start);
start = (start / 1000 + offsetstart) * 1000;
@@ -826,19 +870,31 @@ if (typeof (EventSource) !== 'undefined') {
source.addEventListener('message', function (e) {
// document.getElementById('result').innerHTML += e.data + '<br>';
let checkbox = $(".form-check-input");
let calendarFilter = $('.btn-light-search');
let visibleCalendars = [];
let visibleCalendarTypes = [];
let mycalendar_id = $('#calendar-id').data('calendarid');
visibleCalendars.push(0);
checkbox.each(function () {
if ($(this).prop('checked')) {
visibleCalendars.push($(this).data('calendar_id'));
visibleCalendars.push(parseInt($(this).data('calendar_id')));
}
});
calendarFilter.each(function () {
if (!$(this).hasClass('top-search-filter')) {
visibleCalendarTypes.push(parseInt($(this).data('ctype')));
}
});
jsondata = JSON.parse(e.data);
jsondata.forEach(function (event) {
if (!visibleCalendars.includes(event.calendar_id)) {
if (!visibleCalendars.includes(parseInt(event.calendar_id))) {
return;
}
if (visibleCalendarTypes.length > 0 && !visibleCalendarTypes.includes(parseInt(event.event_type))) {
return;
}
let cevent = calendar.getEventById(event.cal_events_id);
let rights = false;
let movable = false;
@@ -875,6 +931,7 @@ if (typeof (EventSource) !== 'undefined') {
if (event.change_type == '2' && cevent) {
if (cevent) {
if (event.calendar_id == event.calendar_id) {
// console.log(jsondata);
cevent.remove();
calendar.addEvent({
id: event.cal_events_id,
@@ -904,6 +961,40 @@ if (typeof (EventSource) !== 'undefined') {
cname: event.cname,
busy: event.busy
});
// cevent.setProp('title', event.name);
// console.log(event.start_time);
// console.log(event.end_time);
// console.log(event.name);
// cevent.setDates(event.start_time, event.end_time);
//
// // Farben und Klassennamen
// cevent.setProp('backgroundColor', event.bgColor);
// cevent.setProp('textColor', event.txtColor);
// cevent.setProp('classNames', [
// 'cal-class-group-' + event.calendar_id,
// 'cal-class-id-' + event.cal_events_id,
// cursorclass
// ]);
// cevent.setExtendedProp('description', event.description);
// cevent.setExtendedProp('calendar_id', event.calendar_id_check);
// cevent.setExtendedProp('location', event.location);
// cevent.setExtendedProp('event_type', event.event_type);
// cevent.setExtendedProp('attachment', event.attachment);
// cevent.setExtendedProp('attachments', event.attachments);
// cevent.setExtendedProp('privateflag', event.privateflag);
// cevent.setExtendedProp('rruleflag', event.rruleflag);
// cevent.setExtendedProp('rrule', event.rrule);
// cevent.setExtendedProp('duration', event.duration);
// cevent.setExtendedProp('resourceId', event.calendar_id);
// cevent.setExtendedProp('calendar_name', event.calendar_name);
// cevent.setExtendedProp('clickable', event.rights);
// cevent.setExtendedProp('mtime', event.mtime);
// cevent.setExtendedProp('mname', event.mname);
// cevent.setExtendedProp('ctime', event.ctime);
// cevent.setExtendedProp('cname', event.cname);
// cevent.setExtendedProp('busy', event.busy);
// cevent.setProp('editable', movable);
} else {
cevent.remove();
calendar.addEvent({
@@ -1011,16 +1102,16 @@ $(document).ready(function () {
});
$(document).on('show.bs.dropdown', '.dropdown', function () {
let previewMenue='';
let previewMenue = '';
$.getJSON(requestgetpreviewtUrl, {
event_type: $('#type').val()
}, function (data) {
}).done(function (data) {
;
;
let counter =1;
$.each(data.data, function(index, item) {
let counter = 1;
$.each(data.data, function (index, item) {
previewMenue += '<li><a class="dropdown-item text-template" data-text="' + item.data.text + '">' + item.data.name + '</a></li>';
counter++;
});
@@ -1067,9 +1158,11 @@ $(document).ready(function () {
$('#customer-info-check-info').empty();
$('#customer-info-type').val('1');
$('#customer').val('');
$('#ticket').val('');
$('.event-organizer-div').hide();
$('#calendar-attendees').val('').trigger('change');
$('.customer-div').hide();
$('.ticket-div').hide();
$('.calendar-users-all').hide();
$('#EventModalLabel span').text('Termin erstellen');
$('#EventModalLabel .fa-calendar-symbol').addClass('fa-calendar-circle-plus');
@@ -1152,7 +1245,7 @@ $(document).ready(function () {
if ($('#customer-info-check').is(':checked')) {
customer_info_check = 1;
}
if (type == '2') {
if (type == '2' || type == '3' || type == '4') {
customer_info_text = $('#customer-info-text').val();
customer_info_type = $('#customer-info-type').val();
customer_info_type_text = $('#customer-info-type-text').val();
@@ -1247,7 +1340,7 @@ $(document).ready(function () {
if ($('#customer-info-check').is(':checked')) {
customer_info_check = 1;
}
if (type == '2') {
if (type == '2' || type == '3' || type == '4') {
customer_info_text = $('#customer-info-text').val();
customer_info_type = $('#customer-info-type').val();
customer_info_type_text = $('#customer-info-type-text').val();
@@ -1259,7 +1352,8 @@ $(document).ready(function () {
}
let id = $(this).data('id');
const cevent = calendar.getEventById(id);
cevent.remove();
$('#calendar-users > option:selected').each(function () {
users.push($(this).val());
});
@@ -1392,6 +1486,17 @@ $(document).ready(function () {
}
})
});
$('body').on('click', '.btn-light-search', function (event, init = 0) {
if ($(this).hasClass('top-search-filter')) {
$(this).removeClass('top-search-filter');
} else {
$(this).addClass('top-search-filter');
}
refreshCalendarEvents();
});
$('body').on('change', '.calendar-check', function (event, init = 0) {
if ($(this).prop('checked')) {
@@ -1514,10 +1619,12 @@ $(document).ready(function () {
})
$('body').on('change', '#type', function () {
$('#customer').val('');
if ($(this).val() == "1") {
$('.customer-div').hide();
} else if ($(this).val() == "2") {
$('.customer-div').show();
$('.ticket-div').hide();
$('#customer').select2({
placeholder: "Kunden Suche",
minimumInputLength: 3,
@@ -1528,6 +1635,12 @@ $(document).ready(function () {
url: requestAddressUrl,
dataType: 'json',
delay: 250,
data: function (params) {
return {
term: params.term,
xinon: 1,
};
},
processResults: function (data) {
// Transforms the top-level key of the response object from 'items' to 'results'
return {
@@ -1536,6 +1649,84 @@ $(document).ready(function () {
}
}
});
} else if ($(this).val() == "3") {
$('.customer-div').show();
$('.ticket-div').hide();
$('#customer').select2({
placeholder: "Kunden Suche",
minimumInputLength: 3,
// dropdownParent: $('#EventModal'),
dropdownParent: jQuery('#relContainer2'),
language: "de",
ajax: {
url: requestAddressUrl,
dataType: 'json',
delay: 250,
data: function (params) {
return {
term: params.term,
xinon: 0,
};
},
processResults: function (data) {
// Transforms the top-level key of the response object from 'items' to 'results'
return {
results: data.items
};
}
}
});
} else if ($(this).val() == "4") {
$('.customer-div').show();
$('.ticket-div').hide();
$('#customer').select2({
placeholder: "Kunden Suche",
minimumInputLength: 3,
// dropdownParent: $('#EventModal'),
dropdownParent: jQuery('#relContainer2'),
language: "de",
ajax: {
url: requestAddressUrl,
dataType: 'json',
delay: 250,
data: function (params) {
return {
term: params.term,
xinon: 0,
};
},
processResults: function (data) {
// Transforms the top-level key of the response object from 'items' to 'results'
return {
results: data.items
};
}
}
});
}
else if ($(this).val() == "5") {
$('.customer-div').hide();
$('.ticket-div').show();
$('#ticket').select2({
placeholder: "Ticket",
minimumInputLength: 3,
dropdownParent: jQuery('#relContainer3'),
// dropdownParent: $('#EventModal'),
language: "de",
ajax: {
url: requestTicketUrl,
dataType: 'json',
delay: 250,
processResults: function (data) {
// Transforms the top-level key of the response object from 'items' to 'results'
return {
results: data.items
};
}
}
})
}
});
@@ -1608,7 +1799,6 @@ $(document).ready(function () {
text = text.replace(/\[&&end&&\]/g, endtime);
$('#customer-info-text').val(text);
});
@@ -1636,6 +1826,18 @@ $(document).ready(function () {
}
});
$('body').on('change', '#ticket', function () {
if ($('#name').val() == "") {
$('#name').val('Störung: ' + $("#ticket").select2('data')[0].name);
}
if ($('#location').val() == "") {
$('#location').val($("#ticket").select2('data')[0].location);
}
$('#description').val('<a href="https://project.xinon.at/projects/storungen-and-support/work_packages/' + $("#ticket").select2('data')[0].id + '/activity" target="_blank">Ticket Nr.: ' + $("#ticket").select2('data')[0].id + '</a>\n' + $("#ticket").select2('data')[0].subject);
});
$("body").on("click", "#customer-info-check", function () {
@@ -1906,7 +2108,9 @@ $(document).ready(function () {
function refreshCalendarEvents() {
calendar.removeAllEvents();
let checkbox = $(".calendar-check");
let calendarFilter = $('.btn-light-search');
let visibleCalendars = [];
let visibleCalendarTypes = [];
let mycalendar_id = $('#calendar-id').data('calendarid');
visibleCalendars.push(0);
checkbox.each(function () {
@@ -1914,9 +2118,17 @@ $(document).ready(function () {
visibleCalendars.push($(this).data('calendar_id'));
}
});
calendarFilter.each(function () {
if (!$(this).hasClass('top-search-filter')) {
visibleCalendarTypes.push($(this).data('ctype'));
}
});
$.post(requestUrl, {visibleCalendars: visibleCalendars}, function (data) {
$.post(requestUrl, {
visibleCalendars: visibleCalendars,
visibleCalendarTypes: visibleCalendarTypes
}, function (data) {
}, 'json').done(function (json) {
if (json.success == true) {
@@ -2131,6 +2343,4 @@ $(document).ready(function () {
});
}
})
;
});