diff --git a/Layout/default/Calendar/View.php b/Layout/default/Calendar/View.php index 459215a2c..8a5813aec 100644 --- a/Layout/default/Calendar/View.php +++ b/Layout/default/Calendar/View.php @@ -77,8 +77,27 @@ endforeach;
-
-

Kalender

+
+

Filter:

+
+ + + + +
-
@@ -96,13 +114,13 @@ endforeach;
-
-

Kalender +

Kalender
@@ -159,52 +177,11 @@ endforeach; user->name) ?: $specialCalendars[$calendar['calendar_id']] ?>

- $calendar): - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - user->name) ?: $specialCalendars[$calendar['calendar_id']] - ?> - - - +
@@ -393,7 +370,10 @@ endforeach; Typ
@@ -565,7 +545,8 @@ endforeach;
+
@@ -606,6 +588,19 @@ endforeach;
+
+
+ +
+ +
+
+
+ +
+
+
+
@@ -660,6 +655,7 @@ endforeach; let requestEventAttachmentTmpDeleteUrl = " 'deleteCalendarEventAttachmentTmp']) ?>"; let requestEventAttachmentUploadUrl = " 'uploadCalendarEventAttachment']) ?>"; let requestAddressUrl = " 'getAddress']) ?>"; + let requestTicketUrl = " 'getTicket']) ?>"; let requestInsertUrl = " 'insertCalendarEvent']) ?>"; let requestUpdateUrl = " 'updateCalendarEvent']) ?>"; let requestUpdateStateUrl = " 'updateCalendarEventState']) ?>"; diff --git a/application/Address/AddressModel.php b/application/Address/AddressModel.php index c349e74c8..4ab52d2e8 100644 --- a/application/Address/AddressModel.php +++ b/application/Address/AddressModel.php @@ -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; diff --git a/application/Calendar/CalendarController.php b/application/Calendar/CalendarController.php index 373b88a18..fae309a24 100644 --- a/application/Calendar/CalendarController.php +++ b/application/Calendar/CalendarController.php @@ -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() { diff --git a/application/Calendar/CalendarModel.php b/application/Calendar/CalendarModel.php index dd99a51fd..5ca1ca2ff 100644 --- a/application/Calendar/CalendarModel.php +++ b/application/Calendar/CalendarModel.php @@ -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']; diff --git a/application/CalendarTemplate/CalendarTemplateModel.php b/application/CalendarTemplate/CalendarTemplateModel.php index 664e85912..bf4a51278 100644 --- a/application/CalendarTemplate/CalendarTemplateModel.php +++ b/application/CalendarTemplate/CalendarTemplateModel.php @@ -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" diff --git a/public/css/pages/Calendar/View.css b/public/css/pages/Calendar/View.css index 86fdc2843..2ea230c06 100644 --- a/public/css/pages/Calendar/View.css +++ b/public/css/pages/Calendar/View.css @@ -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; } \ No newline at end of file diff --git a/public/img/estmk_logo.png b/public/img/estmk_logo.png new file mode 100644 index 000000000..fb3d64d24 Binary files /dev/null and b/public/img/estmk_logo.png differ diff --git a/public/img/snop-logo.png b/public/img/snop-logo.png new file mode 100644 index 000000000..f8a1ac196 Binary files /dev/null and b/public/img/snop-logo.png differ diff --git a/public/img/xinon-logo.png b/public/img/xinon-logo.png new file mode 100644 index 000000000..67669d6e4 Binary files /dev/null and b/public/img/xinon-logo.png differ diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index 8f9464f57..0180e7a0b 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -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(''); @@ -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(''); + } else { + $('#customer').html(''); + } + $('#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", "
"); + // info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + } + if (info.event.extendedProps['event_type'] == '3') { + + // info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + } + if (info.event.extendedProps['event_type'] == '4') { + + // info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + } + if (info.event.extendedProps['event_type'] == '5') { + + // info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); + info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); } if (info.event.extendedProps['privateflag'] == 1) { info.el.querySelector(".fc-event-title").insertAdjacentHTML("afterend", "
"); @@ -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 + '
'; 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 += '
  • ' + item.data.name + '
  • '; 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('Ticket Nr.: ' + $("#ticket").select2('data')[0].id + '\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 () { }); } - -}) -; +});