Files
thetool/Layout/default/Pipework/Index.php
2021-08-24 23:13:24 +02:00

145 lines
4.3 KiB
PHP

<?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">Tiefbau</li>
</ol>
</div>
<h4 class="page-title">Tiefbau</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">Auftragsliste nach Netzgebiet</h4>
<form method="post" action="<?=self::getUrl("Pipework","save")?>" >
<?php foreach($networks as $networkname => $buildings): ?>
<h4><?=$networkname?></h4>
<table class="table table-striped table-hover">
<?php foreach($buildings as $building): ?>
<?php
$rowspan = 1;
foreach($building->workflowitems as $item) {
if($item->type == "delimiter") {
$rowspan++;
}
}
?>
<tr id="building-<?=$building->id?>">
<td>
<strong><?=$building->street?></strong><br />
<?=$building->code?><br />
<br />
Kontakt: <?=$building->contact?><br />
Telefon: <strong><?=$building->phone?></strong><br />
Email: <?=$building->email?>
</td>
<td>
<table>
<tr>
<?php $i = 0; foreach($building->workflowitems as $item): ?>
<?php if($item->type == "delimiter"): ?>
<?=($i) ? "</tr></table>" : "" ?>
<?=($item->label) ? "<h5>".$item->label."</h5>" : ""?>
<table><tr>
<?php else: ?>
<?php include(realpath(dirname(__FILE__)."/../")."/Workflow/form.php"); ?>
<?php endif; ?>
<?php $i++; endforeach; ?>
</tr>
</table>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php endforeach; ?>
<button type="submit" class="btn btn-primary">Speichern</button>
</form>
</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"); ?>