Files
thetool/Layout/default/Pipework/Index.php
2021-08-30 22:59:23 +02:00

214 lines
11 KiB
PHP

<?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">
<h4 class="header-title mb-3">Filter</h4>
<form method="get" 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-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?>" <?=($filter['status_id'] == $status->id) ? "selected='selected'" : ""?>><?=$status->code?> - <?=__($status->name."-b")?></option>
<?php endforeach; ?>
</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>
<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("Pipework")?>">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 => $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 />
</div>
<div class="mt-3">
<?=$building->contact?><br />
<strong><?=$building->phone?></strong><br />
<?=$building->email?>
</div>
<div class="mt-3">
<label><input type="checkbox" form="wf-building-<?=$building->id?>" name="pipework_enabled" value="1" <?=($building->pipework_enabled==1) ? "checked='checked'" : ""?>> 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>
</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"): ?>
<tr class="workflow-header"><th colspan='<?=$building_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='<?=$building_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-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 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 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 );
}
});
</script>
<?php include(realpath(dirname(__FILE__)."/../")."/footer.php"); ?>