343 lines
19 KiB
PHP
343 lines
19 KiB
PHP
<?php
|
|
//var_dump($pagination);exit;
|
|
?>
|
|
<?php include(realpath(dirname(__FILE__)."/../")."/header.php"); ?>
|
|
<?php $wftype = "term"; ?>
|
|
|
|
|
|
<!-- 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_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_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">Auftragsliste nach Netzgebiet</h4>
|
|
|
|
<?php if($pagination['maxItems'] > $pagination['count']): ?>
|
|
<nav>
|
|
<ul class="pagination justify-content-center mb-1">
|
|
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
|
<a class="page-link" href="<?=$this->getUrl("Linework")?>" tabindex="-1">Erste</a>
|
|
</li>
|
|
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
|
<a class="page-link" href="<?=$this->getUrl("Linework","Index",['s' => $pagination['start'] - $pagination['count'], "filter" => $filter])?>" tabindex="-1">Zurück</a>
|
|
</li>
|
|
<?php for($i = 0; $i < ($pagination['maxItems'] / $pagination['count']); $i++): ?>
|
|
<li class="page-item <?=($pagination['start'] == $i*$pagination['count']) ? "disabled font-weight-bold" : ""?>"><a class="page-link" href="<?=$this->getUrl("Linework","Index",['s' => $i*$pagination['count'], "filter" => $filter])?>"><?=$i+1?></a></li>
|
|
<?php endfor; ?>
|
|
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
|
<a class="page-link" href="<?=$this->getUrl("Linework","Index",['s' => $pagination['start'] + $pagination['count'], "filter" => $filter])?>">Vor</a>
|
|
</li>
|
|
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
|
<a class="page-link" href="<?=$this->getUrl("Linework","Index",['s' => ($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count']), "filter" => $filter])?>">Letzte</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<?php endif; ?>
|
|
<div class="pagination justify-content-center">
|
|
<?php if($pagination['maxItems']): ?>
|
|
Leitungsbauaufträge <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
|
|
<?php else: ?>
|
|
Keine Leitungsbauaufträge gefunden
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?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 mb-2">
|
|
<?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->building->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->building->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 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; ?>
|
|
<?php if($i % 2 != 0): ?>
|
|
<td></td></tr>
|
|
<?php endif; ?>
|
|
<?php endif; ?>
|
|
|
|
<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 if($pagination['maxItems'] > $pagination['count']): ?>
|
|
<div class="pagination justify-content-center mb-1">
|
|
<?php if($pagination['maxItems']): ?>
|
|
Leitungsbauaufträge <?=$pagination['start']+1?> bis <?=($pagination['start'] + $pagination['count'] > $pagination['maxItems']) ? $pagination['maxItems'] : $pagination['start'] + $pagination['count']?> von <?=$pagination['maxItems']?>
|
|
<?php else: ?>
|
|
Keine Leitungsbauaufträge gefunden
|
|
<?php endif; ?>
|
|
</div>
|
|
<nav>
|
|
<ul class="pagination justify-content-center">
|
|
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
|
<a class="page-link" href="<?=$this->getUrl("Linework")?>" tabindex="-1">Erste</a>
|
|
</li>
|
|
<li class="page-item <?=($pagination['start'] - $pagination['count'] < 0) ? "disabled" : ""?>">
|
|
<a class="page-link" href="<?=$this->getUrl("Linework","Index",['s' => $pagination['start'] - $pagination['count'], "filter" => $filter])?>" tabindex="-1">Zurück</a>
|
|
</li>
|
|
<?php for($i = 0; $i < ($pagination['maxItems'] / $pagination['count']); $i++): ?>
|
|
<li class="page-item <?=($pagination['start'] == $i*$pagination['count']) ? "disabled font-weight-bold" : ""?>"><a class="page-link" href="<?=$this->getUrl("Linework","Index",['s' => $i*$pagination['count'], "filter" => $filter])?>"><?=$i+1?></a></li>
|
|
<?php endfor; ?>
|
|
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
|
<a class="page-link" href="<?=$this->getUrl("Linework","Index",['s' => $pagination['start'] + $pagination['count'], "filter" => $filter])?>">Vor</a>
|
|
</li>
|
|
<li class="page-item <?=($pagination['maxItems'] / ($pagination['start'] + $pagination['count']) < 1) ? "disabled" : ""?>">
|
|
<a class="page-link" href="<?=$this->getUrl("Linework","Index",['s' => ($pagination['maxItems'] - $pagination['maxItems'] % $pagination['count']), "filter" => $filter])?>">Letzte</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<?php endif; ?>
|
|
|
|
<?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"); ?>
|