* Vorlagen können nun erstellt und editiert werden. * neue Migration für CalendarTemplates
433 lines
17 KiB
PHP
433 lines
17 KiB
PHP
<?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">Kalender Verwaltung</li>
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title">Kalender Verwaltung</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body mb-3">
|
|
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
|
<li class="nav-item">
|
|
<a
|
|
class="nav-link active"
|
|
id="home-tab"
|
|
data-toggle="tab"
|
|
href="#home"
|
|
role="tab"
|
|
aria-controls="home"
|
|
aria-selected="true"
|
|
>Vorlagen</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a
|
|
class="nav-link"
|
|
id="profile-tab"
|
|
data-toggle="tab"
|
|
href="#user-tab"
|
|
role="tab"
|
|
aria-controls="user-tab"
|
|
aria-selected="false"
|
|
>Benutzer</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<!-- Tab Inhalte -->
|
|
<div class="tab-content" id="myTabContent">
|
|
<div
|
|
class="tab-pane fade show active"
|
|
id="home"
|
|
role="tabpanel"
|
|
aria-labelledby="home-tab"
|
|
>
|
|
<div class="row">
|
|
<div class="col-12">
|
|
<a class="btn btn-primary mb-2 float-right"
|
|
href="<?= self::getUrl("CalendarTemplate", "add") ?>"><i
|
|
class="fas fa-plus"></i> Neuen Vorlage anlegen</a>
|
|
</div>
|
|
</div>
|
|
<table id="datatable2" 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="filterrow2">
|
|
<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 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
|
|
class="tab-pane fade col-12"
|
|
id="user-tab"
|
|
role="tabpanel"
|
|
aria-labelledby="profile-tab"
|
|
>
|
|
<table id="datatable" class="table table-striped table-hover table-sm" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-center">Name</th>
|
|
<th class="text-center">GO Kalender ID</th>
|
|
<th class="text-center">Microsoft Id</th>
|
|
<th class="text-center">Kalenderrechte</th>
|
|
<th class="text-center">Webhook</th>
|
|
<th class="text-center">Webhook Timeout</th>
|
|
<th class="text-center">Aktiv</th>
|
|
<th class="edit-width" style="width: 50px !important;text-decoration: underline"></th>
|
|
</tr>
|
|
<tr id="filterrow">
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($calendars as $calendar):
|
|
$calenadarRights = json_decode($calendar->rights, true);
|
|
$rights = "";
|
|
foreach ($calenadarRights as $key => $value) {
|
|
if ($key != $calendar->go_calendar_id) {
|
|
$rights .= $calendars[$key]->user->name . " : " . $value . "<br>";
|
|
}
|
|
}
|
|
?>
|
|
<tr>
|
|
<td><?= $calendar->user->name ?></td>
|
|
<td class="text-center"><?= $calendar->go_calendar_id ?></td>
|
|
<td class="text-nowrap"><?= $calendar->microsoft_id ?></td>
|
|
<td><?= $rights ?></td>
|
|
<td class="text-nowrap"><?= $calendar->subscription_id ?></td>
|
|
<td class="text-center"><?= ($calendar->expirationDateTime) ? date("d.m.Y H:i", $calendar->expirationDateTime) : '' ?></td>
|
|
<td class="text-center"><?= ($calendar->active == 1) ? '<i class="fa-regular fa-circle-check mr-1"></i>' : '<i class="fa-regular fa-circle-xmark mr-1"></i>' ?></td>
|
|
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
|
<a href="<?= self::getUrl("Calendar", "edit", ["id" => $calendar->id]) ?>"><i
|
|
class="far fa-edit" title="Bearbeiten"></i></a>
|
|
<a href="<?= self::getUrl("Calendar", "delete", ["id" => $calendar->id]) ?>"
|
|
onclick="if(!confirm('Kalender Verwaltung 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>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
let table;
|
|
let table2;
|
|
let tableInitialized = false;
|
|
var hidesearch = [4];
|
|
if (typeof hidesearch === "undefined") {
|
|
var hidesearch;
|
|
hidesearch = [100];
|
|
}
|
|
|
|
if (typeof pageLength === "undefined") {
|
|
var pageLength;
|
|
pageLength = 25;
|
|
}
|
|
|
|
if (typeof cstmdom === "undefined") {
|
|
var cstmdom;
|
|
cstmdom = "flBrtip";
|
|
|
|
}
|
|
if (typeof columndefs === "undefined") {
|
|
var columndefs;
|
|
columndefs = "";
|
|
|
|
}
|
|
|
|
if (typeof columnfilter === "undefined") {
|
|
var columnfilter;
|
|
columnfilter = "";
|
|
}
|
|
if (typeof columnoptions === "undefined") {
|
|
var columnoptions;
|
|
columnoptions = "";
|
|
}
|
|
|
|
$('#filterrow2 th').each(function (i) {
|
|
let title = $('#datatable2 thead th').eq($(this).index()).text();
|
|
|
|
if (hidesearch.includes($(this).index())) {
|
|
|
|
} else if (columnfilter.includes($(this).index())) {
|
|
$(this).html('<select style="padding: 0;height: 28px;;text-align: center;" id="selectsearch" class="form-control form-control-select form-control-special" data-index="' + i + '">' + columnoptions + '</select>');
|
|
|
|
} else {
|
|
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
|
}
|
|
});
|
|
table2 = $('#datatable2').DataTable({
|
|
responsive: {
|
|
breakpoints: [
|
|
{name: 'desktop', width: Infinity},
|
|
{name: 'tablet', width: 1024},
|
|
{name: 'fablet', width: 768},
|
|
{name: 'phone', width: 480}
|
|
]
|
|
},
|
|
pageLength: pageLength,
|
|
buttons: [
|
|
{
|
|
extend: 'excelHtml5',
|
|
text: 'XLSX Export',
|
|
className: 'btn-success margina d-none d-lg-block',
|
|
exportOptions: {
|
|
columns: ['th:not(:last-child)'],
|
|
format: {
|
|
body: function (data, row, column, node) {
|
|
data = $('<p>' + data + '</p>').text();
|
|
return $.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
], columnDefs: [
|
|
columndefs
|
|
],
|
|
"language": {
|
|
"url": "/datatables/json/german.json?v1"
|
|
},
|
|
orderCellsTop: true,
|
|
stateSave: true,
|
|
stateDuration: 60 * 60 * 24 * 30,
|
|
"initComplete": function () {
|
|
$('#datatable2_filter').append('<i id="clear_cookie2" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
|
|
$('#clear_cookie2').click(function () {
|
|
$('#filterrow2 input').val('');
|
|
$('#filterrow2 select').val('');
|
|
table2.search('').columns().search('').draw();
|
|
});
|
|
},
|
|
"dom": cstmdom
|
|
|
|
});
|
|
|
|
$('#filterrow2').on('keyup', 'input', function () {
|
|
|
|
table2
|
|
.column($(this).data('index'))
|
|
.search(this.value)
|
|
.draw();
|
|
|
|
|
|
});
|
|
|
|
$('#selectsearch').change(function () {
|
|
table2
|
|
.column($(this).data('index'))
|
|
.search(this.value)
|
|
.draw();
|
|
|
|
|
|
});
|
|
let state2 = table2.state.loaded();
|
|
if (state2) {
|
|
table2.columns().eq(0).each(function (colIdx) {
|
|
var colSearch = state2.columns[colIdx].search;
|
|
|
|
if (colSearch.search) {
|
|
|
|
|
|
$('#filterrow2').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
|
|
|
|
|
}
|
|
});
|
|
|
|
table2.draw();
|
|
}
|
|
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
|
|
var target = $(e.target).attr("href"); // z.B. #table
|
|
|
|
if (target === '#user-tab' && !tableInitialized) {
|
|
// Initialisierung der DataTable
|
|
var hidesearch = [6, 7];
|
|
if (typeof hidesearch === "undefined") {
|
|
var hidesearch;
|
|
hidesearch = [100];
|
|
}
|
|
console.log(hidesearch);
|
|
|
|
if (typeof pageLength === "undefined") {
|
|
var pageLength;
|
|
pageLength = 25;
|
|
}
|
|
|
|
if (typeof cstmdom === "undefined") {
|
|
var cstmdom;
|
|
cstmdom = "flBrtip";
|
|
|
|
}
|
|
if (typeof columndefs === "undefined") {
|
|
var columndefs;
|
|
columndefs = "";
|
|
|
|
}
|
|
|
|
if (typeof columnfilter === "undefined") {
|
|
var columnfilter;
|
|
columnfilter = "";
|
|
}
|
|
if (typeof columnoptions === "undefined") {
|
|
var columnoptions;
|
|
columnoptions = "";
|
|
}
|
|
|
|
$('#filterrow th').each(function (i) {
|
|
let title = $('#datatable thead th').eq($(this).index()).text();
|
|
|
|
if (hidesearch.includes($(this).index())) {
|
|
|
|
} else if (columnfilter.includes($(this).index())) {
|
|
$(this).html('<select style="padding: 0;height: 28px;;text-align: center;" id="selectsearch" class="form-control form-control-select form-control-special" data-index="' + i + '">' + columnoptions + '</select>');
|
|
|
|
} else {
|
|
$(this).html('<input type="text" placeholder="' + title + '" class="form-control" data-index="' + i + '" value="" />');
|
|
}
|
|
});
|
|
table = $('#datatable').DataTable({
|
|
responsive: {
|
|
breakpoints: [
|
|
{name: 'desktop', width: Infinity},
|
|
{name: 'tablet', width: 1024},
|
|
{name: 'fablet', width: 768},
|
|
{name: 'phone', width: 480}
|
|
]
|
|
},
|
|
pageLength: pageLength,
|
|
buttons: [
|
|
{
|
|
extend: 'excelHtml5',
|
|
text: 'XLSX Export',
|
|
className: 'btn-success margina d-none d-lg-block',
|
|
exportOptions: {
|
|
columns: ['th:not(:last-child)'],
|
|
format: {
|
|
body: function (data, row, column, node) {
|
|
data = $('<p>' + data + '</p>').text();
|
|
return $.isNumeric(data.replace(',', '.')) ? data.replace(',', '.') : data;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
], columnDefs: [
|
|
columndefs
|
|
],
|
|
"language": {
|
|
"url": "/datatables/json/german.json?v1"
|
|
},
|
|
orderCellsTop: true,
|
|
stateSave: true,
|
|
stateDuration: 60 * 60 * 24 * 30,
|
|
"initComplete": function () {
|
|
$('#datatable_filter').append('<i id="clear_cookie" class="fas fa-times clear-fa" title="Filter löschen" aria-hidden="true" ></i>');
|
|
$('#clear_cookie').click(function () {
|
|
$('#filterrow input').val('');
|
|
$('#filterrow select').val('');
|
|
table.search('').columns().search('').draw();
|
|
});
|
|
},
|
|
"dom": cstmdom
|
|
|
|
});
|
|
|
|
$('#filterrow').on('keyup', 'input', function () {
|
|
|
|
table
|
|
.column($(this).data('index'))
|
|
.search(this.value)
|
|
.draw();
|
|
|
|
|
|
});
|
|
|
|
$('#selectsearch').change(function () {
|
|
table
|
|
.column($(this).data('index'))
|
|
.search(this.value)
|
|
.draw();
|
|
|
|
|
|
});
|
|
let state = table.state.loaded();
|
|
if (state) {
|
|
table.columns().eq(0).each(function (colIdx) {
|
|
var colSearch = state.columns[colIdx].search;
|
|
|
|
if (colSearch.search) {
|
|
|
|
|
|
$('#filterrow').find("[data-index='" + colIdx + "']").val(colSearch.search);
|
|
|
|
|
|
}
|
|
});
|
|
|
|
table.draw();
|
|
}
|
|
tableInitialized = true;
|
|
} else if (target === '#table' && tableInitialized) {
|
|
// Neuberechnung der Spalten, falls die Tabelle bereits initialisiert ist
|
|
table.columns.adjust().responsive.recalc();
|
|
}
|
|
});
|
|
</script>
|
|
<!--script type="text/javascript"
|
|
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script-->
|
|
|
|
|
|
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|