Changed workflow to compact tables

This commit is contained in:
Frank Schubert
2021-08-24 23:13:24 +02:00
parent 2e9d5d5767
commit 0d7abef945
7 changed files with 104 additions and 101 deletions

View File

@@ -23,74 +23,55 @@
<div class="card">
<div class="card-body mb-3">
<div class="float-left">
<h4 class="header-title">Auftragsliste</h4>
</div>
<h4 class="header-title mb-3">Auftragsliste nach Netzgebiet</h4>
<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>
<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; ?>
</table>
<button type="submit" class="btn btn-primary">Speichern</button>
</form>
</div>
</div>

View File

@@ -1,11 +1,13 @@
<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
<td>
<?php if($item->type != "gps"): ?>
<label class="form-label" for="wfitem_<?=$item->name?>">
<?=$item->label?>
<?=($item->required == 1) ? "*" : ""?>
</label>
<?php endif; ?>
<?php
switch($item->type) {
case "string":
include(realpath(dirname(__FILE__)."/items/")."/string.php");
@@ -34,8 +36,12 @@
case "delimiter":
include(realpath(dirname(__FILE__)."/items/")."/delimiter.php");
break;
case "date":
include(realpath(dirname(__FILE__)."/items/")."/date.php");
break;
default:
include(realpath(dirname(__FILE__)."/items/")."/string.php");
}
?>
</div>
</div>
?>
</td>

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="checkbox" class="form-control" name="wfitem_<?=$item->name?>_<?=$item->object_id?>" id="wfitem_<?=$item->name?>_<?=$item->object_id?>" value="<?=$item->value->value_string?>">

View File

@@ -0,0 +1,11 @@
<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({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,
todayBtn: 'linked',
autoclose: true
});
</script>

View File

@@ -7,19 +7,18 @@
$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">
<div class="row">
<div class="col-md-6">
<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" id="wfitem_<?=$item->name?>_lat_<?=$building->id?>" value="<?=$lat?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LAT)?>">
</div>
<div class="col-md-6">
<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" id="wfitem_<?=$item->name?>_long_<?=$building->id?>" value="<?=$long?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LONG)?>">
</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

@@ -18,21 +18,27 @@ class PipeworkController extends mfBaseController {
$this->layout()->setTemplate("Pipework/Index");
if($this->me->is("Admin")) {
$this->layout()->set("buildings", BuildingModel::search(["workflow_finished" => 0]));
$my_networks = NetworkModel::getAll();
} else {
$buildings = [];
foreach($this->me->my_networks as $network) {
foreach(BuildingModel::search(["network_id" => $network->id, "workflow_finished" => 0]) as $b) {
if(!array_key_exists($b->id, $buildings)) {
$buildings[$b->id] = $b;
}
$my_networks = $this->me->my_networks;
}
$networks = [];
foreach($my_networks as $network) {
if(!array_key_exists($network->name, $networks)) {
$networks[$network->name] = [];
}
foreach(BuildingModel::search(["network_id" => $network->id, "workflow_finished" => 0]) as $b) {
if(!array_key_exists($b->id, $networks[$network->name])) {
$networks[$network->name][$b->id] = $b;
}
}
//var_dump($buildings);exit;
$this->layout()->set("buildings", $buildings);
}
$this->layout()->set("networks", $networks);
//var_dump(reset(reset($networks))->workflowitems);exit;
// get delimiter count, to adjust rowspan
}

View File

@@ -60,7 +60,7 @@ class WorkflowitemModel {
$db = FronkDB::singleton();
$res = $db->select("Workflowitem", "*", "1=1 ORDER BY name");
$res = $db->select("Workflowitem", "*", "1=1 ORDER BY num");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new Workflowitem($data);
@@ -74,7 +74,7 @@ class WorkflowitemModel {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("Workflowitem", "*", "$where ORDER BY name");
$res = $db->select("Workflowitem", "*", "$where ORDER BY num");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new Workflowitem($data);