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

150 lines
4.9 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): ?>
<?php if(!count($buildings)) continue; ?>
<h4><?=$networkname?></h4>
<table class="table workflow-table">
<?php $bcount = 0; foreach($buildings as $building): ?>
<?php
$rowspan = 1;
foreach($building->workflowitems as $item) {
if($item->type == "delimiter") {
$rowspan++;
}
}
?>
<tr id="building-<?=$building->id?>" class="table-bg-<?=($bcount % 2 == 0) ? "even" : "odd"?>">
<td>
<strong style="white-space: nowrap;"><?=$building->street?></strong><br />
<span class="text-success"><?=$building->code?></span><br />
<br />
Kontakt:<br />
<?=$building->contact?><br />
<strong><?=$building->phone?></strong><br />
<?=$building->email?>
</td>
<td>
<table class="table workflow-table">
<?php $i = 0; foreach($building->workflowitems as $item): ?>
<?php if($i==0): ?>
<?php if($item->type == "delimiter"): ?>
<tr class="workflow-header"><th colspan='<?=$building_wf_colspan?>'><?=$item->label?></th></tr><tr>
<?php else: ?>
<tr>
<?php endif; ?>
<?php else: ?>
<?php if($item->type == "delimiter"): ?>
</tr><tr class="workflow-header"><th colspan='<?=$building_wf_colspan?>'><?=$item->label?></th></tr><tr>
<?php else: ?>
<?php include(realpath(dirname(__FILE__)."/../")."/Workflow/form.php"); ?>
<?php endif; ?>
<?php endif; ?>
<?php $i++; endforeach; ?>
</tr>
</table>
</td>
</tr>
<?php $bcount++; 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"); ?>