Added Linework workflow

This commit is contained in:
Frank Schubert
2021-09-09 22:09:07 +02:00
parent af23c18dc6
commit e5acbdba40
22 changed files with 969 additions and 36 deletions

View File

@@ -0,0 +1,282 @@
<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>
<?php $wftype = "termination"; ?>
<!-- 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">Leitungsbau</li>
</ol>
</div>
<h4 class="page-title">Leitungsbau</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">Filter</h4>
<form method="get" action="<?=self::getUrl("Linework")?>">
<div class="row">
<div class="col-1">
<label class="form-label" for="filter_network_id">Netzgebiet</label>
<select name="filter[network_id]" id="filter_network_id" class="form-control">
<option></option>
<?php foreach($mynetworks as $fnet): ?>
<option value="<?=$fnet->id?>" <?=($filter['network_id'] == $fnet->id) ? "selected='selected'" : ""?>><?=$fnet->name?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_networksection_id">Bauabschnitt</label>
<select name="filter[networksection_id]" id="filter_networksection_id" class="form-control">
<option></option>
<?php foreach($mynetworks as $fnet): ?>
<?php if(is_array($fnet->sections) && count($fnet->sections)): ?>
<optgroup label="<?=$fnet->name?>">
<?php foreach($fnet->sections as $section): ?>
<option value="<?=$section->id?>" <?=($filter['networksection_id'] == $section->id) ? "selected='selected'" : ""?>><?=$section->name?></option>
<?php endforeach; ?>
</optgroup>
<?php endif; ?>
<?php endforeach; ?>
</select>
</div>
<div class="col-2">
<label class="form-label" for="filter_status_id">Anschlussstatus</label>
<select name="filter[status_id]" id="filter_status_id" class="form-control">
<option></option>
<?php foreach(TerminationstatusModel::getAll() as $status): ?>
<option
value="<?=$status->id?>"
<?php if(is_array($filter)): ?>
<?=($filter['status_id'] == $status->id) ? "selected='selected'" : ""?>
<?php else: ?>
<?=(($me->is("lineworker") && !$me->isAdmin()) && $status->id == 3) ? "selected='selected'" : ""?>
<?php endif; ?>
>
<?=$status->code?> - <?=__($status->name."-t")?></option>
<?php endforeach; ?>
</select>
</div>
<div class="col-1">
<label class="form-label" for="filter_building_code">Gebäude Objekt ID</label>
<input type="text" class="form-control" name="filter[building_code]" id="filter_building_code" value="<?=$filter['building_code']?>" />
</div>
<div class="col-1">
<label class="form-label" for="filter_code">Anschluss Objekt ID</label>
<input type="text" class="form-control" name="filter[code]" id="filter_code" value="<?=$filter['code']?>" />
</div>
<div class="col-2">
<label class="form-label" for="filter_building_street">Straße</label>
<input type="text" class="form-control" name="filter[building_street]" id="filter_building_street" value="<?=$filter['building_street']?>" />
</div>
</div>
<div class="row mt-2">
<div class="col">
<button type="submit" class="btn btn-primary">Filter anwenden</button>
<a class="btn btn-secondary" href="<?=self::getUrl("Linework")?>">Filter zurücksetzen</a>
</div>
</div>
</form>
</div>
</div>
<div class="card">
<div class="card-body mb-3">
<h4 class="header-title mb-3">Auftragsliste nach Netzgebiet</h4>
<?php if(is_array($networks) && count($networks)): ?>
<?php foreach($networks as $networkname => $terminations): ?>
<?php if(!count($terminations)) continue; ?>
<h4><?=$networkname?></h4>
<table class="table workflow-table">
<?php $bcount = 0; foreach($terminations as $term): ?>
<?php
$rowspan = 1;
foreach($term->workflowitems as $item) {
if($item->type == "delimiter") {
$rowspan++;
}
}
?>
<tr id="termination-<?=$term->id?>" class="table-bg-<?=($bcount % 2 == 0) ? "even" : "odd"?>">
<td>
<div>
<strong style="white-space: nowrap;"><?=$term->building->street?></strong><br />
<span class="text-success"><?=$term->code?></span><br />
</div>
<div class="mt-3">
<?=$term->contact?><br />
<strong><?=$term->phone?></strong><br />
<?=$term->email?>
</div>
<div class="mt-3">
<label <?=(!$term->lineworker_id) ? "class='text-danger' title='Keine Leitungsbaufirma ausgewählt'" : ""?>>
<input type="checkbox" form="wf-termination-<?=$term->id?>" name="linework_enabled" value="1"
<?=($term->linework_enabled == 1) ? "checked='checked'" : ""?> <?=(!$term->lineworker_id || !$me->is(["Admin", "pipeplanner", "lineplanner"])) ? "disabled='disabled'" : ""?>
>
Baufreigabe
</label>
</div>
<div class="mt-3">
<button type="button" class="btn btn-primary" form="wf-termination-<?=$term->id?>" onclick="document.getElementById(this.getAttribute('form')).submit()">Speichern</button>
</div>
</td>
<td>
<form method="post" name="wf-termination-<?=$term->id?>" id="wf-termination-<?=$term->id?>" action="<?=self::getUrl("Linework","save", ["filter" => $filter])?>" enctype="multipart/form-data" >
<input type="hidden" name="id" value="<?=$term->id?>" />
<table class="table workflow-table">
<?php $i = 0; foreach($term->workflowitems as $item): ?>
<?php if($i==0): ?>
<?php if($item->type == "delimiter"): ?>
<tr class="workflow-header"><th colspan='<?=$termination_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='<?=$termination_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>
<tr>
<td colspan="3">
<label class="form-label">Kommentar</label> <textarea class="form-control" style="height:100%" form="wf-termination-<?=$term->id?>" name="workflow_comment" id="workflow_comment_<?=$term->id?>"><?=$term->workflow_comment?></textarea>
</td>
<td colspan="<?=$termination_wf_colspan - 3?>">
<h5>Dokumente</h5>
<table class="table-sm">
<?php if(is_array($term->files) && count($term->files)): $i=0; foreach($term->files as $file): ?>
<?php if($i % 2 == 0): ?>
<tr>
<td title="<?=$file->file->filename?>">
<a href="<?=self::getUrl("TerminationFile", "delete", ['id' => $file->id, "from" => "linework"])?>" onclick="if(!confirm('Dokument wirklich löschen?')) return false;" class="text-danger mr-1" title="Dokument löschen">
<i class="fas fa-trash"></i>
</a>
<a href="<?=self::getUrl("File", "Download", ['id' => $file->file->id])?>">
<i class="fas fa-download"></i> <?=$file->type?>
</a>
</td>
<?php else: ?>
<td title="<?=$file->file->filename?>">
<a href="<?=self::getUrl("TerminationFile", "delete", ['id' => $file->id, "from" => "linework"])?>" onclick="if(!confirm('Dokument wirklich löschen?')) return false;" class="text-danger mr-1" title="Dokument löschen">
<i class="fas fa-trash"></i>
</a>
<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; endif; ?>
<?=($i % 2 != 0) ? "<td></td></tr>" : ""?>
<tr>
<td>
<strong>Dokument hochladen</strong> <select class="form-control" name="file_type">
<?php foreach(TT_WORKFLOW_TERMINATION_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="LineworkFileUpload" class="form-control-file" />
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</td>
</tr>
<?php $bcount++; endforeach; ?>
</table>
<?php endforeach; ?>
<?php else: ?>
<i>Keine Bauaufträge gefunden</i>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
var term;
var hash = window.location.hash.substr(1);
var match = hash.match(/object=(\d+)/);
if(match && match[1]) {
building = match[1]
var pos = $('#object-' + term).offset().top;
$(window).scrollTop(pos - 150 );
}
});
$('select[name=wfitem_linework_finished]').each(function() {
var elem = this;
//console.log(elem);
$(elem).click(function() {
var id_match = $(this).attr("id").match(/wfitem_linework_finished_(\d+)$/);
var id = id_match[1];
//console.log(id);
var ap_type=$('#wfitem_anschlusspunkt_typ_' + id).val();
var ap_name=$('#wfitem_anschlusspunkt_name_' + id).val();
var rohrname=$('#wfitem_rohrverband_name_' + id).val();
var rohrtype=$('#wfitem_rohrtype_' + id).val();
var rohrfarbe=$('#wfitem_rohrfarbe_' + id).val();
var ist_ap_type=$('#wfitem_ist_anschlusspunkt_typ_' + id).val();
var ist_ap_name=$('#wfitem_ist_anschlusspunkt_name_' + id).val();
var ist_rohrname=$('#wfitem_ist_rohrverband_name_' + id).val();
var ist_rohrtype=$('#wfitem_ist_rohrtype_' + id).val();
var ist_rohrfarbe=$('#wfitem_ist_rohrfarbe_' + id).val();
//console.log(ap_type, ap_name, rohrname, rohrtype, rohrfarbe);
if((!ap_type && !ist_ap_type) || (!ap_name && !ist_ap_type) || (!rohrname && !ist_rohrname) || (!rohrtype || !ist_rohrtype) || (!rohrfarbe && !ist_rohrfarbe)) {
$(this).find("option").attr("disabled", true);
}
if((ap_type || ist_ap_type) && (ap_name || ist_ap_name) && (rohrname || ist_rohrname) && (rohrtype || ist_rohrtype) && (rohrfarbe || ist_rohrfarbe)) {
//console.log("enable");
$(this).find("option").removeAttr("disabled");
}
});
});
</script>
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>

