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
+69 -82
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>
+10 -1
View File
@@ -1 +1,10 @@
<input type="checkbox" class="form-control" name="wfitem_<?=$item->name?>_<?=$building->id?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>">
<input type="hidden" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=($item->value->value_int == 1) ? "1" : "0"?>" />
<input
type="checkbox"
class="form-control"
name="wfitemplaceholder_<?=$item->name?>"
id="wfitemplaceholder_<?=$item->name?>_<?=$building->id?>"
value="1"
<?=($item->value->value_int == 1) ? "checked='checked'" : ""?>
onchange="$('#wfitem_<?=$item->name?>_<?=$building->id?>').val((this.checked) ? 1 : 0)"
>
+20 -1
View File
@@ -1 +1,20 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>_<?=$building->id?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>">
<select class="form-control selectpicker show-tick" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" title="Farbe wählen" data-style="btn-outline-secondary">
<option></option>
<?php foreach(TT_CABLE_COLORS as $name => $color): ?>
<option
style="background-color: rgba(<?=$color["r"]?>,<?=$color["g"]?>,<?=$color["b"]?>, .5); color: #<?=$color["hexfg"]?>"
value="<?=$name?>"
data-bg-color="#<?=$color["hex"]?>" <?=($color['mark']) ? "data-icon='fa-ellipsis-h'" : ""?>
<?=($name == $item->value->value_string) ? "selected='selected'" : ""?>
>
<?=ucfirst($name)?>
</option>
<?php endforeach; ?>
</select>
<script type="text/javascript">
$('#wfitem_<?=$item->name?>_<?=$building->id?>').change(function() {
var color = $('#wfitem_<?=$item->name?>_<?=$building->id?> option:selected').data("bg-color");
//console.log(color);
});
</script>
+1 -1
View File
@@ -1,4 +1,4 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>_<?=$building->id?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>" />
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>" />
<script type="text/javascript">
$('#wfitem_<?=$item->name?>_<?=$building->id?>').datepicker({
+2 -2
View File
@@ -3,7 +3,7 @@ $options = [];
$options = explode(";", $item->typedata);
?>
<select class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>">
<select class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>">
<option></option>
<?php foreach($options as $opt): ?>
<?php
@@ -16,6 +16,6 @@ $options = explode(";", $item->typedata);
}
?>
<option value="<?=$key?>"><?=$label?></option>
<option value="<?=$key?>" <?=($key == $item->value->value_string) ? "selected='selected'" : ""?>><?=$label?></option>
<?php endforeach; ?>
</select>
+1 -1
View File
@@ -1 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>">
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>">
+10 -12
View File
@@ -1,25 +1,23 @@
<?php
$lat = "";
$long = "";
if($item->value_string) {
$gps_parts = explode(";", $item->value_string);
if($item->value->value_string) {
$gps_parts = explode(";", $item->value->value_string);
$lat = $gps_parts[0];
$long = $gps_parts[1];
}
?>
<div class="row">
<div class="col-md-6 padding-right-2">
<div class="col-md-5 padding-right-2">
<label class="form-label" for="wfitem_<?=$item->name?>_lat_<?=$building->id?>">GPS Breite <?=($item->required == 1) ? "*" : ""?></label>
<input type="text" class="form-control" name="wfitem_<?=$item->name?>_lat_<?=$building->id?>" id="wfitem_<?=$item->name?>_lat_<?=$building->id?>" value="<?=$lat?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LAT)?>">
<input type="text" class="form-control" name="wfitem_<?=$item->name?>[lat]" id="wfitem_<?=$item->name?>_lat_<?=$building->id?>" value="<?=$lat?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LAT)?>">
</div>
<div class="col-md-6 padding-left-2">
<div class="col-md-5 padding-left-2">
<label class="form-label" for="wfitem_<?=$item->name?>_long_<?=$building->id?>">GPS Länge <?=($item->required == 1) ? "*" : ""?></label>
<input type="text" class="form-control" name="wfitem_<?=$item->name?>_long_<?=$building->id?>" id="wfitem_<?=$item->name?>_long_<?=$building->id?>" value="<?=$long?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LONG)?>">
<input type="text" class="form-control" name="wfitem_<?=$item->name?>[long]" id="wfitem_<?=$item->name?>_long_<?=$building->id?>" value="<?=$long?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LONG)?>">
</div>
<div class="col-md-2 padding-left-2">
<label class="form-label">&nbsp;</label>
<div><?php if($lat && $long): ?><a href="https://www.google.com/maps/search/?api=1&query=<?=$lat?>,<?=$long?>" target="_blank">Maps</a><?php endif; ?></div>
</div>
</div>
<?php if($lat && $long): ?>
<a href="https://www.google.com/maps/search/?api=1&query=<?=$lat?>,<?=$long?>" target="_blank"><i class="fas fa-external-link-alt"></i> Auf Google Maps öffnen</a>
<?php endif; ?>
+1 -1
View File
@@ -1 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>">
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>">
+1 -1
View File
@@ -1 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>_<?=$building->id?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>">
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>">
+1 -1
View File
@@ -1 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>">
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=$item->value->value_string?>">
+6 -1
View File
@@ -22,6 +22,11 @@
<!-- end Footer -->
<!--<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/vendor.min.js"></script>-->
<script type="text/javascript">
$(".selectpicker").selectpicker({
iconBase: "fas",
tickIcon: "check"
});
</script>
</body>
</html>
+3
View File
@@ -16,6 +16,7 @@
<link href="<?=self::getResourcePath()?>assets/css/leaflet.css" rel="stylesheet" type="text/css" />
<link href="<?=self::getResourcePath()?>assets/css/thetool.css?<?=date('U')?>" rel="stylesheet" type="text/css" />
<link href="<?=self::getResourcePath()?>assets/libs/select2/select2.min.css" rel="stylesheet" type="text/css" />
<link href="<?=self::getResourcePath()?>assets/css/bootstrap-select.min.css" rel="stylesheet" type="text/css" />
<link href="<?=self::getResourcePath()?>css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=self::getResourcePath()?>js/jquery.min.js"></script>
@@ -23,7 +24,9 @@
<script src="<?=self::getResourcePath()?>js/bootstrap-datepicker.min.js"></script>
<script src="<?=self::getResourcePath()?>js/bootstrap-datepicker.de.min.js"></script>
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/leaflet.js"></script>
<script type="text/javascript" src="<?=self::getResourcePath()?>js/popper.min.js"></script>
<script type="text/javascript" src="<?=self::getResourcePath()?>js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/js/bootstrap-select.min.js"></script>