WIP Pipework Workflow

This commit is contained in:
Frank Schubert
2021-08-29 16:56:46 +02:00
parent 0f42b2b942
commit b81081cfe6
22 changed files with 584 additions and 111 deletions

View File

@@ -25,34 +25,43 @@
<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++;
}
<?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>
}
?>
<tr id="building-<?=$building->id?>" class="table-bg-<?=($bcount % 2 == 0) ? "even" : "odd"?>">
<td>
<div>
<strong style="white-space: nowrap;"><?=$building->street?></strong><br />
<span class="text-success"><?=$building->code?></span><br />
<br />
Kontakt:<br />
</div>
<div class="mt-1">
<?=$building->contact?><br />
<strong><?=$building->phone?></strong><br />
<?=$building->email?>
</td>
<td>
</div>
<div class="mt-1">
<label><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?>> Baufreigabe</label>
</div>
<div>
<button type="button" class="btn btn-primary" form="wf-building-<?=$building->id?>" onclick="document.getElementById(this.getAttribute('form')).submit()">Speichern</button>
</div>
</td>
<td>
<form method="post" name="wf-building-<?=$building->id?>" id="wf-building-<?=$building->id?>" action="<?=self::getUrl("Pipework","save")?>" enctype="multipart/form-data" >
<input type="hidden" name="id" value="<?=$building->id?>" />
<table class="table workflow-table">
<?php $i = 0; foreach($building->workflowitems as $item): ?>
<?php if($i==0): ?>
<?php if($item->type == "delimiter"): ?>
@@ -69,14 +78,47 @@
<?php endif; ?>
<?php $i++; endforeach; ?>
</tr>
<tr>
<td colspan="3">
<label class="form-label">Kommentar</label> <textarea class="form-control" style="height:100%" form="wf-building-<?=$building->id?>" name="workflow_comment" id="workflow_comment_<?=$building->id?>"><?=$building->workflow_comment?></textarea>
</td>
<td colspan="<?=$building_wf_colspan - 3?>">
<h5>Dokumente</h5>
<table class="table-sm">
<?php $i=0; foreach($building->files as $file): ?>
<?php if($i % 2 == 0): ?>
<tr>
<td><a href="<?=self::getUrl("File", "Download", ['id' => $file->file->id])?>"><i class="fas fa-download"></i> <?=$file->type?></a></td>
<?php else: ?>
<td><a href="<?=self::getUrl("File", "Download", ['id' => $file->file->id])?>"><i class="fas fa-download"></i> <?=$file->type?></a></td>
</tr>
<?php endif; ?>
<?php $i++; endforeach; ?>
<?=($i % 2 != 0) ? "<td></td></tr>" : ""?>
<tr>
<td>
<strong>Dokument hochladen</strong> <select class="form-control" name="file_type">
<?php foreach(TT_WORKFLOW_BUILDING_FILE_TYPES as $type): ?>
<option value="<?=$type?>"><?=$type?></option>
<?php endforeach; ?>
</select>
</td>
<td>
<small>Erlaubte Dateiendungen: <?=MFUPLOAD_ALLOWED_EXTENSIONS_STR?></small>
<input type="file" name="PipeworkFileUpload" class="form-control-file" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<?php $bcount++; endforeach; ?>
</table>
<?php endforeach; ?>
<button type="submit" class="btn btn-primary">Speichern</button>
</form>
</form>
</td>
</tr>
<?php $bcount++; endforeach; ?>
</table>
<?php endforeach; ?>
</div>
</div>
@@ -86,62 +128,7 @@
<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>