Started creating workflow

This commit is contained in:
Frank Schubert
2021-08-24 21:40:30 +02:00
parent 7ad852c4ef
commit 2e9d5d5767
22 changed files with 717 additions and 1 deletions

View File

@@ -353,6 +353,7 @@
<div class="card-body">
<h4>Produkte</h4>
<?php if(is_array($order->products) && count($order->products)): ?>
<?php foreach($order->products as $product): ?>
<div class="row product-container">
<div class="col-md-1 product-<?=$product->id?>">
@@ -438,6 +439,7 @@
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<div class="row product-container">

View File

@@ -0,0 +1,164 @@
<?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">
<div class="float-left">
<h4 class="header-title">Auftragsliste</h4>
</div>
<table class="table table-striped table-hover">
<tr>
<th>Netzgebiet</th>
<th>POP</th>
<th>Typ</th>
<th>Objektcode</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">Tätigkeiten im Objekt <strong><?=$building->code?></strong></h4>
<p>
<?=$building->street?><br />
<?=$building->zip?> <?=$building->city?>
</p>
<div class="card">
<div class="card-body">
<form method="post" action="<?=self::getUrl("Pipework","save")?>" >
<input type="hidden" name="building_id" value="<?=$building->id?>" />
<?php foreach($building->workflowitems as $item): ?>
<?php include(realpath(dirname(__FILE__)."/../")."/Workflow/form.php"); ?>
<?php endforeach; ?>
<button type="submit" class="btn btn-primary">Speichern</button>
</form>
</div>
</div>
</div>
</div>
</td>
</tr>
<tr style="display:none;">
<td colspan="3"></td>
</tr>
<?php endforeach; ?>
</table>
</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"); ?>

View File

@@ -0,0 +1,41 @@
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="wfitem_<?=$item->name?>">
<?=$item->label?>
<?=($item->required == 1) ? "*" : ""?>
</label>
<div class="col-lg-10">
<?php
switch($item->type) {
case "string":
include(realpath(dirname(__FILE__)."/items/")."/string.php");
break;
case "int":
include(realpath(dirname(__FILE__)."/items/")."/int.php");
break;
case "bool":
include(realpath(dirname(__FILE__)."/items/")."/bool.php");
break;
case "enum":
include(realpath(dirname(__FILE__)."/items/")."/enum.php");
break;
case "text":
include(realpath(dirname(__FILE__)."/items/")."/text.php");
break;
case "file":
include(realpath(dirname(__FILE__)."/items/")."/file.php");
break;
case "gps":
include(realpath(dirname(__FILE__)."/items/")."/gps.php");
break;
case "color":
include(realpath(dirname(__FILE__)."/items/")."/color.php");
break;
case "delimiter":
include(realpath(dirname(__FILE__)."/items/")."/delimiter.php");
break;
}
?>
</div>
</div>

View File

@@ -0,0 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>">

View File

@@ -0,0 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>">

View File

@@ -0,0 +1 @@
<hr />

View File

@@ -0,0 +1,21 @@
<?php
$options = [];
$options = explode(";", $item->typedata);
?>
<select class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>">
<option></option>
<?php foreach($options as $opt): ?>
<?php
$key = $opt;
$label = $opt;
if(strpos($opt, "=") !== false) {
$opt_parts = explode('=', $opt);
$key = $opt_parts[0];
$label = $opt_parts[1];
}
?>
<option value="<?=$key?>"><?=$label?></option>
<?php endforeach; ?>
</select>

View File

@@ -0,0 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>">

View File

@@ -0,0 +1,26 @@
<?php
$lat = "";
$long = "";
if($item->value_string) {
$gps_parts = explode(";", $item->value_string);
$lat = $gps_parts[0];
$long = $gps_parts[1];
}
?>
<div class="form-group row">
<label class="col-lg-1 col-form-label" for="wfitem_<?=$item->name?>_lat_<?=$building->id?>">GPS Breite:</label>
<div class="col-lg-6">
<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>
<div class="form-group row">
<label class="col-lg-1 col-form-label" for="wfitem_<?=$item->name?>_long_<?=$building->id?>">GPS Länge:</label>
<div class="col-lg-6">
<input type="text" class="form-control" name="wfitem_<?=$item->name?>_lat" id="wfitem_<?=$item->name?>_long_<?=$building->id?>" value="<?=$long?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LONG)?>">
</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; ?>

View File

@@ -0,0 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>">

View File

@@ -0,0 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>">

View File

@@ -0,0 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>" value="<?=$item->value->value_string?>">

View File

@@ -37,6 +37,8 @@
</a>
<ul class="submenu">
<li><a href="<?=self::getUrl("Building")?>">Objekte & Anschlüsse</a></li>
<li><a href="<?=self::getUrl("Pipework")?>">Tiefbau</a></li>
<li><a href="<?=self::getUrl("Lineworker")?>">Leitungsbau</a></li>
</ul>
</li>
<?php endif; ?>