andom-tec changes

This commit is contained in:
Frank Schubert
2024-12-24 12:38:29 +01:00
parent aff469924e
commit ee0037835c
24 changed files with 5518 additions and 298 deletions

View File

@@ -0,0 +1,716 @@
<?php
$urlfilter = [];
if($s) {
$urlfilter['s'] = $s;
}
if($f) {
$urlfilter['f'] = $f;
}
$posturl = self::getUrl("Address", "save", $urlfilter);
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- 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("Address")?>">Personen & Firmen</a></li>
<?php if($address->id): ?>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address", "View", ['id' => $address->id])?>"><?=(is_object($address) && get_class($address) == "Address") ? $address->getCompanyOrName() : ""?> [<?=$address->customer_number?>]</a></li>
<?php endif; ?>
<li class="breadcrumb-item active"><?=($address->id) ? "bearbeiten" : "Neu" ?></li>
</ol>
</div>
<h4 class="page-title">Personen & Firmen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card bg-light">
<div class="card-body">
<h4><?=($address->id) ? "Person/Firma bearbeiten" : "Neue Person/Firma"?></h4>
<form class="form-horizontal" method="post" name="addressForm" id="addressForm" action="<?=$posturl?>">
<div class="card">
<div class="card-body">
<input type="hidden" name="id" value="<?=$address->id?>" />
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="customer_number">Kundennummer</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="customer_number" id="customer_number" value="<?=$address->customer_number?>" disabled="disabled" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="company">Firmenname</label>
<div class="col-lg-10">
<textarea name="company" id="company" class="form-control" rows="2"><?=$address->company?></textarea>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="firstname">Vorname</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="firstname" id="firstname" value="<?=$address->firstname?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="lastname">Nachname</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="lastname" id="lastname" value="<?=$address->lastname?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="street">Strasse</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="street" id="street" value="<?=$address->street?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="zip">PLZ / Ort</label>
<div class="col-lg-10">
<div class="row">
<div class="col-md-4">
<input type="text" class="form-control" name="zip" id="zip" placeholder="PLZ" value="<?=$address->zip?>">
</div>
<div class="col-md-8">
<input type="text" class="form-control" name="city" id="city" placeholder="Ort" value="<?=$address->city?>">
</div>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="country">Land</label>
<div class="col-lg-10">
<select name="country_id" id="country_id" class="form-control">
<?php foreach(CountryModel::getAll() as $country): ?>
<option value="<?=$country->id?>" <?=(($address && $address->country_id == $country->id) || ((!$address || !$address->country_id) && $country->name == "Österreich")) ? "selected='selected'" : ""?>><?=$country->name?></option>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="phone">Telefon</label>
<div class="col-lg-10">
<input type="tel" class="form-control" name="phone" id="phone" value="<?=$address->phone?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="mobile">Mobil</label>
<div class="col-lg-10">
<input type="tel" class="form-control" name="mobile" id="mobile" value="<?=$address->mobile?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fax">Fax</label>
<div class="col-lg-10">
<input type="tel" class="form-control" name="fax" id="fax" value="<?=$address->fax?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="email">Email</label>
<div class="col-lg-10">
<input type="email" class="form-control" name="email" id="email" value="<?=$address->email?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="birthdate">Geburtsdatum</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="birthdate" id="birthdate" value="<?=($address->birthdate) ? (new DateTime($address->birthdate))->format("d.m.Y") : ""?>">
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="spin">Service PIN</label>
<div class="col-lg-10">
<input type="spin" class="form-control" name="spin" id="spin" value="<?=$address->spin?>" disabled="disabled">
</div>
</div>
</div>
</div>
<h4>Einwilligungen</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label class="form-check-label"><input type="checkbox" class="form-check-input" name="allow_contact" id="allow_contact" <?=($address->allow_contact) ? "checked='checked'" : ""?> /> Informationen per Post/Email/Telefon</label>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2"></div>
<div class="col-lg-10">
<label class="form-check-label"><input type="checkbox" class="form-check-input" name="allow_spin" id="allow_spin" <?=($address->allow_spin) ? "checked='checked'" : ""?> /> Auskunft mit Service PIN</label>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="addresstypes">Rolle</label>
<div class="col-lg-10">
<select class="select2 form-control select2-multiple" name="addresstypes[]" id="addresstypes" multiple="multiple" data-placeholder="Choose ...">
<?php foreach(TT_ROLES as $role): ?>
<option value="<?=$role?>" <?=(is_array($address->types) && array_key_exists($role, $address->types)) ? "selected='selected'" : ""?>><?=__($role)?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
</div>
<h4 id="billing-data">Verrechnungsdaten</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="uid">UID</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="uid" id="uid" value="<?=$address->uid?>">
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="billing_type">Verrechnungsart</label>
<div class="col-lg-10">
<select class="form-control" name="billing_type" id="billing_type">
<option value="invoice" <?=($address->billing_type == "invoice") ? "selected='selected'" : ""?>>Rechnung</option>
<option value="sepa" <?=($address->billing_type == "sepa") ? "selected='selected'" : ""?>>SEPA Bankeinzug</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="billing_delivery">Rechnungsversand</label>
<div class="col-lg-10">
<select class="form-control" name="billing_delivery" id="billing_delivery">
<option value="email" <?=($address->billing_delivery == "email") ? "selected='selected'" : ""?>>Email</option>
<option value="paper" <?=($address->billing_delivery == "paper" || !$address->billing_delivery) ? "selected='selected'" : ""?>>Post</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_bank">Kreditinstitut</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="bank_account_bank" id="bank_account_bank" value="<?=$address->bank_account_bank?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_owner">Kontoinhaber</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="bank_account_owner" id="bank_account_owner" value="<?=$address->bank_account_owner?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_iban">IBAN</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="bank_account_iban" id="bank_account_iban" value="<?=$address->bank_account_iban?>" />
<small id="iban_error" class="hidden">IBAN ungültig!</small>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_bic">BIC</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="bank_account_bic" id="bank_account_bic" value="<?=$address->bank_account_bic?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="bank_account_bic"></label>
<div class="col-lg-10 alert alert-danger hidden" id="bank-error"></div>
</div>
<?php if($me->can("Fibu")): ?>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="sepa_date">Sepa Mandatsdatum</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="sepa_date" id="sepa_date" value="<?=($address->sepa_date) ? date("d.m.Y", $address->sepa_date) : ""?>" />
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php if($me->can("Fibu")): ?>
<h4>FIBU</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2">Primäres Verrechnungskonto</label>
<div class="col-lg-10">
<label><input type="checkbox" name="fibu_primary_account" id="fibu_primary_account" value="1" <?=($address->fibu_primary_account) ? "checked='checked'" : ""?> /> Ist primäres Verrechnungskonto</label>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_account_number">FIBU Verrechnungsnummer</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_account_number" id="fibu_account_number" value="<?=$address->fibu_account_number?>" />
</div>
</div>
<hr />
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_supplier_number">FIBU Lieferantennummer</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_supplier_number" id="fibu_supplier_number" value="<?=$address->fibu_supplier_number?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_supplier_due">Lieferant Zahlungsziel</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_supplier_due" id="fibu_supplier_due" value="<?=$address->fibu_supplier_due?>" />
<small>Standard: <?=TT_ADDRESS_DEFAULT_SUPPLIER_DUE?> Tage</small>
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_supplier_skonto">Lieferant Skontotage</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_supplier_skonto" id="fibu_supplier_skonto" value="<?=$address->fibu_supplier_skonto?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="fibu_supplier_skonto_rate">Lieferant Skonto %</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="fibu_supplier_skonto_rate" id="fibu_supplier_skonto_rate" value="<?=$address->fibu_supplier_skonto_rate?>" />
</div>
</div>
<div class="form-group row">
<label class="col-lg-2">Lieferant Zahlsperre</label>
<div class="col-lg-10">
<label><input type="checkbox" name="fibu_supplier_paymentblock" id="fibu_supplier_paymentblock" value="1" <?=($address->fibu_supplier_paymentblock) ? "checked='checked'" : ""?> /> Zahlsperre akiviert</label>
</div>
</div>
</div>
</div>
<?php endif; ?>
<h4>Zusatzdaten</h4>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="rtrcode">RTR Betreiber ID</label>
<div class="col-lg-10">
<input class="form-control" name="attributes[rtrcode]" id="rtrcode" value="<?=$address->attributes['rtrcode']->value?>">
</div>
</div>
</div>
</div>
<h4>Verknüpfungen</h4>
<div class="card">
<div class="card-body" id="link-container">
<table class="table table-striped table-sm table-bordered">
<tr>
<th>Typ</th>
<th>Firma</th>
<th>Vorname</th>
<th>Nachname</th>
<th>Telefon</th>
<th>Mobil</th>
<th>Email</th>
<th></th>
</tr>
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(is_array($address->links) && count($address->links) && array_key_exists($type, $address->links)): ?>
<?php foreach($address->links[$type] as $link): ?>
<tr>
<td class="font-weight-bold"><?=__($type)?></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>" target="_blank"><?=$link->address->company?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>" target="_blank"><?=$link->address->firstname?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>" target="_blank"><?=$link->address->lastname?></a></td>
<td><?=$link->address->phone?></td>
<td><?=$link->address->mobile?></td>
<td><?=$link->address->email?></td>
<td>
<a class="mr-2" href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>" target="_blank"><i class="far fa-eyes" title="Anzeigen"></i></a>
<a href="<?=self::getUrl("Address", "deleteLink", ["id" => $link->id])?>" onclick="if(!confirm('Verknüpfung wirklich entfernen?')) return false;" class="text-danger" title="Verknüpfung entfernen"><i class="fas fa-xmark-large"></i></a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
<?php $linknum = 1; ?>
<h5>Neue Verknüpfung</h5>
<div class="form-group row" id="link-<?=$linknum?>">
<div class="col-lg-2"></div>
<div class="col-lg-6">
<div class="input-group mb-3">
<div class="input-group-prepend">
<select class="form-control" name="links[<?=$linknum?>][type]">
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<option value="<?=$type?>"><?=__($type)?></option>
<?php endforeach; ?>
</select>
</div>
<select class="form-control basicAutoComplete link-autocomplete" autocomplete="off" name="links[<?=$linknum?>][address_id]" id="links_<?=$linknum?>_address_id" data-linknum="<?=$linknum?>" data-url="<?=self::getUrl('Address','api')?>?do=findAddress&autocomplete=1" placeholder="Name, Kundennummer, ID" data-noresults-text="Keine Suchergebnisse">
<option></option>
</select>
<div class="input-group-append">
<button type="button" class="btn btn-danger" onclick="clearNewLink(<?=$linknum?>)"><i class="fas fa-xmark-large mr-1"></i> Entfernen</button>
</div>
</div>
</div>
</div>
</div>
</div>
<?php if(is_array($address->linked_as) && count($address->linked_as)): ?>
<h4>Verknüpft als</h4>
<div class="card">
<div class="card-body" id="link-container">
<table class="table-sm table-striped">
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(array_key_exists($type, $address->linked_as)): ?>
<?php foreach($address->linked_as[$type] as $link): ?>
<tr>
<td><?=__($type)?> für:</td>
<td><a href="<?=self::getUrl("Address", "view", ['id' => $link->origin_address_id])?>" target="_blank"><?=$link->origin->getCompanyOrName()?><?=($link->origin->customer_number) ? " [".$link->origin->customer_number."]" : ""?></a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<div class="card">
<div class="card-body">
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="note">Interne Notiz</label>
<div class="col-lg-10">
<textarea id="note" class="form-control" name="note" rows="5"><?=$address->note?></textarea>
</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 mr-1">Speichern</button>
<button type="submit" name="return" value="index" class="btn btn-primary">Speichern und zur Übersicht</button>
<span id="error" class="hidden ml-2 alert alert-danger text-danger">Fehler: Ungültige IBAN</span>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('#sepa_date').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
$('#birthdate').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
var bankdata_valid = false;
$("#parent_id").select2({
allowClear: true,
placeholder: ""
});
$("#addresstypes").select2();
$("#country_id").select2();
function validateIbanFormat(iban) {
if(!iban) {
return false;
}
iban = iban.toUpperCase().replace(/\s+/, '');
//check format
var m;
if(!iban.match(/^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$/)) {
return false;
}
var cc = iban.substr(0, 2);
var check = parseInt(iban.substr(2, 2));
var account = iban.substr(4);
var searchRange = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split('');
//var replaceRange = [];
var checkStr = account + cc + "00";
for(var i = 0; i <= 25; i++) {
checkStr = checkStr.replace(searchRange[i], i + 10);
};
// make checksum
var checksum = parseInt(checkStr.substr(0,1));
for(pos = 1; pos < checkStr.length; pos++) {
checksum *= 10;
checksum += parseInt(checkStr.substr(pos, 1));
checksum %= 97;
}
if(98 - checksum == check) {
return true;
} else {
return false;
}
}
function validateIbanBic(iban, bic) {
if(!iban) return false;
iban = iban.toUpperCase().replace(/\s+/, '');
$.post("<?=self::getUrl("Address", "api")?>", {
do: "validateIbanBic",
iban: iban,
bic: bic
},
function(success) {
if(success.status == "OK") {
var data = success.result;
$("#bank-error").hide();
$("#bank-error").text("");
if(data.iban_correct && data.bic_correct && (!data.iban_sus || data.iban_sus === "www")) {
bankdata_valid = true;
$('#addressForm').submit();
return;
}
var bank_error = [];
if(!data.iban_correct) {
$("#bank_account_iban").addClass("invalid");
bank_error.push("Ungültige IBAN!");
}
if(data.iban_sus && data.iban_sus !== "www") {
$("#bank_account_iban").addClass("invalid");
bank_error.push("IBAN verdächtig (" + data.iban_sus + ")!");
}
if(!data.bic_correct) {
$("#bank_account_bic").addClass("invalid");
bank_error.push("Ungültige BIC!");
if(Array.isArray(data.bic)) {
bank_error.push(" Mögliche korrekte BIC: " + data.bic.join(", "));
}
}
$("#bank-error").html(bank_error.join("<br />\n"));
$("#bank-error").show();
$('html, body').animate( {scrollTop: $('#billing-data').offset().top - 230}, 200);
} else {
$("#bank-error").text("Beim Validieren der Bankdaten ist ein Fehler aufgetreten.");
}
},
"json"
);
return false;
}
function formatIBAN(input) {
let iban = input.value.replace(/\s/g, '');
let formattedIBAN = '';
for (let i = 0; i < iban.length; i++) {
if (i > 0 && i % 4 === 0) {
formattedIBAN += ' ';
}
formattedIBAN += iban[i];
}
input.value = formattedIBAN;
}
$("#bank_account_iban").on("input", function () {
formatIBAN(this);
});
formatIBAN(document.getElementById('bank_account_iban'));
$('#addressForm').submit(function(e) {
$("#error").hide();
$("#bank-error").hide();
$("#bank_account_iban").val($("#bank_account_iban").val().replaceAll(/\s/g, ''));
if($('#billing_type').val() == "sepa") {
console.log("bankdata_valid (1): " + bankdata_valid);
if(bankdata_valid) {
return true;
}
if(!validateIbanFormat($("#bank_account_iban").val())) {
$("#error").show();
console.log("nope");
}
console.log("bankdata_valid: " + bankdata_valid);
if($("#bank_account_iban").val() != "<?=$address->bank_account_iban?>" || $("#bank_account_bic").val() != "<?=$address->bank_account_bic?>") {
validateIbanBic($("#bank_account_iban").val(), $("#bank_account_bic").val());
} else {
return true;
}
e.preventDefault();
return false;
}
});
/*
* link autocomplete
*/
$('.link-autocomplete').autoComplete();
$('.link-autocomplete').keydown(function() {
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
/*
* Links autocomplete
*/
$('.link-autocomplete').on("autocomplete.select", function(evt, item) {
autocompleteSelect(evt,item);
});
function autocompleteSelect(evt, item) {
if(item && item.value === 0) {
$('.link-autocomplete').autoComplete('set', null);
return;
}
var match = evt.currentTarget.id.match(/links_(\d+)_address_id/);
var link_num = match[1];
if(!link_num) {
console.log("Couldn't find selected Address");
}
addLink(Number(link_num) + 1);
}
function addLink(linknum) {
if(!linknum) {
console.log("no linknum");
return false;
}
if($("#links_" + linknum + "_address_id").length) {
console.log("gibs scho");
return false;
}
var new_link = '<div class="form-group row" id="link-' + linknum + '"> \
<label class="col-lg-2 col-form-label" for="links_' + linknum + '_address_id"></label> \
<div class="col-lg-6"> \
<div class="input-group mb-3"> \
<div class="input-group-prepend"> \
<select class="form-control" name="links[' + linknum + '][type]"> \
<option value="techcontact">Technischer Kontakt</option> \
</select> \
</div> \
<select class="form-control basicAutoComplete link-autocomplete" autocomplete="off" name="links[' + linknum + '][address_id]" id="links_' + linknum + '_address_id" data-linknum="' + linknum + '" data-url="<?=self::getUrl('Address','api')?>?do=findAddress&autocomplete=1" placeholder="Name, Kundennummer, ID" data-noresults-text="Keine Suchergebnisse"> \
<option></option> \
</select> \
<div class="input-group-append"> \
<button type="button" class="btn btn-danger" onclick="clearNewLink(' + linknum + ')"><i class="fas fa-xmark-large mr-1"></i> Entfernen</button> \
</div> \
</div> \
</div> \
</div>';
$('#link-container').append(new_link);
//$('#links_' + linknum + '_address_id').autocomplete();
$('#links_' + linknum + '_address_id').autoComplete();
$('#links_' + linknum + '_address_id').keydown(function() {
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
$('#links_' + linknum + '_address_id').on("autocomplete.select", function(evt, item) {
autocompleteSelect(evt,item);
});
}
function clearNewLink(linknum) {
if(!$("#link-" + linknum).length) {
return;
}
// only remove is not the only one
if($('#link-container').find('div.row').length > 1) {
$("#link-" + linknum).remove();
}
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,382 @@
<?php
$pagination_baseurl = $this->getUrl($Mod,"Index");
$pagination_baseurl_params = ["filter" => $filter];
$pagination_entity_name = "Adressen";
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- 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>
<?php if(is_array($filter['addresstype']) && count($filter['addresstype'])): ?>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address")?>">Personen & Firmen</a></li>
<li class="breadcrumb-item active">
<?php foreach($filter['addresstype'] as $type) { $types[] = __($type); } ?>
<?=implode(", ", $types)?>
</li>
<?php else: ?>
<li class="breadcrumb-item active">Personen & Firmen</li>
<?php endif; ?>
</ol>
</div>
<h4 class="page-title">Personen & Firmen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body mb-3">
<h4 class="header-title mb-3"><i class="fad fa-filter fa-fw"></i> Filter</h4>
<form method="get" action="<?=self::getUrl("Address")?>">
<div class="row">
<?php if($me->is("Admin")): ?>
<div class="col-2">
<label class="form-label" for="filter_addresstype">Rolle</label>
<select name="filter[addresstype][]" id="filter_addresstype" class="form-control" multiple="multiple">
<option value="systemowner" <?=(array_key_exists("addresstype", $filter) && in_array("systemowner", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("systemowner")?></option>
<option value="productowner" <?=(array_key_exists("addresstype", $filter) && in_array("productowner", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("productowner")?></option>
<option value="netowner" <?=(array_key_exists("addresstype", $filter) && in_array("netowner", $filter["addresstype"])) ? "selected='selected'" : "netowner"?>><?=__("netowner")?></option>
<option value="salespartner" <?=(array_key_exists("addresstype", $filter) && in_array("salespartner", $filter["addresstype"])) ? "selected='selected'" : "salespartner"?>><?=__("salespartner")?></option>
<option value="pipeworker" <?=(array_key_exists("addresstype", $filter) && in_array("pipeworker", $filter["addresstype"])) ? "selected='selected'" : "pipeworker"?>><?=__("pipeworker")?></option>
<option value="lineworker" <?=(array_key_exists("addresstype", $filter) && in_array("lineworker", $filter["addresstype"])) ? "selected='selected'" : "lineworker"?>><?=__("lineworker")?></option>
<option value="pipeplanner" <?=(array_key_exists("addresstype", $filter) && in_array("pipeplanner", $filter["addresstype"])) ? "selected='selected'" : "pipeplanner"?>><?=__("pipeplanner")?></option>
<option value="lineplanner" <?=(array_key_exists("addresstype", $filter) && in_array("lineplanner", $filter["addresstype"])) ? "selected='selected'" : "lineplanner"?>><?=__("lineplanner")?></option>
<option value="netoperator" <?=(array_key_exists("addresstype", $filter) && in_array("netoperator", $filter["addresstype"])) ? "selected='selected'" : "netoperator"?>><?=__("netoperator")?></option>
<option value="support" <?=(array_key_exists("addresstype", $filter) && in_array("support", $filter["addresstype"])) ? "selected='selected'" : "support"?>><?=__("support")?></option>
<option value="billing" <?=(array_key_exists("addresstype", $filter) && in_array("billing", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("billing")?></option>
<option value="employee" <?=(array_key_exists("addresstype", $filter) && in_array("employee", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("employee")?></option>
<option value="customer" <?=(array_key_exists("addresstype", $filter) && in_array("customer", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("customer")?></option>
<option value="supplier" <?=(array_key_exists("addresstype", $filter) && in_array("supplier", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("supplier")?></option>
<option value="contact" <?=(array_key_exists("addresstype", $filter) && in_array("contact", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("contact")?></option>
<option value="techcontact" <?=(array_key_exists("addresstype", $filter) && in_array("techcontact", $filter["addresstype"])) ? "selected='selected'" : ""?>><?=__("techcontact")?></option>
</select>
</div>
<?php endif; ?>
<div class="col-1">
<label class="form-label" for="filter_customer_number">Kundennummer</label>
<input type="text" class="form-control" name="filter[customer_number]" id="filter_customer_number" value="<?=(array_key_exists('customer_number', $filter)) ? $filter['customer_number'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_spin">Service PIN</label>
<input type="text" class="form-control" name="filter[spin]" id="filter_spin" value="<?=(array_key_exists('spin', $filter)) ? $filter['spin'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_fibu_account_number">FIBU Konto</label>
<input type="text" class="form-control" name="filter[fibu_account_number]" id="filter_fibu_account_number" value="<?=array_key_exists('fibu_account_number', $filter) ? $filter['fibu_account_number'] : ""?>" />
</div>
<div class="col-4">
<label class="form-label" for="filter_kunde">Kunde</label>
<input type="text" class="form-control" name="filter[kunde]" id="filter_kunde" value="<?=array_key_exists('kunde', $filter) ? $filter['kunde'] : ""?>" />
</div>
</div>
<div class="row mt-2">
<div class="col-2">
<label class="form-label" for="filter_street">Straße</label>
<input type="text" class="form-control" name="filter[street]" id="filter_street" value="<?=array_key_exists('street', $filter) ? $filter['street'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_zip">PLZ</label>
<input type="text" class="form-control" name="filter[zip]" id="filter_zip" value="<?=array_key_exists('zip', $filter) ? $filter['zip'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_city">Ort</label>
<input type="text" class="form-control" name="filter[city]" id="filter_city" value="<?=array_key_exists('city', $filter) ? $filter['city'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_country">Land</label>
<input type="text" class="form-control" name="filter[country]" id="filter_country" value="<?=array_key_exists('country', $filter) ? $filter['country'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_pfm">Fon/Fax/Mobil</label>
<input type="text" class="form-control" name="filter[pfm]" id="filter_pfm" value="<?=array_key_exists('pfm', $filter) ? $filter['pfm'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_email">Email</label>
<input type="text" class="form-control" name="filter[email]" id="filter_email" value="<?=array_key_exists('email', $filter) ? $filter['email'] : ""?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_note">Notiz</label>
<input type="text" class="form-control" name="filter[note]" id="filter_note" value="<?=array_key_exists('note', $filter) ? $filter['note'] : ""?>" />
</div>
<?php if(defined("TT_ADDRESS_FILTER_DEFAULT_SYSOWNER") && TT_ADDRESS_FILTER_DEFAULT_SYSOWNER): ?>
<div class="col-1">
<label class="form-label" for="filter_type">Mandant</label>
<select class="form-control" name="filter[type]" id="filter_type">
<option value="<?=(array_key_exists('type', $filter) && $filter["type"] == "all") ? "selected='selected'" : ""?>">Alle</option>
<option value="xinon" <?=(array_key_exists('type', $filter) && $filter["type"] != "xinon") ? "" : "selected='selected'"?>>andom-tec</option>
<option value="others" <?=(array_key_exists('type', $filter) && $filter["type"] == "others") ? "selected='selected'" : ""?>>Fremd</option>
</select>
</div>
<?php endif; ?>
</div>
<div class="row mt-2">
<div class="col">
<button type="submit" class="btn btn-primary"><i class="far fa-search fa-fw"></i> Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("Address", "", ["resetFilter" => 1])?>"><i class="far fa-xmark fa-fw"></i> Filter zurücksetzen</a>
</div>
</div>
</form>
</div>
</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 Personen & Firmen</h4>
</div>
<div class="float-right">
<a class="btn btn-primary" href="<?=self::getUrl("Address", "add")?>"><i class="fas fa-plus"></i> Neue Person/Firma anlegen</a>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
<table class="table table-striped table-hover">
<tr>
<th>Typ</th>
<th>Kundennummer</th>
<th>FIBU Konten</th>
<th>Firma</th>
<th>Name</th>
<th>Adresse</th>
<th>Telefon</th>
<th>Email</th>
<th></th>
</tr>
<?php foreach($addresses as $address): ?>
<tr>
<?php if(is_array($address->types) && count($address->types)):?>
<?php
$types = array_keys($address->types);
$l7d_types = [];
foreach($types as $type):
$l7d_types[] = __($type);
endforeach;
?>
<td title="<?=implode(", ", $l7d_types)?>">
<?=$l7d_types[0]?><?=(count($types) > 1) ? ", ..." : ""?>
</td>
<?php else: ?>
<td></td>
<?php endif; ?>
<td>
<a href="<?=self::getUrl("Address", "view", ["id" => $address->id, 's' => $pagination['start']])?>">
<?=$address->customer_number?>
<?=($address->spin) ? "<br /><span class='text-pink'>".$address->spin."</span>" : ""?>
</a>
</td>
<td>
<?php if($address->fibu_account_number): ?>
<span title="Verrechnungskonto"><?=$address->fibu_account_number?></span><?=($address->fibu_primary_account) ? " <i class='fas fa-check text-success' title='Primäres Verrechnungskonto'></i>" : ""?>
<?php endif; ?>
<?php if($address->fibu_supplier_number): ?>
<br /><span title="Lieferantenkonto"><?=$address->fibu_supplier_number?></span>
<?php endif; ?>
</td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $address->id, 's' => $pagination['start']])?>"><?=nl2br($address->company)?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $address->id, 's' => $pagination['start']])?>"><?=$address->getFullName()?></a></td>
<td>
<?=$address->street?><br />
<?=$address->zip?> <?=$address->city?>
</td>
<td><?=$address->phone?></td>
<td><?=$address->email?></td>
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
<a href="<?=self::getUrl("User", "Index", ["filter" => ["address_id" => $address->id]])?>" title="Benutzer anzeigen"><i class="fas fa-users"></i></a>
<a href="<?=self::getUrl("Address", "view", ["id" => $address->id, 's' => $pagination['start']])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
<a href="<?=self::getUrl("Address", "edit", ["id" => $address->id, 's' => $pagination['start']])?>"><i class="far fa-edit" title="Bearbeiten"></i></a>
<a href="<?=self::getUrl("Address", "delete", ["id" => $address->id, 's' => $pagination['start']])?>" onclick="if(!confirm('Person/Firma wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
</div>
</div>
</div>
</div>
<!-- CREATE TICKET MODAL START -->
<!--add a bootstrap modal here and below add a new <script> which creates a form for self::getUrl("Address", "createTicket") with post parameters
string $subject, string $description, string $customer_name, string $customer_number, string $customer_address, string $customer_phone_number, string $customer_email, string $customer_service_ping
-->
<div class="modal" id="createTicketModal" tabindex="-1" role="dialog" aria-labelledby="createTicketModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="createTicketModalLabel">Störungs-Ticket erstellen</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="createTicketForm">
<div class="row">
<div class="col-6">
<label class="form-label required" for="subject">Betreff</label>
<input type="text" class="form-control" name="subject" id="subject" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="description">Beschreibung</label>
<textarea class="form-control" name="description" id="description" required="required"></textarea>
</div>
<div class="col-6">
<label class="form-label required" for="customer_name">Kundenname</label>
<input type="text" class="form-control" name="customer_name" id="customer_name" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_number">Kundennummer</label>
<input type="text" class="form-control" name="customer_number" id="customer_number" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_address">Kundenadresse</label>
<input type="text" class="form-control" name="customer_address" id="customer_address" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_phone_number">Telefon</label>
<input type="text" class="form-control" name="customer_phone_number" id="customer_phone_number" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_email">Email</label>
<input type="text" class="form-control" name="customer_email" id="customer_email" required="required" />
</div>
<div class="col-6">
<label class="form-label required" for="customer_service_pin">Service-Pin</label>
<input type="text" class="form-control" name="customer_service_pin" id="customer_service_pin" required="required" />
</div>
</div>
<!-- add submit and close button here-->
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Ticket erstellen</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal" @click="closeModal">Schließen</button>
</div>
</form>
</div>
<script>
const newTicketUrl = '<?=self::getUrl("Address", "createTicket")?>';
function openCreateTicketModal(customer_name, customer_number, customer_address, customer_phone_number, customer_email, customer_service_pin) {
$("#createTicketModal").modal("show");
$("#subject").val('');
$("#description").val('');
$("#customer_name").val(customer_name);
$("#customer_number").val(customer_number);
$("#customer_address").val(customer_address);
$("#customer_phone_number").val(customer_phone_number);
$("#customer_email").val(customer_email);
$("#customer_service_pin").val(customer_service_pin);
}
document.getElementById('createTicketForm').addEventListener('submit', submitNewTicket);
function submitNewTicket(e) {
e.preventDefault();
const data = {
subject: $("#subject").val(),
description: $("#description").val(),
customer_name: $("#customer_name").val(),
customer_number: $("#customer_number").val(),
customer_address: $("#customer_address").val(),
customer_phone_number: $("#customer_phone_number").val(),
customer_email: $("#customer_email").val(),
customer_service_pin: $("#customer_service_pin").val()
};
$.post(newTicketUrl, data, function(response) {
response = JSON.parse(response);
console.log(response);
if(response.id) {
window.open('https://project.xinon.at/projects/storungen-and-support/work_packages/' + response.id + '/activity', '_blank');
closeModal();
} else {
alert("Fehler beim Erstellen des Tickets.");
}
});
}
function closeModal() {
$("#createTicketModal").modal("hide");
// set all input fields to empty
$("#createTicketForm").trigger("reset");
}
</script>
<!-- CREATE TICKET MODAL END -->
<script type="text/javascript">
$("#filter_addresstype").select2({closeOnSelect: false});
function startBmdExport(e, type) {
e.preventDefault();
if(type == "inc") {
name = "inkrementellen";
url = "<?=self::getUrl("Address", "exportBmd")?>";
} else if(type == "full") {
name = "VOLLSTÄNDIGEN";
url = "<?=self::getUrl("Address", "exportBmd", ["type" => "full"])?>";
} else {
return false;
}
console.log(name);
if(!confirm("Wirklich " + name + " BMD-Export starten?")) {
return false;
}
$('button, input').prop('disabled', true);
$('a').removeAttr("href");
$("#bmd-export-loader").show();
window.location.href = url;
return false;
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,350 @@
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- 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="javascript: void(0);"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item"><a href="javascript: void(0);">Personen & Firmen</a></li>
<li class="breadcrumb-item active"><?=$address->getCompanyOrName()?> [<?=$address->customer_number?>]</li>
</ol>
</div>
<h4 class="page-title">Personen & Firmen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<div class="float-left">
<a href="<?=self::getUrl("Address","Index", ['s' => $s])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Übersicht</a>
<a href="<?=self::getUrl("Address","edit", ['id' => $address->id, 's' => $s, 'f' => "view"])?>" class="btn btn-outline-success"><i class="fas fa-edit"></i> Adresse bearbeiten</a>
</div>
<div class="float-right">
<a href="<?=self::getUrl("Address","invoice", ["address_id" => $address->id])?>" class="btn btn-purple mr-1"><i class="far fa-file-invoice-dollar"></i> Rechungsübersicht</a>
</div>
</div>
</div>
<div class="row">
<div class="col-8">
<div class="card border-top-primary">
<div class="card-body">
<h3 class="text-center mb-3"><?=$address->getCompanyOrName()?><?=($address->customer_number) ? " [".$address->customer_number."]" : ""?></h3>
<table class="table table-sm table-striped view-table">
<tr>
<th>Kundennummer</th>
<td><?=$address->customer_number?></td>
</tr><tr>
<th>Firmenname</th>
<td><?=nl2br($address->company)?></td>
</tr><tr>
<th>Vorname</th>
<td><?=$address->firstname?></td>
</tr><tr>
<th>Nachname</th>
<td><?=$address->lastname?></td>
</tr><tr>
<th>Straße</th>
<td><?=$address->street?></td>
</tr><tr>
<th>PLZ / Ort</th>
<td><?=$address->zip?> <?=$address->city?></td>
</tr><tr>
<th>Land</th>
<td><?=$address->country->name?></td>
</tr><tr>
<th>Telefon</th>
<td><?=$address->phone?></td>
</tr><tr>
<th>Mobil</th>
<td><?=$address->mobile?></td>
</tr><tr>
<th>Fax</th>
<td><?=$address->fax?></td>
</tr><tr>
<th>Email</th>
<td><?=$address->email?></td>
</tr><tr>
<th>Geburtsdatum</th>
<td><?=($address->birthdate) ? (new DateTime($address->birthdate))->format("d.m.Y") : ""?></td>
</tr><tr>
<th>Interne Notiz</th>
<td><?=nl2br($address->note)?></td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Service PIN</th>
<td><?=$address->spin?></td>
</tr><tr>
<th>Einwilligungen</th>
<td>
<p><i class="mr-1 fas <?=($address->allow_contact) ? "fa-check text-success" : "fa-xmark-large text-danger"?>"></i> Informationen per Post/Email/Telefon</p>
<p><i class="mr-1 fas <?=($address->allow_spin) ? "fa-check text-success" : "fa-xmark-large text-danger"?>"></i>Auskunft mit Service PIN</p>
</td>
</tr><tr>
<th>Rollen</th>
<td>
<?php if(is_array($address->types) && count($address->types)): ?>
<?php foreach(TT_ROLES as $role): ?>
<ul>
<?php if(array_key_exists($role, $address->types)): ?>
<li><?=__($role)?></li>
<?php endif; ?>
</ul>
<?php endforeach; ?>
<?php endif; ?>
</td>
</tr><tr>
<td colspan="2">
<h4>
Verrechnungsdaten
<?php if(array_key_exists("billing", $address->links_to) && is_array($address->links_to["billing"]) && count($address->links_to["billing"])): ?>
(<span class='text-danger'>Achtung: Seperate Rechnungsadresse vorhanden</span>)
<?php elseif(array_key_exists("billing", $address->linked_as) && is_array($address->linked_as["billing"]) && count($address->linked_as["billing"])): ?>
<span class='text-success'>(Ist aktive Rechnungsadresse)</span>
<?php endif; ?>
</h4>
</td>
</tr><tr>
<th>UID</th>
<td><?=$address->uid?></td>
</tr><tr>
<th>Verrechnungsart</th>
<td><?=($address->billing_type == "sepa") ? "SEPA Bankeinzug" : "Rechnung"?></td>
</tr><tr>
<th>Rechnungsversand</th>
<td><?=($address->billing_delivery == "paper" || !$address->billing_delivery) ? "Post" : "Email"?></td>
</tr><tr>
<th>Kreditinstitut</th>
<td><?=$address->bank_account_bank?></td>
</tr><tr>
<th>Kontoinhaber</th>
<td><?=$address->bank_account_owner?></td>
</tr><tr>
<th>IBAN</th>
<td><?php
$iban = $address->bank_account_iban;
$iban = preg_replace('/\s+/', '', $iban);
$iban = chunk_split($iban, 4, ' ');
$iban = trim($iban);
echo $iban;
?></td>
</tr><tr>
<th>BIC</th>
<td><?=$address->bank_account_bic?></td>
</tr>
<?php if($me->can("Fibu")): ?>
<tr>
<th>Sepa Mandatsdatum</th>
<td><?=($address->sepa_date) ? date("d.m.Y", $address->sepa_date) : ""?></td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2"><h4>FIBU</h4></td>
</tr>
<tr>
<th>Ist primäres Verrechnungskonto</th>
<td><?=($address->fibu_primary_account) ? "<i class='fas fa-check text-success' title='Primäres Verrechnungskonto'></i>" : "<i class='fas fa-xmark text-danger'></i>"?></td>
</tr><tr>
<th>Verrechnungskonto</th>
<td><?=$address->fibu_account_number?></td>
</tr><tr>
<th>Lieferantenkonto</th>
<td><?=$address->fibu_supplier_number?></td>
</tr><tr>
<th>Zahlungsziel Lieferant</th>
<td><?=$address->fibu_supplier_due?></td>
</tr><tr>
<th>Lieferant Skontotage</th>
<td><?=$address->fibu_supplier_skonto?></td>
</tr><tr>
<th>Lieferant Skonto %</th>
<td><?=$address->fibu_supplier_skonto_rate?></td>
</tr><tr>
<th>Lieferant Zahlsperre</th>
<td><?=($address->fibu_supplier_paymentblock) ? "<i class='fas fa-xmark text-danger'></i> Automatische Zahlungen gesperrt" : "Nicht gesperrt"?></td>
</tr><tr>
<td colspan="2"><h4>Zusatzdaten</h4></td>
</tr><tr>
<th>RTR Code</th>
<td><?=(is_array($address->attributes) && array_key_exists("rtrcode", $address->attributes)) ? $address->attributes['rtrcode']->value : ""?></td>
</tr><tr>
<th></th>
<td></td>
</tr><tr>
<th>Erstellt</th>
<td class="text-monospace"><?=date("d.m.Y H:i:s", $address->create)?> (<?=$address->creator->name?>)</td>
</tr><tr>
<th>Letzte Bearbeitung</th>
<td class="text-monospace"><?=date("d.m.Y H:i:s", $address->edit)?> (<?=$address->editor->name?>)</td>
</tr>
</table>
<h4>Verknüpfungen</h4>
<?php if(is_array($address->links) && count($address->links)): ?>
<div class="card border-top-warning">
<div class="card-body" id="link-container">
<table class="table table-striped table-sm table-bordered">
<tr>
<th>Typ</th>
<th>Firma</th>
<th>Name</th>
<th>Telefon</th>
<th>Mobil</th>
<th>Email</th>
<th></th>
</tr>
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(is_array($address->links_to) && array_key_exists($type, $address->links_to)): ?>
<?php foreach($address->links_to[$type] as $link): ?>
<tr>
<td class="font-weight-bold"><?=__($type)?></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><?=$link->address->company?></a></td>
<td><a href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><?=$link->address->getFullName()?></a></td>
<td><?=$link->address->phone?></td>
<td><?=$link->address->mobile?></td>
<td><?=$link->address->email?></td>
<td>
<a class="mr-2" href="<?=self::getUrl("Address", "view", ["id" => $link->address_id])?>"><i class="far fa-eyes" title="Anzeigen"></i></a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<?php if(is_array($address->linked_as) && count($address->linked_as)): ?>
<h4>Verknüpft als</h4>
<div class="card">
<div class="card-body" id="link-container">
<table class="table-sm table-striped">
<?php foreach(TT_ADDRESS_LINK_TYPES as $type): ?>
<?php if(array_key_exists($type, $address->linked_as)): ?>
<?php foreach($address->linked_as[$type] as $link): ?>
<tr>
<td><strong><?=__($type)?></strong> für:</td>
<td><a href="<?=self::getUrl("Address", "view", ['id' => $link->origin_address_id])?>"><?=$link->origin->getCompanyOrName()?><?=($link->origin->customer_number) ? " [".$link->origin->customer_number."]" : ""?></a></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
</div>
</div>
</div>
<div class="col-4">
<div class="card border-top-success">
<div class="card-header">
Aktive Produkte (Contracts)
</div>
<?php if(is_array($address->contracts) && count($address->contracts)): ?>
<ul class="list-group list-group-flush">
<?php foreach($address->contracts as $contract): ?>
<?php if($contract->owner_id != $address->id) continue; ?>
<li class="list-group-item <?=$contract->isCancelled() ? "canceled" : ""?>">
<?php if($contract->billingaddress_id && $contract->owner_id != $contract->billingaddress_id): ?>
<a href="<?=self::getUrl("Address", "view", ["id" => $contract->billingaddress_id])?>" class="mr-1">
<i class="far fa-fw fa-money-bill-simple-wave" title="Hat separate Rechungsadresse"></i>
</a>
<?php endif; ?>
<?php if($contract->cancel_date && $contract->cancel_date > date("U")): ?>
<i class="far fa-fw fa-eraser text-danger mr-1" title="Kündigungsdatum <?=date("d.m.Y", $contract->cancel_date)?>"></i>
<?php endif; ?>
<a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>" class="<?=($contract->price < 0) ? "text-danger" : ""?>">
<?=$contract->product_name?> <?=($contract->matchcode) ? "[".$contract->matchcode."]" : ""?>
</a>
<?php if(is_array($contract->voicenumbers)): ?>
<span class="text-pink">
(<?=implode(", ", $contract->voicenumbers)?>)
</span>
<?php endif; ?>
<span class='text-secondary'>
<?=($contract->finish_date) ? "Fertigstellung: ".date('d.m.Y', $contract->finish_date) : "in Herstellung"?>
<?=($contract->cancel_date) ? "Kündigung: ".date('d.m.Y', $contract->cancel_date) : ""?>
</span>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
<?php if(is_array($address->active_contracts) && count($address->active_contracts)): ?>
<div class="card border-top-success">
<div class="card-header">
Verträge
</div>
<div class="card-body">
<table class="table table-striped table-sm table-bordered table-hover">
<tr>
<th>Rolle</th>
<th>Contract ID</th>
<th>Produkt</th>
<th>Matchcode</th>
<th>Preis</th>
<th>Setup</th>
<th>Bestelldatum</th>
<th>Fertigstellung</th>
<th>Kündigung</th>
</tr>
<?php foreach($address->active_contracts as $contract): ?>
<tr>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>">
<a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>">
<?php if($contract->owner_id == $address->id): ?>
Vertragsinhaber
<?php elseif($contract->billingaddress_id == $address->id): ?>
Rechnungsempfänger
<?php endif; ?>
</a>
</td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->id?></a></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->product_name?></a></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><a href="<?=self::getUrl("Contract", "View", ["id" => $contract->id])?>"><?=$contract->matchcode?></a></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?> <?=($contract->price < 0) ? "text-danger" : ""?>">€ <?=number_format($contract->price,4,",",".")?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?> <?=($contract->price_setup < 0) ? "text-danger" : ""?>">€ <?=number_format($contract->price_setup,4,",",".")?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->order_date) ? date('d.m.Y', $contract->order_date) : ""?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?>"><?=($contract->finish_date) ? date('d.m.Y', $contract->finish_date) : ""?></td>
<td class="contract <?=($contract->isCancelled()) ? "canceled" : ""?> <?=($contract->cancel_date) ? "font-weight-bold text-danger" : ""?>"><?=($contract->cancel_date) ? date('d.m.Y', $contract->cancel_date) : ""?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
<?php endif; ?>
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("Address","Index", ['s' => $s])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Übersicht</a>
<a href="<?=self::getUrl("Address","edit", ['id' => $address->id, 's' => $s, 'f' => "view"])?>" class="btn btn-outline-success"><i class="fas fa-edit"></i> Adresse bearbeiten</a>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,10 @@
<?php
$header = "\u{FEFF}FIBU Kontonummber;Zahlungsziel Lieferant;Skontotage;Skontoprozent;Zahlsperre;Vorname;Nachname;Straße Hausnummer;PLZ;Ort;Land;Telefon;Mail;UID;SEPA;Kontoinhaber;IBAN;BIC;customer_numbers\n";
$this->setReturnValue(["header" => $header]);
foreach($addresses as $a):
?>
<?=$a["fibu_account_number"]?>;<?=$a["fibu_supplier_due"]?>;<?=$a["fibu_supplier_skonto"]?>;<?=$a["fibu_supplier_skonto_rate"]?>;<?=$a["fibu_supplier_paymentblock"]?>;<?=$this->nl2ws($a["firstname"])?>;<?=$this->nl2ws($a["lastname"])?>;<?=$this->nl2ws($a["street"])?>;<?=$this->nl2ws($a["zip"])?>;<?=$this->nl2ws($a["city"])?>;<?=$this->nl2ws($a["countrycode"])?>;<?=$this->nl2ws($a["phone"])?>;<?=$this->nl2ws($a["email"])?>;<?=$this->nl2ws($a["uid"])?>;<?=$a["billing_type"]?>;<?=$a["bank_owner"]?>;<?=$a["iban"]?>;<?=$a["bic"]?>;<?=implode(" ",$a["customer_numbers"])?>
<?php
endforeach;

View File

@@ -0,0 +1,98 @@
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- 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="javascript: void(0);"><?=MFAPPNAME_SLUG?></a></li>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address")?>">Personen & Firmen</a></li>
<li class="breadcrumb-item"><a href="<?=self::getUrl("Address", "view", ["id" => $address->id])?>"><?=$address->getCompanyOrName()?> [<?=$address->customer_number?>]</a></li>
<li class="breadcrumb-item active">Rechnungen</li>
</ol>
</div>
<h4 class="page-title">Personen & Firmen</h4>
</div>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("Address","view", ["id" => $address->id])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Addresse</a>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card border-top-purple">
<div class="card-body">
<h3 class="">Rechnungen zu Kundennummer <?=$address->customer_number?></h3>
<div class="mb-3">Verrechnungskonto: <?=$address->fibu_account_number?></div>
<div class="font-weight-bold"><?=$address->getCompanyOrName()?></div>
<div><?=$address->street?></div>
<div><?=$address->zip?> <?=$address->city?></div>
<div><?=$address->country->name?></div>
<table class="table table-sm table-striped mt-2">
<tr>
<th>Typ</th>
<th>Rechnungsnummer</th>
<th>Rechnungsdatum</th>
<th>Betrag Netto</th>
<th>Betrag Brutto</th>
<th>Zahlungsart</th>
<th>Versand</th>
<th></th>
</tr>
<?php foreach($invoices as $invoice): ?>
<tr>
<td>
<ul>
<?php if($invoice->owner_id == $address->id):?>
<li>Vertragsinhaber</li>
<?php endif; ?>
<?php if($invoice->billingaddress_id == $address->id):?>
<li>Rechnungsempfänger</li>
<?php endif; ?>
</ul>
</td>
<td><a href="<?=self::getUrl("Invoice", "downloadInvoice", ["id" => $invoice->id])?>"><i class="fas fa-download fa-fw"></i> <?=$invoice->invoice_number?></a></td>
<td><?=date("d.m.Y", $invoice->invoice_date)?></td>
<td class="<?=($invoice->total < 0) ? "text-danger" : ""?>">€ <?=number_format($invoice->total, 2, ",", ".")?></td>
<td class="<?=($invoice->total_gross < 0) ? "text-danger" : ""?>">€ <?=number_format($invoice->total_gross, 2, ",", ".")?></td>
<td><?=($invoices->billing_type == "sepa") ? "Einzug" : "Einzahlung" ?></td>
<td><?=($invoices->billing_delivery == "email") ? "Email (".$invoice->email.")" : "Postversand" ?></td>
<td><a href="<?=self::getUrl("Invoice", "downloadInvoiceCsv", ["id" => $invoice->id])?>" title="CSV-Download"><i class="fas fa-file-csv fa-fw"></i></a></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-body">
<a href="<?=self::getUrl("Address","view", ["id" => $address->id])?>" class="btn btn-secondary mr-1"><i class="fas fa-list"></i> Zurück zur Addresse</a>
</div>
</div>
</div>
</div>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,32 @@
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<?php if(is_array($newss) && count($newss)): ?>
<?php foreach($newss as $news): ?>
<div class="row justify-content-center mt-1">
<div class="col-12 col-xl-10 mt-2">
<h4>Neuigkeiten</h4>
<div class="card no-shadow" style="border: 1px solid #ced4da">
<div class="card-header bg-info text-white pt-1 pb-1" style="font-size: 1rem; font-weight: 400;">
<span><?=date("d.m.Y", $news->create)?>:</span>
<?php if($news->subject): ?>
<?=$news->subject?>
<?php endif; ?>
</div>
<div class="card-body pb-0 pt-1">
<div class="row col-12">
<div><?=$news->text?></div>
</div>
</div>
<div class="card-footer pt-1 pb-1 bg-light text-secondary text-monospace font-italic">
<?=$news->editor->name?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -0,0 +1,32 @@
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<?php if(is_array($newss) && count($newss)): ?>
<?php foreach($newss as $news): ?>
<div class="row justify-content-center mt-1">
<div class="col-12 col-xl-10 mt-2">
<h4>Neuigkeiten</h4>
<div class="card no-shadow" style="border: 1px solid #ced4da">
<div class="card-header bg-info text-white pt-1 pb-1" style="font-size: 1rem; font-weight: 400;">
<span><?=date("d.m.Y", $news->create)?>:</span>
<?php if($news->subject): ?>
<?=$news->subject?>
<?php endif; ?>
</div>
<div class="card-body pb-0 pt-1">
<div class="row col-12">
<div><?=$news->text?></div>
</div>
</div>
<div class="card-footer pt-1 pb-1 bg-light text-secondary text-monospace font-italic">
<?=$news->editor->name?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,256 @@
<?php
$siteTitle = "Benutzer";
?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- 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("User")?>">Benutzer</a></li>
<li class="breadcrumb-item"><?=($action == "edit") ? "bearbeiten" : "neu"?></li>
</ol>
</div>
<h4 class="page-title">Benutzer</h4>
</div>
</div>
</div>
<!-- end page title -->
<!-- Main content -->
<div class="row">
<div class="col-lg">
<div class="card">
<div class="card-body">
<h4 class="header-title mb-3">Benutzer bearbeiten</h4>
<form method="post" action="<?=$this->getUrl("User","save")?>">
<input type="hidden" name="id" value="<?=$user->id?>" />
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username" class="form-control" value="<?=$user->username?>" />
</div>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" class="form-control" value="<?=$user->name?>" />
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" id="email" name="email" class="form-control" value="<?=$user->email?>" />
</div>
<div class="form-group">
<label for="mobile">Handy Nr.:</label>
<input type="text" id="mobile" placeholder="+436641234xxx" name="mobile" class="form-control" value="<?=$user->mobile?>" />
</div>
<div class="form-group">
<label for="address_id">Firma/Person:</label>
<select name="address_id" id="address_id" class="form-control">
<option value=""></option>
<?php foreach($addresses as $address): ?>
<option value="<?=$address->id?>" <?=($address->id == $user->address_id || $address->id == $user->address_id) ? "selected='selected'" : ""?>><?=($address->company) ? $address->company : $address->getFullName()?><?=($address->customer_number) ? " (".$address->customer_number.")" : ""?></option>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="admin">Admin:</label>
<select name="admin" id="admin" class="form-control" <?=($user->id == 1) ? "disabled='disabled'" : ""?>>
<option value="false" <?=(isset($user) && !$user->isAdmin()) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=(isset($user) && $user->isAdmin() || $user->id == 1) ? "selected='selected'" : ""?>>Yes</option>
</select>
</div>
<div class="form-group">
<label for="employee"><?=TT_SYSOWNER_NAME_HTML?> Mitarbeiter:</label>
<select name="employee" id="employee" class="form-control">
<option value="false" <?=(isset($user) && !$user->is("employee")) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=(isset($user) && $user->is("employee")) ? "selected='selected'" : ""?>>Yes</option>
</select>
</div>
<div class="form-group <?=(!isset($user) || !$user->is("employee")) ? "hidden" : ""?>" id="employee-number-container">
<label for="employee_number"><?=TT_SYSOWNER_NAME_HTML?> Mitarbeiternummer:</label>
<input type="text" id="employee_number" name="employee_number" class="form-control" value="<?=(isset($user)) ? (new WorkerFlag($user->id, "employee_number"))->value() : ""?>" />
</div>
<div class="form-group <?=(!isset($user) || !$user->is("employee")) ? "hidden" : ""?>" id="project-api-key-container">
<label for="project_api_key">OpenProject API Key:</label>
<input type="text" id="project_api_key" name="project_api_key" class="form-control" value="<?=(isset($user)) ? (new WorkerFlag($user->id, "project_api_key"))->value() : ""?>" />
</div>
<div class="form-group">
<label for="technician">Techniker:</label>
<select name="technician" id="technician" class="form-control">
<option value="false" <?=(isset($user) && !$user->is("technician")) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=(isset($user) && $user->is("technician")) ? "selected='selected'" : ""?>>Yes</option>
</select>
</div>
<div class="form-group" id="preorderfront-container">
<label for="preorderfront">Preorder Frontdesk (Semi-Readonly):</label>
<select name="preorderfront" id="preorderfront" class="form-control">
<option value="false" <?=(isset($user) && !$user->is("preorderfront")) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=(isset($user) && $user->is("preorderfront")) ? "selected='selected'" : ""?>>Yes</option>
</select>
</div>
<div class="form-group" id="preorder-reporting-container">
<label for="preorderaddressreporting">Preorder Address Reporting API User:</label>
<select name="preorderaddressreporting" id="preorderaddressreporting" class="form-control">
<option value="false" <?=(isset($user) && !$user->is("preorderaddressreporting")) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=(isset($user) && $user->is("preorderaddressreporting")) ? "selected='selected'" : ""?>>Yes</option>
</select>
<small>z.B. Meridiam</small>
</div>
<div class="form-group" id="preorderlogistics-container">
<label for="preorderlogistics">Preorder Logistikpartner:</label>
<select name="preorderlogistics" id="preorderlogistics" class="form-control">
<option value="false" <?=(isset($user) && !$user->is("preorderlogistics")) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=(isset($user) && $user->is("preorderlogistics")) ? "selected='selected'" : ""?>>Yes</option>
</select>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" class="form-control" value="" />
</div>
<div class="form-group">
<label for="password2">Repeat Password:</label>
<input type="password" id="password2" name="password2" class="form-control" value="" />
</div>
<hr />
<div class="form-group">
<label for="twofactorrequired">2FA erzwingen:</label>
<select name="twofactorrequired" id="twofactorrequired" class="form-control">
<option value="false" <?=(isset($user) && !$user->twofactorrequired) ? "selected='selected'" : ""?>>No</option>
<option value="true" <?=( (!isset($user) || !$user->id) || (isset($user) && $user->twofactorrequired)) ? "selected='selected'" : ""?>>Yes</option>
</select>
</div>
<hr />
<h4 class="card-title mb-3">Modulberechtigungen</h4>
<div class="row">
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Building]" id="can_building" value="1" <?=($user && $user->can("Building")) ? "checked='checked'" : ""?> />
<label for="can_building" class="form-check-label">Objekte & Anschlüsse (Gebäude)</label>
</div>
</div>
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Pipework]" id="can_pipework" value="1" <?=$user && $user->can("Pipework") ? "checked='checked'" : ""?> />
<label for="can_pipework" class="form-check-label">Tiefbau</label>
</div>
</div>
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Linework]" id="can_linework" value="1" <?=$user && $user->can("Linework") ? "checked='checked'" : ""?> />
<label for="can_linework" class="form-check-label">Leitungsbau</label>
</div>
</div>
</div>
<div class="row">
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Patching]" id="can_patching" value="1" <?=$user && $user->can("Patching") ? "checked='checked'" : ""?> />
<label for="can_patching" class="form-check-label">Patching</label>
</div>
</div>
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Filestore]" id="can_filestore" value="1" <?=$user && $user->can("Filestore") ? "checked='checked'" : ""?> />
<label for="can_filestore" class="form-check-label">Filestore (Netzbau)</label>
</div>
</div>
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Cpeprovisioning]" id="can_cpeprovisioning" value="1" <?=$user && $user->can("Cpeprovisioning") ? "checked='checked'" : ""?> />
<label for="can_cpeprovisioning" class="form-check-label">CPE Provisioning</label>
</div>
</div>
</div>
<div class="row">
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Cpeshipping]" id="can_cpeshipping" value="1" <?=$user && $user->can("Cpeshipping") ? "checked='checked'" : ""?> />
<label for="can_cpeshipping" class="form-check-label">CPE Versand</label>
</div>
</div>
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Voipnumbering]" id="can_voipnumbering" value="1" <?=$user && $user->can("Voipnumbering") ? "checked='checked'" : ""?> />
<label for="can_voipnumbering" class="form-check-label">VOIP Nummernverwaltung</label>
</div>
</div>
<div class="col-4">
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" name="can[Order]" id="can_order" value="1" <?=$user && $user->can("Order") ? "checked='checked'" : ""?> />
<label for="can_order" class="form-check-label">Bestellung</label>
</div>
</div>
</div>
<hr />
<div class="form-group">
<input type="submit" name="submit" value="Speichern" class="btn btn-primary" />
</div>
</form>
</div>
</div>
</div>
</div>
<?php if($user->id): ?>
<div class="row">
<div class="col-lg">
<div class="card">
<div class="card-header">
<h3 class="card-title">API Key</h3>
</div>
<div class="card-body">
<div class="form-group">
<input type="text" class="form-control" value="<?=$user->apikey?>" disabled="disabled" />
</div>
<div class="form-group">
<form method="post" action="<?=self::getUrl("User", "generateApikey")?>">
<input type="hidden" name="id" value="<?=$user->id?>" />
<?php if($user->apikey): ?>
<button type="submit" class="btn btn-outline-primary" onclick="if(!confirm('Achtung: Dadurch wird der bisherige API Key ungültig. Wirklich neuen API Key generieren?')) return false;">Neuen API Key generieren</button>
<?php else: ?>
<button type="submit" class="btn btn-outline-primary">API Key generieren</button>
<?php endif; ?>
</form>
</div>
</div>
</div>
</div>
</div>
<?php endif; ?>
<script type="text/javascript">
$(document).ready(function() {
$("#address_id").select2({
allowClear: true,
placeholder: ""
});
$("#employee").change(function() {
if($("#employee").val() == "true") {
$("#employee-number-container").show(400);
} else {
$("#employee-number-container").hide(400);
}
});
});
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>

View File

@@ -1,129 +1,124 @@
<div class="topbar-menu">
<div class="container-fluid">
<div id="navigation">
<!-- Navigation Menu-->
<ul class="navigation-menu">
<div class="container-fluid">
<div id="navigation">
<!-- Navigation Menu-->
<ul class="navigation-menu">
<?php if(!$me->is("Admin")): ?>
<li class="has-submenu">
<a href="<?=self::getUrl("Dashboard")?>"><i class="fe-airplay"></i> Dashboard</a>
</li>
<?php endif; ?>
<?php if($me->is("Admin")): ?>
<li class="has-submenu">
<a href="<?=self::getUrl("Dashboard")?>"><i class="fe-airplay"></i> Dashboard <div class="arrow-down"></div></a>
<ul class="submenu">
<li><a href="<?=self::getUrl("News")?>"><i class="far fa-th-list text-info"></i> News</a></li>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin", "netowner"])): ?>
<li class="has-submenu">
<a href="#">
<i class="far fa-database"></i>Stammdaten <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if($me->is(["Admin"])): ?>
<li class="has-sub-submenu font-weight-bold"><a>Betriebsstammdaten</a></li>
<li><a href="<?=self::getUrl("Address")?>"><i class="fad fa-user text-info"></i> Personen & Firmen</a></li>
<li><a href="<?=self::getUrl("Product")?>"><i class="far fa-rectangle-list text-info"></i> Produkte</a></li>
<li><a href="<?=self::getUrl("Productgroup")?>"><i class="far fa-list-tree text-info"></i> Produktgruppen</a></li>
<?php if($me->is("preorderfront")): ?>
<li class="has-submenu">
<a href="#">
<i class="fal fa-money-bill-wave"></i>Verkauf <div class="arrow-down"></div>
</a>
<ul class="submenu">
<li><a href="<?=self::getUrl("Preorder")?>"><i class="far fa-fw fa-calendar-lines text-info"></i> Vorbestellung</a></li>
</ul>
</li>
<?php else: ?>
<?php if(!$me->is("Admin")): ?>
<li class="has-submenu">
<a href="<?=self::getUrl("Dashboard")?>"><i class="fa-solid fa-airplay"></i> Dashboard</a>
</li>
<?php endif; ?>
<li><a href="<?=self::getUrl("Network")?>"><i class="fad fa-network-wired text-info"></i> Netzgebiete</a></li>
<li class="has-sub-submenu" ><a href="<?=self::getUrl("Pop")?>"><i class="fad fa-house text-info"></i> Pops</a></li>
<li ><a href="<?=self::getUrl("Devicemanufactor")?>"><i class="fad fa-router text-info"></i> Geräte Hersteller</a></li>
<li><a href="<?=self::getUrl("Devicetype")?>"><i class="fad fa-router text-info"></i> Geräte Typen</a></li>
<li class="has-sub-submenu"><a href="<?=self::getUrl("Device")?>"><i class="fad fa-router text-info "></i> Devices</a></li>
<li class="has-sub-submenu"><a href="<?=self::getUrl("User")?>"><i class="fad fa-users text-info"></i> Benutzer</a></li>
<li class="has-sub-submenu font-weight-bold mt-1"><a>Grundstammdaten</a></li>
<?php endif; ?>
<?php if($me->is(["Admin"])): ?>
<li><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-microchip text-info"></i> Technologien</a></li>
<!--<li><a href="<?=self::getUrl("Contractconfig")?>"><i class="fad fa-gear text-info"></i> ContractConfig</a></li>-->
<?php endif; ?>
<?php if($me->is("Admin")): ?>
<li class="has-submenu">
<a href="<?=self::getUrl("Dashboard")?>"><i class="fa-solid fa-airplay"></i> Dashboard <div class="arrow-down"></div></a>
<ul class="submenu">
<li><a href="<?=self::getUrl("News")?>"><i class="far fa-fw fa-th-list text-info"></i> News</a></li>
</ul>
</li>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","pipeplanner","pipeworker","lineworker"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fas fa-hard-hat"></i>Netzbau <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if($me->is(["Admin","netowner","pipeplanner"])): ?><li><a href="<?=self::getUrl("Building")?>"><i class="fas fa-city text-info"></i> Objekte & Anschlüsse</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","pipeworker","lineplanner","lineworker"])): ?><li><a href="<?=self::getUrl("Pipework")?>"><i class="fad fa-wrench text-info"></i> Tiefbau</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"])): ?><li><a href="<?=self::getUrl("Linework")?>"><i class="fas fa-ethernet text-info"></i> Leitungsbau</a></li><?php endif; ?>
<?php if($me->is(["Admin", "netowner", "netoperator", "lineworker"])): ?><li><a href="<?=self::getUrl("Patching")?>"><i class="fas fa-plug text-info"></i> Patchungen</a></li><?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fad fa-running"></i>Netzbetrieb <div class="arrow-down"></div>
</a>
<ul class="submenu">
<li><a href="<?=self::getUrl("Cpeprovisioning")?>"><i class="fad fa-hdd text-info"></i> CPE Provisioning</a></li>
<li><a href="<?=self::getUrl("Cpeshipping")?>"><i class="fad fa-shipping-fast text-info"></i> CPE Versand</a></li>
</ul>
</li>
<?php endif; ?>
<?php if(false && $me->is(["Admin"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fad fa-phone"></i>Telefonie <div class="arrow-down"></div>
</a>
<ul class="submenu">
<li><a href="<?=self::getUrl("Voicenumberblock")?>"><i class="fad fa-blender-phone text-info"></i> Rufnummernblöcke</a></li>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin","netowner","salespartner"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fal fa-money-bill-wave"></i>Verkauf <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if(false && $me->is(["Admin","netowner","salespartner"])): ?>
<li><a href="<?=self::getUrl("Preordercampaign")?>"><i class="far fa-calendar-lines text-info"></i> Vorbestellung</a></li>
<?php endif; ?>
<?php if($me->is(["Admin","salespartner"])): ?>
<li><a href="<?=self::getUrl("Order")?>"><i class="far fa-file-signature text-info"></i> Bestellungen</a></li>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
<!--
<?php if($me->is(["Admin"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fas fa-shopping-basket"></i>Verträge<div class="arrow-down"></div>
</a>
<ul class="submenu">
<li><a href="<?=self::getUrl("Contract")?>"><i class="fas fa-file-contract"></i> Verträge</a></li>
<li><hr /></li>
<li><a href="<?=self::getUrl("Contractconfiggroup")?>"><i class="fas fa-wrench"></i> Vertragsconfig</a></li>
</ul>
</li>
<?php endif; ?>
-->
</ul>
<!-- End navigation menu -->
<?php if($me->is(["Admin"]) || ($me->is("netowner") && $me->hasGwrNetworks())): ?>
<li class="has-submenu">
<a href="#">
<i class="far fa-fw fa-database"></i>Stammdaten <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if($me->is(["Admin"])): ?>
<li class="has-sub-submenu font-weight-bold"><a>Betriebsstammdaten</a></li>
<li class="mobile-hide"><a href="<?=self::getUrl("Address")?>"><i class="fad fa-fw fa-user text-info"></i> Personen & Firmen</a></li>
<li class="mobile-hide"><a href="<?=self::getUrl("Product")?>"><i class="far fa-fw fa-rectangle-list text-info"></i> Produkte</a></li>
<li class="mobile-hide"><a href="<?=self::getUrl("Productgroup")?>"><i class="far fa-fw fa-list-tree text-info"></i> Produktgruppen</a></li>
<div class="clearfix"></div>
<li class="mobile-hide"><a href="<?=self::getUrl("Network")?>"><i class="fad fa-fw fa-network-wired text-info"></i> Netzgebiete</a></li>
<li class="" ><a href="<?=self::getUrl("Pop")?>"><i class="fad fa-fw fa-house text-info"></i> Pops</a></li>
<li class=""><a href="<?=self::getUrl("Device")?>"><i class="fad fa-fw fa-router text-info "></i> Devices</a></li>
<li class="has-sub-submenu"><a href="<?=self::getUrl("User")?>"><i class="fad fa-fw fa-users text-info"></i> Benutzer</a></li>
<li class="has-sub-submenu font-weight-bold mt-1 mobile-hide"><a>Grundstammdaten</a></li>
<?php endif; ?>
<?php if($me->is(["Admin"])): ?>
<li class="mobile-hide"><a href="<?=self::getUrl("Producttech")?>"><i class="fad fa-fw fa-microchip text-info"></i> Technologien</a></li>
<?php if($me->can("Fibu")): ?><li class="mobile-hide"><a href="<?=self::getUrl("Vatgroup")?>"><i class="fas fa-fw fa-circle-dollar-to-slot text-info"></i> Steuersätze</a></li><?php endif; ?>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","pipeplanner","pipeworker","lineworker"])): ?>
<li class="has-submenu mobile-hide">
<a href="#">
<i class="fas fa-fw fa-hard-hat"></i>Netzbau <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if($me->is(["Admin","netowner","pipeplanner"]) && $me->can("Building")): ?><li><a href="<?=self::getUrl("Building")?>"><i class="fas fa-fw fa-city text-info"></i> Objekte & Anschlüsse</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","pipeworker","lineplanner","lineworker"]) && $me->can("Pipework")): ?><li><a href="<?=self::getUrl("Pipework")?>"><i class="fad fa-fw fa-wrench text-info"></i> Tiefbau</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"]) && $me->can("Linework")): ?><li><a href="<?=self::getUrl("Linework")?>"><i class="fas fa-fw fa-ethernet text-info"></i> Leitungsbau</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","netoperator","lineworker"]) && $me->can("Patching")): ?><li class="has-sub-submenu"><a href="<?=self::getUrl("Patching")?>"><i class="fas fa-fw fa-plug text-info"></i> Patchungen</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","lineplanner","pipeworker","netoperator","lineworker"]) && $me->can("Filestore")): ?><li class="has-sub-submenu"><a href="<?=self::getUrl("Filestore")?>"><i class="fas fa-fw fa-file text-info"></i> Dateiablage</a></li><?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin"]) || $me->can(["Cpeprovisioning", "Cpeshipping"])): ?>
<li class="has-submenu mobile-hide">
<a href="#">
<i class="fad fa-fw fa-running"></i>Netzbetrieb <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if($me->isAdmin() || $me->can("Cpeprovisioning")): ?><li><a href="<?=self::getUrl("Cpeprovisioning")?>"><i class="fad fa-fw fa-hdd text-info"></i> CPE Provisioning</a></li><?php endif; ?>
<?php if($me->isAdmin() || $me->can("Cpeshipping")): ?><li><a href="<?=self::getUrl("Cpeshipping")?>"><i class="fad fa-fw fa-shipping-fast text-info"></i> CPE Versand</a></li><?php endif; ?>
<?php if($me->isAdmin()) : ?><li><a href="<?=self::getUrl("MaintenanceNotification")?>"><i class="fa-solid fa-envelope-badge text-info"></i> Wartungsmeldungen</a></li><?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin"]) || $me->can("Voipnumbering")): ?>
<li class="has-submenu mobile-hide">
<a href="#">
<i class="fad fa-fw fa-phone"></i>Telefonie <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if($me->isAdmin() || $me->can("Voipnumbering")): ?><li><a href="<?=self::getUrl("Voicenumberblock")?>"><i class="fad fa-fw fa-phone-office text-info"></i> Rufnummernblöcke</a></li><?php endif; ?>
<?php if($me->isAdmin() || $me->can("Voiceplan")): ?><li><a href="<?=self::getUrl("Voiceplan")?>"><i class="fas fa-fw fa-phone-arrow-up-right text-info"></i> Sprachtarife</a></li><?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php if($me->is(["Admin","netowner","salespartner"]) || $me->can(["Order", "Preorder"])): ?>
<li class="has-submenu">
<a href="#">
<i class="fal fa-fw fa-money-bill-wave"></i>Verkauf <div class="arrow-down"></div>
</a>
<ul class="submenu">
<?php if($me->is(["Admin","salespartner"]) && $me->can("Order")): ?>
<li><a href="<?=self::getUrl("Order")?>"><i class="far fa-fw fa-file-signature text-info"></i> Bestellungen</a></li>
<?php endif; ?>
</ul>
</li>
<?php endif; ?>
<?php endif; ?>
</ul>
<!-- End navigation menu -->
<div class="clearfix"></div>
</div>
<!-- end #navigation -->
</div>
<!-- end #navigation -->
</div>
<!-- end container -->
<!-- end container -->
</div>
<!-- end navbar-custom -->
<!-- end navbar-custom -->

View File

@@ -1,133 +1,67 @@
<!-- Topbar Start -->
<div class="navbar-custom">
<div class="container-fluid">
<ul class="list-unstyled topnav-menu float-right mb-0">
<div class="container-fluid">
<ul class="list-unstyled topnav-menu float-right mb-0" id="topbar">
<li class="dropdown notification-list">
<!-- Mobile menu toggle-->
<a class="navbar-toggle nav-link">
<div class="lines">
<span></span>
<span></span>
<span></span>
</div>
</a>
<!-- End mobile menu toggle-->
</li>
<li class="dropdown notification-list">
<a class="nav-link dropdown-toggle" data-toggle="adropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<i class="fe-bell noti-icon"></i>
<!--<span class="badge badge-danger rounded-circle noti-icon-badge">2</span>-->
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-lg">
<!-- item-->
<div class="dropdown-item noti-title">
<h5 class="m-0">
<span class="float-right">
<a href="" class="text-dark">
<small>Clear All</small>
<li class="dropdown notification-list">
<!-- Mobile menu toggle-->
<a class="navbar-toggle nav-link">
<div class="lines">
<span></span>
<span></span>
<span></span>
</div>
</a>
</span>Notification
</h5>
</div>
<!-- End mobile menu toggle-->
</li>
<div class="aslimscroll noti-scroll">
<li class="dropdown notification-list">
<a class="nav-link dropdown-toggle" data-toggle="adropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<i class="fe-bell noti-icon"></i>
<!--<span class="badge badge-danger rounded-circle noti-icon-badge">2</span>-->
</a>
</li>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item notify-item">
<div class="notify-icon">
<img src="<?=self::getResourcePath()?>assets/images/users/avatar-2.jpg" class="img-fluid rounded-circle" alt="" /> </div>
<p class="notify-details">Cristina Pride</p>
<p class="text-muted mb-0 user-msg">
<small>Hi, How are you? What about our next meeting</small>
</p>
</a>
<li>
<a class="nav-link nav-user mr-0" href="<?=self::getUrl("UserProfile")?>">
<!-- <img src="<?=self::getResourcePath()?>assets/images/users/avatar-4.jpg" alt="user-image" class="rounded-circle"> -->
<!-- <i style="font-size: 24px; border-radius: 50%;" class="fas fa-user-secret text-white img-circle bg-info"></i>-->
<?php if(TT_WORKER_FORCE_2FA && !$me->twofactor): ?>
<i class="fas fa-exclamation-triangle text-warning" title="Zwei-Faktor-Authentifizierung (2FA) nicht aktiviert!"></i>
<?php else: ?>
<i class="fa-light fa-gear"></i>
<?php endif; ?>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item notify-item active">
<div class="notify-icon bg-warning"><i class="mdi mdi-comment-account-outline"></i> </div>
<p class="notify-details">Caleb Flakelar commented on Admin<small class="text-muted">1 min ago</small></p>
</a>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item notify-item">
<div class="notify-icon bg-info"><i class="mdi mdi-account-plus"></i></div>
<p class="notify-details">New user registered.<small class="text-muted">5 hours ago</small></p>
</a>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item notify-item">
<div class="notify-icon">
<img src="<?=self::getResourcePath()?>assets/images/users/avatar-4.jpg" class="img-fluid rounded-circle" alt="" /> </div>
<p class="notify-details">Karen Robinson</p>
<p class="text-muted mb-0 user-msg">
<small>Wow ! this admin looks good and awesome design</small>
</p>
</a>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item notify-item">
<div class="notify-icon bg-danger"><i class="mdi mdi-comment-account-outline"></i></div>
<p class="notify-details">Caleb Flakelar commented on Admin<small class="text-muted">4 days ago</small></p>
</a>
<!-- item-->
<a href="javascript:void(0);" class="dropdown-item notify-item">
<div class="notify-icon bg-primary">
<i class="mdi mdi-heart"></i>
</div>
<p class="notify-details">Carlos Crouch liked
<b>Admin</b>
<small class="text-muted">13 days ago</small>
</p>
</a>
</div>
<!-- All-->
<a href="javascript:void(0);" class="dropdown-item text-center text-primary notify-item notify-all">
View all
<i class="fi-arrow-right"></i>
</a>
</div>
</li>
<li>
<a class="nav-link nav-user mr-0" href="#">
<!-- <img src="<?=self::getResourcePath()?>assets/images/users/avatar-4.jpg" alt="user-image" class="rounded-circle"> -->
<i style="font-size: 24px; border-radius: 50%;" class="fas fa-user-secret text-white img-circle bg-info"></i>
<span class="pro-user-name ml-1">
<?=$me->username?>
<span class="pro-user-name ml-1">
<?=$me->username?>
</span>
</a>
</li>
</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>
<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>
</ul>
</ul>
<ul class="list-unstyled topnav-menu-left m-0">
<ul class="list-unstyled topnav-menu-left m-0">
<li class="logo-box float-left">
<a href="<?=self::getUrl("Dashboard")?>" class="logo">
<li class="logo-box float-left">
<a href="<?=self::getUrl("Dashboard")?>" class="logo">
<span class="logo-lg">
<img src="<?=self::getResourcePath()?>assets/images/<?=MFAPPNAME_SLUG?>-logo-top.png" alt="" style="height:80px; padding-top:12px; padding-left:32px;">
</span>
<span class="logo-sm">
<span class="logo-sm">
<img src="<?=self::getResourcePath()?>assets/images/<?=MFAPPNAME_SLUG?>-logo-top.png" alt="" height="28">
</span>
</a>
</li>
</ul>
</a>
</li>
</ul>
</div> <!-- end container-fluid-->
</div> <!-- end container-fluid-->
</div>
<!-- end Topbar -->

View File

@@ -0,0 +1,7 @@
<div class="pagination justify-content-center">
<?php if($pagination['maxItems']): ?>
<?=$pagination_entity_name?> <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
<?php else: ?>
Keine <?=$pagination_entity_name?> gefunden
<?php endif; ?>
</div>

View File

@@ -0,0 +1,106 @@
<?php if($pagination['maxItems'] > $pagination['count']): ?>
<?php
$mfPagination_pagecount = intval($pagination['maxItems'] / $pagination['count']);
$mfPagination_currentpage = $pagination['start'] / $pagination['count'];
$mfPagination_pages = [];
$mfPagination_baseurl_params = $pagination_baseurl_params;
$log = mfLoghandler::singleton();
$mfPagination_pagecount_add = 0;
if($mfPagination_pagecount < 12) {
if($pagination['maxItems'] % $pagination['count'] != 0) {
$mfPagination_pagecount_add = 1;
}
for($i = 0; $i < $mfPagination_pagecount+$mfPagination_pagecount_add; $i++) {
$mfPagination_baseurl_params['s'] = $i * $pagination['count'];
$page = [
's' => $i * $pagination['count'],
'url' => $pagination_baseurl."?".http_build_query($mfPagination_baseurl_params),
'current' => ($pagination['start'] == $i*$pagination['count']),
];
$mfPagination_pages[$i] = $page;
}
} else {
if($pagination['maxItems'] % $pagination['count'] != 0) {
$mfPagination_pagecount_add = 1;
}
$show_from = $mfPagination_currentpage - 4;
$show_to = $mfPagination_currentpage + 4;
if($show_from < 1) {
$show_from = 1;
}
if($show_to > $mfPagination_pagecount) {
$show_to = $mfPagination_pagecount + $mfPagination_pagecount_add;
}
for($i = 0; $i < $mfPagination_pagecount + $mfPagination_pagecount_add; $i++) {
if($show_from > 1 && $i == $show_from) {
$mfPagination_pages[$i] = "separator_before";
continue;
}
if($i == $show_to && $show_to < $mfPagination_pagecount) {
$mfPagination_pages[$i] = "separator_after";
continue;
}
$mfPagination_baseurl_params['s'] = $i * $pagination['count'];
if(($i == 0 || $i == $mfPagination_pagecount) || ($i >= $show_from && $i <= $show_to)) {
//$log->debug("show_from: $show_from, show_to: $show_to");
$page = [
's' => $i * $pagination['count'],
'url' => $pagination_baseurl."?".http_build_query($mfPagination_baseurl_params),
'current' => ($pagination['start'] == $i*$pagination['count']),
];
$mfPagination_pages[$i] = $page;
}
}
}
if(count($pagination_baseurl_params)) {
$baseurl_with_params = $pagination_baseurl."?".http_build_query($pagination_baseurl_params);
if(substr($baseurl_with_params, -1, 1) != "&" && substr($baseurl_with_params, -1, 1) != "?") {
$baseurl_with_params .= "&";
}
} else {
$baseurl_with_params = $pagination_baseurl."?";
}
?>
<nav>
<ul class="pagination justify-content-center mb-1">
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
<a class="page-link" href="<?=$baseurl_with_params?>" tabindex="-1">Erste</a>
</li>
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
<a class="page-link" href="<?=$baseurl_with_params?>s=<?=($pagination['start'] - $pagination['count'])?>" tabindex="-1">Zurück</a>
</li>
<?php foreach($mfPagination_pages as $mfPageIndex => $mfPage):?>
<?php if($mfPage == "separator_before" || $mfPage == "separator_after"): ?>
<li class="page-item disabled font-weight-bold text-secondary points"><a class="page-link">...</a></li>
<?php continue; endif; ?>
<li class="page-item <?=($mfPage['current']) ? "disabled font-weight-bold text-secondary" : ""?>"><a class="page-link" href="<?=$mfPage['url']?>"><?=$mfPageIndex+1?></a></li>
<?php endforeach; ?>
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) <= 1) ? "disabled" : ""?>">
<a class="page-link" href="<?=$baseurl_with_params?>s=<?=($pagination['start'] + $pagination['count'])?>">Weiter</a>
</li>
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) <= 1) ? "disabled" : ""?>">
<?php if($pagination['maxItems'] % $pagination['count'] == 0): ?>
<a class="page-link" href="<?=$baseurl_with_params?>s=<?=($pagination['maxItems'] - $pagination['count'])?>">Letzte</a>
<?php else: ?>
<a class="page-link" href="<?=$baseurl_with_params?>s=<?=($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count'])?>">Letzte</a>
<?php endif; ?>
</li>
</ul>
</nav>
<?php endif; ?>