Mobile Integration,Pop Multiple Networks,DataTables responsible update,Migrations
Mobile Integration: * in footer.php js eingefügt damit das mobile Menu funktioniert * in menu.php bzw. app.css neue Klasse eingefügt mobile-hide um in der mobilen Version Menupünkte zu verstecken Pop Multiple Networks * Pops können nun mehrere Netzgebiete haben * Netzgebiete und Pop ansicht angepasst * (Script muss ausgeführt werden um die PopNetwork Table vom Bestand zu befüllen) DataTables responsible update * Datatables update und responsible addon * Diverse Anpassungen für Responsible in: - Pops, Geräte Hersteller, Geräte Typen, Devices, Benutzer Anpassungen auf neu getProperty Migrations * PopNetwork * Poprackmodulepatch
This commit is contained in:
336
Layout/default/Timerecording/Index.php
Normal file
336
Layout/default/Timerecording/Index.php
Normal file
@@ -0,0 +1,336 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
$daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
.edit-button {
|
||||
color: #007bff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.approved-open {
|
||||
background-color: #fdb751 !important;
|
||||
color: #000;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.approved-closed {
|
||||
background-color: #96ff68 !important;
|
||||
color: #000;
|
||||
border-radius: 5px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.fa-clock {
|
||||
color: #ff9b00;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.edit-placeholder {
|
||||
height: 15px;
|
||||
width: 19px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
</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 active">Buchungen</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Buchungen</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("Timerecording", "save") ?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<input id="id" type="hidden" name="id" value=""/>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-lg-2">
|
||||
<label class="col-form-label" for="timerecordingCategory_id">Buchungsart</label>
|
||||
|
||||
<select id="timerecordingCategory_id" name="timerecordingCategory_id"
|
||||
class="select2 form-control" required="required">
|
||||
<?php foreach ($timerecordingCategoriess as $timerecordingCategories): ?>
|
||||
<option value="<?= $timerecordingCategories->id ?>"
|
||||
data-approval="<?= $timerecordingCategories->approval ?>"
|
||||
data-comment="<?= $timerecordingCategories->require_comment ?>"
|
||||
data-hourday="<?= $timerecordingCategories->hourday ?>"><?= $timerecordingCategories->name ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div class="form-group col-lg-1">
|
||||
<label class="col-form-label" for="date">Datum</label>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<input type="date" id="date" name="date" class="form-control "
|
||||
value="<?= date("Y-m-d", time()) ?>"
|
||||
placeholder="<?= date("d.m.Y", time()); ?>" required="required"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="enddate-div" class="form-group col-lg-1" style="display:none">
|
||||
<label class="col-form-label" for="enddate">bis Datum</label>
|
||||
<div class="form-row">
|
||||
<div class="col">
|
||||
<input type="date" id="enddate" name="enddate" class="form-control "
|
||||
value=""
|
||||
placeholder=""/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="endtime-div" class="col-lg-2">
|
||||
<div class="form-row">
|
||||
<div class="form-group col">
|
||||
<label class=" col-form-label" for="start">Von</label>
|
||||
|
||||
<input type="time" id="start" name="start" class="form-control "
|
||||
value="08:00" placeholder="07:00" required="required"/>
|
||||
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label class=" col-form-label" for="end">Bis</label>
|
||||
<input type="time" id="end" name="end" class="form-control "
|
||||
value="15:00" min="08:00" placeholder="15:00" required="required"/>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-lg-2">
|
||||
<label class="col-form-label" for="commend">Anmerkung</label>
|
||||
<input type="text" id="commend" name="commend" class="form-control"
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class=" row mt-2">
|
||||
<div class="col-lg-2 ">
|
||||
<button id="submit-button" type="submit" class="btn btn-primary">Speichern</button>
|
||||
<button id="cancel-button" type="button" class="btn btn-secondary" style="display:none">Abbrechen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<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 Buchungen</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 200px;" class="text-center text-nowrap ">Datum</th>
|
||||
<th class="text-nowrap edit-width text-center">Von</th>
|
||||
<th class="text-nowrap edit-width text-center">Bis</th>
|
||||
<th class="text-nowrap edit-width text-center">Summe</th>
|
||||
<th class="text-center text-nowrap">Buchungsart</th>
|
||||
<th class="text-center">Anmerkung</th>
|
||||
<th class="edit-width"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ($timerecordings as $timerecording):
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
$sum = "-";
|
||||
$day = "";
|
||||
$orderdate = $timerecording->start;
|
||||
if ($timerecording->timerecordingCategory->hourday == 1) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
$end = date("H:i", $timerecording->end);
|
||||
$seconds = $timerecording->end - $timerecording->start;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 2) {
|
||||
$date = date("d.m.", $timerecording->start) . " - " . $daysgerm[date("w", $timerecording->end)] . " " . date("d.m.Y", $timerecording->end);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$enddate = date("Y-m-d", $timerecording->end);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day=$daysgerm[date("w", $timerecording->start)];
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 3 || $timerecording->timerecordingCategory->hourday == 4) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
$state = '<i class="fa-regular fa-clock mr-1"></i>';
|
||||
} else if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 1) {
|
||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||
}
|
||||
?>
|
||||
<tr class="">
|
||||
<td data-order="<?= $orderdate ?>" class="text-nowrap "><?= $state ?><?= $day . " " . $date ?></td>
|
||||
<td class="text-nowrap text-center"><?= $start ?></td>
|
||||
<td class="text-nowrap text-center"><?= $end ?></td>
|
||||
<td class="text-nowrap text-center"><?= $sum ?></td>
|
||||
<td class="text-nowrap"><?= $timerecording->timerecordingCategory->name ?></td>
|
||||
<td><?= $timerecording->commend ?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<?php if ($timerecording->completed == 0):
|
||||
if ($timerecording->approved == 0) : ?>
|
||||
<i class="far fa-edit edit-button" data-id="<?= $timerecording->id ?>"
|
||||
data-date="<?= $datadate ?>"
|
||||
data-category="<?= $timerecording->timerecordingCategory->id ?>"
|
||||
data-start="<?= $start ?>"
|
||||
data-end="<?= $end ?>"
|
||||
data-enddate="<?= $enddate ?>"
|
||||
data-commend="<?= $timerecording->commend ?>"
|
||||
title="Bearbeiten"></i>
|
||||
<?php else : ?>
|
||||
<div class="edit-placeholder"></div>
|
||||
<?php endif; ?>
|
||||
<a href="<?= self::getUrl("Timerecording", "delete", ["id" => $timerecording->id]) ?>"
|
||||
onclick="if(!confirm('Buchung wirklich löschen?')) return false;" class="text-danger"
|
||||
title="Löschen"><i class="fas fa-trash"></i></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [1, 2, 3, 6];
|
||||
|
||||
$(document).ready(function () {
|
||||
$(".select2").select2();
|
||||
|
||||
$("body").on("change", "#timerecordingCategory_id", function () {
|
||||
if (parseInt($(this).find(':selected').data('hourday')) === 2) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
});
|
||||
$("#enddate-div").show();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("min", $('#date').val());
|
||||
$(this).val($('#date').val());
|
||||
})
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 1) {
|
||||
$("#endtime-div").show();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("disabled", false);
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 3 || parseInt($(this).find(':selected').data('hourday')) === 4) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("disabled", true);
|
||||
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
}
|
||||
if (parseInt($(this).find(':selected').data('comment')) === 1) {
|
||||
$('#commend').prop("required", true);
|
||||
} else {
|
||||
$('#commend').prop("required", false);
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#enddate-div').css('display') === "block") {
|
||||
if ($('#date').val() > $('#enddate').val()) {
|
||||
$('#enddate').prop("min", $('#date').val());
|
||||
$('#enddate').val($('#date').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#endtime').css('display') === "block") {
|
||||
if ($('#start').val() > $('#end').val()) {
|
||||
console.log('größer');
|
||||
$('#end').prop("min", $('#start').val());
|
||||
$('#end').val($('#start').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("click", ".edit-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-primary').addClass('btn-danger').show();
|
||||
$('#submit-button').text('Ändern');
|
||||
$('#cancel-button').show();
|
||||
$('#timerecordingCategory_id').val($(this).data('category')).change();
|
||||
$('#id').val($(this).data('id'));
|
||||
$('#date').val($(this).data('date'));
|
||||
$('#start').val($(this).data('start'));
|
||||
$('#end').val($(this).data('end'));
|
||||
$('#enddate').val($(this).data('enddate'));
|
||||
$('#commend').val($(this).data('commend'));
|
||||
$('.alert-success').remove();
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
$("body").on("click", "#cancel-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-danger').addClass('btn-primary').show();
|
||||
$('#submit-button').text('Speichern');
|
||||
$('#cancel-button').hide();
|
||||
$('#id').val('');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
117
Layout/default/TimerecordingCategories/Form.php
Normal file
117
Layout/default/TimerecordingCategories/Form.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<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"><a
|
||||
href="<?= self::getUrl("TimerecordingCategory") ?>">Zeiterfassung
|
||||
Buchungsarten</a>
|
||||
</li>
|
||||
<li class="breadcrumb-item active"><?= ($timerecordingcategoriess->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title"><?= ($timerecordingcategoriess->id) ? "Zeiterfassung Buchungsart bearbeiten" : "Neue Zeiterfassung Buchungsart" ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?= ($timerecordingcategoriess->id) ? "Zeiterfassung Buchungsart bearbeiten" : "Neue Zeiterfassung Buchungsart" ?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post"
|
||||
action="<?= self::getUrl("TimerecordingCategory", "save") ?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<input type="hidden" name="id" value="<?= $timerecordingcategoriess->id ?>"/>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="name">Beizeichnung</label>
|
||||
<div class="col-lg-3">
|
||||
<input type="text" id="name" name="name" class="form-control"
|
||||
value="<?= $timerecordingcategoriess->name ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="short">BMD KZ</label>
|
||||
<div class="col-lg-2">
|
||||
<input type="text" id="short" name="short" class="form-control"
|
||||
value="<?= $timerecordingcategoriess->short ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="hourday">Buchungszeitraum</label>
|
||||
<div class="col-lg-2">
|
||||
<select id="hourday" name="hourday" class="select2 form-control">
|
||||
<?php foreach ($timerecordingcategorieshourday as $key => $value) : ?>
|
||||
<option value="<?= $key ?>" <?= ($key == $timerecordingcategoriess->hourday) ? "selected='selected'" : "" ?>><?= $value ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="approval">Genehmigungspflichtig</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" <?php if ($timerecordingcategoriess->approval) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="approval" value="1" id="olt">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="require_comment">Anmerkung
|
||||
Pflichtfeld</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" <?php if ($timerecordingcategoriess->require_comment) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="require_comment" value="1" id="olt">
|
||||
</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("TimerecordingCategory") ?>">
|
||||
<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')
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
93
Layout/default/TimerecordingCategories/Index.php
Normal file
93
Layout/default/TimerecordingCategories/Index.php
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
<?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">Zeiterfassung Buchungsarten</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Zeiterfassung Buchungsarten</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 Zeiterfassung Buchungsarten</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?= self::getUrl("TimerecordingCategory", "add") ?>"><i
|
||||
class="fas fa-plus"></i> <span class="d-none d-lg-inline-block"> Neuen Buchungsart anlegen</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">Beizeichnung</th>
|
||||
<th class="text-center">BMD KZ</th>
|
||||
<th class="text-center">Buchungszeitraum</th>
|
||||
<th class="text-center">Genehmigungspflichtig</th>
|
||||
<th class="text-center">Anmerkung Pflichtfeld</th>
|
||||
<th class="edit-width"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordingcategoriess as $timerecordingcategories): ?>
|
||||
<tr>
|
||||
<td><?= $timerecordingcategories->name ?></td>
|
||||
<td><?= $timerecordingcategories->short ?></td>
|
||||
<td><?= $timerecordingcategorieshourday[$timerecordingcategories->hourday] ?></td>
|
||||
<td><?= $timerecordingcategoriesapproval[$timerecordingcategories->approval] ?></td>
|
||||
<td><?= $timerecordingcategoriesrequire_comment[$timerecordingcategories->require_comment] ?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?= self::getUrl("TimerecordingCategory", "edit", ["id" => $timerecordingcategories->id]) ?>"><i
|
||||
class="far fa-edit" title="Bearbeiten"></i></a>
|
||||
<a href="<?= self::getUrl("TimerecordingCategory", "delete", ["id" => $timerecordingcategories->id]) ?>"
|
||||
onclick="if(!confirm('Zeiterfassung Kategorie 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 = [5];
|
||||
|
||||
$(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"); ?>
|
||||
290
Layout/default/TimerecordingPermit/Index.php
Normal file
290
Layout/default/TimerecordingPermit/Index.php
Normal file
@@ -0,0 +1,290 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
$daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
|
||||
<style>
|
||||
.edit-button {
|
||||
color: #007bff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.approved-open {
|
||||
background-color: #fdb751 !important;
|
||||
color: #000;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.approved-closed {
|
||||
background-color: #96ff68 !important;
|
||||
color: #000;
|
||||
border-radius: 5px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.fa-clock {
|
||||
color: #ff9b00;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.edit-placeholder {
|
||||
height: 15px;
|
||||
width: 22px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.fa-square-check {
|
||||
color: #23b900;
|
||||
font-size: 17px;
|
||||
vertical-align: middle;
|
||||
margin-bottom: 2px;
|
||||
margin-right: 3px;
|
||||
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
<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">Buchungen</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Buchungen</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 Buchungen</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 200px;" class="text-center text-nowrap ">Datum</th>
|
||||
<th style="width: 200px;" class="text-nowrap">Mitarbeiter</th>
|
||||
<th class="text-nowrap text-center edit-width">Von</th>
|
||||
<th class="text-nowrap text-center edit-width">Bis</th>
|
||||
<th class="text-nowrap edit-width text-center">Summe</th>
|
||||
<th class="text-center text-nowrap">Buchungsart</th>
|
||||
<th class="text-center">Anmerkung</th>
|
||||
<th class="text-center edit-width-large">Freigabe</th>
|
||||
<th class="edit-width text-center"></th>
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordings as $timerecording):
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
$sum = "-";
|
||||
$day = "";
|
||||
$orderdate = $timerecording->start;
|
||||
if ($timerecording->timerecordingCategory->hourday == 1) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
$end = date("H:i", $timerecording->end);
|
||||
$seconds = $timerecording->end - $timerecording->start;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 2) {
|
||||
$date = date("d.m.", $timerecording->start) . " - " . $daysgerm[date("w", $timerecording->end)] . " " . date("d.m.Y", $timerecording->end);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$enddate = date("Y-m-d", $timerecording->end);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day=$daysgerm[date("w", $timerecording->start)];
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 3 || $timerecording->timerecordingCategory->hourday == 4) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
$state = '<i class="fa-regular fa-clock mr-1"></i>';
|
||||
} else if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 1) {
|
||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||
}
|
||||
$approved = 'Offen';
|
||||
if ($timerecording->approved == 1) $approved = 'Genehmigt';
|
||||
$completed = 'Genehmigt';
|
||||
// if ($timerecording->completed == 1) $completed = 'Genehmigt';
|
||||
?>
|
||||
<tr class="">
|
||||
<td data-order="<?= $orderdate ?>" class="text-nowrap "><?= $state ?><?= $day . " " . $date ?></td>
|
||||
<td class="text-nowrap "><?= $timerecording->user->name ?></td>
|
||||
<td class="text-nowrap text-center"><?= $start ?></td>
|
||||
<td class="text-nowrap text-center"><?= $end ?></td>
|
||||
<td class="text-nowrap text-center"><?= $sum ?></td>
|
||||
<td class="text-nowrap"><?= $timerecording->timerecordingCategory->name ?></td>
|
||||
<td><?= $timerecording->commend ?></td>
|
||||
<td class="text-center"><?= $approved ?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<?php if ($timerecording->completed == 0):
|
||||
if ($timerecording->approved == 0) : ?>
|
||||
<a href="<?= self::getUrl("TimerecordingPermit", "approve", ["id" => $timerecording->id]) ?>"
|
||||
onclick="if(!confirm('Buchung genehmigen?')) return false;"> <i
|
||||
class="fa-regular fa-square-check permit-button" title="genehmigen"
|
||||
data-id="<?= $timerecording->id ?>"></i></a>
|
||||
<a href="<?php self::getUrl("TimerecordingPermit", "deny", ["id" => $timerecording->id]) ?>"
|
||||
onclick="if(!confirm('Buchung wirklich ablehnen?')) return false;"
|
||||
class="text-danger"
|
||||
title="Ablehnen"><i class="fas fa-ban deny-button"></i></a>
|
||||
<?php else : ?>
|
||||
<div class="edit-placeholder"></div>
|
||||
<?php endif; ?>
|
||||
<!-- <i class="far fa-edit edit-button" data-id="--><?php //= $timerecording->id
|
||||
?><!--"-->
|
||||
<!-- data-date="--><?php //= $datadate
|
||||
?><!--"-->
|
||||
<!-- data-category="--><?php //= $timerecording->timerecordingCategory->id
|
||||
?><!--"-->
|
||||
<!-- data-start="--><?php //= $start
|
||||
?><!--"-->
|
||||
<!-- data-end="--><?php //= $end
|
||||
?><!--"-->
|
||||
<!-- data-enddate="--><?php //= $enddate
|
||||
?><!--"-->
|
||||
<!-- title="Bearbeiten"></i>-->
|
||||
<!-- <a href="--><?php //= self::getUrl("Timerecording", "delete", ["id" => $timerecording->id])
|
||||
?><!--"-->
|
||||
<!-- onclick="if(!confirm('Buchung wirklich löschen?')) return false;" class="text-danger"-->
|
||||
<!-- title="Löschen"><i class="fas fa-trash"></i></a>-->
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [2, 3, 4, 8];
|
||||
var columnfilter = [7];
|
||||
var columnoptions = '<option value=""></option><option value="Offen">Offen</option><option value="Genehmigt">Genehmigt</option><option value="Abgelehnt">Abgelehnt</option>';
|
||||
$(document).ready(function () {
|
||||
$(".select2").select2();
|
||||
|
||||
$("body").on("change", "#timerecordingCategory_id", function () {
|
||||
if (parseInt($(this).find(':selected').data('hourday')) === 2) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
});
|
||||
$("#enddate-div").show();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("min", $('#date').val());
|
||||
$(this).val($('#date').val());
|
||||
})
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 1) {
|
||||
$("#endtime-div").show();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("disabled", false);
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 3 || parseInt($(this).find(':selected').data('hourday')) === 4) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("disabled", true);
|
||||
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
}
|
||||
if (parseInt($(this).find(':selected').data('comment')) === 1) {
|
||||
$('#commend').prop("required", true);
|
||||
} else {
|
||||
$('#commend').prop("required", false);
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#enddate-div').css('display') === "block") {
|
||||
if ($('#date').val() > $('#enddate').val()) {
|
||||
$('#enddate').prop("min", $('#date').val());
|
||||
$('#enddate').val($('#date').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#endtime').css('display') === "block") {
|
||||
if ($('#start').val() > $('#end').val()) {
|
||||
console.log('größer');
|
||||
$('#end').prop("min", $('#start').val());
|
||||
$('#end').val($('#start').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("click", ".edit-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-primary').addClass('btn-danger').show();
|
||||
$('#submit-button').text('Ändern');
|
||||
$('#cancel-button').show();
|
||||
$('#timerecordingCategory_id').val($(this).data('category')).change();
|
||||
$('#id').val($(this).data('id'));
|
||||
$('#date').val($(this).data('date'));
|
||||
$('#start').val($(this).data('start'));
|
||||
$('#end').val($(this).data('end'));
|
||||
$('#enddate').val($(this).data('enddate'));
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
$("body").on("click", "#cancel-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-danger').addClass('btn-primary').show();
|
||||
$('#submit-button').text('Speichern');
|
||||
$('#cancel-button').hide();
|
||||
$('#id').val('');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
264
Layout/default/TimerecordingReport/Index.php
Normal file
264
Layout/default/TimerecordingReport/Index.php
Normal file
@@ -0,0 +1,264 @@
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php");
|
||||
$daysgerm = array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
|
||||
?>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
|
||||
type="text/css"/>
|
||||
<style>
|
||||
.edit-button {
|
||||
color: #007bff;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.approved-open {
|
||||
background-color: #fdb751 !important;
|
||||
color: #000;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.approved-closed {
|
||||
background-color: #96ff68 !important;
|
||||
color: #000;
|
||||
border-radius: 5px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.fa-clock {
|
||||
color: #ff9b00;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.edit-placeholder {
|
||||
height: 15px;
|
||||
width: 19px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
|
||||
</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 active">Buchungen</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Buchungen</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 Buchungen</h4>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table id="datatable" class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 200px;" class="text-center text-nowrap ">Datum</th>
|
||||
<th style="width: 200px;" class="text-nowrap">Mitarbeiter</th>
|
||||
<th class="text-nowrap text-center edit-width">Von</th>
|
||||
<th class="text-nowrap text-center edit-width">Bis</th>
|
||||
<th class="text-nowrap edit-width text-center">Summe</th>
|
||||
<th class="text-center text-nowrap">Buchungsart</th>
|
||||
<th class="text-center">Anmerkung</th>
|
||||
<th class="text-center edit-width">Verbucht</th>
|
||||
<!-- <th class="edit-width"></th>-->
|
||||
</tr>
|
||||
<tr id="filterrow">
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<!-- <th></th>-->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($timerecordings as $timerecording):
|
||||
$state = "";
|
||||
$enddate = "";
|
||||
$sum = "-";
|
||||
$day = "";
|
||||
$orderdate = $timerecording->start;
|
||||
if ($timerecording->timerecordingCategory->hourday == 1) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = date("H:i", $timerecording->start);
|
||||
$end = date("H:i", $timerecording->end);
|
||||
$seconds = $timerecording->end - $timerecording->start;
|
||||
$minutes = floor(($seconds % 3600) / 60);
|
||||
$hours = floor($seconds / 3600);
|
||||
$sum = sprintf("%02d", $hours) . ":" . sprintf("%02d", $minutes);
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 2) {
|
||||
$date = date("d.m.", $timerecording->start) . " - " . $daysgerm[date("w", $timerecording->end)] . " " . date("d.m.Y", $timerecording->end);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$enddate = date("Y-m-d", $timerecording->end);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
} else if ($timerecording->timerecordingCategory->hourday == 3 || $timerecording->timerecordingCategory->hourday == 4) {
|
||||
$date = date("d.m.Y", $timerecording->start);
|
||||
$datadate = date("Y-m-d", $timerecording->start);
|
||||
$start = "-";
|
||||
$end = "-";
|
||||
$day = $daysgerm[date("w", $timerecording->start)];
|
||||
}
|
||||
|
||||
if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 0) {
|
||||
$state = '<i class="fa-regular fa-clock mr-1"></i>';
|
||||
} else if ($timerecording->timerecordingCategory->approval == 1 && $timerecording->approved == 1) {
|
||||
$state = '<i class="fa-regular fa-circle-check mr-1"></i>';
|
||||
}
|
||||
$completed = 'Nein';
|
||||
if ($timerecording->completed == 1) $completed = 'Ja';
|
||||
|
||||
?>
|
||||
<tr class="">
|
||||
<td data-order="<?= $orderdate ?>" class="text-nowrap "><?= $state ?><?= $day . " " . $date ?></td>
|
||||
<td class="text-nowrap "><?= $timerecording->user->name ?></td>
|
||||
<td class="text-nowrap text-center"><?= $start ?></td>
|
||||
<td class="text-nowrap text-center"><?= $end ?></td>
|
||||
<td class="text-nowrap text-center"><?= $sum ?></td>
|
||||
<td class="text-nowrap"><?= $timerecording->timerecordingCategory->name ?></td>
|
||||
<td><?= $timerecording->commend ?></td>
|
||||
<td><?= $completed ?></td>
|
||||
<!-- <td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">-->
|
||||
<!-- --><?php //if ($timerecording->completed == 0):
|
||||
// if ($timerecording->approved == 0) : ?>
|
||||
<!-- <i class="far fa-edit edit-button" data-id="--><?php //= $timerecording->id ?><!--"-->
|
||||
<!-- data-date="--><?php //= $datadate ?><!--"-->
|
||||
<!-- data-category="--><?php //= $timerecording->timerecordingCategory->id ?><!--"-->
|
||||
<!-- data-start="--><?php //= $start ?><!--"-->
|
||||
<!-- data-end="--><?php //= $end ?><!--"-->
|
||||
<!-- data-enddate="--><?php //= $enddate ?><!--"-->
|
||||
<!-- title="Bearbeiten"></i>-->
|
||||
<!-- --><?php //else : ?>
|
||||
<!-- <div class="edit-placeholder"></div>-->
|
||||
<!-- --><?php //endif; ?>
|
||||
<!-- <a href="--><?php //= self::getUrl("Timerecording", "delete", ["id" => $timerecording->id]) ?><!--"-->
|
||||
<!-- onclick="if(!confirm('Buchung wirklich löschen?')) return false;" class="text-danger"-->
|
||||
<!-- title="Löschen"><i class="fas fa-trash"></i></a>-->
|
||||
<!-- --><?php //endif; ?>
|
||||
<!-- </td>-->
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [2, 3, 4, 8];
|
||||
var columnfilter = [7];
|
||||
var columnoptions = '<option value=""></option><option value="Ja">Ja</option><option value="Nein">Nein</option>';
|
||||
$(document).ready(function () {
|
||||
$(".select2").select2();
|
||||
|
||||
$("body").on("change", "#timerecordingCategory_id", function () {
|
||||
if (parseInt($(this).find(':selected').data('hourday')) === 2) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
});
|
||||
$("#enddate-div").show();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("min", $('#date').val());
|
||||
$(this).val($('#date').val());
|
||||
})
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 1) {
|
||||
$("#endtime-div").show();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", true);
|
||||
$(this).prop("disabled", false);
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
} else if (parseInt($(this).find(':selected').data('hourday')) === 3 || parseInt($(this).find(':selected').data('hourday')) === 4) {
|
||||
$("#endtime-div").hide();
|
||||
$("#endtime-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("disabled", true);
|
||||
|
||||
});
|
||||
$("#enddate-div").hide();
|
||||
$("#enddate-div").find('input').each(function () {
|
||||
$(this).prop("required", false);
|
||||
$(this).prop("min", '');
|
||||
$(this).val('');
|
||||
})
|
||||
}
|
||||
if (parseInt($(this).find(':selected').data('comment')) === 1) {
|
||||
$('#commend').prop("required", true);
|
||||
} else {
|
||||
$('#commend').prop("required", false);
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#enddate-div').css('display') === "block") {
|
||||
if ($('#date').val() > $('#enddate').val()) {
|
||||
$('#enddate').prop("min", $('#date').val());
|
||||
$('#enddate').val($('#date').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
$("body").on("change", "#date", function () {
|
||||
if ($('#endtime').css('display') === "block") {
|
||||
if ($('#start').val() > $('#end').val()) {
|
||||
console.log('größer');
|
||||
$('#end').prop("min", $('#start').val());
|
||||
$('#end').val($('#start').val());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("click", ".edit-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-primary').addClass('btn-danger').show();
|
||||
$('#submit-button').text('Ändern');
|
||||
$('#cancel-button').show();
|
||||
$('#timerecordingCategory_id').val($(this).data('category')).change();
|
||||
$('#id').val($(this).data('id'));
|
||||
$('#date').val($(this).data('date'));
|
||||
$('#start').val($(this).data('start'));
|
||||
$('#end').val($(this).data('end'));
|
||||
$('#enddate').val($(this).data('enddate'));
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
$("body").on("click", "#cancel-button", function () {
|
||||
$('#submit-button').hide().removeClass('btn-danger').addClass('btn-primary').show();
|
||||
$('#submit-button').text('Speichern');
|
||||
$('#cancel-button').hide();
|
||||
$('#id').val('');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>assets/js/datatables-std.js?<?= date('U') ?>"></script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
|
||||
@@ -29,7 +29,18 @@
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if($me->is("employee")): ?>
|
||||
<li class="has-submenu"><a href="#"><i class="far fa-fw fa-calendar-clock"></i>Zeiterfassung <div class="arrow-down"></div></a>
|
||||
<ul class="submenu">
|
||||
<li><a href="<?=self::getUrl("Timerecording")?>"><i class="far fa-fw fa-calendar text-info"></i> Buchungen</a></li>
|
||||
<?php if ($me->can('Fibu')): ?>
|
||||
<li><a href="<?=self::getUrl("TimerecordingCategory")?>"><i class="far fa-fw fa-list text-info"></i> Buchungsarten</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingPermit")?>"><i class="far fa-fw fa-calendar-check text-info"></i> Freigaben</a></li>
|
||||
<li><a href="<?=self::getUrl("TimerecordingReport")?>"><i class="far fa-fw fa-chart-pie text-info"></i> Auswertungen</a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin"]) || ($me->is("netowner") && $me->hasGwrNetworks())): ?>
|
||||
<li class="has-submenu">
|
||||
<a href="#">
|
||||
@@ -54,7 +65,7 @@
|
||||
<?php if($me->is(["Admin"]) || ($me->is("netowner") && $me->hasGwrNetworks())): ?>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("AddressDB")?>"><i class="fas fa-fw fa-city text-info "></i> GWR / AddressDB</a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if($me->is(["Admin"])): ?>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("OpenAccessId")?>"><i class="fad fa-fw fa-link-simple text-info"></i> Open Access IDs</a></li>
|
||||
<li class="mobile-hide"><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-fw fa-microchip text-info"></i> Technologien</a></li>
|
||||
@@ -64,8 +75,8 @@
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if($me->is(["Admin","netowner","lineplanner","pipeplanner","pipeworker","lineworker"])): ?>
|
||||
<li class="has-submenu mobile-hide">
|
||||
<a href="#">
|
||||
@@ -104,7 +115,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if($me->is(["Admin","netowner","salespartner"]) || $me->can(["Order", "Preorder"])): ?>
|
||||
<li class="has-submenu mobile-hide">
|
||||
<a href="#">
|
||||
@@ -134,7 +145,7 @@
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
-->
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<!-- End navigation menu -->
|
||||
|
||||
61
application/Timerecording/Timerecording.php
Normal file
61
application/Timerecording/Timerecording.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
class Timerecording extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
private $user;
|
||||
private $timerecordingCategory;
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
145
application/Timerecording/TimerecordingController.php
Normal file
145
application/Timerecording/TimerecordingController.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->is(["employee"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
$this->layout()->setTemplate("Timerecording/Index");
|
||||
$timerecordingCategoriess = TimerecordingCategoryModel::getAll();
|
||||
$this->layout()->set("timerecordingCategoriess", $timerecordingCategoriess);
|
||||
$timerecordings = TimerecordingModel::search(['user_id' => $this->me->id]);
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$timerecordingCategoriess = TimerecordingCategoryModel::getAll();
|
||||
$this->layout()->set("timerecordingCategoriess", $timerecordingCategoriess);
|
||||
$this->layout()->setTemplate("Timerecording/Form");
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Buchung nicht gefunden", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
|
||||
$timerecordings = new Timerecording($id);
|
||||
if ($timerecordings->id != $id) {
|
||||
$this->layout()->setFlash("Buchung nicht gefunden", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
|
||||
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
return $this->addAction();
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
$r = $this->request;
|
||||
$id = $r->id;
|
||||
$enddate = $r->enddate;
|
||||
if (!$enddate && $r->start && $r->end) {
|
||||
$starttime = strtotime($r->date . " " . $r->start . ":00");
|
||||
$endtime = strtotime($r->date . " " . $r->end . ":00");
|
||||
} elseif ($enddate) {
|
||||
$starttime = strtotime($r->date . " 00:00:00");
|
||||
$endtime = strtotime($enddate . " 23:59:00");
|
||||
} else if (!$enddate && !$r->start && !$r->end) {
|
||||
$starttime = strtotime($r->date . " 00:00:00");
|
||||
$endtime = NULL;
|
||||
}
|
||||
|
||||
if (is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$timerecordings = new Timerecording($id);
|
||||
if (!$timerecordings->id) {
|
||||
$this->layout()->setFlash("Buchungen nicht gefunden", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['user_id'] = $this->me->id;
|
||||
$data['start'] = $starttime;
|
||||
$data['end'] = $endtime;
|
||||
$data['timerecordingCategory_id'] = trim($r->timerecordingCategory_id);
|
||||
$data['commend'] = trim($r->commend);
|
||||
|
||||
if (!$data['user_id']) {
|
||||
$this->layout()->setFlash("Benutzer darf nicht leer sein", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
if ($data['start'] < 1577833200) {
|
||||
$this->layout()->setFlash("Ungültige Startzeit", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
if ($data['end'] && $data['end'] < 1577833200) {
|
||||
$this->layout()->setFlash("Ungültige Endzeit", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
if (!$data['timerecordingCategory_id']) {
|
||||
$data['timerecordingCategory_id'] = NULL;
|
||||
}
|
||||
if (!$data['commend']) {
|
||||
$data['commend'] = NULL;
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$timerecordings->update($data);
|
||||
|
||||
} else {
|
||||
$timerecordings = TimerecordingModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $timerecordings->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Buchung konnte nicht angelegt werden", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Buchung erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Buchung erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$timerecordings = new Timerecording($id);
|
||||
if (!$timerecordings->id || $timerecordings->id != $id) {
|
||||
$this->layout()->setFlash("Buchung nicht gefunden.", "error");
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
|
||||
$timerecordings->delete();
|
||||
$this->redirect("Timerecording");
|
||||
}
|
||||
|
||||
}
|
||||
148
application/Timerecording/TimerecordingModel.php
Normal file
148
application/Timerecording/TimerecordingModel.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingModel
|
||||
{
|
||||
private $user_id;
|
||||
private $start;
|
||||
private $end;
|
||||
private $timerecordingCategory_id;
|
||||
private $commend;
|
||||
private $approved;
|
||||
private $completed;
|
||||
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new Timerecording();
|
||||
|
||||
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("Timerecording", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Timerecording($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("Timerecording", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new Timerecording($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
public static function getAllPermits()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$sql = "SELECT Timerecording.* FROM `Timerecording`
|
||||
INNER JOIN `TimerecordingCategory` ON (`Timerecording`.`timerecordingCategory_id` = `TimerecordingCategory`.`id`)
|
||||
WHERE `TimerecordingCategory`.`approval`='1'";
|
||||
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new Timerecording($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("Timerecording", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new Timerecording($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("Timerecording", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new Timerecording($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
if (array_key_exists("user_id", $filter)) {
|
||||
$userid = $filter['user_id'];
|
||||
if (is_numeric($userid)) {
|
||||
$where .= " AND user_id=$userid";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
41
application/TimerecordingCategory/TimerecordingCategory.php
Normal file
41
application/TimerecordingCategory/TimerecordingCategory.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingCategory extends mfBaseModel
|
||||
{
|
||||
private $editor;
|
||||
private $creator;
|
||||
|
||||
|
||||
public function getProperty($name)
|
||||
{
|
||||
if ($this->$name == null) {
|
||||
|
||||
if (!$this->id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($name == "creator") {
|
||||
$this->creator = new User($this->create_by);
|
||||
return $this->creator;
|
||||
}
|
||||
|
||||
if ($name == "editor") {
|
||||
$this->editor = new User($this->edit_by);
|
||||
return $this->editor;
|
||||
}
|
||||
|
||||
$classname = ucfirst($name);
|
||||
$idfield = $name . "_id";
|
||||
$this->$name = new $classname($this->$idfield);
|
||||
|
||||
if ($this->$name->id) {
|
||||
return $this->$name;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingCategoryController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->can(["Fibu"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("TimerecordingCategories/Index");
|
||||
$timerecordingcategoriesapproval = TimerecordingCategoryModel::$approval_definition;
|
||||
$timerecordingcategorieshourday = TimerecordingCategoryModel::$hourday_definition;
|
||||
$timerecordingcategoriesrequire_comment = TimerecordingCategoryModel::$require_comment_definition;
|
||||
$timerecordingcategoriess = TimerecordingCategoryModel::getAll();
|
||||
$this->layout()->set("timerecordingcategoriesrequire_comment", $timerecordingcategoriesrequire_comment);
|
||||
$this->layout()->set("timerecordingcategorieshourday", $timerecordingcategorieshourday);
|
||||
$this->layout()->set("timerecordingcategoriesapproval", $timerecordingcategoriesapproval);
|
||||
$this->layout()->set("timerecordingcategoriess", $timerecordingcategoriess);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
$timerecordingcategorieshourday = TimerecordingCategoryModel::$hourday_definition;
|
||||
$this->layout()->set("timerecordingcategorieshourday", $timerecordingcategorieshourday);
|
||||
$this->layout()->setTemplate("TimerecordingCategories/Form");
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
|
||||
if (!is_numeric($id) || !$id) {
|
||||
$this->layout()->setFlash("Zeiterfassung Kategorie nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingCategory");
|
||||
}
|
||||
|
||||
$timerecordingcategoriess = new TimerecordingCategory($id);
|
||||
if ($timerecordingcategoriess->id != $id) {
|
||||
$this->layout()->setFlash("Zeiterfassung Kategorie nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingCategory");
|
||||
}
|
||||
$timerecordingcategorieshourday = TimerecordingCategoryModel::$hourday_definition;
|
||||
$this->layout()->set("timerecordingcategorieshourday", $timerecordingcategorieshourday);
|
||||
$this->layout()->set("timerecordingcategoriess", $timerecordingcategoriess);
|
||||
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";
|
||||
$timerecordingcategoriess = new TimerecordingCategory($id);
|
||||
if (!$timerecordingcategoriess->id) {
|
||||
$this->layout()->setFlash("Zeiterfassung Kategorien nicht gefunden", "error");
|
||||
$this->redirect("TimerecordingCategory");
|
||||
}
|
||||
} else {
|
||||
$mode = "add";
|
||||
}
|
||||
|
||||
$data = [];
|
||||
$data['name'] = trim($r->name);
|
||||
$data['short'] = trim($r->short);
|
||||
$data['hourday'] = trim($r->hourday);
|
||||
$data['approval'] = trim($r->approval);
|
||||
$data['require_comment'] = trim($r->require_comment);
|
||||
|
||||
|
||||
if (!$data['name']) {
|
||||
$data['name'] = NULL;
|
||||
}
|
||||
if (!$data['short']) {
|
||||
$data['short'] = NULL;
|
||||
}
|
||||
if (!$data['approval']) {
|
||||
$data['approval'] = 0;
|
||||
}
|
||||
if (!$data['require_comment']) {
|
||||
$data['require_comment'] = 0;
|
||||
}
|
||||
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$timerecordingcategoriess->update($data);
|
||||
|
||||
} else {
|
||||
$timerecordingcategoriess = TimerecordingCategoryModel::create($data);
|
||||
}
|
||||
// var_dump($filestore);
|
||||
// exit;
|
||||
$id = $timerecordingcategoriess->save();
|
||||
|
||||
if (!$id) {
|
||||
$this->layout()->setFlash("Zeiterfassung Kategorie konnte nicht angelegt werden", "error");
|
||||
$this->redirect("TimerecordingCategory");
|
||||
}
|
||||
|
||||
if ($mode == "edit") {
|
||||
$this->layout()->setFlash("Zeiterfassung Kategorie erfolgreich geändert", "success");
|
||||
} else if ($mode = "add") {
|
||||
$this->layout()->setFlash("Zeiterfassung Kategorie erfolgreich angelegt", "success");
|
||||
}
|
||||
$this->redirect("TimerecordingCategory");
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$timerecordingcategoriess = new TimerecordingCategory($id);
|
||||
if (!$timerecordingcategoriess->id || $timerecordingcategoriess->id != $id) {
|
||||
$this->layout()->setFlash("Zeiterfassung Kategorie nicht gefunden.", "error");
|
||||
$this->redirect("TimerecordingCategory");
|
||||
}
|
||||
|
||||
$timerecordingcategoriess->delete();
|
||||
$this->redirect("TimerecordingCategory");
|
||||
}
|
||||
|
||||
}
|
||||
132
application/TimerecordingCategory/TimerecordingCategoryModel.php
Normal file
132
application/TimerecordingCategory/TimerecordingCategoryModel.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingCategoryModel
|
||||
{
|
||||
private $name;
|
||||
private $short;
|
||||
private $hourday;
|
||||
private $approval;
|
||||
private $require_comment;
|
||||
public static $hourday_definition = array(1 => "Uhrzeit (von/bis)", 2 => "Tage (von/bis)", 3 => "Startdatum", 4 => "Enddatum");
|
||||
public static $approval_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $require_comment_definition = array(0 => "Nein", 1 => "Ja");
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static function create(array $data)
|
||||
{
|
||||
$model = new TimerecordingCategory();
|
||||
|
||||
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("timerecordingCategory", "*", "id=$id LIMIT 1");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingCategory($data);
|
||||
}
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
$items = [];
|
||||
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$res = $db->select("TimerecordingCategory", "*", "1=1");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingCategory($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static function getFirst()
|
||||
{
|
||||
$db = FronkDB::singleton();
|
||||
|
||||
$where = self::getSqlFilter($filter);
|
||||
$res = $db->select("TimerecordingCategory", "*", "$where ");
|
||||
if ($db->num_rows($res)) {
|
||||
$data = $db->fetch_object($res);
|
||||
$item = new TimerecordingCategory($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("TimerecordingCategory", "*", "$where");
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_object($res)) {
|
||||
$items[] = new TimerecordingCategory($data);
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
private static function getSqlFilter($filter)
|
||||
{
|
||||
$where = "1=1 ";
|
||||
|
||||
//var_dump($filter);exit;
|
||||
if (array_key_exists("network_id", $filter)) {
|
||||
$networkid = $filter['network_id'];
|
||||
if (is_numeric($networkid)) {
|
||||
$where .= " AND network_id=$networkid";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingPermitController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->can(["Fibu"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("TimerecordingPermit/Index");
|
||||
$timerecordingCategoriess = TimerecordingCategoryModel::getAll();
|
||||
$this->layout()->set("timerecordingCategoriess", $timerecordingCategoriess);
|
||||
$timerecordings = TimerecordingModel::getAllPermits();
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected function approveAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
$timerecordings = new Timerecording($id);
|
||||
if (!$timerecordings->id || $timerecordings->id != $id) {
|
||||
$this->layout()->setFlash("Buchung nicht gefunden.", "error");
|
||||
$this->redirect("TimerecordingPermit");
|
||||
}
|
||||
$data = [];
|
||||
$data['approved'] = 1;
|
||||
$timerecordings->update($data);
|
||||
$timerecordings->save();
|
||||
|
||||
$this->redirect("TimerecordingPermit");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
class TimerecordingReportController extends mfBaseController
|
||||
{
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->needlogin = true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me", $me);
|
||||
|
||||
if (!$me->can(["Fibu"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
protected function indexAction()
|
||||
{
|
||||
|
||||
$this->layout()->setTemplate("TimerecordingReport/Index");
|
||||
$timerecordingCategoriess = TimerecordingCategoryModel::getAll();
|
||||
$this->layout()->set("timerecordingCategoriess", $timerecordingCategoriess);
|
||||
$timerecordings = TimerecordingModel::getAll();
|
||||
$this->layout()->set("timerecordings", $timerecordings);
|
||||
|
||||
}
|
||||
|
||||
protected function addAction()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected function editAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function saveAction()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
protected function deleteAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
42
db/migrations/20240108081420_timerecording.php
Normal file
42
db/migrations/20240108081420_timerecording.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
use Phinx\Util\Literal;
|
||||
|
||||
final class Timerecording extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$timerecording = $this->table("Timerecording", ["signed" => true]);
|
||||
$timerecording->addColumn("user_id", "integer", ["null" => false])->addIndex(["user_id"]);
|
||||
$timerecording->addColumn("start", "integer", ["null" => true]);
|
||||
$timerecording->addColumn("end", "integer", ["null" => true]);
|
||||
$timerecording->addColumn("timerecordingCategory_id", "integer", ["null" => false]);
|
||||
$timerecording->addColumn("commend", "text", ["null" => true]);
|
||||
$timerecording->addColumn("approved", "integer", ["null" => false, "default" => "0"]);
|
||||
$timerecording->addColumn("completed", "integer", ["null" => false, "default" => "0"]);
|
||||
$timerecording->addColumn("create_by", "integer", ["null" => false]);
|
||||
$timerecording->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$timerecording->addColumn("create", "integer", ["null" => false]);
|
||||
$timerecording->addColumn("edit", "integer", ["null" => false]);
|
||||
$timerecording->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("Timerecording")->drop()->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
39
db/migrations/20240108081441_timerecording_category.php
Normal file
39
db/migrations/20240108081441_timerecording_category.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingCategory extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$timerecordingCategory = $this->table("TimerecordingCategory", ["signed" => true]);
|
||||
$timerecordingCategory->addColumn("name", "text", ["null" => false]);
|
||||
$timerecordingCategory->addColumn("short", "string", ["null" => true, "limit" => 64]);
|
||||
$timerecordingCategory->addColumn("hourday", "integer", ["null" => false, "default" => "1", "comment" => "1:Stunden/2:Tage/3:Startdatum/4:Enddatum"]);
|
||||
$timerecordingCategory->addColumn("approval", "integer", ["null" => false, "default" => "0"]);
|
||||
$timerecordingCategory->addColumn("require_comment", "integer", ["null" => false, "default" => "0"]);
|
||||
$timerecordingCategory->addColumn("create_by", "integer", ["null" => false]);
|
||||
$timerecordingCategory->addColumn("edit_by", "integer", ["null" => false]);
|
||||
$timerecordingCategory->addColumn("create", "integer", ["null" => false]);
|
||||
$timerecordingCategory->addColumn("edit", "integer", ["null" => false]);
|
||||
$timerecordingCategory->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingCategory")->drop()->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user