453 lines
21 KiB
PHP
453 lines
21 KiB
PHP
<?php
|
|
$pagination_baseurl = $this->getUrl($Mod,"Index");
|
|
$pagination_baseurl_params = ["filter" => $filter];
|
|
$pagination_entity_name = "Tiefbauaufträge";
|
|
|
|
if(!is_array($filter)) $filter = [];
|
|
?>
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
|
|
<?php $wftype = "building"; ?>
|
|
<style>
|
|
.dropdown-menu.show {
|
|
z-index: 9999999;
|
|
}
|
|
|
|
.select2-selection {
|
|
min-height: calc(1.5em + .9rem + 2px);
|
|
}
|
|
</style>
|
|
|
|
<!-- 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")?>"><?=MFAPPNAME_SLUG?></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">
|
|
<h4 class="header-title mb-3">Filter</h4>
|
|
|
|
<form method="get" id="filterform" action="<?=self::getUrl("Pipework")?>">
|
|
<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>
|
|
|
|
<?php if($me->is("Admin")): ?>
|
|
<div class="col-1">
|
|
<label class="form-label" for="filter_pipeworker_id">Zugeteilt an</label>
|
|
<select name="filter[pipeworker_id]" id="filter_pipeworker_id" class="form-control">
|
|
<option></option>
|
|
<?php foreach($pipeworkers as $address): ?>
|
|
<option value="<?=$address->id?>" <?=(is_array($filter) && array_key_exists("pipeworker_id", $filter) && $filter['pipeworker_id'] == $address->id) ? "selected='selected'" : ""?>><?=$address->getCompanyOrName()?></option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_status_id">Objektstatus</label>
|
|
<select name="filter[status_id]" id="filter_status_id" class="form-control">
|
|
<option></option>
|
|
<?php foreach(BuildingstatusModel::getAll() as $status): ?>
|
|
<option
|
|
value="<?=$status->id?>"
|
|
<?php if(array_key_exists("status_id", $filter)): ?>
|
|
<?=($filter['status_id'] == $status->id) ? "selected='selected'" : ""?>
|
|
<?php else: ?>
|
|
<?=(!in_array($me->id, ["145","62","56"]) && $status->id == 3) ? "selected='selected'" : ""?>
|
|
<?php endif; ?>
|
|
>
|
|
<?=$status->code?> - <?=__($status->name."-b")?></option>
|
|
<?php endforeach; ?>
|
|
<option value="">-----</option>
|
|
<option value="3,4,5" <?=(array_key_exists("status_id", $filter) && $filter["status_id"] == "3,4,5") ? "selected='selected'" : ""?>>Bauauftrag zugeteilt oder erledigt</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="col-1">
|
|
<label class="form-label" for="filter_code">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_street">Straße</label>
|
|
<input type="text" class="form-control" name="filter[street]" id="filter_street" value="<?=$filter['street']?>" />
|
|
</div>
|
|
|
|
<div class="col-2">
|
|
<label class="form-label" for="filter_pipework_enabled">Baufreigabe</label>
|
|
<select name="filter[pipework_enabled]" id="filter_pipework_enabled" class="form-control">
|
|
<option value="">Alle</option>
|
|
<option value="1" <?=(array_key_exists("pipework_enabled", $filter) && $filter["pipework_enabled"] == "1") ? "selected='selected'" : ""?>>Ja</option>
|
|
<option value="0" <?=(array_key_exists("pipework_enabled", $filter) && $filter["pipework_enabled"] == "0") ? "selected='selected'" : ""?>>Nein</option>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
<div class="row mt-2">
|
|
<div>
|
|
<button type="submit" class="btn btn-primary">Filter anwenden</button>
|
|
<a class="btn btn-secondary" href="<?=self::getUrl("Pipework")?>">Filter zurücksetzen</a>
|
|
<?php if ($me->is(["Admin"])) :?>
|
|
<a class="btn btn-outline-secondary" href="<?=self::getUrl("Pipework", "History")?>">Zur Historie</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div style="width: 512px;">
|
|
<div class="row">
|
|
<div class="col-6">
|
|
<button type="button" id="export-button" class="form-control btn btn-outline-success ml-2" onclick="exportButtonClick()">
|
|
<div id="export-button-label"><i class="fas fa-download mr-1"></i> Download als .xls</div>
|
|
<div id="progress-bar" class="progress-bar progress-bar-striped progress-bar-animated bg-primary hidden" style="width: 0%;">Bitte warten... 0%</div>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-body mb-3">
|
|
<h4 class="header-title">Auftragsliste nach Netzgebiet</h4>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
|
|
|
|
<?php if(is_array($networks) && count($networks)): ?>
|
|
<?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>
|
|
<div>
|
|
<strong style="white-space: nowrap;"><?=$building->street?></strong><br />
|
|
<span class="text-success"><?=$building->code?></span><br />
|
|
<?php if($building->pipeworker_id): ?>
|
|
<span class="text-primary"><?=($building->pipeworker_id) ? $building->pipeworker->getCompanyOrName() : ""?></span><br />
|
|
<?php else: ?>
|
|
<span><em>-- Keiner Baufirma zugewiesen --</em></span><br />
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="mt-3">
|
|
<?=$building->contact?><br />
|
|
<strong><?=$building->phone?></strong><br />
|
|
<?=$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>
|
|
<?php if($building->pipework_enabled): ?>
|
|
<div style="overflow-x:hidden">
|
|
<small class="text-info text-mono"
|
|
title="Freigegeben: <?=date("d.m.Y H:i",$building->pipework_enabled_date)?> von <?=$building->pipework_enabler->name?> (<?=$building->pipework_enabler->address->getCompanyOrName(true)?>)"
|
|
><?=$building->pipework_enabler->getAbbrName()?></small>
|
|
</div>
|
|
<?php endif; ?>
|
|
</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>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<form method="post" name="wf-building-<?=$building->id?>" id="wf-building-<?=$building->id?>" action="<?=self::getUrl("Pipework","save", ["s" => $pagination['start'], "filter" => $filter])?>" 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"): ?>
|
|
<tr class="workflow-header"><th colspan='<?=$wfColspan?>' <?=($item->style) ? "style='".$item->style."'" : ""?>><?=$item->label?></th></tr><tr>
|
|
<?php else: ?>
|
|
<tr>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
<?php if($item->type == "delimiter"): ?>
|
|
</tr><tr class="workflow-header"><th colspan='<?=$wfColspan?>' <?=($item->style) ? "style='".$item->style."'" : ""?>><?=$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 Tiefbau</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>
|
|
<?php if($building->termination_workflow_comments): ?>
|
|
<td colspan="3">
|
|
<label class="form-label">Kommentare Leitungsbau</label> <textarea class="form-control" style="height:100%" form="wf-building-<?=$building->id?>" name="workflow_comment_term" id="workflow_comment_term_<?=$building->id?>" readonly="readonly"><?=$building->termination_workflow_comments?></textarea>
|
|
</td>
|
|
<?php endif; ?>
|
|
<td colspan="<?=$wfColspan - 3?>">
|
|
<h5>Dokumente</h5>
|
|
<table class="table-sm">
|
|
<?php $i=0; foreach($building->files as $file): ?>
|
|
<?php if($i % 2 == 0): ?>
|
|
<tr>
|
|
<td title="<?=$file->file->filename?>">
|
|
<a href="<?=self::getUrl("BuildingFile", "delete", ['id' => $file->id, "from" => "pipework"])?>" 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("BuildingFile", "delete", ['id' => $file->id, "from" => "pipework"])?>" 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; ?>
|
|
<?=($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>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
<?php $bcount++; endforeach; ?>
|
|
</table>
|
|
<?php endforeach; ?>
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination-summary.php"); ?>
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/tpl/pagination.php"); ?>
|
|
|
|
|
|
|
|
<?php else: ?>
|
|
<i>Keine Bauaufträge gefunden</i>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
var building;
|
|
var hash = window.location.hash.substr(1);
|
|
var match = hash.match(/object=(\d+)/);
|
|
if(match && match[1]) {
|
|
building = match[1]
|
|
var pos = $('#building-' + building).offset().top;
|
|
$(window).scrollTop(pos - 150 );
|
|
}
|
|
|
|
|
|
});
|
|
|
|
$('select[name=wfitem_pipework_finished]').each(function() {
|
|
var elem = this;
|
|
//console.log(elem);
|
|
$(elem).click(function() {
|
|
var id_match = $(this).attr("id").match(/wfitem_pipework_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");
|
|
}
|
|
|
|
});
|
|
});
|
|
|
|
|
|
var export_uid = "";
|
|
var export_progress = 0;
|
|
var downloadUrl;
|
|
|
|
$('#filterform').change(function() {
|
|
downloadUrl = "";
|
|
});
|
|
|
|
/*
|
|
* Eport button click
|
|
*/
|
|
function exportButtonClick() {
|
|
if(downloadUrl) {
|
|
document.location.href = '<?=self::getUrl("Pipework","downloadExport")?>?uid=' + export_uid
|
|
return;
|
|
}
|
|
|
|
|
|
var form = $('#filterform');
|
|
var actionUrl = '<?=self::getUrl("Pipework", "export")?>';
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: actionUrl,
|
|
data: form.serialize(),
|
|
dataType: "json",
|
|
success: function(success) {
|
|
if(success.status = "OK") {
|
|
if(success.uid) {
|
|
export_uid = success.uid;
|
|
export_progress = success.progress;
|
|
//$('#progress-bar-wrapper').show();
|
|
$('#export-button-label').hide();
|
|
$('#progress-bar').show();
|
|
setTimeout(updateExportProgress, 200);
|
|
$('#export-button').addClass("bg-dark");
|
|
$('#export-button').prop("onclick", null).off("click");
|
|
//$('#export-button').prop("disabled", true);
|
|
} else {
|
|
console.log("no uid returned");
|
|
}
|
|
}
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
function updateExportProgress() {
|
|
if(!export_uid) {
|
|
return false;
|
|
}
|
|
|
|
$.get("<?=self::getUrl("Pipework", "exportProgress")?>",
|
|
{
|
|
uid: export_uid
|
|
},
|
|
function(success) {
|
|
if(success.status == "OK") {
|
|
updateProgressBar(success.progress);
|
|
if(success.progress >= 100) {
|
|
downloadUrl = '<?=self::getUrl("Pipework","downloadExport")?>?uid=' + export_uid;
|
|
setTimeout(() => {document.location.href = '<?=self::getUrl("Pipework","downloadExport")?>?uid=' + export_uid}, 200);
|
|
setTimeout(clearProgressBar, 5000);
|
|
} else {
|
|
setTimeout(updateExportProgress, 500);
|
|
}
|
|
}
|
|
},
|
|
"json"
|
|
);
|
|
}
|
|
|
|
function updateProgressBar(progress) {
|
|
$('#progress-bar').css("width", progress + "%");
|
|
$('#progress-bar').text("Bitte warten... " + progress + "%");
|
|
|
|
/*if(progress > 50) {
|
|
$('#progress-bar').removeClass("text-secondary");
|
|
}*/
|
|
|
|
if(progress >= 100) {
|
|
$('#progress-bar').addClass("bg-success").removeClass("bg-primary");
|
|
}
|
|
|
|
}
|
|
|
|
function clearProgressBar() {
|
|
//$('#progress-bar-wrapper').hide();
|
|
$('#progress-bar').css("width", "0%");
|
|
$('#progress-bar').text("Bitte warten... 0%");
|
|
$('#progress-bar').addClass("bg-primary").removeClass("bg-success");
|
|
$('#export-button').prop("disabled", false);
|
|
$('#progress-bar').hide();
|
|
$('#export-button').removeClass("bg-dark");
|
|
$('#export-button').click(exportButtonClick);
|
|
$('#export-button-label').show();
|
|
}
|
|
$("#filter_network_id").select2({closeOnSelect: false});
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|