Merge branch 'spidev' into 'master'

Zeiterfassung Update

See merge request fronk/thetool!1839
This commit is contained in:
Daniel Spitzer
2025-10-11 16:31:01 +00:00
5 changed files with 508 additions and 443 deletions
+467 -439
View File
@@ -6,509 +6,537 @@ foreach ($days as $key => $day) {
$daysSelect .= "</select>"; $daysSelect .= "</select>";
?> ?>
<script> <script>
var daysselect = `<?= $daysSelect ?>`; var daysselect = `<?= $daysSelect ?>`;
</script> </script>
<link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet" <link href="<?= self::getResourcePath() ?>assets/css/select2-cstm.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/> type="text/css"/>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet" <link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/> type="text/css"/>
<style> <style>
.fa-circle-plus { .fa-circle-plus {
color: #00b125; color: #00b125;
cursor: pointer; cursor: pointer;
font-size: 17px; font-size: 17px;
float: right; float: right;
} }
.remove-workinghours { .remove-workinghours {
cursor: pointer; cursor: pointer;
color: #ff0606; color: #ff0606;
font-size: 17px; font-size: 17px;
float: right; float: right;
margin-left: 7px; margin-left: 7px;
margin-top: 8px; margin-top: 8px;
} }
.remove-wh-history { .remove-wh-history {
cursor: pointer; cursor: pointer;
color: #ff0606; color: #ff0606;
font-size: 17px; font-size: 17px;
float: right; float: right;
margin-left: 7px; margin-left: 7px;
} }
</style> </style>
<!-- start page title --> <!-- start page title -->
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="page-title-box"> <div class="page-title-box">
<div class="page-title-right"> <div class="page-title-right">
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a> <li class="breadcrumb-item"><a href="<?= self::getUrl("Dashboard") ?>"><?= MFAPPNAME_SLUG ?></a>
</li> </li>
<li class="breadcrumb-item"><a <li class="breadcrumb-item"><a
href="<?= self::getUrl("TimerecordingEmployee") ?>">Personaladministration</a></li> href="<?= self::getUrl("TimerecordingEmployee") ?>">Personaladministration</a></li>
<li class="breadcrumb-item active"><?= ($timerecordingemployees->id) ? "bearbeiten" : "Neu" ?></li> <li class="breadcrumb-item active"><?= ($timerecordingemployees->id) ? "bearbeiten" : "Neu" ?></li>
</ol> </ol>
</div>
<h4 class="page-title"><?= ($timerecordingemployees->id) ? "Personaladministration" : "Personaladministration" ?></h4>
</div> </div>
<h4 class="page-title"><?= ($timerecordingemployees->id) ? "Personaladministration" : "Personaladministration" ?></h4>
</div> </div>
</div> </div>
<!-- end page title --> </div>
<div class="row"> <!-- end page title -->
<div class="col-lg-12"> <div class="row">
<div class="col-lg-12">
<div class="card bg-light"> <div class="card bg-light">
<div class="card-body"> <div class="card-body">
<h4 class="header-title mb-2"><?= ($timerecordingemployees->id) ? "Personaladministration" : "Personaladministration" ?></h4> <h4 class="header-title mb-2"><?= ($timerecordingemployees->id) ? "Personaladministration" : "Personaladministration" ?></h4>
<form class="form-horizontal" method="post" <form class="form-horizontal" method="post"
action="<?= self::getUrl("TimerecordingEmployee", "save") ?>"> action="<?= self::getUrl("TimerecordingEmployee", "save") ?>">
<div class="card no-shadow"> <div class="card no-shadow">
<div class="card-body"> <div class="card-body">
<input type="hidden" name="id" value="<?= $timerecordingemployees->id ?>"/> <input type="hidden" name="id" value="<?= $timerecordingemployees->id ?>"/>
<div class="form-group row"> <div class="card no-shadow">
<label class="col-lg-2 col-form-label" <div class="card-body">
for="bmd_active">Aktive Verrechnung</label> <h3>Allgemein</h3>
<div class="col-lg-3">
<div class="form-check">
<input id="bmd_active"
class="form-check-input" <?php if ($timerecordingemployees->bmd_active) echo 'checked="checked"'; ?>
type="checkbox" name="bmd_active" value="1"/>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="user_id">Mitarbeiter *</label>
<div class="col-lg-3">
<select required="required" id="user_id" name="user_id"
class="select2 form-control">
<option value="<?= $timerecordinguser[0]->id ?>"><?= $timerecordinguser[0]->name ?></option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="type">Vertragsart *</label>
<div class="col-lg-3">
<select class="select2 form-control " name="type" id="type">
<option value="1" <?= ($timerecordingemployees->type == '1') ? "selected='selected'" : "" ?>>
Angestellter
</option>
<option value="2" <?= ($timerecordingemployees->type == '2') ? "selected='selected'" : "" ?>>
Arbeiter
</option>
<option value="3" <?= ($timerecordingemployees->type == '3') ? "selected='selected'" : "" ?>>
Lehrling
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="startdate">Startdatum
Zeiterfassung</label>
<div class="col-lg-2">
<input required="required" type="date" id="startdate" name="startdate"
class="form-control"
value="<?= ($timerecordingemployees->startdate) ? date('Y-m-d', $timerecordingemployees->startdate) : "" ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="enddate">Enddatum
Zeiterfassung</label>
<div class="col-lg-2">
<input type="date" id="enddate" name="enddate"
class="form-control"
value="<?= ($timerecordingemployees->enddate) ? date('Y-m-d', $timerecordingemployees->enddate) : "" ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="birthday">Geburtstag</label>
<div class="col-lg-2">
<input type="date" id="birthday" name="birthday"
class="form-control"
value="<?= ($timerecordingemployees->birthday) ? date('Y-m-d', $timerecordingemployees->birthday) : "" ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="insurance_number">SV-Nummer (4 stellig)</label>
<div class="col-lg-1">
<input type="number" id="insurance_number" name="insurance_number"
class="form-control" max="9999"
value="<?= ($timerecordingemployees->insurance_number) ?: "" ?>"/>
</div>
</div>
<?php if ($me->superexpertEnabled()): ?>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bpahours">Black Pig Stunden</label>
<div class="col-lg-1">
<input required="required" type="text" id="bpahours" name="bpahours"
class="form-control"
value="<?= str_replace(".", ",", $timerecordingemployees->bpahours / 3600) ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bpahours_value">Black Pig
Bewertung</label>
<div class="col-lg-1">
<input required="required" type="text" id="bpahours_value"
name="bpahours_value"
class="form-control"
value="<?= str_replace(".", ",", $timerecordingemployees->bpahours_value) ?>"/>
</div>
</div>
<?php endif; ?>
<div class="form-group row" style="display:none">
<label class="col-lg-2 col-form-label" for="holidays">Initiale Urlaubstage</label>
<div class="col-lg-1">
<input type="number" id="holidays" name="holidays"
class="form-control"
value="<?= $timerecordingemployees->holidays ?>"/>
</div>
</div>
<div class="form-group row" style="">
<label class="col-lg-2 col-form-label" for="plushours">Initiale Gutstunden</label>
<div class="col-lg-1">
<input type="text" id="plushours" name="plushours"
class="form-control"
value="<?= str_replace(".", ",", $timerecordingemployees->plushours / 3600) ?>"/>
</div>
</div>
<div class="form-group row" style="">
<label class="col-lg-2 col-form-label" for="overtime">Initiale Überstunden</label>
<div class="col-lg-1">
<input type="text" id="overtime" name="overtime"
class="form-control"
value="<?= str_replace(".", ",", $timerecordingemployees->overtime / 3600) ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label"
for="auto_workinghours">Schnellbuchung</label>
<div class="col-lg-3">
<div class="form-check">
<input id="auto_workinghours"
class="form-check-input" <?php if ($timerecordingemployees->auto_workinghours) echo 'checked="checked"'; ?>
type="checkbox" name="auto_workinghours" value="1"/>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label"
for="auto_workinghours">Jobrad</label>
<div class="col-lg-3">
<div class="form-check">
<input id="jobbike"
class="form-check-input" <?php if ($timerecordingemployees->jobbike) echo 'checked="checked"'; ?>
type="checkbox" name="jobbike" value="1"/>
</div>
</div>
</div>
<?php if ($me->superexpertEnabled()): ?>
<div class="form-group row"> <div class="form-group row">
<label class="col-lg-2 col-form-label" <label class="col-lg-2 col-form-label"
for="bmd_active">Nur im Admin-Mode sichtbar</label> for="bmd_active">Aktive Verrechnung</label>
<div class="col-lg-3"> <div class="col-lg-3">
<div class="form-check"> <div class="form-check">
<input id="only_admin" <input id="bmd_active"
class="form-check-input" <?php if ($timerecordingemployees->only_admin) echo 'checked="checked"'; ?> class="form-check-input" <?php if ($timerecordingemployees->bmd_active) echo 'checked="checked"'; ?>
type="checkbox" name="only_admin" value="1"/> type="checkbox" name="bmd_active" value="1"/>
</div> </div>
</div> </div>
</div> </div>
<?php endif; ?>
<div id="workinghours_div">
<div class="form-group row"> <div class="form-group row">
<label class="col-lg-2 col-form-label" for="workinghours">Sollzeiten <label class="col-lg-2 col-form-label" for="user_id">Mitarbeiter *</label>
Arbeitswoche <i <div class="col-lg-3">
class="fa-regular fa-circle-plus add-workinghours"></i></label> <select required="required" id="user_id" name="user_id"
<div class="col-lg-2 text-center"> class="select2 form-control">
<label class="col-form-label" for="workinghours"><span <option value="<?= $timerecordinguser[0]->id ?>"><?= $timerecordinguser[0]->name ?></option>
id="workinghours-text">0 Stunden 0 Minuten</span></label> </select>
</div> </div>
<div class="col-lg-2 text-center"> </div>
<button type="button" id="change-workinghours" data-toggle="modal" <div class="form-group row">
data-target="#closeWorkingHoursModal" class="btn btn-danger"> <label class="col-lg-2 col-form-label" for="type">Vertragsart *</label>
Arbeitszeit Abschluss <div class="col-lg-3">
</button> <select class="select2 form-control " name="type" id="type">
<option value="1" <?= ($timerecordingemployees->type == '1') ? "selected='selected'" : "" ?>>
Angestellter
</option>
<option value="2" <?= ($timerecordingemployees->type == '2') ? "selected='selected'" : "" ?>>
Arbeiter
</option>
<option value="3" <?= ($timerecordingemployees->type == '3') ? "selected='selected'" : "" ?>>
Lehrling
</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="startdate">Startdatum
Zeiterfassung</label>
<div class="col-lg-2">
<input required="required" type="date" id="startdate" name="startdate"
class="form-control"
value="<?= ($timerecordingemployees->startdate) ? date('Y-m-d', $timerecordingemployees->startdate) : "" ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="enddate">Enddatum
Zeiterfassung</label>
<div class="col-lg-2">
<input type="date" id="enddate" name="enddate"
class="form-control"
value="<?= ($timerecordingemployees->enddate) ? date('Y-m-d', $timerecordingemployees->enddate) : "" ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="birthday">Geburtstag</label>
<div class="col-lg-2">
<input type="date" id="birthday" name="birthday"
class="form-control"
value="<?= ($timerecordingemployees->birthday) ? date('Y-m-d', $timerecordingemployees->birthday) : "" ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="insurance_number">SV-Nummer (4
stellig)</label>
<div class="col-lg-1">
<input type="number" id="insurance_number" name="insurance_number"
class="form-control" max="9999"
value="<?= ($timerecordingemployees->insurance_number) ?: "" ?>"/>
</div>
</div>
<?php if ($me->superexpertEnabled()): ?>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bpahours">Black Pig
Stunden</label>
<div class="col-lg-1">
<input required="required" type="text" id="bpahours" name="bpahours"
class="form-control"
value="<?= str_replace(".", ",", $timerecordingemployees->bpahours / 3600) ?>"/>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bpahours_value">Black Pig
Bewertung</label>
<div class="col-lg-1">
<input required="required" type="text" id="bpahours_value"
name="bpahours_value"
class="form-control"
value="<?= str_replace(".", ",", $timerecordingemployees->bpahours_value) ?>"/>
</div>
</div>
<?php endif; ?>
<div class="form-group row" style="display:none">
<label class="col-lg-2 col-form-label" for="holidays">Initiale
Urlaubstage</label>
<div class="col-lg-1">
<input type="number" id="holidays" name="holidays"
class="form-control"
value="<?= $timerecordingemployees->holidays ?>"/>
</div> </div>
</div> </div>
<?php <div class="form-group row" style="">
if ($timerecordingworkinghours): <label class="col-lg-2 col-form-label" for="plushours">Initiale
Gutstunden</label>
<div class="col-lg-1">
<input type="text" id="plushours" name="plushours"
class="form-control"
value="<?= str_replace(".", ",", $timerecordingemployees->plushours / 3600) ?>"/>
</div>
</div>
foreach ($timerecordingworkinghours as $timerecordingworkinghour): ?> <div class="form-group row" style="">
<div class="form-group row wtime"> <label class="col-lg-2 col-form-label" for="overtime">Initiale
<div class="col-lg-2"> Überstunden</label>
<i class="fa-regular fa-circle-minus remove-workinghours"></i> <div class="col-lg-1">
</div> <input type="text" id="overtime" name="overtime"
<div class="col-lg-2"> class="form-control"
<select required="required" name="day[]" value="<?= str_replace(".", ",", $timerecordingemployees->overtime / 3600) ?>"/>
class="select2 form-control" </div>
readonly="readonly"> </div>
<?php foreach ($days as $key => $day) : ?> <div class="form-group row">
<option value="<?= $key ?>" <?= ($key == $timerecordingworkinghour->day) ? "selected='selected'" : "" ?>><?= $day ?></option>'; <label class="col-lg-2 col-form-label"
<?php endforeach; for="auto_workinghours">Schnellbuchung</label>
?> <div class="col-lg-3">
</select> <div class="form-check">
</div> <input id="auto_workinghours"
<div class="col-lg-1"> class="form-check-input" <?php if ($timerecordingemployees->auto_workinghours) echo 'checked="checked"'; ?>
<input type="time" name="timestart[]" class="form-control timestart" type="checkbox" name="auto_workinghours" value="1"/>
value="<?= $timerecordingworkinghour->start ?>" </div>
required="required"/> </div>
</div> </div>
<div class="col-lg-1"> <div class="form-group row">
<input required="required" type="time" name="timeend[]" <label class="col-lg-2 col-form-label"
class="form-control timeend" for="auto_workinghours">Jobrad</label>
value="<?= $timerecordingworkinghour->end ?>"/> <div class="col-lg-3">
<div class="form-check">
<input id="jobbike"
class="form-check-input" <?php if ($timerecordingemployees->jobbike) echo 'checked="checked"'; ?>
type="checkbox" name="jobbike" value="1"/>
</div>
</div>
</div>
<?php if ($me->superexpertEnabled()): ?>
<div class="form-group row">
<label class="col-lg-2 col-form-label"
for="bmd_active">Nur im Admin-Mode sichtbar</label>
<div class="col-lg-3">
<div class="form-check">
<input id="only_admin"
class="form-check-input" <?php if ($timerecordingemployees->only_admin) echo 'checked="checked"'; ?>
type="checkbox" name="only_admin" value="1"/>
</div> </div>
</div> </div>
<?php </div>
endforeach; <?php endif; ?>
endif
?>
</div> </div>
</div> </div>
</div> <div class="card no-shadow">
<div class="card-body">
<h3>Arbeitszeiten</h3>
<div class="form-group row">
<label class="col-lg-2 col-form-label"
for="auto_workinghours">Nacht Zulage</label>
<div class="col-lg-3">
<div class="form-check">
<input id="night_allowance"
class="form-check-input" <?php if ($timerecordingemployees->night_allowance) echo 'checked="checked"'; ?>
type="checkbox" name="night_allowance" value="1"/>
</div>
</div>
</div>
<div id="workinghours_div">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="workinghours">Sollzeiten
Arbeitswoche <i
class="fa-regular fa-circle-plus add-workinghours"></i></label>
<div class="col-lg-2 text-center">
<label class="col-form-label" for="workinghours"><span
id="workinghours-text">0 Stunden 0 Minuten</span></label>
</div>
<div class="col-lg-2 text-center">
<button type="button" id="change-workinghours" data-toggle="modal"
data-target="#closeWorkingHoursModal" class="btn btn-danger">
Arbeitszeit Abschluss
</button>
</div>
</div>
<div class="form-group row"> <?php
<label class="col-lg-2"></label> if ($timerecordingworkinghours):
<div class="col-lg-10">
<a href="<?= self::getUrl("TimerecordingEmployee") ?>">
<button type="button" class="btn btn-secondary">Abbrechen</button>
</a>
<button type="submit" class="btn btn-primary">Speichern</button>
</div> foreach ($timerecordingworkinghours as $timerecordingworkinghour): ?>
</div> <div class="form-group row wtime">
<div class="col-lg-2">
</form> <i class="fa-regular fa-circle-minus remove-workinghours"></i>
</div> </div>
<?php if ($timerecordingworkinghourshistory) : ?> <div class="col-lg-2">
<div class="card-body"> <select required="required" name="day[]"
class="select2 form-control"
<div class="card no-shadow"> readonly="readonly">
<div class="card-body"> <?php foreach ($days as $key => $day) : ?>
<div class="row"> <option value="<?= $key ?>" <?= ($key == $timerecordingworkinghour->day) ? "selected='selected'" : "" ?>><?= $day ?></option>';
<div class="col-lg-6"> <?php endforeach;
?>
<h4 class="header-title mb-2">Arbeitszeiten Historie</h4> </select>
<table id="datatable" class="table table-sm "> </div>
<thead> <div class="col-lg-1">
<tr> <input type="time" name="timestart[]"
<th class="text-center">Arbeitszeiten</th> class="form-control timestart"
<th class="text-center">Wochenstunden</th> value="<?= $timerecordingworkinghour->start ?>"
<th class="text-center">Bis</th> required="required"/>
<th></th> </div>
</tr> <div class="col-lg-1">
</thead> <input required="required" type="time" name="timeend[]"
<tbody> class="form-control timeend"
value="<?= $timerecordingworkinghour->end ?>"/>
</div>
</div>
<?php <?php
foreach ($timerecordingworkinghourshistory as $key => $timerecordingworkinghours): endforeach;
if (!$timerecordingworkinghours['workinghours']) { endif
$historyworkingkours = '0 Stunden'; ?>
$historyworkingkoursText = "keine";
} else {
$historyworkingkoursText = $timerecordingworkinghours['workinghours'];
$hours = $timerecordingworkinghours['workingtime'] / 3600;
$historyworkingkours = $hours . ' Stunden';
}
?>
<tr>
<td class="text-center"><?= $historyworkingkoursText ?></td>
<td class="text-center"><?= $historyworkingkours ?></td>
<td class="text-center"><?= date('d.m.Y', $key) ?></td>
<td><i class="fa-regular fa-circle-minus remove-wh-history" data-id="<?= $timerecordingworkinghours['id'] ?>"></i>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php endif; ?>
</div>
</div> <div class="form-group row">
</div> <label class="col-lg-2"></label>
<div class="col-lg-10">
<div class="modal fade" id="closeWorkingHoursModal" tabindex="-1" role="dialog" <a href="<?= self::getUrl("TimerecordingEmployee") ?>">
aria-labelledby="closeWorkingHoursModalTitle" aria-hidden="true"> <button type="button" class="btn btn-secondary">Abbrechen</button>
<div class="modal-dialog modal-dialog-centered" role="document"> </a>
<div class="modal-content"> <button type="submit" class="btn btn-primary">Speichern</button>
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Arbeitszeit abschließen</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group row justify-content-center ">
<label class="col-lg-5 col-form-label" for="user_id">Letzter Tag</label>
<div class="col-lg-5">
<input type="date" id="workingHoursCloseDate" class="form-control required">
</div>
</div>
<div class="form-group row justify-content-center ">
<div class="col-lg-12 row justify-content-center"><h4 class="p-0 m-1">Arbeitszeiten</h4></div>
<div class="col-lg-12 row justify-content-center"><h5 class="p-0 m-1"
id="workingHoursTime"></h5></div>
<div id="old-workingHours" class="col-lg-10">
<table class="table table-sm">
</table>
</div> </div>
</div> </div>
</form>
</div>
<?php if ($timerecordingworkinghourshistory) : ?>
<div class="card-body">
<div class="card no-shadow">
<div class="card-body">
<div class="row">
<div class="col-lg-6">
<h4 class="header-title mb-2">Arbeitszeiten Historie</h4>
<table id="datatable" class="table table-sm ">
<thead>
<tr>
<th class="text-center">Arbeitszeiten</th>
<th class="text-center">Wochenstunden</th>
<th class="text-center">Bis</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
foreach ($timerecordingworkinghourshistory as $key => $timerecordingworkinghours):
if (!$timerecordingworkinghours['workinghours']) {
$historyworkingkours = '0 Stunden';
$historyworkingkoursText = "keine";
} else {
$historyworkingkoursText = $timerecordingworkinghours['workinghours'];
$hours = $timerecordingworkinghours['workingtime'] / 3600;
$historyworkingkours = $hours . ' Stunden';
}
?>
<tr>
<td class="text-center"><?= $historyworkingkoursText ?></td>
<td class="text-center"><?= $historyworkingkours ?></td>
<td class="text-center"><?= date('d.m.Y', $key) ?></td>
<td><i class="fa-regular fa-circle-minus remove-wh-history"
data-id="<?= $timerecordingworkinghours['id'] ?>"></i>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div> </div>
<div class="modal-footer"> <?php endif; ?>
<button type="button" class="btn btn-success" id="save-close-workingHours">Abschließen</button> </div>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
</div>
</div>
<div class="modal fade" id="closeWorkingHoursModal" tabindex="-1" role="dialog"
aria-labelledby="closeWorkingHoursModalTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Arbeitszeit abschließen</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="form-group row justify-content-center ">
<label class="col-lg-5 col-form-label" for="user_id">Letzter Tag</label>
<div class="col-lg-5">
<input type="date" id="workingHoursCloseDate" class="form-control required">
</div>
</div> </div>
<div class="form-group row justify-content-center ">
<div class="col-lg-12 row justify-content-center"><h4 class="p-0 m-1">Arbeitszeiten</h4></div>
<div class="col-lg-12 row justify-content-center"><h5 class="p-0 m-1"
id="workingHoursTime"></h5></div>
<div id="old-workingHours" class="col-lg-10">
<table class="table table-sm">
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" id="save-close-workingHours">Abschließen</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
</div> </div>
</div> </div>
</div> </div>
<script type="text/javascript"> </div>
function checktime() { <script type="text/javascript">
var sum = 0; function checktime() {
$(".wtime").each(function (index) { var sum = 0;
var newdatestart = new Date('2020/01/01 ' + $(this).find('.timestart').val() + ':00'); $(".wtime").each(function (index) {
var newdateend = new Date('2020/01/01 ' + $(this).find('.timeend').val() + ':00'); var newdatestart = new Date('2020/01/01 ' + $(this).find('.timestart').val() + ':00');
var differenz = (newdateend - newdatestart) / 1000; var newdateend = new Date('2020/01/01 ' + $(this).find('.timeend').val() + ':00');
var differenz = (newdateend - newdatestart) / 1000;
sum = sum + differenz; sum = sum + differenz;
});
var timenew = Math.floor(sum / 3600) + ' Stunden ' + Math.floor((sum % 3600) / 60) + ' Minuten';
$('#workinghours-text').text(timenew);
}
$(".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')
}); });
var timenew = Math.floor(sum / 3600) + ' Stunden ' + Math.floor((sum % 3600) / 60) + ' Minuten';
$('#workinghours-text').text(timenew);
}
$("#workinghours_div").on("change", "input", function () { $(".select2").select2({placeholder: ""});
checktime();
}); // 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')
});
$("body").on("click", ".remove-workinghours", function () { $("#workinghours_div").on("change", "input", function () {
$(this).closest('.form-group').remove(); checktime();
checktime(); });
});
$("body").on("click", ".add-workinghours", function () { $("body").on("click", ".remove-workinghours", function () {
$('#workinghours_div').append(`<div class="form-group row wtime"><div class="col-lg-2"><i class="fa-regular fa-circle-minus remove-workinghours"></i></div><div class="col-lg-2">` + $(this).closest('.form-group').remove();
daysselect + `</div><div class="col-lg-1"><input type="time" name="timestart[]" class="form-control timestart" checktime();
});
$("body").on("click", ".add-workinghours", function () {
$('#workinghours_div').append(`<div class="form-group row wtime"><div class="col-lg-2"><i class="fa-regular fa-circle-minus remove-workinghours"></i></div><div class="col-lg-2">` +
daysselect + `</div><div class="col-lg-1"><input type="time" name="timestart[]" class="form-control timestart"
value="07:00" required="required" /></div><div class="col-lg-1"><input required="required" type="time" name="timeend[]" class="form-control timeend" value="07:00" required="required" /></div><div class="col-lg-1"><input required="required" type="time" name="timeend[]" class="form-control timeend"
value="15:00" /></div>`); value="15:00" /></div>`);
checktime(); checktime();
$(".select2").select2({placeholder: ""}); $(".select2").select2({placeholder: ""});
}) })
$(document).ready(function () { $(document).ready(function () {
checktime(); checktime();
$('#closeWorkingHoursModal').on('shown.bs.modal', function () { $('#closeWorkingHoursModal').on('shown.bs.modal', function () {
$('#old-workingHours table').empty(); $('#old-workingHours table').empty();
$('#workingHoursCloseDate').val(''); $('#workingHoursCloseDate').val('');
$('#workingHoursTime').text($('#workinghours-text').text()); $('#workingHoursTime').text($('#workinghours-text').text());
if ($(".wtime").length > 0) { if ($(".wtime").length > 0) {
$(".wtime").each(function (index) {
var day = $(this).find('select').val();
var start = $(this).find('.timestart').val();
var end = $(this).find('.timeend').val();
var dayname = $(this).find('select option:selected').text();
var html = '<tr><td>' + dayname + '</td><td>' + start + '</td><td>' + end + '</td></tr>';
$('#old-workingHours table').append(html);
});
} else {
$('#old-workingHours table').append('<tr><td class="text-center" colspan="3">Keine Arbeitszeiten</td></tr>');
}
$(".wtime").each(function (index) {
});
})
//old-workingHours
$('body').on('click', '#save-close-workingHours', function () {
let reqworkingHoursSaveUrl = '<?= self::getUrl("TimerecordingEmployee", "api", ['do' => 'saveWorkingHours']) ?>';
let workingHours = [];
$(".wtime").each(function (index) { $(".wtime").each(function (index) {
var day = $(this).find('select').val(); var day = $(this).find('select').val();
var start = $(this).find('.timestart').val(); var start = $(this).find('.timestart').val();
var end = $(this).find('.timeend').val(); var end = $(this).find('.timeend').val();
workingHours.push({day: day, start: start, end: end}); var dayname = $(this).find('select option:selected').text();
var html = '<tr><td>' + dayname + '</td><td>' + start + '</td><td>' + end + '</td></tr>';
$('#old-workingHours table').append(html);
}); });
let required = true; } else {
$('.required').each(function () { $('#old-workingHours table').append('<tr><td class="text-center" colspan="3">Keine Arbeitszeiten</td></tr>');
if ($(this).val() == '') { }
required = false; $(".wtime").each(function (index) {
$(this).addClass('is-invalid');
} else {
$(this).removeClass('is-invalid');
}
});
if (!required) {
return;
}
$.ajax({
url: reqworkingHoursSaveUrl,
type: 'POST',
data: {
workingHours: workingHours,
enddate: $('#workingHoursCloseDate').val(),
userid: <?= $timerecordinguser[0]->id ?>
},
success: function (data) {
$('#closeWorkingHoursModal').modal('hide');
location.reload();
}
});
});
$('body').on('click', '.remove-wh-history', function () {
let reqworkingHoursSaveUrl = '<?= self::getUrl("TimerecordingEmployee", "api", ['do' => 'deleteWorkingHours']) ?>'; });
let id = $(this).data('id'); })
if (!confirm('Arbeitszeitänderung löschen?')) {
return; //old-workingHours
$('body').on('click', '#save-close-workingHours', function () {
let reqworkingHoursSaveUrl = '<?= self::getUrl("TimerecordingEmployee", "api", ['do' => 'saveWorkingHours']) ?>';
let workingHours = [];
$(".wtime").each(function (index) {
var day = $(this).find('select').val();
var start = $(this).find('.timestart').val();
var end = $(this).find('.timeend').val();
workingHours.push({day: day, start: start, end: end});
});
let required = true;
$('.required').each(function () {
if ($(this).val() == '') {
required = false;
$(this).addClass('is-invalid');
} else {
$(this).removeClass('is-invalid');
}
});
if (!required) {
return;
}
$.ajax({
url: reqworkingHoursSaveUrl,
type: 'POST',
data: {
workingHours: workingHours,
enddate: $('#workingHoursCloseDate').val(),
userid: <?= $timerecordinguser[0]->id ?>
},
success: function (data) {
$('#closeWorkingHoursModal').modal('hide');
location.reload();
} }
$.ajax({
url: reqworkingHoursSaveUrl,
type: 'POST',
data: {
id: id,
userid: <?= $timerecordinguser[0]->id ?>
},
success: function (data) {
location.reload();
}
});
}); });
}); });
</script> $('body').on('click', '.remove-wh-history', function () {
let reqworkingHoursSaveUrl = '<?= self::getUrl("TimerecordingEmployee", "api", ['do' => 'deleteWorkingHours']) ?>';
let id = $(this).data('id');
if (!confirm('Arbeitszeitänderung löschen?')) {
return;
}
$.ajax({
url: reqworkingHoursSaveUrl,
type: 'POST',
data: {
id: id,
userid: <?= $timerecordinguser[0]->id ?>
},
success: function (data) {
location.reload();
}
});
});
});
</script>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?> <?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/footer.php"); ?>
@@ -167,6 +167,7 @@ class TimerecordingEmployeeController extends mfBaseController
$data['user_id'] = trim($r->user_id); $data['user_id'] = trim($r->user_id);
$data['auto_workinghours'] = trim($r->auto_workinghours); $data['auto_workinghours'] = trim($r->auto_workinghours);
$data['jobbike'] = trim($r->jobbike); $data['jobbike'] = trim($r->jobbike);
$data['night_allowance'] = trim($r->night_allowance);
$data['holidays'] = trim($r->holidays); $data['holidays'] = trim($r->holidays);
$data['plushours'] = $plushours; $data['plushours'] = $plushours;
$data['startdate'] = strtotime($r->startdate); $data['startdate'] = strtotime($r->startdate);
@@ -235,6 +236,9 @@ class TimerecordingEmployeeController extends mfBaseController
if (!$data['jobbike']) { if (!$data['jobbike']) {
$data['jobbike'] = 0; $data['jobbike'] = 0;
} }
if (!$data['night_allowance']) {
$data['night_allowance'] = 0;
}
if ($mode == "edit") { if ($mode == "edit") {
$timerecordingemployees->update($data); $timerecordingemployees->update($data);
@@ -12,6 +12,7 @@ class TimerecordingEmployeeModel
private $plushours_now; private $plushours_now;
private $plushours_timestamp; private $plushours_timestamp;
private $overtime; private $overtime;
private $night_allowance;
private $overtime_now; private $overtime_now;
private $overtime_timestamp; private $overtime_timestamp;
private $bpahours; private $bpahours;
@@ -564,7 +564,7 @@ class TimerecordingReportController extends mfBaseController
die(); die();
} }
private function checkOvertime($timerecording) private function checkOvertime($timerecording,$night_allowance=0)
{ {
$start = $timerecording->start; $start = $timerecording->start;
$end = $timerecording->end; $end = $timerecording->end;
@@ -583,10 +583,10 @@ class TimerecordingReportController extends mfBaseController
$end = $timerecording->end; $end = $timerecording->end;
$startday = date('Y-m-d', $start); $startday = date('Y-m-d', $start);
if (date('w', $start) == 0 || $holiDay[$startday]) { if ((date('w', $start) == 0 || $holiDay[$startday]) && $night_allowance==0) {
$O100free = $O100free + $timerecording->end - $timerecording->start; $O100free = $O100free + $timerecording->end - $timerecording->start;
} else { } else {
if ($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) { if (($start < $O100end || $start > $O100start || $end < $O100end || $end > $O100start) && $night_allowance==0) {
$sum = $end - $start; $sum = $end - $start;
if ($sum >= 10800) { if ($sum >= 10800) {
if ($start < $O100end) { if ($start < $O100end) {
@@ -653,6 +653,7 @@ class TimerecordingReportController extends mfBaseController
$plusHours_now = $employee[0]->plushours_now; $plusHours_now = $employee[0]->plushours_now;
$overtime_now = $employee[0]->overtime_now; $overtime_now = $employee[0]->overtime_now;
$auto_workinghours = $employee[0]->auto_workinghours; $auto_workinghours = $employee[0]->auto_workinghours;
$night_allowance= $employee[0]->night_allowance;
$startdate = $employee[0]->startdate; $startdate = $employee[0]->startdate;
if ($employee[0]->enddate) { if ($employee[0]->enddate) {
$enddate = strtotime(date('Y-m-d', $employee[0]->enddate) . " 23:59:59"); $enddate = strtotime(date('Y-m-d', $employee[0]->enddate) . " 23:59:59");
@@ -885,7 +886,7 @@ class TimerecordingReportController extends mfBaseController
$nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name; $nlzTimes[$timerecording->id]['category'] = $timerecording->timerecordingCategory->name;
$nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short; $nlzTimes[$timerecording->id]['categoryshort'] = $timerecording->timerecordingCategory->short;
} else { } else {
$overtimes = $this->checkOvertime($timerecording); $overtimes = $this->checkOvertime($timerecording,$night_allowance);
$isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum']; $isSecondscleanarray[$timerecording->timerecordingCategory->short] = $isSecondscleanarray[$timerecording->timerecordingCategory->short] - $overtimes['sum'];
if ($employee->only_admin != 1) { if ($employee->only_admin != 1) {
@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
use Phinx\Migration\AbstractMigration;
final class TimerecordingEmployeeAddNigthAllowance extends AbstractMigration
{
public function up(): void
{
if ($this->getEnvironment() == "thetool") {
$table = $this->table("TimerecordingEmployee", ["signed" => true]);
$table->addColumn("night_allowance", "integer", ["null" => false,'default' => 0, "after" => "overtime"]);
$table->update();
}
if($this->getEnvironment() == "addressdb") {
}
}
public function down(): void
{
if($this->getEnvironment() == "thetool") {
$this->table("TimerecordingEmployee")->removeColumn("night_allowance")->save();
}
if($this->getEnvironment() == "addressdb") {
}
}
}