View File

@@ -1,5 +1,5 @@
<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>
<?php $wftype = "building"; ?>
<!-- start page title -->
@@ -127,7 +127,7 @@
<?=$building->email?>
</div>
<div class="mt-3">
<label <?=(!$building->pipeworker_id) ? "class='text-danger' title='Keine Tiefbaufirma ausgewählt'" : ""?>><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?> <?=(!$building->pipeworker_id || !$me->is(["Admin", "Pipeplanner "])) ? "disabled='disabled'" : ""?>> Baufreigabe</label>
<label <?=(!$building->pipeworker_id) ? "class='text-danger' title='Keine Tiefbaufirma ausgewählt'" : ""?>><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?> <?=(!$building->pipeworker_id || !$me->is(["Admin", "pipeplanner"])) ? "disabled='disabled'" : ""?>> Baufreigabe</label>
</div>
<div class="mt-3">
<button type="button" class="btn btn-primary" form="wf-building-<?=$building->id?>" onclick="document.getElementById(this.getAttribute('form')).submit()">Speichern</button>

View File

@@ -1,8 +1,8 @@
<td class="workflow-item">
<?php if($item->type != "gps"): ?>
<label class="form-label" for="wfitem_<?=$item->name?>_<?=$building->id?>">
<label class="form-label" for="wfitem_<?=$item->name?>_<?=$$wftype->id?>">
<?=($item->label) ? $item->label : "&nbsp;"?>
<?=($item->required == 1) ? "*" : ""?>
<?=($item->label && $item->required == 1) ? "*" : ""?>
</label>
<?php endif; ?>

