Zeiterfassung update
This commit is contained in:
@@ -19,10 +19,10 @@ for ($i = 1; $i <= 25; $i++) {
|
||||
$year = date('Y', $time);
|
||||
$timestamp_montag = strtotime("{$year}-W{$kw}");
|
||||
$timestamp_freitag = strtotime("{$year}-W{$kw}-5");
|
||||
|
||||
$weeks[$time] = "KW" . $kw . " " . $year . " (" . date('d.m', $timestamp_montag) . "-" . date('d.m', $timestamp_freitag) . ")";
|
||||
$time = $time - 604800;
|
||||
}
|
||||
|
||||
$time = time();
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$mon = date('n', $time);
|
||||
@@ -34,9 +34,8 @@ for ($i = 1; $i <= 12; $i++) {
|
||||
$years[time() + 31536000] = date('Y', time() + 31536000);
|
||||
$years[time()] = date('Y', time());
|
||||
$years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<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"
|
||||
@@ -88,6 +87,10 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
background-color: #d0fbd9;
|
||||
}
|
||||
|
||||
.form-check-label {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!-- start page title -->
|
||||
<div class="row">
|
||||
@@ -122,7 +125,8 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
<option value="<?= $timerecordingCategories->id ?>"
|
||||
data-approval="<?= $timerecordingCategories->approval ?>"
|
||||
data-comment="<?= $timerecordingCategories->require_comment ?>"
|
||||
data-hourday="<?= $timerecordingCategories->hourday ?>"><?= $timerecordingCategories->name ?></option>
|
||||
data-hourday="<?= $timerecordingCategories->hourday ?>"
|
||||
data-businesstrip="<?= $timerecordingCategories->businesstrip ?>"><?= $timerecordingCategories->name ?></option>
|
||||
<?php
|
||||
endif;
|
||||
endforeach; ?>
|
||||
@@ -170,24 +174,44 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
</div>
|
||||
<div class="form-group col-lg-2">
|
||||
<label class="col-form-label" for="comment">Anmerkung</label>
|
||||
<input type="text" id="comment" name="comment" class="form-control"
|
||||
<input type="text" id="comment" name="comment" class="form-control"/>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-2 mb-2" id="businesstrip-div">
|
||||
|
||||
<div class="form-check text-center mt-1">
|
||||
<input class="form-check-input" type="checkbox" name="businesstrip" value=""
|
||||
id="businesstrip">
|
||||
<label class="form-check-label" for="businesstrip" value="1">
|
||||
Dienstreise > 12KM
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-2">
|
||||
<input style="display:none" type="text" id="businesstrip_info" name="businesstrip_info"
|
||||
placeholder="Ort"
|
||||
class="form-control"/>
|
||||
</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 id="cancel-button" type="button" class="btn btn-secondary" style="display:none">
|
||||
Abbrechen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class=" row mt-2">
|
||||
<div class="col-lg-4" id="message-box">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
@@ -229,7 +253,7 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
<div class="input-group">
|
||||
<select id="datayear" class="form-control select2">
|
||||
<?php foreach ($years as $key => $Year): ?>
|
||||
<option <?= (date('Y', time()) == $Year) ? "selected='selsected'" : NULL ?>
|
||||
<option <?= (date('Y', time()) == $Year) ? "selected='selected'" : NULL ?>
|
||||
value="<?= $key ?>"><?= $Year ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
@@ -314,8 +338,6 @@ $years[time() - 31536000] = date('Y', time() - 31536000);
|
||||
let insertUrl = "<?= self::getUrl("Timerecording", "save") ?>";
|
||||
let deleteUrl = "<?= self::getUrl("Timerecording", "delete") ?>";
|
||||
let requestUrl = "<?= self::getUrl("Timerecording", "api", ['do' => 'getTimerecordings']) ?>";
|
||||
|
||||
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="<?= self::getResourcePath() ?>js/pages/timerecording/index.js?<?= date('U') ?>"></script>
|
||||
|
||||
@@ -80,6 +80,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="businesstrip">Dienstreisemöglichkeit</label>
|
||||
<div class="col-lg-3">
|
||||
<div class="form-check">
|
||||
<input id="businesstrip" class="form-check-input" <?php if ($timerecordingcategoriess->businesstrip) echo 'checked="checked"'; ?>
|
||||
type="checkbox" name="businesstrip" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="only_admin">Nur für Buchhaltung zu buchen</label>
|
||||
<div class="col-lg-3">
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<th class="text-center">BMD KZ</th>
|
||||
<th class="text-center">Buchungszeitraum</th>
|
||||
<th class="text-center">Genehmigungspflichtig</th>
|
||||
<th class="text-center">Dienstreisemöglichkeit</th>
|
||||
<th class="text-center">Anmerkung Pflichtfeld</th>
|
||||
<th class="text-center">Nur Buchhaltung</th>
|
||||
<th class="edit-width"></th>
|
||||
@@ -52,17 +53,19 @@
|
||||
<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><?= $timerecordingcategoriesrequire_comment[$timerecordingcategories->only_admin] ?></td>
|
||||
<td class="text-center"><?= $timerecordingcategories->name ?></td>
|
||||
<td class="text-center"><?= $timerecordingcategories->short ?></td>
|
||||
<td class="text-center"><?= $timerecordingcategorieshourday[$timerecordingcategories->hourday] ?></td>
|
||||
<td class="text-center"><?= $timerecordingcategoriesapproval[$timerecordingcategories->approval] ?></td>
|
||||
<td class="text-center"><?= $timerecordingcategoriesbusinesstrip[$timerecordingcategories->businesstrip] ?></td>
|
||||
<td class="text-center"><?= $timerecordingcategoriesrequire_comment[$timerecordingcategories->require_comment] ?></td>
|
||||
<td class="text-center"><?= $timerecordingcategoriesrequire_only_admin[$timerecordingcategories->only_admin] ?></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>
|
||||
@@ -83,7 +86,7 @@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
var hidesearch = [6];
|
||||
var hidesearch = [7];
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
|
||||
@@ -22,9 +22,13 @@ class TimerecordingCategoryController extends mfBaseController
|
||||
$this->layout()->setTemplate("TimerecordingCategories/Index");
|
||||
$timerecordingcategoriesapproval = TimerecordingCategoryModel::$approval_definition;
|
||||
$timerecordingcategorieshourday = TimerecordingCategoryModel::$hourday_definition;
|
||||
$timerecordingcategoriesbusinesstrip = TimerecordingCategoryModel::$businesstrip_definition;
|
||||
$timerecordingcategoriesrequire_comment = TimerecordingCategoryModel::$require_comment_definition;
|
||||
$timerecordingcategoriesrequire_only_admin = TimerecordingCategoryModel::$require_only_admin;
|
||||
$timerecordingcategoriess = TimerecordingCategoryModel::getAll();
|
||||
$this->layout()->set("timerecordingcategoriesrequire_comment", $timerecordingcategoriesrequire_comment);
|
||||
$this->layout()->set("timerecordingcategoriesrequire_only_admin", $timerecordingcategoriesrequire_only_admin);
|
||||
$this->layout()->set("timerecordingcategoriesbusinesstrip", $timerecordingcategoriesbusinesstrip);
|
||||
$this->layout()->set("timerecordingcategorieshourday", $timerecordingcategorieshourday);
|
||||
$this->layout()->set("timerecordingcategoriesapproval", $timerecordingcategoriesapproval);
|
||||
$this->layout()->set("timerecordingcategoriess", $timerecordingcategoriess);
|
||||
@@ -82,6 +86,7 @@ class TimerecordingCategoryController extends mfBaseController
|
||||
$data['approval'] = trim($r->approval);
|
||||
$data['require_comment'] = trim($r->require_comment);
|
||||
$data['only_admin'] = trim($r->only_admin);
|
||||
$data['businesstrip'] = trim($r->businesstrip);
|
||||
|
||||
|
||||
if (!$data['name']) {
|
||||
@@ -99,7 +104,9 @@ class TimerecordingCategoryController extends mfBaseController
|
||||
if (!$data['only_admin']) {
|
||||
$data['only_admin'] = 0;
|
||||
}
|
||||
|
||||
if (!$data['businesstrip']) {
|
||||
$data['businesstrip'] = 0;
|
||||
}
|
||||
// var_dump($_FILES);
|
||||
// var_dump($upload);
|
||||
// exit;
|
||||
|
||||
@@ -8,9 +8,12 @@ class TimerecordingCategoryModel
|
||||
private $approval;
|
||||
private $require_comment;
|
||||
private $only_admin;
|
||||
private $businesstrip;
|
||||
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 $businesstrip_definition = array(0 => "Nein", 1 => "Ja");
|
||||
public static $require_only_admin = array(0 => "Nein", 1 => "Ja");
|
||||
|
||||
public static function find($data)
|
||||
{
|
||||
|
||||
@@ -106,6 +106,7 @@ class TimerecordingEmployeeController extends mfBaseController
|
||||
$data['user_id'] = trim($r->user_id);
|
||||
$data['auto_workinghours'] = trim($r->auto_workinghours);
|
||||
$data['holidays'] = trim($r->holidays);
|
||||
$data['businesstrip'] = trim($r->businesstrip);
|
||||
$data['plushours'] = $plushours;
|
||||
$data['startdate'] = strtotime($r->startdate);
|
||||
|
||||
@@ -118,7 +119,6 @@ class TimerecordingEmployeeController extends mfBaseController
|
||||
$data['auto_workinghours'] = 0;
|
||||
}
|
||||
|
||||
|
||||
if ($mode == "edit") {
|
||||
$timerecordingemployees->update($data);
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingCategoryAddFieldBusinesstrip extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("TimerecordingCategory", ["signed" => true]);
|
||||
$table->addColumn("businesstrip", "integer", ["null" => false, "default" => '0', "after" => "holidays"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("TimerecordingCategory")->removeColumn("businesstrip")->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class TimerecordingAddFieldsBusinesstrip extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("Timerecording", ["signed" => true]);
|
||||
$table->addColumn("businesstrip", "integer", ["null" => false, "default" => '0', "after" => "timerecordingCategory_id"]);
|
||||
$table->addColumn("businesstrip_info", "string", ["null" => true, "after" => "businesstrip"]);
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if ($this->getEnvironment() == "thetool") {
|
||||
$this->table("Timerecording")->removeColumn("businesstrip")->save();
|
||||
$this->table("Timerecording")->removeColumn("businesstrip_info")->save();
|
||||
}
|
||||
|
||||
if ($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ if (typeof columnfilter === "undefined") {
|
||||
var columnfilter;
|
||||
columnfilter = "";
|
||||
}
|
||||
|
||||
if (typeof columnoptions === "undefined") {
|
||||
var columnoptions;
|
||||
columnoptions = "";
|
||||
@@ -280,6 +281,19 @@ $(document).ready(function () {
|
||||
}
|
||||
$(".select2").select2();
|
||||
table.ajax.reload();
|
||||
});
|
||||
$("body").on("click", "#businesstrip", function () {
|
||||
if ($(this).prop('checked') == true) {
|
||||
$('#businesstrip_info').show();
|
||||
$('#businesstrip_info').prop('required', true);
|
||||
|
||||
} else {
|
||||
$('#businesstrip_info').hide();
|
||||
$('#businesstrip_info').val('');
|
||||
$('#businesstrip_info').prop('required', false);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
$("body").on("click", ".delete-item", function () {
|
||||
if (confirm('Buchung wirklich löschen?')) {
|
||||
@@ -287,11 +301,10 @@ $(document).ready(function () {
|
||||
id: $.trim($(this).data('id')),
|
||||
ajax: 1
|
||||
}).done(function (data) {
|
||||
|
||||
table.ajax.reload();
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$('form').submit(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user