Added andom-tec Layout package
This commit is contained in:
463
Layout/andom-tec/Building/Form.php
Normal file
463
Layout/andom-tec/Building/Form.php
Normal file
@@ -0,0 +1,463 @@
|
||||
<?php include(realpath(dirname(__FILE__)."/../")."/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")?>">the-tool</a></li>
|
||||
<li class="breadcrumb-item"><a href="<?=self::getUrl("Building")?>">Objekte</a></li>
|
||||
<li class="breadcrumb-item active"><?=($building->id) ? "bearbeiten" : "Neu" ?></li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Objekte</h4>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end page title -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="header-title mb-2"><?=($building->id) ? "Objekt bearbeiten" : "Neues Objekt"?></h4>
|
||||
|
||||
<form class="form-horizontal" method="post" action="<?=self::getUrl("Building", "save")?>">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<input type="hidden" name="id" value="<?=$building->id?>" />
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="network_id">Netzgebiet *</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="network_id" id="network_id">
|
||||
<option></option>
|
||||
<?php foreach($networks as $network): ?>
|
||||
<option value="<?=$network->id?>" <?=($building->network_id == $network->id) ? "selected='selected'" : ""?>><?=($network->name)?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="type_id">Objekttyp *</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="type_id" id="type_id">
|
||||
<option></option>
|
||||
<?php foreach($types as $type): ?>
|
||||
<option value="<?=$type->id?>" <?=($building->type_id == $type->id) ? "selected='selected'" : ""?>><?=($type->name)?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="units">Nutzungseinheiten *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="number" class="form-control" name="units" id="units" value="<?=$building->units?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="street">Straße *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="street" id="street" value="<?=$building->street?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="zip">PLZ *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="zip" id="zip" value="<?=$building->zip?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="city">Ort *</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="city" id="city" value="<?=$building->city?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($building->id): ?>
|
||||
<div class="form-group row" id="gps-again" style="display:none;">
|
||||
<div class="col-lg-2"></div>
|
||||
<div class="col-lg-10">
|
||||
<label class="text-pink"><input type="checkbox" name="gps_again" value="1" /> GPS-Koordinaten erneut berechnen</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="code">Objekt ID</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="code" id="code" value="<?=$building->code?>" readonly="readonly" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="oan_id">OAN ID</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="oan_id" id="oan_id" value="<?=$building->oan_id?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="pop_id">POP</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="pop_id" id="pop_id">
|
||||
<option></option>
|
||||
<?php foreach($networks as $network): ?>
|
||||
<?php foreach($network->pops as $pop): ?>
|
||||
<option value="<?=$pop->id?>" <?=($building->pop_id == $pop->id) ? "selected='selected'" : ""?>><?=$network->name?> - <?=($pop->name)?></option>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-4 col-form-label" for="gps_lat">GPS Länge (N)</label>
|
||||
<div class="col-lg-8">
|
||||
<input type="text" class="form-control" name="gps_lat" id="gps_lat" value="<?=$building->gps_lat?>" <?=($building->gps_lat) ? "readonly='readonly'" : ""?> />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-4 col-form-label" for="gps_long">GPS Breite (E)</label>
|
||||
<div class="col-lg-8">
|
||||
<input type="text" class="form-control" name="gps_long" id="gps_long" value="<?=$building->gps_long?>" <?=($building->gps_lat) ? "readonly='readonly'" : ""?> />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($building->gps_lat && $building->gps_long): ?>
|
||||
<div class="form-group row">
|
||||
<div class="col-lg-4"></div>
|
||||
<div class="col-lg-8">
|
||||
<button type="button" id="edit-gps" class="btn btn-sm btn-outline-pink"><i class="fas fa-edit"></i> GPS-Koordinaten bearbeiten</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<?php if($building->gps_lat && $building->gps_long): ?>
|
||||
<div class="col-lg-6">
|
||||
<div id="building-map" style="height:420px;width:100%"></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if($building->gps_lat && $building->gps_long): ?>
|
||||
<div class="row mb-3">
|
||||
<div class="col-lg-2">
|
||||
</div>
|
||||
<div class="col-lg-10">
|
||||
<a href="https://maps.google.com/maps?t=k&q=loc:<?=$building->gps_lat?>+<?=$building->gps_long?>" target="_blank"><i class="fas fa-external-link-alt"></i> Auf Google Maps öffnen</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="laea">LAEA Koordinaten</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="laea" id="laea" value="<?=$building->laea?>" readonly='readonly' />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="contact">Kontakt</label>
|
||||
<div class="col-lg-10">
|
||||
<input type="text" class="form-control" name="contact" id="contact" value="<?=$building->contact?>" />
|
||||
</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="text" class="form-control" name="phone" id="phone" value="<?=$building->phone?>" />
|
||||
</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="text" class="form-control" name="email" id="email" value="<?=$building->email?>" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="networksection_id">Bauabschnitt</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="networksection_id" id="networksection_id">
|
||||
<option></option>
|
||||
<?php foreach($networksections as $section): ?>
|
||||
<option value="<?=$section->id?>" <?=($building->networksection_id == $section->id) ? "selected='selected'" : ""?>><?=($section->network->name)?> - <?=($section->name)?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="status_id">Status</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="status_id" id="status_id" <?=($building->id && !$me->is("Admin")) ? "disabled='disabled'" : ""?>>
|
||||
<option></option>
|
||||
<?php foreach($statuses as $status): ?>
|
||||
<option value="<?=$status->id?>" <?=($building->status_id == $status->id) ? "selected='selected'" : ""?>><?=$status->code?> - <?=__($status->name."-b")?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="header-title mb-2">Berechtigungen</h4>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="pipeworker_id">Tiefbau</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="pipeworker_id" id="pipeworker_id" <?=(!$me->is(["Admin", "netowner", "pipeplanner"])) ? "disabled='disabled'" : ""?>>
|
||||
<option></option>
|
||||
<?php foreach($pipeworkers as $pw): ?>
|
||||
<option value="<?=$pw->id?>" <?=($building->pipeworker_id == $pw->id) ? "selected='selected'" : ""?>><?=$pw->getCompanyOrName()?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-lg-2 col-form-label" for="lineworker_id">Kabelbau</label>
|
||||
<div class="col-lg-10">
|
||||
<select class="select2 form-control " name="lineworker_id" id="lineworker_id" <?=(!$me->is(["Admin", "netowner", "pipeplanner"])) ? "disabled='disabled'" : ""?>>
|
||||
<option></option>
|
||||
<?php foreach($lineworkers as $lw): ?>
|
||||
<option value="<?=$lw->id?>" <?=($building->lineworker_id == $lw->id) ? "selected='selected'" : ""?>><?=$lw->getCompanyOrName()?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</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="note">Interne Notiz</label>
|
||||
<div class="col-lg-10">
|
||||
<textarea id="note" class="form-control" name="note" rows="5"><?=$building->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">Speichern</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$("#network_id").select2({placeholder: ""});
|
||||
$("#pop_id").select2({placeholder: "", allowClear: true,});
|
||||
$("#type_id").select2({placeholder: ""});
|
||||
$("#networksection_id").select2({placeholder: "", allowClear: true,});
|
||||
|
||||
// disable mousewheel on input number field when in focus
|
||||
$('form').on('focus', 'input[type=number]', function (e) {
|
||||
$(this).on('wheel.disableScroll', function (e) {
|
||||
e.preventDefault();
|
||||
})
|
||||
});
|
||||
$('form').on('blur', 'input[type=number]', function (e) {
|
||||
$(this).off('wheel.disableScroll');
|
||||
});
|
||||
|
||||
function updatePops() {
|
||||
var network_id = $("#network_id").val();
|
||||
if(!network_id) {
|
||||
return true;
|
||||
}
|
||||
// get new pops
|
||||
$.get("<?=self::getUrl("Pop","Api")?>",
|
||||
{
|
||||
"do": "getPops",
|
||||
network_id: network_id
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
//console.log(success);
|
||||
var pops = success.result.pops;
|
||||
if(typeof pops !== 'object' || pops === null) {
|
||||
return true;
|
||||
}
|
||||
var selected = $("#pop_id option:selected").val();
|
||||
$("#pop_id option:gt(0)").remove();
|
||||
for(var pop_id in pops) {
|
||||
$("#pop_id").append($("<option></option>").attr("value", pop_id).text(pops[pop_id]));
|
||||
}
|
||||
if(selected) {
|
||||
$("#pop_id").val(selected);
|
||||
}
|
||||
}
|
||||
},
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
function updateSections() {
|
||||
var network_id = $("#network_id").val();
|
||||
if(!network_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$.get("<?=self::getUrl("Networksection","Api")?>",
|
||||
{
|
||||
"do": "getSections",
|
||||
network_id: network_id
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
var sections = success.result.sections;
|
||||
if(typeof sections !== 'object' || sections === null) {
|
||||
return true;
|
||||
}
|
||||
var selected = $("#networksection_id option:selected").val();
|
||||
$("#networksection_id option:gt(0)").remove();
|
||||
for(var section_id in sections) {
|
||||
$("#networksection_id").append($("<option></option>").attr("value", section_id).text(sections[section_id]));
|
||||
}
|
||||
console.log("selected: " + selected);
|
||||
if(selected) {
|
||||
$("#networksection_id").val(selected);
|
||||
}
|
||||
}
|
||||
},
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
function updatePermissions() {
|
||||
var network_id = $("#network_id").val();
|
||||
if(!network_id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var types = ["lineworker", "pipeworker"];
|
||||
|
||||
$.get("<?=self::getUrl("Network","Api")?>",
|
||||
{
|
||||
"do": "getPermissions",
|
||||
network_id: network_id,
|
||||
types: types.join('|')
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
var perms = success.result.permissions;
|
||||
if(typeof perms !== 'object' || perms === null) {
|
||||
return true;
|
||||
}
|
||||
types.forEach(function(type) {
|
||||
var selected = $("#" + type + "_id option:selected").val();
|
||||
$("#" + type + "_id").empty();
|
||||
$("#" + type + "_id").append($("<option></option>"));
|
||||
for(var perm_id in perms[type]) {
|
||||
$("#" + type + "_id").append($("<option></option>").attr("value", perm_id).text(perms[type][perm_id]));
|
||||
}
|
||||
if(selected) {
|
||||
$("#" + type + "_id").val(selected);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'json'
|
||||
);
|
||||
}
|
||||
|
||||
function enableGpsInputs() {
|
||||
$("#gps_lat").removeAttr("readonly");
|
||||
$("#gps_long").removeAttr("readonly");
|
||||
$("#edit-gps").remove();
|
||||
}
|
||||
|
||||
function showGpsAgain() {
|
||||
$("#gps-again").show();
|
||||
$("#gps-again input[type=checkbox").prop("checked", true);
|
||||
}
|
||||
|
||||
|
||||
<?php if($building->gps_lat && $building->gps_long): ?>
|
||||
////////////
|
||||
// Map
|
||||
////////////
|
||||
var gpslat = <?=($building->gps_lat) ? $building->gps_lat : 0?>;
|
||||
var gpslong = <?=($building->gps_long) ? $building->gps_long : 0?>;
|
||||
console.log(gpslat + "," + gpslong);
|
||||
|
||||
// Building Map
|
||||
var buildingMap = L.map('building-map').setView([gpslat, gpslong], 18);
|
||||
|
||||
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
|
||||
//L.tileLayer('<?=self::getResourcePath()?>assets/map/{id}/{z}/{x}/{y}.png', {
|
||||
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
|
||||
minZoom: 12,
|
||||
maxZoom: 22,
|
||||
//id: 'OSMPublicTransport',
|
||||
//id: 'mapbox.streets',
|
||||
id: 'mapbox/streets-v11',
|
||||
//id: 'mapbox.pirates',
|
||||
accessToken: '<?=TT_MAPBOX_TILE_API_TOKEN?>'
|
||||
}).addTo(buildingMap);
|
||||
|
||||
var marker = L.marker([gpslat, gpslong]).addTo(buildingMap);
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
$("#street, #zip, #city").change(function() {
|
||||
showGpsAgain();
|
||||
});
|
||||
|
||||
$("#edit-gps").click( function() {
|
||||
enableGpsInputs();
|
||||
});
|
||||
|
||||
$("#network_id").change(function() {
|
||||
updatePops();
|
||||
updatePermissions();
|
||||
updateSections();
|
||||
});
|
||||
|
||||
$( document ).ready(function() {
|
||||
updatePops();
|
||||
updatePermissions();
|
||||
updateSections();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>
|
||||
397
Layout/andom-tec/Building/Index.php
Normal file
397
Layout/andom-tec/Building/Index.php
Normal file
@@ -0,0 +1,397 @@
|
||||
<?php include(realpath(dirname(__FILE__)."/../")."/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")?>">the-tool</a></li>
|
||||
<li class="breadcrumb-item active">Objekte</li>
|
||||
</ol>
|
||||
</div>
|
||||
<h4 class="page-title">Objekte</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">Filter</h4>
|
||||
|
||||
<form method="get" action="<?=self::getUrl("Building")?>">
|
||||
<div class="row">
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_network_id">Netzgebiet</label>
|
||||
<select name="filter[network_id]" id="filter_network_id" class="form-control">
|
||||
<option></option>
|
||||
<?php foreach($mynetworks as $fnet): ?>
|
||||
<option value="<?=$fnet->id?>" <?=($filter['network_id'] == $fnet->id) ? "selected='selected'" : ""?>><?=$fnet->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_networksection_id">Bauabschnitt</label>
|
||||
<select name="filter[networksection_id]" id="filter_networksection_id" class="form-control">
|
||||
<option></option>
|
||||
<?php foreach($mynetworks as $fnet): ?>
|
||||
<?php if(is_array($fnet->sections) && count($fnet->sections)): ?>
|
||||
<optgroup label="<?=$fnet->name?>">
|
||||
<?php foreach($fnet->sections as $section): ?>
|
||||
<option value="<?=$section->id?>" <?=($filter['networksection_id'] == $section->id) ? "selected='selected'" : ""?>><?=$section->name?></option>
|
||||
<?php endforeach; ?>
|
||||
</optgroup>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<label class="form-label" for="filter_status_id">Objektstatus</label>
|
||||
<select name="filter[status_id]" id="filter_status_id" class="form-control">
|
||||
<option></option>
|
||||
<?php foreach(BuildingstatusModel::getAll() as $status): ?>
|
||||
<option
|
||||
value="<?=$status->id?>"
|
||||
<?php if(is_array($filter)): ?>
|
||||
<?=($filter['status_id'] == $status->id) ? "selected='selected'" : ""?>
|
||||
<?php else: ?>
|
||||
<?=(($me->is("pipeworker") && !$me->isAdmin()) && $status->id == 3) ? "selected='selected'" : ""?>
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?=$status->code?> - <?=__($status->name."-b")?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-1">
|
||||
<label class="form-label" for="filter_code">Objekt ID</label>
|
||||
<input type="text" class="form-control" name="filter[code]" id="filter_code" value="<?=$filter['code']?>" />
|
||||
</div>
|
||||
|
||||
<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="<?=$filter['street']?>" />
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="row mt-2">
|
||||
<div class="col">
|
||||
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
||||
<a class="btn btn-secondary" href="<?=self::getUrl("Building")?>">Filter zurücksetzen</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Objekte</h4>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary mb-2" href="<?=self::getUrl("Building", "add")?>"><i class="fas fa-plus"></i> Neues Objekt anlegen</a>
|
||||
</div>
|
||||
|
||||
<?php if($pagination['maxItems'] > $pagination['count']): ?>
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center mb-1">
|
||||
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod, "Index", ["filter" => $filter])?>" tabindex="-1">Erste</a>
|
||||
</li>
|
||||
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] - $pagination['count'], "filter" => $filter])?>" tabindex="-1">Zurück</a>
|
||||
</li>
|
||||
<?php for($i = 0; $i < ($pagination['maxItems'] / $pagination['count']); $i++): ?>
|
||||
<li class="page-item <?=($pagination['start'] == $i*$pagination['count']) ? "disabled font-weight-bold" : ""?>"><a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $i*$pagination['count'], "filter" => $filter])?>"><?=$i+1?></a></li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] + $pagination['count'], "filter" => $filter])?>">Vor</a>
|
||||
</li>
|
||||
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => ($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count']), "filter" => $filter])?>">Letzte</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
<div class="pagination justify-content-center">
|
||||
<?php if($pagination['maxItems']): ?>
|
||||
Objekte <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
|
||||
<?php else: ?>
|
||||
Keine Objekte gefunden
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<tr>
|
||||
<th>Netzgebiet</th>
|
||||
<th>POP</th>
|
||||
<th>Typ</th>
|
||||
<th>Objekt ID</th>
|
||||
<th>OAN ID</th>
|
||||
<th>Adresse</th>
|
||||
<th>Einheiten</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($buildings as $building): ?>
|
||||
<tr class="building-list-tr" id="building-<?=$building->id?>">
|
||||
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->network->name?></td>
|
||||
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->pop->name?></td>
|
||||
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->type->name?></td>
|
||||
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->code?></td>
|
||||
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->oan_id?></td>
|
||||
<td onclick="toggleBuilding(<?=$building->id?>)">
|
||||
<?=$building->street?><br />
|
||||
<?=$building->zip?> <?=$building->city?>
|
||||
</td>
|
||||
<td onclick="toggleBuilding(<?=$building->id?>)"><?=$building->units?></td>
|
||||
<td onclick="toggleBuilding(<?=$building->id?>)" class="text-monospace"><?=__($building->status->name."-b")?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?=self::getUrl("Building", "edit", ["id" => $building->id])?>"><i class="far fa-edit" title="Objekt Bearbeiten"></i></a>
|
||||
<a href="<?=self::getUrl("Building", "delete", ["id" => $building->id])?>" class="text-danger" onclick="if(!confirm('Objekt wirklich löschen?')) return false;" title="Objekt Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="building-detail-<?=$building->id?>" style="display:none; background-color:#fff">
|
||||
<td colspan="8">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Anschlüsse im Objekt <strong><?=$building->code?></strong></h4>
|
||||
<p>
|
||||
<?=$building->street?><br />
|
||||
<?=$building->zip?> <?=$building->city?>
|
||||
</p>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
|
||||
<?php if(is_array($building->terminations) && count($building->terminations)): ?>
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th>Anschluss ID</th>
|
||||
<th>Bezeichung</th>
|
||||
<th>Kontakt</th>
|
||||
<th>Telefon</th>
|
||||
<th>Email</th>
|
||||
<th>Status</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<?php foreach($building->terminations as $term): ?>
|
||||
|
||||
<tr>
|
||||
<td><?=$term->code?></td>
|
||||
<td>
|
||||
|
||||
<span id="term-name-<?=$term->id?>-text"><?=$term->name?></span>
|
||||
<div class="input-group" id="term-name-<?=$term->id?>-input" style="display:none">
|
||||
<input type="text" class="form-control" id="term-name-<?=$term->id?>-input" value="<?=$term->name?>" />
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-primary" title="Speichern" onclick="saveTerminationControl(<?=$term->id?>, 'name')"><i class="fas fa-check"></i></button>
|
||||
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleTerminationControl(<?=$term->id?>, 'name')"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="float-right" id="term-name-<?=$term->id?>-edit">
|
||||
<i class="far fa-edit text-pink" style="cursor:pointer" title="Bezeichnung Bearbeiten" onclick="toggleTerminationControl(<?=$term->id?>, 'name')"></i>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<span id="term-contact-<?=$term->id?>-text"><?=$term->contact?></span>
|
||||
<div class="input-group" id="term-contact-<?=$term->id?>-input" style="display:none">
|
||||
<input type="text" class="form-control" value="<?=$term->contact?>" />
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-primary" title="Speichern" onclick="saveTerminationControl(<?=$term->id?>, 'contact')"><i class="fas fa-check"></i></button>
|
||||
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleTerminationControl(<?=$term->id?>, 'contact')"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="float-right" id="term-contact-<?=$term->id?>-edit">
|
||||
<i class="far fa-edit text-pink" style="cursor:pointer" title="Kontakt Bearbeiten" onclick="toggleTerminationControl(<?=$term->id?>, 'contact')"></i>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<span id="term-phone-<?=$term->id?>-text"><?=$term->phone?></span>
|
||||
<div class="input-group" id="term-phone-<?=$term->id?>-input" style="display:none">
|
||||
<input type="text" class="form-control" value="<?=$term->phone?>" />
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-primary" title="Speichern" onclick="saveTerminationControl(<?=$term->id?>, 'phone')"><i class="fas fa-check"></i></button>
|
||||
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleTerminationControl(<?=$term->id?>, 'phone')"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="float-right" id="term-phone-<?=$term->id?>-edit">
|
||||
<i class="far fa-edit text-pink" style="cursor:pointer" title="Telefon Bearbeiten" onclick="toggleTerminationControl(<?=$term->id?>, 'phone')"></i>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<span id="term-email-<?=$term->id?>-text"><?=$term->email?></span>
|
||||
<div class="input-group" id="term-email-<?=$term->id?>-input" style="display:none">
|
||||
<input type="text" class="form-control" value="<?=$term->email?>" />
|
||||
<div class="input-group-append">
|
||||
<button type="button" class="btn btn-primary" title="Speichern" onclick="saveTerminationControl(<?=$term->id?>, 'email')"><i class="fas fa-check"></i></button>
|
||||
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleTerminationControl(<?=$term->id?>, 'email')"><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="float-right" id="term-email-<?=$term->id?>-edit">
|
||||
<i class="far fa-edit text-pink" style="cursor:pointer" title="Email Bearbeiten" onclick="toggleTerminationControl(<?=$term->id?>, 'email')"></i>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
<td class="text-monospace"><?=__($term->status->name."-t")?></td>
|
||||
<td style="text-align: left; letter-spacing: 4px; font-size: 1.1em;">
|
||||
<a href="<?=self::getUrl("Termination", "delete", ["id" => $term->id])?>" class="text-danger" onclick="if(!confirm('Objekt wirklich löschen?')) return false;" title="Objekt Löschen"><i class="fas fa-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<?php endif; ?>
|
||||
<h4>Neuer Anschluss</h4>
|
||||
<form method="post" action="<?=self::getUrl("Termination", "save")?>">
|
||||
<input type="hidden" name="building_id" value="<?=$building->id?>" />
|
||||
<table class="table tale-bordered">
|
||||
<tr>
|
||||
<td><input type="text" class="form-control" value="<automatisch generiert>" disabled="disabled" /></td>
|
||||
<td><input type="text" class="form-control" name="name" value="" placeholder="Bezeichnung" /></td>
|
||||
<td><input type="text" class="form-control" name="contact" value="" placeholder="Kontakt" /></td>
|
||||
<td><input type="text" class="form-control" name="phone" value="" placeholder="Telefon" /></td>
|
||||
<td><input type="text" class="form-control" name="email" value="" placeholder="Email" /></td>
|
||||
<td><button type="submit" class="btn btn-primary">Speichern</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="display:none;">
|
||||
<td colspan="3"></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<div class="pagination justify-content-center">
|
||||
<?php if($pagination['maxItems']): ?>
|
||||
Objekte <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
|
||||
<?php else: ?>
|
||||
Keine Objekte gefunden
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if($pagination['maxItems'] > $pagination['count']): ?>
|
||||
<nav>
|
||||
<ul class="pagination justify-content-center mb-1">
|
||||
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod, "Index", ["filter" => $filter])?>" tabindex="-1">Erste</a>
|
||||
</li>
|
||||
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] - $pagination['count'], "filter" => $filter])?>" tabindex="-1">Zurück</a>
|
||||
</li>
|
||||
<?php for($i = 0; $i < ($pagination['maxItems'] / $pagination['count']); $i++): ?>
|
||||
<li class="page-item <?=($pagination['start'] == $i*$pagination['count']) ? "disabled font-weight-bold" : ""?>"><a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $i*$pagination['count'], "filter" => $filter])?>"><?=$i+1?></a></li>
|
||||
<?php endfor; ?>
|
||||
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => $pagination['start'] + $pagination['count'], "filter" => $filter])?>">Vor</a>
|
||||
</li>
|
||||
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
||||
<a class="page-link" href="<?=$this->getUrl($Mod,"Index",['s' => ($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count']), "filter" => $filter])?>">Letzte</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function toggleBuilding(id) {
|
||||
$('#building-detail-' + id).toggle();
|
||||
if($('#building-detail-' + id).is(":hidden")) {
|
||||
$('#building-' + id).removeClass("table-info");
|
||||
$('#building-' + id).removeClass("text-info");
|
||||
} else {
|
||||
$('#building-' + id).addClass("text-info");
|
||||
$('#building-' + id).addClass("table-info");
|
||||
}
|
||||
}
|
||||
|
||||
function toggleTerminationControl(id, type) {
|
||||
$("#term-" + type + "-" + id + "-text").toggle();
|
||||
$("#term-" + type + "-" + id + "-input").toggle();
|
||||
$("#term-" + type + "-" + id + "-edit").toggle();
|
||||
}
|
||||
|
||||
function saveTerminationControl(id, type) {
|
||||
if(!Number.isInteger(id) || id < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var value = $("#term-" + type + "-" + id + "-input input[type=text]").val();
|
||||
|
||||
$.post("<?=self::getUrl("Termination","Api")?>",
|
||||
{
|
||||
'do': "setValue",
|
||||
id: id,
|
||||
type: type,
|
||||
value: value
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
$("#term-" + type + "-" + id + "-text").text(value);
|
||||
} else {
|
||||
console.log("error saving (" + type + ", '" + value + "')");
|
||||
}
|
||||
|
||||
toggleTerminationControl(id, type);
|
||||
},
|
||||
'json');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
var building;
|
||||
var hash = window.location.hash.substr(1);
|
||||
var match = hash.match(/building=(\d+)/);
|
||||
if(match && match[1]) {
|
||||
building = match[1]
|
||||
toggleBuilding(building);
|
||||
|
||||
//$('body').scrollTop($('#building-' + building).offset() - 50);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>
|
||||
Reference in New Issue
Block a user