View File

@@ -1,10 +1,10 @@
<input type="hidden" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>" value="<?=($item->value->value_int == 1) ? "1" : "0"?>" />
<input type="hidden" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->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?>"
id="wfitemplaceholder_<?=$item->name?>_<?=$$wftype->id?>"
value="1"
<?=($item->value->value_int == 1) ? "checked='checked'" : ""?>
onchange="$('#wfitem_<?=$item->name?>_<?=$building->id?>').val((this.checked) ? 1 : 0)"
onchange="$('#wfitem_<?=$item->name?>_<?=$$wftype->id?>').val((this.checked) ? 1 : 0)"
>

View File

@@ -8,7 +8,7 @@ if(preg_match('/^(.+)-1R$/', $color_name, $cmatch)) {
?>
<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-<?=$color_name?>">
<select class="form-control selectpicker show-tick" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>" title="Farbe wählen" data-style="btn-outline-<?=$color_name?>">
<option></option>
<?php foreach(TT_CABLE_COLORS as $name => $color): ?>
<option
@@ -23,24 +23,24 @@ if(preg_match('/^(.+)-1R$/', $color_name, $cmatch)) {
</select>
<script type="text/javascript">
$('#wfitem_<?=$item->name?>_<?=$building->id?>').change(function() {
var color = $('#wfitem_<?=$item->name?>_<?=$building->id?> option:selected').data("bg-color");
var name = $('#wfitem_<?=$item->name?>_<?=$building->id?> option:selected').val();
$("wfitem_<?=$item->name?>_<?=$building->id?>").data("style", "btn-danger");
console.log("button [data-id='wfitem_<?=$item->name?>_<?=$building->id?>']");
console.log($("button [data-id='wfitem_<?=$item->name?>_<?=$building->id?>']"));
$('#wfitem_<?=$item->name?>_<?=$$wftype->id?>').change(function() {
var color = $('#wfitem_<?=$item->name?>_<?=$$wftype->id?> option:selected').data("bg-color");
var name = $('#wfitem_<?=$item->name?>_<?=$$wftype->id?> option:selected').val();
$("wfitem_<?=$item->name?>_<?=$$wftype->id?>").data("style", "btn-danger");
console.log("button [data-id='wfitem_<?=$item->name?>_<?=$$wftype->id?>']");
console.log($("button [data-id='wfitem_<?=$item->name?>_<?=$$wftype->id?>']"));
var matches;
if(matches = name.match(/^(.+)-1R$/)) {
name = matches[1];
}
$("[data-id='wfitem_<?=$item->name?>_<?=$building->id?>']").removeClass(function (index, className) {
$("[data-id='wfitem_<?=$item->name?>_<?=$$wftype->id?>']").removeClass(function (index, className) {
console.log(className);
return (className.match (/(^|\s)btn-outline-\S+/g) || []).join(' ');
});
$("[data-id='wfitem_<?=$item->name?>_<?=$building->id?>']").addClass("btn-outline-" + name)
$("[data-id='wfitem_<?=$item->name?>_<?=$$wftype->id?>']").addClass("btn-outline-" + name)
console.log(color);
console.log(name);

View File

@@ -1,7 +1,7 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" 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?>_<?=$$wftype->id?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>" />
<script type="text/javascript">
$('#wfitem_<?=$item->name?>_<?=$building->id?>').datepicker({
$('#wfitem_<?=$item->name?>_<?=$$wftype->id?>').datepicker({
language: 'de',
format: "dd.mm.yyyy",
showWeekDays: true,

View File

@@ -1,9 +1,47 @@
<?php
$options = [];
$options = explode(";", $item->typedata);
if(strpos($item->typedata, "=Model=") !== false) {
// get options from Model
$m = [];
if(preg_match('/^=Model=(\w+)(?::([^:]+):)?$/', $item->typedata, $m)) {
// dynamic enum
$model = $m[1];
$modelClass = $model."Model";
$filter = [];
if($m[2]) {
$filter_parts = explode("=", $m[2]);
$filter_name = $filter_parts[0];
$filter_value = $filter_parts[1];
if(substr($filter_value, 0, 1) == '`') {
$filter_value = substr($filter_value, 1, strlen($filter_value) - 2);
$objPath = explode("->", $filter_value);
if(count($objPath) > 1) {
$obj = array_shift($objPath);
$curr = $$obj;
foreach($objPath as $part) {
$curr = $curr->$part;
}
$filter_value = $curr;
}
}
foreach($modelClass::search([$filter_name => $filter_value]) as $modelObject) {
$options[] = $modelObject->id . "=" . $modelObject->name;
}
}
}
} else {
$options = explode(";", $item->typedata);
}
?>
<select class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$building->id?>">
<select class="form-control" name="wfitem_<?=$item->name?>" id="wfitem_<?=$item->name?>_<?=$$wftype->id?>">
<option></option>
<?php foreach($options as $opt): ?>
<?php

View File

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

View File

@@ -9,12 +9,12 @@
?>
<div class="row">
<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]" id="wfitem_<?=$item->name?>_lat_<?=$building->id?>" value="<?=$lat?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LAT)?>">
<label class="form-label" for="wfitem_<?=$item->name?>_lat_<?=$$wftype->id?>">GPS Breite <?=($item->required == 1) ? "*" : ""?></label>
<input type="text" class="form-control" name="wfitem_<?=$item->name?>[lat]" id="wfitem_<?=$item->name?>_lat_<?=$$wftype->id?>" value="<?=$lat?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LAT)?>">
</div>
<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]" id="wfitem_<?=$item->name?>_long_<?=$building->id?>" value="<?=$long?>" placeholder="<?=str_replace(",", ".", TT_PLACEHOLDER_GPS_LONG)?>">
<label class="form-label" for="wfitem_<?=$item->name?>_long_<?=$$wftype->id?>">GPS Länge <?=($item->required == 1) ? "*" : ""?></label>
<input type="text" class="form-control" name="wfitem_<?=$item->name?>[long]" id="wfitem_<?=$item->name?>_long_<?=$$wftype->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>

View File

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

View File

@@ -1 +1 @@
<input type="text" class="form-control" name="wfitem_<?=$item->name?>" 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?>_<?=$$wftype->id?>" value="<?=$item->value->value_string?>" placeholder="<?=$item->placeholder?>">

View File

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

View File

@@ -38,7 +38,7 @@
<ul class="submenu">
<?php if($me->is(["Admin","netowner","pipeplanner","lineplanner"])): ?><li><a href="<?=self::getUrl("Building")?>">Objekte & Anschlüsse</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","pipeworker"])): ?><li><a href="<?=self::getUrl("Pipework")?>">Tiefbau</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","lineplanner","lineworker"])): ?><li><a href="<?=self::getUrl("Lineworker")?>">Leitungsbau</a></li><?php endif; ?>
<?php if($me->is(["Admin","netowner","pipeplanner","pipeworker","lineplanner","lineworker"])): ?><li><a href="<?=self::getUrl("Linework")?>">Leitungsbau</a></li><?php endif; ?>
</ul>
</li>
<?php endif; ?>