Kalender Updates
* Vorlagen können nun erstellt und editiert werden. * neue Migration für CalendarTemplates
This commit is contained in:
@@ -565,7 +565,7 @@ endforeach;
|
|||||||
</div>
|
</div>
|
||||||
<div class="d-inline-block ml-2">
|
<div class="d-inline-block ml-2">
|
||||||
<div class="dropdown">
|
<div class="dropdown">
|
||||||
<button style="padding: 1px 8px;" 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">
|
type="button" data-toggle="dropdown" aria-expanded="false">
|
||||||
Vorlagen
|
Vorlagen
|
||||||
</button>
|
</button>
|
||||||
@@ -671,6 +671,7 @@ endforeach;
|
|||||||
let requestUpdateColorUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarColor']) ?>";
|
let requestUpdateColorUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'updateCalendarColor']) ?>";
|
||||||
let requestDeleteUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'deleteCalendarEvent']) ?>";
|
let requestDeleteUrl = "<?= self::getUrl("Calendar", "api", ['do' => 'deleteCalendarEvent']) ?>";
|
||||||
let requestUpdateEventsUrl = "<?= self::getUrl("api/v1/calendar")?>/calendarStream?user=<?= $encryptedUser ?>";
|
let requestUpdateEventsUrl = "<?= self::getUrl("api/v1/calendar")?>/calendarStream?user=<?= $encryptedUser ?>";
|
||||||
|
let requestgetpreviewtUrl = "<?= self::getUrl("CalendarTemplate", "api", ['do' => 'getPreview']) ?>";
|
||||||
let calendarRights = '<?php echo json_encode($rights); ?>';
|
let calendarRights = '<?php echo json_encode($rights); ?>';
|
||||||
|
|
||||||
var holiDays = [];
|
var holiDays = [];
|
||||||
|
|||||||
@@ -0,0 +1,172 @@
|
|||||||
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||||
|
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||||
|
type="text/css"/>
|
||||||
|
<style>
|
||||||
|
.btn-sm {
|
||||||
|
padding: .1rem .5rem;
|
||||||
|
font-size: .9rem;
|
||||||
|
line-height: 1.5;
|
||||||
|
border-radius: .15rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<!-- start page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box">
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item"><a
|
||||||
|
href="<?= self::getUrl("CalendarTemplate") ?>">Vorlagen</a></li>
|
||||||
|
<li class="breadcrumb-item active"><?= ($calendartemplates->id) ? "bearbeiten" : "Neu" ?></li>
|
||||||
|
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<h4 class="page-title"><?= ($calendartemplates->id) ? "Vorlage bearbeiten" : "Neuer Vorlage" ?></h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
|
||||||
|
<div class="card bg-light">
|
||||||
|
<div class="card-body">
|
||||||
|
<h4 class="header-title mb-2"><?= ($calendartemplates->id) ? "Vorlage bearbeiten" : "Neuer Vorlage" ?></h4>
|
||||||
|
|
||||||
|
<form class="form-horizontal" method="post"
|
||||||
|
action="<?= self::getUrl("CalendarTemplate", "save") ?>">
|
||||||
|
<div class="card no-shadow">
|
||||||
|
<div class="card-body">
|
||||||
|
<input type="hidden" name="id" value="<?= $calendartemplates->id ?>"/>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="event_type">Termintyp</label>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<select class="select2 form-control " name="event_type" id="event_type">
|
||||||
|
<?php foreach (CalendarTemplateModel::$calendarTemplateEventTypes as $key => $value): ?>
|
||||||
|
<option value="<?= $key ?>" <?= ($calendartemplates->event_type == $key) ? 'selected="selected"' : '' ?>><?= $value ?></option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="name">Vorlagen Name</label>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<input type="text" id="name" name="name" class="form-control"
|
||||||
|
value="<?= $calendartemplates->name ?>"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2 col-form-label" for="is_reminder">Reminder</label>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="form-check mt-1">
|
||||||
|
<input class="form-check-input" <?= ($calendartemplates->is_reminder) ? 'checked="checked"' : '' ?> type="checkbox" name="is_reminder" id="is_reminder" value="1">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
|
||||||
|
<label class="col-lg-2 col-form-label" for="text">Vorlagen Text</label>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<div class="snippet-buttons mb-1">
|
||||||
|
<button class="btn btn-info btn-sm" type="button" data-snippet="[&&date&&]"
|
||||||
|
title="Datum des Termins">Datum
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-info btn-sm" type="button" data-snippet="[&&start&&]"
|
||||||
|
title="Start Uhrzeit des Termins">Start
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-info btn-sm" type="button" data-snippet="[&&end&&]"
|
||||||
|
title="End Uhrzeit des Termins">Ende
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-info btn-sm" type="button" data-snippet="[&&vmnm&&]"
|
||||||
|
title="Dynamisch Vormittag/Nachmittags je nach Termin begin">dyn.
|
||||||
|
VM/NM
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<textarea id="text" name="text" style="height: 200px;"
|
||||||
|
class="form-control"><?= $calendartemplates->text ?></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<h5 id="preview-info" data-date="<?= date('d.m.Y', strtotime('+1 day')) ?>"
|
||||||
|
data-start="08:00" data-end="10:00" data-dynvmnm="vormittags"
|
||||||
|
class="pt-0 mt-0">Vorschau für Beispieltermin: <span
|
||||||
|
class="font-14 font-weight-normal"><?= date('d.m.Y', strtotime('+1 day')) . " 08:00 - 10:00" ?></span>
|
||||||
|
</h5>
|
||||||
|
<div id="text-preview"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-lg-2"></label>
|
||||||
|
<div class="col-lg-10">
|
||||||
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
||||||
|
<a href="<?= self::getUrl("Calendar") ?>">
|
||||||
|
<button type="button" class="btn btn-secondary">Abbrechen</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(".select2").select2({placeholder: ""});
|
||||||
|
|
||||||
|
// disable mousewheel on a input number field when in focus
|
||||||
|
$('form').on('focus', 'input[type=number]', function (e) {
|
||||||
|
$(this).on('wheel.disableScroll', function (e) {
|
||||||
|
e.preventDefault()
|
||||||
|
})
|
||||||
|
});
|
||||||
|
$('form').on('blur', 'input[type=number]', function (e) {
|
||||||
|
$(this).off('wheel.disableScroll')
|
||||||
|
});
|
||||||
|
$(document).ready(function () {
|
||||||
|
function preview() {
|
||||||
|
let text = $("#text").val();
|
||||||
|
text = text.replace(/\[&&vmnm&&\]/g, $("#preview-info").data("dynvmnm"));
|
||||||
|
text = text.replace(/\[&&date&&\]/g, $("#preview-info").data("date"));
|
||||||
|
text = text.replace(/\[&&start&&\]/g, $("#preview-info").data("start"));
|
||||||
|
text = text.replace(/\[&&end&&\]/g, $("#preview-info").data("end"));
|
||||||
|
text = text.replace(/\n/g, "<br>");
|
||||||
|
$("#text-preview").html(text);
|
||||||
|
}
|
||||||
|
$("#text").on("keyup blur change focus", preview);
|
||||||
|
preview();
|
||||||
|
$('.snippet-buttons button').on('click', function () {
|
||||||
|
var snippet = $(this).data('snippet');
|
||||||
|
insertAtCursor('#text', snippet);
|
||||||
|
$('#text').focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
function insertAtCursor(textareaSelector, text) {
|
||||||
|
var textarea = $(textareaSelector)[0];
|
||||||
|
var start = textarea.selectionStart;
|
||||||
|
var end = textarea.selectionEnd;
|
||||||
|
var value = textarea.value;
|
||||||
|
|
||||||
|
// Text vor und nach der Cursorposition
|
||||||
|
var before = value.substring(0, start);
|
||||||
|
var after = value.substring(end, value.length);
|
||||||
|
|
||||||
|
// Neuen Wert setzen
|
||||||
|
textarea.value = before + text + after;
|
||||||
|
|
||||||
|
// Cursorposition setzen
|
||||||
|
var cursorPosition = start + text.length;
|
||||||
|
textarea.selectionStart = textarea.selectionEnd = cursorPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||||
|
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||||
|
type="text/css"/>
|
||||||
|
<!-- start page title -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="page-title-box">
|
||||||
|
<div class="page-title-right">
|
||||||
|
<ol class="breadcrumb m-0">
|
||||||
|
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
|
||||||
|
</li>
|
||||||
|
<li class="breadcrumb-item active">Vorlagen</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<h4 class="page-title">Vorlagen</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- end page title -->
|
||||||
|
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body mb-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="float-left">
|
||||||
|
<h4 class="header-title">Liste aller Vorlagen</h4>
|
||||||
|
</div>
|
||||||
|
<div class="float-right">
|
||||||
|
<a class="btn btn-primary mb-2" href="<?= self::getUrl("CalendarTemplate", "add") ?>"><i
|
||||||
|
class="fas fa-plus"></i> Neuen Vorlage anlegen</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<table id="datatable" class="table table-striped table-hover table-sm">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">Termintyp</th>
|
||||||
|
<th class="text-center">Vorlagen Name</th>
|
||||||
|
<th class="text-center">Reminder</th>
|
||||||
|
<th class="text-center">Vorlagen Text</th>
|
||||||
|
<th class="edit-width"></th>
|
||||||
|
</tr>
|
||||||
|
<tr id="filterrow">
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($calendartemplates as $calendartemplate): ?>
|
||||||
|
<tr>
|
||||||
|
<td class="text-center"><?= $calendarTemplateEventTypes[$calendartemplate->event_type] ?></td>
|
||||||
|
<td><?= $calendartemplate->name ?></td>
|
||||||
|
<td style="text-align: center" class="text-center"><?= ($calendartemplate->is_reminder) ? 'Ja' : 'Nein' ?></td>
|
||||||
|
<td><?= $calendartemplate->text ?></td>
|
||||||
|
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||||
|
<a href="<?= self::getUrl("CalendarTemplate", "edit", ["id" => $calendartemplate->id]) ?>"><i
|
||||||
|
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||||
|
<a href="<?= self::getUrl("CalendarTemplate", "delete", ["id" => $calendartemplate->id]) ?>"
|
||||||
|
onclick="if(!confirm('Vorlage wirklich löschen?')) return false;" class="text-danger"
|
||||||
|
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var hidesearch = [4];
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript"
|
||||||
|
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||||
|
|
||||||
|
|
||||||
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||||
@@ -326,11 +326,13 @@ class CalendarController extends mfBaseController
|
|||||||
|
|
||||||
protected function indexAction()
|
protected function indexAction()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->layout()->setTemplate("Calendar/Index");
|
$this->layout()->setTemplate("Calendar/Index");
|
||||||
$calendars = CalendarModel::getAll();
|
$calendars = CalendarModel::getAll();
|
||||||
|
$calendarTemplateEventTypes = CalendarTemplateModel::$calendarTemplateEventTypes;
|
||||||
|
$this->layout()->set("calendarTemplateEventTypes", $calendarTemplateEventTypes);
|
||||||
|
$calendartemplates = CalendarTemplateModel::getAll();
|
||||||
|
$this->layout()->set("calendartemplates", $calendartemplates);
|
||||||
$this->layout()->set("calendars", $calendars);
|
$this->layout()->set("calendars", $calendars);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function addAction()
|
protected function addAction()
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class CalendarTemplate extends mfBaseModel
|
||||||
|
{
|
||||||
|
private $editor;
|
||||||
|
private $creator;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function getProperty($name)
|
||||||
|
{
|
||||||
|
if ($this->$name == null) {
|
||||||
|
|
||||||
|
if (!$this->id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name == "creator") {
|
||||||
|
$this->creator = mfValuecache::singleton()->get("Worker-id-" . $this->create_by);
|
||||||
|
if ($this->creator === null) {
|
||||||
|
$this->creator = new User($this->create_by);
|
||||||
|
if ($this->creator->id) {
|
||||||
|
mfValuecache::singleton()->set("Worker-id-" . $this->create_by, $this->creator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->creator;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($name == "editor") {
|
||||||
|
$this->editor = mfValuecache::singleton()->get("Worker-id-" . $this->edit_by);
|
||||||
|
if ($this->editor === null) {
|
||||||
|
$this->editor = new User($this->edit_by);
|
||||||
|
if ($this->editor->id) {
|
||||||
|
mfValuecache::singleton()->set("Worker-id-" . $this->edit_by, $this->editor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
$classname = ucfirst($name);
|
||||||
|
$idfield = $name . "_id";
|
||||||
|
$this->$name = mfValuecache::singleton()->get("mfObjectmodel-$name-" . $this->$idfield);
|
||||||
|
if (!$this->$name) {
|
||||||
|
$this->$name = new $classname($this->$idfield);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->$name->id) {
|
||||||
|
mfValuecache::singleton()->set("mfObjectmodel-$name-" . $this->$name->id, $this->$name);
|
||||||
|
return $this->$name;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->$name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class CalendarTemplateController extends mfBaseController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected function init()
|
||||||
|
{
|
||||||
|
$this->needlogin = true;
|
||||||
|
$me = new User();
|
||||||
|
$me->loadMe();
|
||||||
|
$this->me = $me;
|
||||||
|
$this->layout()->set("me", $me);
|
||||||
|
|
||||||
|
if (!$me->is(["Admin"])) {
|
||||||
|
$this->redirect("Dashboard");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
protected function apiAction()
|
||||||
|
{
|
||||||
|
$r = $this->request;
|
||||||
|
$do=$r->do;
|
||||||
|
switch ($do) {
|
||||||
|
case "getPreview":
|
||||||
|
$event_type = $r->event_type;
|
||||||
|
$calendartemplates = CalendarTemplateModel::search(array("event_type"=>$event_type));
|
||||||
|
$result['status'] = "success";
|
||||||
|
$result['data'] = $calendartemplates;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$result['status'] = "error";
|
||||||
|
$result['message'] = "Aktion nicht gefunden";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
echo json_encode($result);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function indexAction()
|
||||||
|
{
|
||||||
|
$this->layout()->setTemplate("CalendarTemplate/Index");
|
||||||
|
$calendartemplates = CalendarTemplateModel::getAll();
|
||||||
|
$calendarTemplateEventTypes=CalendarTemplateModel::$calendarTemplateEventTypes;
|
||||||
|
$this->layout()->set("calendarTemplateEventTypes", $calendarTemplateEventTypes);
|
||||||
|
$this->layout()->set("calendartemplates", $calendartemplates);
|
||||||
|
}
|
||||||
|
protected function addAction()
|
||||||
|
{
|
||||||
|
$this->layout()->setTemplate("CalendarTemplate/Form");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function editAction()
|
||||||
|
{
|
||||||
|
$id = $this->request->id;
|
||||||
|
|
||||||
|
if (!is_numeric($id) || !$id) {
|
||||||
|
$this->layout()->setFlash("Vorlage nicht gefunden", "error");
|
||||||
|
$this->redirect("CalendarTemplate");
|
||||||
|
}
|
||||||
|
|
||||||
|
$calendartemplates = new CalendarTemplate($id);
|
||||||
|
if ($calendartemplates->id != $id) {
|
||||||
|
$this->layout()->setFlash("Vorlage nicht gefunden", "error");
|
||||||
|
$this->redirect("CalendarTemplate");
|
||||||
|
}
|
||||||
|
$calendarTemplateEventTypes=CalendarTemplateModel::$calendarTemplateEventTypes;
|
||||||
|
$this->layout()->set("calendarTemplateEventTypes", $calendarTemplateEventTypes);
|
||||||
|
$this->layout()->set("calendartemplates", $calendartemplates);
|
||||||
|
return $this->addAction();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function saveAction()
|
||||||
|
{
|
||||||
|
$r = $this->request;
|
||||||
|
$id = $r->id;
|
||||||
|
//var_dump($r->get());exit;
|
||||||
|
if (is_numeric($id) && $id > 0) {
|
||||||
|
$mode = "edit";
|
||||||
|
$calendartemplates = new CalendarTemplate($id);
|
||||||
|
if (!$calendartemplates->id) {
|
||||||
|
$this->layout()->setFlash("Vorlagen nicht gefunden", "error");
|
||||||
|
$this->redirect("Calendar");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$mode = "add";
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
$data['event_type'] = trim($r->event_type);
|
||||||
|
$data['name'] = trim($r->name);
|
||||||
|
$data['is_reminder'] = trim($r->is_reminder);
|
||||||
|
$data['text'] = trim($r->text);
|
||||||
|
|
||||||
|
|
||||||
|
if (!$data['event_type']) {
|
||||||
|
$data['event_type']=NULL;
|
||||||
|
}
|
||||||
|
if (!$data['name']) {
|
||||||
|
$data['name']=NULL;
|
||||||
|
}
|
||||||
|
if (!$data['is_reminder']) {
|
||||||
|
$data['is_reminder']=0;
|
||||||
|
}
|
||||||
|
if (!$data['text']) {
|
||||||
|
$data['text']=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// var_dump($_FILES);
|
||||||
|
// var_dump($upload);
|
||||||
|
// exit;
|
||||||
|
|
||||||
|
|
||||||
|
if ($mode == "edit") {
|
||||||
|
$calendartemplates->update($data);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$calendartemplates = CalendarTemplateModel::create($data);
|
||||||
|
}
|
||||||
|
// var_dump($filestore);
|
||||||
|
// exit;
|
||||||
|
$id = $calendartemplates->save();
|
||||||
|
|
||||||
|
if (!$id) {
|
||||||
|
$this->layout()->setFlash("Vorlage konnte nicht angelegt werden", "error");
|
||||||
|
$this->redirect("CalendarTemplate");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode == "edit") {
|
||||||
|
$this->layout()->setFlash("Vorlage erfolgreich geändert", "success");
|
||||||
|
} else if ($mode = "add") {
|
||||||
|
$this->layout()->setFlash("Vorlage erfolgreich angelegt", "success");
|
||||||
|
}
|
||||||
|
$this->redirect("Calendar");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function deleteAction()
|
||||||
|
{
|
||||||
|
$id = $this->request->id;
|
||||||
|
$calendartemplates = new CalendarTemplate($id);
|
||||||
|
if (!$calendartemplates->id || $calendartemplates->id != $id) {
|
||||||
|
$this->layout()->setFlash("Vorlage nicht gefunden.", "error");
|
||||||
|
$this->redirect("CalendarTemplate");
|
||||||
|
}
|
||||||
|
|
||||||
|
$calendartemplates->delete();
|
||||||
|
$this->redirect("Calendar");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class CalendarTemplateModel
|
||||||
|
{
|
||||||
|
private $event_type;
|
||||||
|
private $name;
|
||||||
|
private $is_reminder;
|
||||||
|
private $text;
|
||||||
|
|
||||||
|
public static $calendarTemplateEventTypes=array(
|
||||||
|
"1"=>"Termin",
|
||||||
|
"2"=>"IBN",
|
||||||
|
"3"=>"IBN E-Stmk",
|
||||||
|
"4"=>"IBN Snopp",
|
||||||
|
"5"=>"Störungen"
|
||||||
|
);
|
||||||
|
public static function find($data)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function create(array $data)
|
||||||
|
{
|
||||||
|
$model = new CalendarTemplate();
|
||||||
|
|
||||||
|
foreach ($data as $field => $value) {
|
||||||
|
if (property_exists(get_called_class(), $field)) {
|
||||||
|
if (substr($field, 0, 5) == "vlan_" && !$value) {
|
||||||
|
$model->$field = null;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$model->$field = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$me = mfValuecache::singleton()->get("me");
|
||||||
|
if (!$me) {
|
||||||
|
$me = new User();
|
||||||
|
$me->loadMe();
|
||||||
|
mfValuecache::singleton()->set("me", $me);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($model->create_by === null) {
|
||||||
|
$model->create_by = $me->id;
|
||||||
|
}
|
||||||
|
if ($model->edit_by === null) {
|
||||||
|
$model->edit_by = $me->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getOne($id)
|
||||||
|
{
|
||||||
|
if (!is_numeric($id) || !$id) {
|
||||||
|
throw new Exception("Invalid number", 400);
|
||||||
|
}
|
||||||
|
$item = [];
|
||||||
|
$db = FronkDB::singleton();
|
||||||
|
|
||||||
|
$res = $db->select("CalendarTemplate", "*", "id=$id LIMIT 1");
|
||||||
|
if ($db->num_rows($res)) {
|
||||||
|
$data = $db->fetch_object($res);
|
||||||
|
$item = new CalendarTemplate($data);
|
||||||
|
}
|
||||||
|
return $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getAll()
|
||||||
|
{
|
||||||
|
$items = [];
|
||||||
|
|
||||||
|
$db = FronkDB::singleton();
|
||||||
|
|
||||||
|
$res = $db->select("CalendarTemplate", "*", "1=1");
|
||||||
|
if ($db->num_rows($res)) {
|
||||||
|
while ($data = $db->fetch_object($res)) {
|
||||||
|
$items[] = new CalendarTemplate($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $items;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getFirst()
|
||||||
|
{
|
||||||
|
$db = FronkDB::singleton();
|
||||||
|
|
||||||
|
$where = self::getSqlFilter($filter);
|
||||||
|
$res = $db->select("CalendarTemplate", "*", "$where ");
|
||||||
|
if ($db->num_rows($res)) {
|
||||||
|
$data = $db->fetch_object($res);
|
||||||
|
$item = new CalendarTemplate($data);
|
||||||
|
if ($item->id) {
|
||||||
|
return $item;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function search($filter)
|
||||||
|
{
|
||||||
|
$items = [];
|
||||||
|
$db = FronkDB::singleton();
|
||||||
|
|
||||||
|
$where = self::getSqlFilter($filter);
|
||||||
|
$res = $db->select("CalendarTemplate", "*", "$where");
|
||||||
|
if ($db->num_rows($res)) {
|
||||||
|
while ($data = $db->fetch_object($res)) {
|
||||||
|
$items[] = new CalendarTemplate($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getSqlFilter($filter)
|
||||||
|
{
|
||||||
|
$where = "1=1 ";
|
||||||
|
|
||||||
|
//var_dump($filter);exit;
|
||||||
|
if (array_key_exists("event_type", $filter)) {
|
||||||
|
$event_type = $filter['event_type'];
|
||||||
|
if (is_numeric($event_type)) {
|
||||||
|
$where .= " AND event_type=$event_type";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//var_dump($filter, $where);exit;
|
||||||
|
return $where;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
final class CalendarTemplate extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
if ($this->getEnvironment() == "thetool") {
|
||||||
|
$table = $this->table("CalendarTemplate", ["signed" => true]);
|
||||||
|
|
||||||
|
$table->addColumn("event_type", "integer", ["null" => false, "default" => "0"]);
|
||||||
|
$table->addColumn("name", "text", ["null" => false]);
|
||||||
|
$table->addColumn("is_reminder", "integer", ["null" => false, "default" => "0"]);
|
||||||
|
$table->addColumn("text", "text", ["null" => true]);
|
||||||
|
$table->addColumn("create_by", "integer", ["null" => false]);
|
||||||
|
$table->addColumn("edit_by", "integer", ["null" => false]);
|
||||||
|
$table->addColumn("create", "integer", ["null" => false]);
|
||||||
|
$table->addColumn("edit", "integer", ["null" => false]);
|
||||||
|
$table->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->getEnvironment() == "addressdb") {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
if ($this->getEnvironment() == "thetool") {
|
||||||
|
$this->table("CalendarTemplate")->drop()->save();
|
||||||
|
}
|
||||||
|
if ($this->getEnvironment() == "addressdb") {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
+144
-131
@@ -2,6 +2,7 @@ var hidesearch = [2, 3, 4, 8];
|
|||||||
var columnfilter = [7];
|
var columnfilter = [7];
|
||||||
var columnoptions = '<option value=""></option><option value="Offen">Offen</option><option value="Genehmigt">Genehmigt</option><option value="Abgelehnt">Abgelehnt</option>';
|
var columnoptions = '<option value=""></option><option value="Offen">Offen</option><option value="Genehmigt">Genehmigt</option><option value="Abgelehnt">Abgelehnt</option>';
|
||||||
|
|
||||||
|
|
||||||
const fileTypeClasses = {
|
const fileTypeClasses = {
|
||||||
'image/png': 'fa-file-png',
|
'image/png': 'fa-file-png',
|
||||||
'image/jpeg': 'fa-file-jpg',
|
'image/jpeg': 'fa-file-jpg',
|
||||||
@@ -28,8 +29,8 @@ const fileTypeClasses = {
|
|||||||
|
|
||||||
// Weitere Typen und Klassen hinzufügen...
|
// Weitere Typen und Klassen hinzufügen...
|
||||||
};
|
};
|
||||||
var calendar;
|
let calendar;
|
||||||
var calendarEl = document.getElementById('calendar');
|
let calendarEl = document.getElementById('calendar');
|
||||||
calendarRights = JSON.parse(calendarRights);
|
calendarRights = JSON.parse(calendarRights);
|
||||||
|
|
||||||
function formatFileSize(bytes) {
|
function formatFileSize(bytes) {
|
||||||
@@ -76,16 +77,16 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
}, 'json').done(function (json) {
|
}, 'json').done(function (json) {
|
||||||
if (json.success == true) {
|
if (json.success == true) {
|
||||||
var userevents = [];
|
let userevents = [];
|
||||||
var otherevents = [];
|
let otherevents = [];
|
||||||
var resources = [];
|
let resources = [];
|
||||||
var category = "";
|
let category = "";
|
||||||
var rights = false;
|
let rights = false;
|
||||||
var movable = false;
|
let movable = false;
|
||||||
var resourceCounter = 0;
|
let resourceCounter = 0;
|
||||||
var rrule = null;
|
let rrule = null;
|
||||||
var duration = null;
|
let duration = null;
|
||||||
var rruleflag = false;
|
let rruleflag = false;
|
||||||
let allDAy;
|
let allDAy;
|
||||||
let cursorclass = "";
|
let cursorclass = "";
|
||||||
$.each($('.calendar-check'), function (index, value) {
|
$.each($('.calendar-check'), function (index, value) {
|
||||||
@@ -445,21 +446,20 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
minute: '2-digit',
|
minute: '2-digit',
|
||||||
second: '2-digit',
|
second: '2-digit',
|
||||||
});
|
});
|
||||||
var typeText;
|
let typeText;
|
||||||
if (obj.customer_info_type == 1) {
|
if (obj.customer_info_type == 1) {
|
||||||
typeText = 'E-Mail';
|
typeText = 'E-Mail';
|
||||||
} else if (obj.customer_info_type == 2) {
|
} else if (obj.customer_info_type == 2) {
|
||||||
typeText = 'SMS';
|
typeText = 'SMS';
|
||||||
}
|
}
|
||||||
var title = `<div class="text-center font-weight-500">Letzte gesendete Info (` + typeText + `):</div>
|
let title = `<div class="text-center font-weight-500">Letzte gesendete Info (` + typeText + `):</div>
|
||||||
<div class="text-left">` + obj.customer_info_text.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2') + `</div>
|
<div class="text-left">` + obj.customer_info_text.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1<br />$2') + `</div>
|
||||||
<div class="text-left"><span class="font-weight-500">gesendet an:</span> ` + obj.customer_info_type_text + `</div>
|
<div class="text-left"><span class="font-weight-500">gesendet an:</span> ` + obj.customer_info_type_text + `</div>
|
||||||
<div class="text-left"><span class="font-weight-500">gesendet von:</span> ` + obj.sendby + `</div>
|
<div class="text-left"><span class="font-weight-500">gesendet von:</span> ` + obj.sendby + `</div>
|
||||||
<div class="text-left"><span class="font-weight-500">gesendet am:</span> ` + germanDateTime + `</div>
|
<div class="text-left"><span class="font-weight-500">gesendet am:</span> ` + germanDateTime + `</div>
|
||||||
|
|
||||||
`;
|
`;
|
||||||
console.log(title);
|
let tooltip = new Tooltip($('.customer-info-point'), {
|
||||||
var tooltip = new Tooltip($('.customer-info-point'), {
|
|
||||||
title: title,
|
title: title,
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
@@ -505,7 +505,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
let attendees = JSON.parse(data.data.attendees.attendees);
|
let attendees = JSON.parse(data.data.attendees.attendees);
|
||||||
$.each(attendees, function (index, value) {
|
$.each(attendees, function (index, value) {
|
||||||
if (!Number.isInteger(value)) {
|
if (!Number.isInteger(value)) {
|
||||||
var valueExists = $("#calendar-attendees option").filter(function () {
|
let valueExists = $("#calendar-attendees option").filter(function () {
|
||||||
return $(this).val() === value;
|
return $(this).val() === value;
|
||||||
}).length > 0;
|
}).length > 0;
|
||||||
if (!valueExists) {
|
if (!valueExists) {
|
||||||
@@ -599,10 +599,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
eventDidMount: function (info) {
|
eventDidMount: function (info) {
|
||||||
var eventstart = new Date(info.event.startStr);
|
let eventstart = new Date(info.event.startStr);
|
||||||
var eventend = new Date(info.event.endStr);
|
let eventend = new Date(info.event.endStr);
|
||||||
|
|
||||||
var title;
|
let title;
|
||||||
if (!info.event.allDay) {
|
if (!info.event.allDay) {
|
||||||
eventstart = String(eventstart.getUTCHours()).padStart(2, '0') + ':' + String(eventstart.getUTCMinutes()).padStart(2, '0');
|
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');
|
eventend = String(eventend.getUTCHours()).padStart(2, '0') + ':' + String(eventend.getUTCMinutes()).padStart(2, '0');
|
||||||
@@ -628,7 +628,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
const obj = JSON.parse(info.event.extendedProps['attachments']);
|
const obj = JSON.parse(info.event.extendedProps['attachments']);
|
||||||
let docs = "";
|
let docs = "";
|
||||||
$.each(obj, function (index, value) {
|
$.each(obj, function (index, value) {
|
||||||
var filename;
|
let filename;
|
||||||
if (fileTypeClasses[value.contentType]) {
|
if (fileTypeClasses[value.contentType]) {
|
||||||
filename = fileTypeClasses[value.contentType];
|
filename = fileTypeClasses[value.contentType];
|
||||||
} else {
|
} else {
|
||||||
@@ -666,7 +666,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tooltip = new Tooltip(info.el, {
|
let tooltip = new Tooltip(info.el, {
|
||||||
title: title,
|
title: title,
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
delay: {hide: 50},
|
delay: {hide: 50},
|
||||||
@@ -675,25 +675,25 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
html: true,
|
html: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
var tooltips = info.event.extendedProps['tooltips'] || [];
|
let tooltips = info.event.extendedProps['tooltips'] || [];
|
||||||
tooltips.push(tooltip);
|
tooltips.push(tooltip);
|
||||||
info.event.setExtendedProp('tooltips', tooltips);
|
info.event.setExtendedProp('tooltips', tooltips);
|
||||||
},
|
},
|
||||||
|
|
||||||
eventWillUnmount: function (info) {
|
eventWillUnmount: function (info) {
|
||||||
for (var tooltip of info.event.extendedProps['tooltips']) {
|
for (let tooltip of info.event.extendedProps['tooltips']) {
|
||||||
tooltip.dispose();
|
tooltip.dispose();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
eventResize: function (info) {
|
eventResize: function (info) {
|
||||||
|
|
||||||
var start = info.event.start.getTime();
|
let start = info.event.start.getTime();
|
||||||
const offsetstart = getOffset(start);
|
const offsetstart = getOffset(start);
|
||||||
start = (start / 1000 + offsetstart) * 1000;
|
start = (start / 1000 + offsetstart) * 1000;
|
||||||
var end = info.event.end.getTime();
|
let end = info.event.end.getTime();
|
||||||
const offsetend = getOffset(end);
|
const offsetend = getOffset(end);
|
||||||
end = (end / 1000 + offsetend) * 1000;
|
end = (end / 1000 + offsetend) * 1000;
|
||||||
var id = info.event.id;
|
let id = info.event.id;
|
||||||
$.post(requestUpdateUrl, {
|
$.post(requestUpdateUrl, {
|
||||||
start: start,
|
start: start,
|
||||||
end: end,
|
end: end,
|
||||||
@@ -701,14 +701,14 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}, function (data) {
|
}, function (data) {
|
||||||
|
|
||||||
}).done(function (data) {
|
}).done(function (data) {
|
||||||
var tooltip = new Tooltip(info.el, {
|
let tooltip = new Tooltip(info.el, {
|
||||||
title: info.event.extendedProps.description,
|
title: info.event.extendedProps.description,
|
||||||
placement: 'right',
|
placement: 'right',
|
||||||
trigger: 'hover',
|
trigger: 'hover',
|
||||||
container: 'body'
|
container: 'body'
|
||||||
});
|
});
|
||||||
|
|
||||||
var tooltips = info.event.extendedProps['tooltips'] || [];
|
let tooltips = info.event.extendedProps['tooltips'] || [];
|
||||||
tooltips.push(tooltip);
|
tooltips.push(tooltip);
|
||||||
info.event.setExtendedProp('tooltips', tooltips);
|
info.event.setExtendedProp('tooltips', tooltips);
|
||||||
});
|
});
|
||||||
@@ -716,13 +716,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
},
|
},
|
||||||
eventDrop: function (info) {
|
eventDrop: function (info) {
|
||||||
// sleep(2000).then(() => {
|
// sleep(2000).then(() => {
|
||||||
var start = info.event.start.getTime();
|
let start = info.event.start.getTime();
|
||||||
const offsetstart = getOffset(start);
|
const offsetstart = getOffset(start);
|
||||||
start = (start / 1000 + offsetstart) * 1000;
|
start = (start / 1000 + offsetstart) * 1000;
|
||||||
var end = info.event.end.getTime();
|
let end = info.event.end.getTime();
|
||||||
const offsetend = getOffset(end);
|
const offsetend = getOffset(end);
|
||||||
end = (end / 1000 + offsetend) * 1000;
|
end = (end / 1000 + offsetend) * 1000;
|
||||||
var id = info.event.id;
|
let id = info.event.id;
|
||||||
$.post(requestUpdateUrl, {
|
$.post(requestUpdateUrl, {
|
||||||
start: start,
|
start: start,
|
||||||
end: end,
|
end: end,
|
||||||
@@ -797,7 +797,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
if (typeof (EventSource) !== 'undefined') {
|
if (typeof (EventSource) !== 'undefined') {
|
||||||
console.info('Starting connection...');
|
console.info('Starting connection...');
|
||||||
|
|
||||||
var source = new EventSourcePolyfill(requestUpdateEventsUrl, {
|
let source = new EventSourcePolyfill(requestUpdateEventsUrl, {
|
||||||
// Specifying custom request headers
|
// Specifying custom request headers
|
||||||
headers: {
|
headers: {
|
||||||
'X-API-KEY': 'wcdqEHXcXl5f1sZTEHKPTutqpFBbRf55'
|
'X-API-KEY': 'wcdqEHXcXl5f1sZTEHKPTutqpFBbRf55'
|
||||||
@@ -809,7 +809,7 @@ if (typeof (EventSource) !== 'undefined') {
|
|||||||
}, false);
|
}, false);
|
||||||
let jsondata;
|
let jsondata;
|
||||||
source.addEventListener('error', function (e) {
|
source.addEventListener('error', function (e) {
|
||||||
var txt;
|
let txt;
|
||||||
switch (Event.target.readyState) {
|
switch (Event.target.readyState) {
|
||||||
// if reconnecting
|
// if reconnecting
|
||||||
case EventSource.CONNECTING:
|
case EventSource.CONNECTING:
|
||||||
@@ -839,12 +839,12 @@ if (typeof (EventSource) !== 'undefined') {
|
|||||||
if (!visibleCalendars.includes(event.calendar_id)) {
|
if (!visibleCalendars.includes(event.calendar_id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var cevent = calendar.getEventById(event.cal_events_id);
|
let cevent = calendar.getEventById(event.cal_events_id);
|
||||||
var rights = false;
|
let rights = false;
|
||||||
var movable = false;
|
let movable = false;
|
||||||
var rrule = null;
|
let rrule = null;
|
||||||
var duration = null;
|
let duration = null;
|
||||||
var rruleflag = false;
|
let rruleflag = false;
|
||||||
let cursorclass = '';
|
let cursorclass = '';
|
||||||
if (event.rrule) {
|
if (event.rrule) {
|
||||||
rrule = event.rrule;
|
rrule = event.rrule;
|
||||||
@@ -937,7 +937,7 @@ if (typeof (EventSource) !== 'undefined') {
|
|||||||
|
|
||||||
} else if (event.change_type == '1' || !cevent) {
|
} else if (event.change_type == '1' || !cevent) {
|
||||||
if (event.calendar_id == event.calendar_id) {
|
if (event.calendar_id == event.calendar_id) {
|
||||||
var info = calendar.addEvent({
|
let info = calendar.addEvent({
|
||||||
id: event.cal_events_id,
|
id: event.cal_events_id,
|
||||||
title: event.name,
|
title: event.name,
|
||||||
start: event.start_time,
|
start: event.start_time,
|
||||||
@@ -964,7 +964,7 @@ if (typeof (EventSource) !== 'undefined') {
|
|||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var info = calendar.addEvent({
|
let info = calendar.addEvent({
|
||||||
id: event.cal_events_id,
|
id: event.cal_events_id,
|
||||||
title: event.name,
|
title: event.name,
|
||||||
start: event.start_time,
|
start: event.start_time,
|
||||||
@@ -992,7 +992,7 @@ if (typeof (EventSource) !== 'undefined') {
|
|||||||
}
|
}
|
||||||
calendar.render();
|
calendar.render();
|
||||||
} else if (event.change_type == '3') {
|
} else if (event.change_type == '3') {
|
||||||
var cevent = calendar.getEventById(event.cal_events_id);
|
let cevent = calendar.getEventById(event.cal_events_id);
|
||||||
cevent.remove();
|
cevent.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1010,6 +1010,24 @@ $(document).ready(function () {
|
|||||||
calendar.render();
|
calendar.render();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(document).on('show.bs.dropdown', '.dropdown', function () {
|
||||||
|
let previewMenue='';
|
||||||
|
$.getJSON(requestgetpreviewtUrl, {
|
||||||
|
event_type: $('#type').val()
|
||||||
|
}, function (data) {
|
||||||
|
|
||||||
|
}).done(function (data) {
|
||||||
|
;
|
||||||
|
|
||||||
|
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++;
|
||||||
|
});
|
||||||
|
$('.dropdown-menu').html(previewMenue);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('body').on('click', '.fa-window-restore', function () {
|
$('body').on('click', '.fa-window-restore', function () {
|
||||||
$('.card').removeClass('card-fullscreen');
|
$('.card').removeClass('card-fullscreen');
|
||||||
$('#card-size').removeClass('fa-window-restore').addClass('fa-window-maximize');
|
$('#card-size').removeClass('fa-window-restore').addClass('fa-window-maximize');
|
||||||
@@ -1084,7 +1102,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click', '#add-event', function () {
|
$('body').on('click', '#add-event', function () {
|
||||||
var valid = true;
|
let valid = true;
|
||||||
|
|
||||||
$('#EventModal .is-require').each(function (index, value) {
|
$('#EventModal .is-require').each(function (index, value) {
|
||||||
if ($(this).val() == "") {
|
if ($(this).val() == "") {
|
||||||
@@ -1098,35 +1116,35 @@ $(document).ready(function () {
|
|||||||
if (!valid) {
|
if (!valid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var attachments = [];
|
let attachments = [];
|
||||||
$('.doc-main-div').each(function (index, value) {
|
$('.doc-main-div').each(function (index, value) {
|
||||||
if ($(this).data('docid')) {
|
if ($(this).data('docid')) {
|
||||||
attachments.push($(this).data('docid'));
|
attachments.push($(this).data('docid'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var start = $('#start-date').val() + ' ' + $('#start-time').val();
|
let start = $('#start-date').val() + ' ' + $('#start-time').val();
|
||||||
var end = $('#end-date').val() + ' ' + $('#end-time').val();
|
let end = $('#end-date').val() + ' ' + $('#end-time').val();
|
||||||
var title = $('#name').val();
|
let title = $('#name').val();
|
||||||
var location = $('#location').val();
|
let location = $('#location').val();
|
||||||
var description = $('#description').val();
|
let description = $('#description').val();
|
||||||
var newkey = $('#attachments').data('newkey');
|
let newkey = $('#attachments').data('newkey');
|
||||||
var allday = 0;
|
let allday = 0;
|
||||||
var reminder = $('#reminder').val();
|
let reminder = $('#reminder').val();
|
||||||
var type = $('#type').val();
|
let type = $('#type').val();
|
||||||
var busy = $('#busy').val();
|
let busy = $('#busy').val();
|
||||||
var customer;
|
let customer;
|
||||||
var customer_info_check = 0;
|
let customer_info_check = 0;
|
||||||
var customer_info_text;
|
let customer_info_text;
|
||||||
var customer_info_type;
|
let customer_info_type;
|
||||||
var customer_info_type_text;
|
let customer_info_type_text;
|
||||||
var customer_info_reminder_check = 0;
|
let customer_info_reminder_check = 0;
|
||||||
var private = $('.privacy-click');
|
let private = $('.privacy-click');
|
||||||
var privateflag = 0;
|
let privateflag = 0;
|
||||||
if (private.hasClass('fa-lock')) {
|
if (private.hasClass('fa-lock')) {
|
||||||
privateflag = 1;
|
privateflag = 1;
|
||||||
}
|
}
|
||||||
var users = [];
|
let users = [];
|
||||||
|
|
||||||
if ($('#allday').is(':checked')) {
|
if ($('#allday').is(':checked')) {
|
||||||
allday = 1;
|
allday = 1;
|
||||||
@@ -1178,7 +1196,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
$('body').on('click', '#update-event', function () {
|
$('body').on('click', '#update-event', function () {
|
||||||
|
|
||||||
var valid = true;
|
let valid = true;
|
||||||
|
|
||||||
$('#EventModal .is-require').each(function (index, value) {
|
$('#EventModal .is-require').each(function (index, value) {
|
||||||
if ($(this).val() == "") {
|
if ($(this).val() == "") {
|
||||||
@@ -1192,35 +1210,35 @@ $(document).ready(function () {
|
|||||||
if (!valid) {
|
if (!valid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var attachments = [];
|
let attachments = [];
|
||||||
$('.doc-main-div').each(function (index, value) {
|
$('.doc-main-div').each(function (index, value) {
|
||||||
if ($(this).data('docid')) {
|
if ($(this).data('docid')) {
|
||||||
attachments.push($(this).data('docid'));
|
attachments.push($(this).data('docid'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var start = $('#start-date').val() + ' ' + $('#start-time').val();
|
let start = $('#start-date').val() + ' ' + $('#start-time').val();
|
||||||
var end = $('#end-date').val() + ' ' + $('#end-time').val();
|
let end = $('#end-date').val() + ' ' + $('#end-time').val();
|
||||||
var title = $('#name').val();
|
let title = $('#name').val();
|
||||||
var location = $('#location').val();
|
let location = $('#location').val();
|
||||||
var description = $('#description').val();
|
let description = $('#description').val();
|
||||||
var newkey = $('#attachments').data('newkey');
|
let newkey = $('#attachments').data('newkey');
|
||||||
var allday = 0;
|
let allday = 0;
|
||||||
var reminder = $('#reminder').val();
|
let reminder = $('#reminder').val();
|
||||||
var type = $('#type').val();
|
let type = $('#type').val();
|
||||||
var busy = $('#busy').val();
|
let busy = $('#busy').val();
|
||||||
var customer;
|
let customer;
|
||||||
var customer_info_check = 0;
|
let customer_info_check = 0;
|
||||||
var customer_info_text;
|
let customer_info_text;
|
||||||
var customer_info_type;
|
let customer_info_type;
|
||||||
var customer_info_type_text;
|
let customer_info_type_text;
|
||||||
var customer_info_reminder_check = 0;
|
let customer_info_reminder_check = 0;
|
||||||
var private = $('.privacy-click');
|
let private = $('.privacy-click');
|
||||||
var privateflag = 0;
|
let privateflag = 0;
|
||||||
if (private.hasClass('fa-lock')) {
|
if (private.hasClass('fa-lock')) {
|
||||||
privateflag = 1;
|
privateflag = 1;
|
||||||
}
|
}
|
||||||
var users = [];
|
let users = [];
|
||||||
|
|
||||||
if ($('#allday').is(':checked')) {
|
if ($('#allday').is(':checked')) {
|
||||||
allday = 1;
|
allday = 1;
|
||||||
@@ -1240,7 +1258,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
var id = $(this).data('id');
|
let id = $(this).data('id');
|
||||||
|
|
||||||
$('#calendar-users > option:selected').each(function () {
|
$('#calendar-users > option:selected').each(function () {
|
||||||
users.push($(this).val());
|
users.push($(this).val());
|
||||||
@@ -1305,8 +1323,8 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
|
|
||||||
$('body').on('click', '#delete-event', function () {
|
$('body').on('click', '#delete-event', function () {
|
||||||
var id = $(this).data('id');
|
let id = $(this).data('id');
|
||||||
var users = [];
|
let users = [];
|
||||||
$('#calendar-users > option:selected').each(function () {
|
$('#calendar-users > option:selected').each(function () {
|
||||||
users.push($(this).val());
|
users.push($(this).val());
|
||||||
});
|
});
|
||||||
@@ -1343,10 +1361,10 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('change', '.color-input,.color-text-input', function (event, init = 0) {
|
$('body').on('change', '.color-input,.color-text-input', function (event, init = 0) {
|
||||||
var bgcolors = [];
|
let bgcolors = [];
|
||||||
var txtcolors = [];
|
let txtcolors = [];
|
||||||
var calendar_id = [];
|
let calendar_id = [];
|
||||||
var thisis = $(this);
|
let thisis = $(this);
|
||||||
$.each($('.color-input'), function (index, value) {
|
$.each($('.color-input'), function (index, value) {
|
||||||
if ($(this).data('calendar_id')) {
|
if ($(this).data('calendar_id')) {
|
||||||
bgcolors.push($(this).closest('div').find('.color-input').val());
|
bgcolors.push($(this).closest('div').find('.color-input').val());
|
||||||
@@ -1358,7 +1376,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var id = $('#calendar-id').data('id');
|
let id = $('#calendar-id').data('id');
|
||||||
let groups = getGroups();
|
let groups = getGroups();
|
||||||
$.post(requestUpdateColorUrl, {
|
$.post(requestUpdateColorUrl, {
|
||||||
id: id,
|
id: id,
|
||||||
@@ -1381,11 +1399,11 @@ $(document).ready(function () {
|
|||||||
} else {
|
} else {
|
||||||
refreshCalendarEvents()
|
refreshCalendarEvents()
|
||||||
}
|
}
|
||||||
var resources = calendar.getResources();
|
let resources = calendar.getResources();
|
||||||
$.each(resources, function (index, value) {
|
$.each(resources, function (index, value) {
|
||||||
value.remove();
|
value.remove();
|
||||||
});
|
});
|
||||||
var resourceCounter = 0;
|
let resourceCounter = 0;
|
||||||
$.each($('.calendar-check'), function (index, value) {
|
$.each($('.calendar-check'), function (index, value) {
|
||||||
if ($(this).prop('checked')) {
|
if ($(this).prop('checked')) {
|
||||||
rights = true;
|
rights = true;
|
||||||
@@ -1405,8 +1423,8 @@ $(document).ready(function () {
|
|||||||
;
|
;
|
||||||
|
|
||||||
function uploadajax(ttl, cl) {
|
function uploadajax(ttl, cl) {
|
||||||
var fileList = $('#files-input').prop("files");
|
let fileList = $('#files-input').prop("files");
|
||||||
var form_data = "";
|
let form_data = "";
|
||||||
|
|
||||||
form_data = new FormData();
|
form_data = new FormData();
|
||||||
form_data.append("upload_file", fileList[cl]);
|
form_data.append("upload_file", fileList[cl]);
|
||||||
@@ -1414,7 +1432,7 @@ $(document).ready(function () {
|
|||||||
form_data.append("newkey", $('#attachments').data('newkey'));
|
form_data.append("newkey", $('#attachments').data('newkey'));
|
||||||
|
|
||||||
|
|
||||||
var request = $.ajax({
|
let request = $.ajax({
|
||||||
url: requestEventAttachmentUploadUrl,
|
url: requestEventAttachmentUploadUrl,
|
||||||
cache: false,
|
cache: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
@@ -1423,10 +1441,10 @@ $(document).ready(function () {
|
|||||||
data: form_data,
|
data: form_data,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
xhr: function () {
|
xhr: function () {
|
||||||
var xhr = $.ajaxSettings.xhr();
|
let xhr = $.ajaxSettings.xhr();
|
||||||
if (xhr.upload) {
|
if (xhr.upload) {
|
||||||
xhr.upload.addEventListener('progress', function (event) {
|
xhr.upload.addEventListener('progress', function (event) {
|
||||||
var percent = 0;
|
let percent = 0;
|
||||||
if (event.lengthComputable) {
|
if (event.lengthComputable) {
|
||||||
percent = Math.ceil(event.loaded / event.total * 100);
|
percent = Math.ceil(event.loaded / event.total * 100);
|
||||||
}
|
}
|
||||||
@@ -1453,10 +1471,10 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
|
|
||||||
$('body').on('change', '#files-input', function () {
|
$('body').on('change', '#files-input', function () {
|
||||||
var fileList = $('#files-input').prop("files");
|
let fileList = $('#files-input').prop("files");
|
||||||
|
|
||||||
$('#uploadsts').html('');
|
$('#uploadsts').html('');
|
||||||
var i;
|
let i;
|
||||||
for (i = 0; i < fileList.length; i++) {
|
for (i = 0; i < fileList.length; i++) {
|
||||||
let newkey = $('#attachments').data('newkey');
|
let newkey = $('#attachments').data('newkey');
|
||||||
const filetype = fileList[i].type;
|
const filetype = fileList[i].type;
|
||||||
@@ -1521,6 +1539,7 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$('body').on('change', '#jumpevent', function () {
|
$('body').on('change', '#jumpevent', function () {
|
||||||
$('.event-search-result').removeClass('event-search-result');
|
$('.event-search-result').removeClass('event-search-result');
|
||||||
if ($(this).val() == "" || $(this).val() == null) {
|
if ($(this).val() == "" || $(this).val() == null) {
|
||||||
@@ -1552,7 +1571,7 @@ $(document).ready(function () {
|
|||||||
return {
|
return {
|
||||||
q: params.term, // Der Suchbegriff
|
q: params.term, // Der Suchbegriff
|
||||||
term: params.term, // Der Suchbegriff
|
term: params.term, // Der Suchbegriff
|
||||||
calendars: visibleCalendars, // Die dynamische Variable, die du hinzufügen möchtest
|
calendars: visibleCalendars, // Die dynamische letiable, die du hinzufügen möchtest
|
||||||
cal_id: $('#calendar-id').data('calendarid')
|
cal_id: $('#calendar-id').data('calendarid')
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -1582,22 +1601,15 @@ $(document).ready(function () {
|
|||||||
} else {
|
} else {
|
||||||
daytimetext = "nachmittags";
|
daytimetext = "nachmittags";
|
||||||
}
|
}
|
||||||
let textTemplate;
|
let text = $(this).data('text');
|
||||||
if ($(this).data('id') == 1) {
|
text = text.replace(/\[&&vmnm&&\]/g, daytimetext);
|
||||||
textTemplate = `Sehr geehrter Kunde,
|
text = text.replace(/\[&&date&&\]/g, formattedDate);
|
||||||
Ihr Technikertermin findet am ` + formattedDate + ` ` + daytimetext + ` statt.
|
text = text.replace(/\[&&start&&\]/g, starttime);
|
||||||
Mit Freundlichen Grüßen
|
text = text.replace(/\[&&end&&\]/g, endtime);
|
||||||
Xinon GMbH`;
|
|
||||||
} else if ($(this).data('id') == 2) {
|
|
||||||
textTemplate = `Sehr geehrter Kunde,
|
|
||||||
wir möchten Sie daran erinnern, dass Ihr Technikertermin am ` + formattedDate + ` ` + daytimetext + ` stattfindet.
|
|
||||||
Mit Freundlichen Grüßen
|
|
||||||
Xinon GMbH`;
|
|
||||||
} else if ($(this).data('id') == 3) {
|
|
||||||
textTemplate = formattedDate + ` zwischen ` + starttime + ` und ` + endtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#customer-info-text').val(textTemplate);
|
|
||||||
|
|
||||||
|
$('#customer-info-text').val(text);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -1657,7 +1669,7 @@ Xinon GMbH`;
|
|||||||
|
|
||||||
let groupname = $.trim($(this).text());
|
let groupname = $.trim($(this).text());
|
||||||
$(this).html('<input type="text" data-oldname="' + groupname + '" class="form-control cal-group-name-input" value="' + groupname + '">');
|
$(this).html('<input type="text" data-oldname="' + groupname + '" class="form-control cal-group-name-input" value="' + groupname + '">');
|
||||||
var strLength = $(this).find('.cal-group-name-input').val().length * 2;
|
let strLength = $(this).find('.cal-group-name-input').val().length * 2;
|
||||||
|
|
||||||
|
|
||||||
$(this).find('.cal-group-name-input')[0].setSelectionRange(strLength, strLength);
|
$(this).find('.cal-group-name-input')[0].setSelectionRange(strLength, strLength);
|
||||||
@@ -1676,11 +1688,11 @@ Xinon GMbH`;
|
|||||||
$(this).closest('.calendar-side-borders-sub').find('.form-check-input').prop('checked', false);
|
$(this).closest('.calendar-side-borders-sub').find('.form-check-input').prop('checked', false);
|
||||||
refreshCalendarEvents()
|
refreshCalendarEvents()
|
||||||
}
|
}
|
||||||
var resources = calendar.getResources();
|
let resources = calendar.getResources();
|
||||||
$.each(resources, function (index, value) {
|
$.each(resources, function (index, value) {
|
||||||
value.remove();
|
value.remove();
|
||||||
});
|
});
|
||||||
var resourceCounter = 0;
|
let resourceCounter = 0;
|
||||||
$.each($('.calendar-check'), function (index, value) {
|
$.each($('.calendar-check'), function (index, value) {
|
||||||
if ($(this).prop('checked')) {
|
if ($(this).prop('checked')) {
|
||||||
rights = true;
|
rights = true;
|
||||||
@@ -1814,6 +1826,7 @@ Xinon GMbH`;
|
|||||||
return groupsJson;
|
return groupsJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function checkGroupCheckboxes() {
|
function checkGroupCheckboxes() {
|
||||||
$('.group-checkbox').each(function (index, value) {
|
$('.group-checkbox').each(function (index, value) {
|
||||||
let checked = 0;
|
let checked = 0;
|
||||||
@@ -1907,16 +1920,16 @@ Xinon GMbH`;
|
|||||||
|
|
||||||
}, 'json').done(function (json) {
|
}, 'json').done(function (json) {
|
||||||
if (json.success == true) {
|
if (json.success == true) {
|
||||||
var userevents = [];
|
let userevents = [];
|
||||||
var otherevents = [];
|
let otherevents = [];
|
||||||
var resources = [];
|
let resources = [];
|
||||||
var category = "";
|
let category = "";
|
||||||
var rights = false;
|
let rights = false;
|
||||||
var movable = false;
|
let movable = false;
|
||||||
var resourceCounter = 0;
|
let resourceCounter = 0;
|
||||||
var rrule = null;
|
let rrule = null;
|
||||||
var duration = null;
|
let duration = null;
|
||||||
var rruleflag = false;
|
let rruleflag = false;
|
||||||
let allDAy = false;
|
let allDAy = false;
|
||||||
let cursorclass = "";
|
let cursorclass = "";
|
||||||
$.each($('.calendar-check'), function (index, value) {
|
$.each($('.calendar-check'), function (index, value) {
|
||||||
|
|||||||
Reference in New Issue
Block a user