User/rework

This commit is contained in:
Luca Haid
2025-03-17 08:56:54 +00:00
parent 720688e346
commit e28dddc2e2
14 changed files with 613 additions and 218 deletions

View File

@@ -74,6 +74,13 @@ $siteTitle = "Benutzer";
</option>
</select>
</div>
<div class="form-group">
<label for="active">Aktiv:</label>
<select name="active" id="active" class="form-control">
<option value="false" <?=(isset($user) && !$user->active == 0) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=(isset($user) && $user->active == 1) ? "selected='selected'" : ""?>>Yes</option>
</select>
</div>
<div class="form-group">
<label for="technician">Techniker:</label>
<select name="technician" id="technician" class="form-control">

View File

@@ -1,153 +0,0 @@
<?php
$siteTitle = "Benutzer";
$pagination_baseurl = $this->getUrl($Mod, "Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Benutzer";
?>
<?php include(realpath(dirname(__FILE__) . "/../../$mfLayoutPackage") . "/header.php"); ?>
<link href="<?= self::getResourcePath() ?>assets/css/datatables-std.css?<?= date('U') ?>" rel="stylesheet"
type="text/css"/>
<style>
.fa-exclamation-triangle, .fa-envelope, .fa-mobile-retro {
font-size: 18px;
}
.fa-exclamation-triangle {
color: red;
}
</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">Benutzer</li>
</ol>
</div>
<h4 class="page-title">Benutzer</h4>
</div>
</div>
</div>
<!-- end page title -->
<!-- Main content -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<div class="overflow-auto">
<div class="float-left">
<h4 class="header-title">Benutzerliste</h4>
<p class="sub-header">
<?php if (is_array($filter) && count($filter)): ?>
<?php if ($filter['address_id']): ?>
Zugehörig zu <?= (AddressModel::getOne($filter["address_id"])->getCompanyOrName()) ?>
<br/>
<?php endif; ?>
<?php else: ?>
<?php endif; ?>
</p>
</div>
<div class="float-right">
<?php if (is_array($filter) && count($filter) && is_numeric($filter['address_id'])): ?>
<a class="btn btn-primary"
href="<?= self::getUrl("User", "add", ['address_id' => $filter['address_id']]) ?>"><i
class="fas fa-plus"></i><span class="d-none d-lg-inline"> Neuen Benutzer anlegen</span></a>
<?php else: ?>
<a class="btn btn-primary" href="<?= self::getUrl("User", "add") ?>"><i
class="fas fa-plus"></i><span class="d-none d-lg-inline"> Neuen Benutzer anlegen</span></a>
<?php endif; ?>
</div>
</div>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<div style="clear: both;" class="mt-2">
<table id="datatable" class="table table-striped table-hover font-13 table-sm ">
<thead>
<tr>
<th>Username</th>
<th>Name</th>
<th>Firma / Person</th>
<th>Email</th>
<th>Handy Nr.</th>
<th>2FA</th>
<th>Admin</th>
<th>Techniker</th>
<th></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 ($users as $user):
if ($user->twofactor == 0) {
$twoFactortype = '<i class="fa fa-exclamation-triangle"><span style="display: none">N/A</span></i>';
} else if ($user->twofactor == 1) {
$twoFactortype = '<i class="fa-light fa-envelope"><span style="display: none">Mail</span></i>';
} else if ($user->twofactor == 2) {
$twoFactortype = '<i class="fa-light fa-mobile-retro"><span style="display: none">SMS</span></i>';
}
?>
<tr>
<td class="text-nowrap"><?= $user->username ?></td>
<td><?= $user->name ?></td>
<td><?= ($user->address->company) ? $user->address->company : $user->address->getFullName() ?></td>
<td><?= $user->email ?></td>
<td><?= $user->mobile ?></td>
<td class="text-center"><?= $twoFactortype ?></td>
<td><?= ($user->isAdmin()) ? "Ja" : "Nein" ?></td>
<td><?= ($user->is("Technician")) ? "Ja" : "Nein" ?></td>
<td class="edit-width"
style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?= self::getUrl("User", "edit", ['id' => $user->id]) ?>"
title="User bearbeiten"><i class="far fa-edit"></i></a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<?php //include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
</div>
</div>
</div>
</div>
<!-- Control Sidebar -->
<aside class="control-sidebar control-sidebar-dark">
<!-- Control sidebar content goes here -->
</aside>
<!-- /.control-sidebar -->
<script type="text/javascript">
var hidesearch = [8];
var columndefs = {type: 'ip-address', targets: 4};
var columnfilter = [5];
var columnoptions = '<option value=""></option><option value="SMS">SMS</option><option value="Mail">Mail</option><option value="N/A">N/A</option>';
$(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"); ?>

View File

@@ -38,12 +38,23 @@
</a>
</li>
<li>
<a href="<?=self::getUrl("Dashboard","logout")?>" class="nav-link nav-user">
<i class="fas fa-sign-out-alt"></i>
<span class="pro-user-name ml-1">Abmelden</span>
</a>
</li>
<!-- if $_SESSION[MFAPPNAME.'_impersonate'] is set then show a button that redirects to "User" "impersonate" "unimpersonate = true"-->
<?php if(isset($_SESSION[MFAPPNAME.'_impersonate'])): ?>
<li>
<a href="<?=self::getUrl("User","impersonate",["unimpersonate"=>true])?>" class="nav-link nav-user">
<i class="fas fa-user-secret text-white img-circle bg-info"></i>
<span class="pro-user-name ml-1">Zurück als <?=$_SESSION[MFAPPNAME.'_username']?></span>
</a>
</li>
<?php else: ?>
<li>
<a href="<?=self::getUrl("Dashboard","logout")?>" class="nav-link nav-user">
<i class="fas fa-sign-out-alt"></i>
<span class="pro-user-name ml-1">Abmelden</span>
</a>
</li>
<?php endif; ?>
</ul>