1272 lines
69 KiB
PHP
1272 lines
69 KiB
PHP
<?php
|
|
$pagination_entity_name = "Adressen";
|
|
?>
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/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")?>"><?=MFAPPNAME_SLUG?></a></li>
|
|
<li class="breadcrumb-item"><a href="<?=self::getUrl("ConstructionConsentProject")?>">Zustimmungserklärungsprojekte</a></li>
|
|
<li class="breadcrumb-item"><a href="<?=self::getUrl("ConstructionConsent", "Index", ["filter" => ["project_id" => $item->constructionconsentproject_id]])?>">Zustimmungserklärungen <?=$item->project->name?></a></li>
|
|
<li class="breadcrumb-item active"><?=$item->name?></li>
|
|
</ol>
|
|
</div>
|
|
<h4 class="page-title">Zustimmungserkärungen</h4>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- end page title -->
|
|
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<a href="#" onclick="window.history.back(); return false;" class="btn btn-secondary mr-1"><i class="fas fa-fw fa-list"></i> Zurück zur Übersicht</a>
|
|
<a href="<?=self::getUrl("ConstructionConsent","edit", ['id' => $item->id])?>" class="btn btn-outline-success"><i class="fas fa-fw fa-edit"></i> Zustimmungserklärung bearbeiten</a>
|
|
|
|
|
|
<?php if(!is_array($item->owners) || !count($item->owners)):?>
|
|
<!--a href="#" class="float-right btn btn-outline-primary disabled mr-1"><i class="fas fa-fw fa-envelope"></i> Zustimmungserklärungsformular an alle Besitzer senden</a-->
|
|
<?php else: ?>
|
|
<!--a href="<?=self::getUrl("ConstructionConsent", "Send", ["id" => $item->id])?>" class="float-right btn btn-primary mr-1"><i class="fas fa-fw fa-envelope"></i> Zustimmungserklärungsformular an alle Besitzer senden</a-->
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-5">
|
|
|
|
<div class="card border-top-primary">
|
|
<div class="card-body">
|
|
<h3 class="text-center mb-3">Zustimmungserklärung <?=$item->name?></h3>
|
|
|
|
<table class="table table-sm table-striped view-table">
|
|
<tr>
|
|
<th>Projekt</th>
|
|
<td><?=$item->project->name?></td>
|
|
</tr>
|
|
|
|
<?php if ($item->object_type == 'street' && isset($item->data->netzgebiet_id)): ?>
|
|
<tr>
|
|
<th>Netzgebiet</th>
|
|
<td><?=$item->netzgebiet->name?></td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
|
|
<tr>
|
|
<th>Objekttyp</th>
|
|
<td><?=__($item->object_type, "consent")?></td>
|
|
</tr>
|
|
<?php if($item->object_type == "building"): ?>
|
|
<tr>
|
|
<th>Gebäude</th>
|
|
<td>
|
|
<?=$item->adb_hausnummer->ortschaft->name?>, <?=$item->adb_hausnummer->strasse->name?> <?=$item->adb_hausnummer->hausnummer?><br />
|
|
<?=$item->adb_hausnummer->strasse->gemeinde->name?>
|
|
</td>
|
|
</tr><tr>
|
|
<th>Wohneinheiten</th>
|
|
<td><?=$item->adb_hausnummer->unit_count?></td>
|
|
</tr><tr>
|
|
<th>Bestellungen</th>
|
|
<td><?=$item->preorder_count?></td>
|
|
</tr>
|
|
<?php else: ?>
|
|
<tr>
|
|
<th>Straße</th>
|
|
<td>
|
|
<?=($item->adb_strasse->ortschaft_id) ? $item->adb_strasse->ortschaft->name.", " : ""?><?=$item->adb_strasse->name?><br />
|
|
<?=$item->adb_strasse->gemeinde->name?>
|
|
</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
<tr>
|
|
<th>Geplante Länge</th>
|
|
<td><?=$item->usage_length?> lfm</td>
|
|
</tr><tr>
|
|
<th>Geplante Nutzung</th>
|
|
<td>
|
|
<?php if($item->usage_pipe_on_plot): ?>
|
|
<i class="fas fa-fw fa-check text-success"></i>
|
|
<?php else: ?>
|
|
<i class="fas fa-fw fa-xmark"></i>
|
|
<?php endif; ?>
|
|
Verlegung von Rohren und Lichtwellenleitern am Grundstück<br />
|
|
|
|
<?php if($item->usage_pipe_in_building): ?>
|
|
<i class="fas fa-fw fa-check text-success"></i>
|
|
<?php else: ?>
|
|
<i class="fas fa-fw fa-xmark"></i>
|
|
<?php endif; ?>
|
|
Verlegung von Rohren und Lichtwellenleitern in den darauf befindlichen Gebäuden<br />
|
|
|
|
<?php if($item->usage_manhole): ?>
|
|
<i class="fas fa-fw fa-check text-success"></i>
|
|
<?php else: ?>
|
|
<i class="fas fa-fw fa-xmark"></i>
|
|
<?php endif; ?>
|
|
Errichtung eines Schachtes/einer Kabelmontagegrube und/oder eines LWL-Verteilschrankes/einer LWL-Abschlussbox<br />
|
|
|
|
<?php if($item->usage_owner): ?>
|
|
<i class="fas fa-fw fa-check text-success"></i>
|
|
<?php else: ?>
|
|
<i class="fas fa-fw fa-xmark"></i>
|
|
<?php endif; ?>
|
|
Die Nutzung der Liegenschaft seitens BB dient der Eigenversorgung der GE und/oder dessen Nutzer(in) und wird dieser entgeltlos zugestimmt
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Genehmigung überschreiben</th>
|
|
<td>
|
|
<input type="checkbox" id="approve_override" class="switchery" data-size="small" data-color="#25b343" data-toggle-param="approve_override" <?=($item->approve_override) ? "checked='checked'" : ""?> />
|
|
</td>
|
|
</tr>
|
|
<?php if($item->object_type == "building"): ?>
|
|
<tr>
|
|
<td colspan="2"><h4>Metadaten</h4></td>
|
|
</tr><tr>
|
|
<th>Termine</th>
|
|
<td>
|
|
<table class="table">
|
|
<tr>
|
|
<th></th>
|
|
<th class="text-left">Begehungstermin</th>
|
|
<th class="text-left">Durchgeführt</th>
|
|
<th class="text-left">Begehungsprotokoll</th>
|
|
</tr>
|
|
<tr>
|
|
<th>Planer</th>
|
|
<td class="text-monospace"><a data-toggle="modal" data-target="#plannerDateModal" href="#"><i class="fas fa-fw fa-edit"></i></a> <?=($item->inspection_date_planner) ? date("d.m.Y", $item->inspection_date_planner) : ""?></td>
|
|
<td><input type="checkbox" id="inspection_planner" class="switchery" data-size="small" data-color="#25b343" data-toggle-param="inspection_planner" <?=($item->inspection_planner) ? "checked='checked'" : ""?> /></td>
|
|
<td>
|
|
<?php if($item->inspection_protocol_planner): ?>
|
|
<a href="<?=self::getUrl("File", "download", ["id" => $item->inspection_protocol_planner->file_id])?>">Begehungsprotokoll</a>
|
|
<a class="text-danger" href="<?=self::getUrl("ConstructionConsent", "deleteFile", ["id" => $item->id, "file_id" => $item->inspection_protocol_planner->file_id])?>" onclick="if(!confirm('Begehungsprotokoll wirklich löschen?')) return false;" title="Begehungsprotokoll Löschen"><i class="far fa-fw fa-trash-alt"></i></a>
|
|
<?php else: ?>
|
|
<a data-toggle="modal" data-target="#inspectionProtocolPlanner" href="#" title="Begehungsprotokoll Hochladen"><i class="far fa-fw fa-file-upload"></i></a>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Freigabe Elektriker</th>
|
|
<td class="text-monospace"><a data-toggle="modal" data-target="#electricianDateModal" href="#"><i class="fas fa-fw fa-edit"></i></a> <?=($item->inspection_date_electrician) ? date("d.m.Y", $item->inspection_date_electrician) : ""?></td>
|
|
<td><input type="checkbox" id="inspection_electrician" class="switchery" data-size="small" data-color="#25b343" data-toggle-param="inspection_electrician" <?=($item->inspection_electrician) ? "checked='checked'" : ""?> /></td>
|
|
<td>
|
|
<?php if($item->inspection_protocol_electrician): ?>
|
|
<a href="<?=self::getUrl("File", "download", ["id" => $item->inspection_protocol_electrician->file_id])?>">Begehungsprotokoll</a>
|
|
<a class="text-danger" href="<?=self::getUrl("ConstructionConsent", "deleteFile", ["id" => $item->id, "file_id" => $item->inspection_protocol_electrician->file_id])?>" onclick="if(!confirm('Begehungsprotokoll wirklich löschen?')) return false;" title="Begehungsprotokoll Löschen"><i class="far fa-fw fa-trash-alt"></i></a>
|
|
<?php else: ?>
|
|
<a data-toggle="modal" data-target="#inspectionProtocolElectrician" href="#" title="Begehungsprotokoll Hochladen"><i class="far fa-fw fa-file-upload"></i></a>
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr><tr>
|
|
<th>Baufortschritt</th>
|
|
<td>
|
|
<ul class="list-group">
|
|
<li class="list-group-item"><input type="checkbox" class="switchery" id="conduit_installed_building" data-size="small" data-color="#25b343" onchange="saveCheckbox('conduit_installed_building')" <?=($item->conduit_installed_building) ? "checked='checked'" : ""?> /> FTTx Location mit Leerrohr versorgt</li>
|
|
<li class="list-group-item"><input type="checkbox" class="switchery" id="conduit_installed_ftu" data-size="small" data-color="#25b343" onchange="saveCheckbox('conduit_installed_ftu')" <?=($item->conduit_installed_ftu) ? "checked='checked'" : ""?> /> Leerrohr bis HAK verlegt</li>
|
|
<li class="list-group-item"><input type="checkbox" class="switchery" id="inhouse_cabling" data-size="small" data-color="#25b343" onchange="saveCheckbox('inhouse_cabling')" <?=($item->inhouse_cabling) ? "checked='checked'" : ""?> /> Inhouseverkabelung von Wohneinheiten erledigt</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
<?php endif; ?>
|
|
|
|
<tr>
|
|
<td colspan="2"><h4>Grundbuchdaten</h4></td>
|
|
</tr><tr>
|
|
<th>EZ</th>
|
|
<td><?=$item->ez?></td>
|
|
</tr><tr>
|
|
<th>KG</th>
|
|
<td><?=$item->kg?></td>
|
|
</tr><tr>
|
|
<th>GST</th>
|
|
<td><?=$item->gst?></td>
|
|
</tr><tr>
|
|
<th>GSTNR</th>
|
|
<td><?=$item->gstnr?></td>
|
|
</tr><tr>
|
|
<th>Rimo GN</th>
|
|
<td><?=$item->rimo_gn?></td>
|
|
</tr><tr>
|
|
<th>Plan/Skizze</th>
|
|
<td>
|
|
<?php if($item->file && $item->file->file && $item->file->file->fileExists()): ?>
|
|
<!--img src="<?=self::getUrl("File", "Download", ["id" => $item->file->file_id])?>" style="max-width: 480px;"/-->
|
|
<img src="<?=$item->file->file->asDataUrl()?>" style="max-width: 480px;" />
|
|
<?php endif; ?>
|
|
</td>
|
|
</tr><tr>
|
|
<th></th>
|
|
<td></td>
|
|
</tr><tr>
|
|
<th>Erstellt</th>
|
|
<td class="text-monospace"><?=date("d.m.Y H:i:s", $item->create)?> (<?=$item->creator->name?>)</td>
|
|
</tr><tr>
|
|
<th>Letzte Bearbeitung</th>
|
|
<td class="text-monospace"><?=date("d.m.Y H:i:s", $item->edit)?> (<?=$item->editor->name?>)</td>
|
|
</tr>
|
|
</table>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-7">
|
|
<div class="card border-top-warning">
|
|
<div class="card-body">
|
|
<h3 class="text-center mb-3">Ansprechpartner
|
|
<small><a data-toggle="modal" data-target="#newContactModal" href="#"><i class="fas fa-plus"></i> Neuen Ansprechpartner hinzufügen</a></small>
|
|
</h3>
|
|
|
|
<?php if(!is_array($item->contacts) || !count($item->contacts)): ?>
|
|
<i>Keine Ansprechpartner eingetragen</i>
|
|
<?php else: ?>
|
|
<table class="table table-sm table-striped table-hover">
|
|
<tr>
|
|
<th>Kontakttyp</th>
|
|
<th>Name</th>
|
|
<th>Telefon</th>
|
|
<th>Fax</th>
|
|
<th>Email</th>
|
|
<th></th>
|
|
</tr>
|
|
<?php foreach($item->contacts as $type => $contacts): ?>
|
|
<?php foreach($contacts as $contact):
|
|
if (substr($contact->phone, 0, 2) != "43" && substr($contact->phone, 0, 2) != "49" && substr($contact->phone, 0, 1) != "0") {
|
|
$phone = "0".$contact->phone;
|
|
} else {
|
|
$phone = $contact->phone;
|
|
}
|
|
?>
|
|
<tr id="contact-data-<?=$contact->id?>" data-name="<?=$contact->name?>" data-phone="<?=$phone?>" data-fax="<?=$contact->fax?>" data-email="<?=$contact->email?>" data-type="<?=$contact->type?>" data-street="<?=$contact->street?>" data-zip="<?=$contact->zip?>" data-city="<?=$contact->city?>" data-country="<?=$contact->country?>">
|
|
<td class="text-monospace"><?=__($contact->type, "consent")?></td>
|
|
<td><?=$contact->name?></td>
|
|
<td><?=$phone?></td>
|
|
<td><?=$contact->fax?></td>
|
|
<td><?=$contact->email?></td>
|
|
<td>
|
|
<a href="#" title="Ansprechpartner bearbeiten" onclick="editContact(<?=$contact->id?>); return false;"><i class="far fa-fw fa-edit"></i></a>
|
|
<a href="<?=self::getUrl("ConstructionConsentContact", "delete", ["contact_id" => $contact->id])?>" onclick="if(!confirm('Ansprechpartner wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash"></i></a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card border-top-success">
|
|
<div class="card-body">
|
|
<h3 class="text-center mb-3">Objektbesitzer
|
|
<small><a href="#" onclick="newOwner(); return false;"><i class="fas fa-plus"></i> Neuen Besitzer hinzufügen</a></small>
|
|
</h3>
|
|
|
|
<!--button class="btn btn-sm btn-outline-primary mb-2"><i class="fas fa-down fa-fw"></i> Grundbuch jetzt abfragen</button-->
|
|
|
|
<?php if(!is_array($item->owners) || !count($item->owners)): ?>
|
|
<i>Noch keine Besitzer bekannt</i>
|
|
<?php else: ?>
|
|
<div class="row">
|
|
<div class="col-3">
|
|
<h5>Zusammenfassung Status (von <?=count($item->owners)?>)</h5>
|
|
<table class="table table-sm">
|
|
<?php foreach($item->owner_status_counts as $type => $count): ?>
|
|
<tr class="ConstructionConsentOwnerResult-<?=$type?>">
|
|
<th><?=__($type, "consent")?></th>
|
|
<td><?=$count?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
<div class="col-3">
|
|
<?php
|
|
// Determine the status based on the counts
|
|
$status_class = 'blue'; // Default to blue (all open)
|
|
if (isset($item->owner_result_counts['denied']) && $item->owner_result_counts['denied'] > 0) {
|
|
$status_class = 'red'; // Red if at least one denied
|
|
} elseif (
|
|
(isset($item->owner_result_counts['unresolvable']) && $item->owner_result_counts['unresolvable'] > 0) ||
|
|
(isset($item->owner_result_counts['moved']) && $item->owner_result_counts['moved'] > 0) ||
|
|
(isset($item->owner_result_counts['open']) && $item->owner_result_counts['open'] > 0)
|
|
) {
|
|
$status_class = 'yellow'; // Yellow if at least one unresolvable or moved
|
|
} elseif (isset($item->owner_result_counts['accepted']) &&
|
|
$item->owner_result_counts['accepted'] === count($item->owners)) {
|
|
$status_class = 'green'; // Green if all accepted
|
|
}
|
|
?>
|
|
<!-- Circle for status -->
|
|
|
|
<h5><div class="status-circle <?=$status_class?>"></div> Zusammenfassung Ergebnis (von <?=count($item->owners)?>)</h5>
|
|
<table class="table table-sm">
|
|
<?php foreach($item->owner_result_counts as $type => $count): ?>
|
|
<?php if(!$type) continue; ?>
|
|
<tr class="ConstructionConsentOwnerResult-<?=$type?>">
|
|
<th><?=__($type,"consent")?></th>
|
|
<td><?=$count?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
<table class="table table-sm table-striped table-hover">
|
|
<tr>
|
|
<th></th>
|
|
<th>Name/Anschrift</th>
|
|
<th>Telefon<br />Fax<br />Email</th>
|
|
<th>Anfragestatus</th>
|
|
<th>Ergebnis</th>
|
|
<th></th>
|
|
</tr>
|
|
<?php foreach($item->owners as $owner):
|
|
if (substr($owner->phone, 0, 2) != "43" && substr($owner->phone, 0, 2) != "49" && substr($owner->phone, 0, 1) != "0") {
|
|
$phone = "0".$owner->phone;
|
|
} else {
|
|
$phone = $owner->phone;
|
|
}
|
|
?>
|
|
<tr id="owner-data-<?=$owner->id?>" data-title="<?=$owner->title?>" data-firstname="<?=$owner->firstname?>" data-lastname="<?=$owner->lastname?>" data-street="<?=$owner->street?>" data-zip="<?=$owner->zip?>" data-city="<?=$owner->city?>" data-country="<?=$owner->country?>" data-phone="<?=$phone?>" data-phone2="<?=$owner->phone2?>" data-fax="<?=$owner->fax?>" data-email="<?=$owner->email?>" data-birthdate="<?=($owner->birthdate) ? (new DateTime($owner->birthdate))->format("d.m.Y"): ""?>">
|
|
<td style="font-size: 1.4em;">
|
|
<a href="<?=self::getUrl("ConstructionConsent", "Download", ["owner_id" => $owner->id])?>" title="Zustimmungserklärungsformular herunterladen"><i class="far fa-fw fa-file-download"></i></a>
|
|
</td>
|
|
<td>
|
|
|
|
<?php if($owner->company): ?>
|
|
<strong><?=$owner->company?></strong><br />
|
|
<?php else: ?>
|
|
<strong><?=($owner->title) ? $owner->title." " : ""?><?=$owner->firstname?> <?=$owner->lastname?></strong><br />
|
|
<?php endif; ?>
|
|
<?=$owner->street?><br />
|
|
<?=$owner->zip?> <?=$owner->city?><br />
|
|
<?=$owner->country?>
|
|
</td>
|
|
<td>
|
|
<?=$phone?><br />
|
|
<?=$owner->fax?><br />
|
|
<?=$owner->email?>
|
|
</td>
|
|
<td class="text-monospace">
|
|
<span id="status-<?=$owner->id?>-text" data-status-id="<?=$owner->status?>"><span id="status-<?=$owner->id?>-statustext"><?=($owner->status) ? __($owner->status, "consent") : ""?></span> <a href="#" onclick="return toggleStatusControl(<?=$owner->id?>)"><i class="fas fa-fw fa-edit"></i></a></span>
|
|
<div class="input-group" id="status-<?=$owner->id?>-input" style="display:none">
|
|
<select class="form-control">
|
|
<option value="new" <?=($owner->status == "new") ? "selected='selected'" : ""?>><?=__("new", "consent")?></option>
|
|
<option value="sent" <?=($owner->status == "sent") ? "selected='selected'" : ""?>><?=__("sent", "consent")?></option>
|
|
<option value="returned" <?=($owner->status == "returned") ? "selected='selected'" : ""?>><?=__("returned", "consent")?></option>
|
|
<option value="outstanding" <?=($owner->status == "outstanding") ? "selected='selected'" : ""?>><?=__("outstanding", "consent")?></option>
|
|
</select>
|
|
<div class="input-group-append">
|
|
<button type="button" class="btn btn-primary" title="Speichern" onclick="saveStatusControl(<?=$owner->id?>)"><i class="fas fa-check"></i></button>
|
|
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleStatusControl(<?=$owner->id?>)"><i class="fas fa-times"></i></button>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td class="text-monospace">
|
|
<span id="result-<?=$owner->id?>-text" data-result-id="<?=$owner->result?>"><span id="result-<?=$owner->id?>-resulttext"><?=($owner->result) ? __($owner->result, "consent") : ""?></span> <a href="#" onclick="return toggleResultControl(<?=$owner->id?>)"><i class="fas fa-fw fa-edit"></i></a></span>
|
|
<div class="input-group" id="result-<?=$owner->id?>-input" style="display:none">
|
|
<select class="form-control">
|
|
<option></option>
|
|
<option value="open" <?=($owner->result == "open") ? "selected='selected'" : ""?>><?=__("open", "consent")?></option>
|
|
<option value="accepted" <?=($owner->result == "accepted") ? "selected='selected'" : ""?>><?=__("accepted", "consent")?></option>
|
|
<option value="denied" <?=($owner->result == "denied") ? "selected='selected'" : ""?>><?=__("denied", "consent")?></option>
|
|
<option value="unresolvable" <?=($owner->result == "unresolvable") ? "selected='selected'" : ""?>><?=__("unresolvable", "consent")?></option>
|
|
<option value="moved" <?=($owner->result == "moved") ? "selected='selected'" : ""?>><?=__("moved", "consent")?></option>
|
|
</select>
|
|
<div class="input-group-append">
|
|
<button type="button" class="btn btn-primary" title="Speichern" onclick="saveResultControl(<?=$owner->id?>)"><i class="fas fa-check"></i></button>
|
|
<button type="button" class="btn btn-secondary" title="Abbrechen" onclick="toggleResultControl(<?=$owner->id?>)"><i class="fas fa-times"></i></button>
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<?php if(is_array($owner->files) && count($owner->files)): foreach($owner->files as $file): ?>
|
|
<a href="<?=self::getUrl("File", "download", ["id" => $file->file_id])?>"><i class="far fa-fw fa-file"></i> <?=$file->filename?></a>
|
|
<a class="text-danger" href="<?=self::getUrl("ConstructionConsentOwner", "deleteFile", ["id" => $file->id])?>" onclick="if(!confirm('Datei wirklich löschen?')) return false;" title="Datei Löschen"><i class="far fa-fw fa-trash-alt"></i></a>
|
|
<br />
|
|
<?php endforeach; endif; ?>
|
|
</div>
|
|
|
|
<hr />
|
|
<div class="mt-2"><a href="#" onclick="openOwnerUploadModal(<?=$owner->id?>); return false;"><i class="far fa-cloud-upload" style="font-size: 1.4em;"></i> Dokument hochladen</a></div>
|
|
</td>
|
|
<td>
|
|
<a href="#" title="Besitzer bearbeiten" onclick="editOwner(<?=$owner->id?>); return false;"><i class="far fa-fw fa-edit"></i></a>
|
|
<a href="<?=self::getUrl("ConstructionConsentOwner", "delete", ["id" => $owner->id])?>" onclick="if(!confirm('Besitzer wirklich löschen?')) return false;" class="text-danger" title="Löschen"><i class="fas fa-trash-alt"></i></a>
|
|
</td>
|
|
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-lg-6">
|
|
|
|
<div class="card border-top-warning">
|
|
<div class="card-body">
|
|
<h4>Journal</h4>
|
|
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<button type="button" class="btn btn-sm btn-info" onclick="$('#new-journal').toggle(); $('#new-journal-text').focus()"><i class="fas fa-plus"></i> Neuer Journaleintrag</button>
|
|
<div id="new-journal" class="hidden mt-2">
|
|
<form method="post" action="<?=self::getUrl("ConstructionConsentJournal", "save")?>">
|
|
<input type="hidden" name="consent_id" value="<?=$item->id?>" />
|
|
<textarea id="new-journal-text" name="text" class="form-control mb-2" style="height:120px;" placeholder="Text hier eingeben..."></textarea>
|
|
<button class="btn btn-sm btn-primary" type="submit"><i class="fas fa-save"></i> Speichern</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<table class="table table-striped table-sm journal">
|
|
<?php foreach($item->journal as $j): ?>
|
|
<tr>
|
|
<td style="white-space: nowrap" class="text-monospace"><?=date("d.m.Y H:i", $j->create)?> (<?=$j->creator?>)</td>
|
|
<td style="width: 100%">
|
|
<?=nl2br($j->text)?>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-lg-6">
|
|
|
|
<div class="card border-top-info">
|
|
<div class="card-body">
|
|
<h4>History</h4>
|
|
|
|
<div style="max-height: 550px; overflow: scroll">
|
|
<table class="table table-sm table-striped">
|
|
<tr>
|
|
<th>Zeitpunkt</th>
|
|
<th>Benutzer</th>
|
|
<th>Feld</th>
|
|
<th>Alter Wert</th>
|
|
<th>Neuer Wert</th>
|
|
</tr>
|
|
<?php foreach($item->history as $history): ?>
|
|
<tr>
|
|
<td class="text-monospace"><?=date("d.m.Y H:i:s", $history->create)?></td>
|
|
<td><?=$history->creator->name?></td>
|
|
<td><?=$history->getKey()?></td>
|
|
<td class="text-monospace"><?=$history->getText("old")?></td>
|
|
<td class="text-monospace"><?=$history->getText("new")?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
</div>
|
|
|
|
<div class="modal fade" id="newOwnerModal" aria-hidden="true" aria-labelledby="#newOwnerModelLabel" tabindex="-1">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<form method="post" action="<?=self::getUrl("ConstructionConsentOwner", "save")?>">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title" id="newOwnerModelLabel">Neuen Besitzer hinzufügen</h3>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<?php if ($is_admin): ?>
|
|
<div class="form-group">
|
|
<label for="owner_id_not_included" class="col-form-label">Besitzer aus Vorbestellung suchen:</label>
|
|
<select class="form-control" name="owner_id_not_included" id="search-owner">
|
|
<option></option>
|
|
</select>
|
|
</div>
|
|
<hr>
|
|
<?php endif; ?>
|
|
|
|
<input type="hidden" name="constructionconsent_id" value="<?=$item->id?>" />
|
|
<input type="hidden" name="id" value="" />
|
|
<h4>Name & Anschrift</h4>
|
|
|
|
<div class="form-group">
|
|
<label for="title" class="col-form-label">Titel:</label>
|
|
<input type="text" class="form-control" name="title" id="title" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="company" class="col-form-label">Firma:</label>
|
|
<input type="text" required class="form-control" name="company" id="company" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="firnstname" class="col-form-label">Vorname:</label>
|
|
<input type="text" required class="form-control" name="firstname" id="firstname" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="lastname" class="col-form-label">Nachname:</label>
|
|
<input type="text" required class="form-control" name="lastname" id="lastname" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="street" class="col-form-label">Straße:</label>
|
|
<input type="text" required class="form-control" name="street" id="street" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="zip" class="col-form-label">PLZ / Ort:</label>
|
|
<div class="row">
|
|
<div class="col-4">
|
|
<input type="text" required class="form-control" name="zip" id="zip" />
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" required class="form-control" name="city" id="city" />
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="country" class="col-form-label">Land:</label>
|
|
<input type="text" class="form-control" name="country" id="country" />
|
|
<small>Kann leer bleiben für Österreich</small>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="birthdate" class="col-form-label">Geburtsdatum:</label>
|
|
<input type="text" class="form-control" name="birthdate" id="birthdate" />
|
|
</div>
|
|
|
|
<h4>Kontakt</h4>
|
|
|
|
<div class="form-group">
|
|
<label for="phone" class="col-form-label">Telefon 1:</label>
|
|
<input type="text" class="form-control" name="phone" id="phone" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="phone2" class="col-form-label">Telefon 2:</label>
|
|
<input type="text" class="form-control" name="phone2" id="phone2" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="fax" class="col-form-label">Fax:</label>
|
|
<input type="text" class="form-control" name="fax" id="fax" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="email" class="col-form-label">Email:</label>
|
|
<input type="text" class="form-control" name="email" id="email" />
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="ownerUpload" aria-hidden="true" aria-labelledby="#ownerUploadLabel" tabindex="-1">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<form method="post" action="<?=self::getUrl("ConstructionConsentOwner", "uploadDocument")?>" enctype="multipart/form-data">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title" id="ownerUploadLabel">Dokument hochladen</h3>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<input type="hidden" name="owner_id" id="owner-upload-owner_id" value="" />
|
|
|
|
<div class="form-group">
|
|
<label for="consentOwnerUpload" class="col-form-label">Datei auswählen *</label>
|
|
<input type="file" class="form-control" name="consentOwnerUpload" id="consentOwnerUpload" />
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Hochladen</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="newContactModal" aria-hidden="true" aria-labelledby="#newContactModelLabel" tabindex="-1">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<form method="post" action="<?=self::getUrl("ConstructionConsentContact", "save")?>">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title" id="newContactModelLabel">Neuen Ansprechpartner hinzufügen</h3>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<input type="hidden" name="constructionconsent_id" value="<?=$item->id?>" />
|
|
<input type="hidden" name="contact_id" value="" />
|
|
|
|
<div class="form-group">
|
|
<label for="street" class="col-form-label">Kontakttyp:</label>
|
|
<select class="form-control" name="type" id="contact_type">
|
|
|
|
<option value="property_manager">Hausverwaltung</option>
|
|
<option value="electrician">Elektriker</option>
|
|
<option value="contact">Ansprechpartner</option>
|
|
<option value="owner">Eigentümer</option>
|
|
<option value="other">Sonstige</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="name" class="col-form-label">Name: *</label>
|
|
<textarea class="form-control" name="name" id="contact_name"></textarea>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="street" class="col-form-label">Straße:</label>
|
|
<input type="text" class="form-control" name="street" id="contact_street" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="zip" class="col-form-label">PLZ / Ort:</label>
|
|
<div class="row">
|
|
<div class="col-4">
|
|
<input type="text" class="form-control" name="zip" id="contact_zip" />
|
|
</div>
|
|
<div class="col-8">
|
|
<input type="text" class="form-control" name="city" id="contact_city" />
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="phone" class="col-form-label">Telefon:</label>
|
|
<input type="text" class="form-control" name="phone" id="contact_phone" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="fax" class="col-form-label">Fax:</label>
|
|
<input type="text" class="form-control" name="fax" id="contact_fax" />
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="email" class="col-form-label">Email:</label>
|
|
<input type="text" class="form-control" name="email" id="contact_email" />
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="plannerDateModal" aria-hidden="true" aria-labelledby="#plannerDateLabel" tabindex="-1">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<form method="post" action="<?=self::getUrl("ConstructionConsent", "saveDate")?>" enctype="multipart/form-data">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title" id="ownerUploadLabel">Begehung mit Planer</h3>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<input type="hidden" name="consent_id" id="plannerdate_consent_id" value="<?=$item->id?>" />
|
|
|
|
<div class="form-group">
|
|
<label for="" class="col-form-label">Termin *</label>
|
|
<input type="text" class="form-control" name="inspection_date_planner" id="inspection_date_planner" value="<?=($item->inspection_date_planner) ? date("d.m.Y", $item->inspection_date_planner) : ""?>" />
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="electricianDateModal" aria-hidden="true" aria-labelledby="#electricianDateLabel" tabindex="-1">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<form method="post" action="<?=self::getUrl("ConstructionConsent", "saveDate")?>" enctype="multipart/form-data">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title" id="ownerUploadLabel">Begehung mit Elektriker</h3>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<input type="hidden" name="consent_id" id="electriciandate_consent_id" value="<?=$item->id?>" />
|
|
|
|
<div class="form-group">
|
|
<label for="" class="col-form-label">Termin *</label>
|
|
<input type="text" class="form-control" name="inspection_date_electrician" id="inspection_date_electrician" value="<?=($item->inspection_date_electrician) ? date("d.m.Y", $item->inspection_date_electrician) : ""?>" />
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Speichern</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="inspectionProtocolPlanner" aria-hidden="true" aria-labelledby="#inspectionProtocolPlannerLabel" tabindex="-1">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<form method="post" action="<?=self::getUrl("ConstructionConsent", "uploadFile")?>" enctype="multipart/form-data">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title" id="inspectionProtocolPlannerLabel">Begehungsprotokoll hochladen</h3>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<h4>Begehung mit Planer</h4>
|
|
|
|
<input type="hidden" name="consent_id" id="inspection_protocol_upload_id" value="<?=$item->id?>" />
|
|
<input type="hidden" name="upload_type" id="inspection_protocol_planner_upload_type" value="planner" />
|
|
|
|
<div class="form-group">
|
|
<label for="inspection_protocol_planner_file" class="col-form-label">Datei auswählen *</label>
|
|
<input type="file" class="form-control" name="inspection_protocol_file" id="inspection_protocol_planner_file" />
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Hochladen</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="inspectionProtocolElectrician" aria-hidden="true" aria-labelledby="#inspectionProtocolElectricianLabel" tabindex="-1">
|
|
<div class="modal-dialog modal-dialog-centered">
|
|
<div class="modal-content">
|
|
<form method="post" action="<?=self::getUrl("ConstructionConsent", "uploadFile")?>" enctype="multipart/form-data">
|
|
<div class="modal-header">
|
|
<h3 class="modal-title" id="inspectionProtocolElectricianLabel">Begehungsprotokoll hochladen</h3>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<h4>Begehung mit Elektriker</h4>
|
|
|
|
<input type="hidden" name="consent_id" id="inspection_protocol_upload_id" value="<?=$item->id?>" />
|
|
<input type="hidden" name="upload_type" id="inspection_protocol_electrician_upload_type" value="electrician" />
|
|
|
|
<div class="form-group">
|
|
<label for="inspection_protocol_electrician_file" class="col-form-label">Datei auswählen *</label>
|
|
<input type="file" class="form-control" name="inspection_protocol_file" id="inspection_protocol_electrician_file" />
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Abbrechen</button>
|
|
<button type="submit" class="btn btn-primary">Hochladen</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
var switcheries = [];
|
|
Array.from(document.getElementsByClassName("switchery")).forEach(function(elem) {
|
|
let color = $(elem).data("color");
|
|
let size = $(elem).data("size");
|
|
switcheries.push(new Switchery(elem, {color: color, size: size}));
|
|
|
|
if($(elem).data("toggle-param")) {
|
|
$(elem).on("change", function() {
|
|
saveCheckbox($(this).data("toggle-param"));
|
|
});
|
|
}
|
|
});
|
|
|
|
$("#inspection_date_planner,#inspection_date_electrician,#birthdate").datepicker({
|
|
language: 'de',
|
|
format: "dd.mm.yyyy",
|
|
showWeekDays: true,
|
|
todayBtn: 'linked',
|
|
autoclose: true
|
|
});
|
|
|
|
function openOwnerUploadModal(oid) {
|
|
$('#owner-upload-owner_id').val(oid);
|
|
$("#consentOwnerUpload").val("");
|
|
$("#owner-upload-name").val("");
|
|
|
|
$('#ownerUpload').modal();
|
|
}
|
|
|
|
function newOwner() {
|
|
$("#newOwnerModal input[name=title]").val("");
|
|
$("#newOwnerModal input[name=firstname]").val("");
|
|
$("#newOwnerModal input[name=lastname]").val("");
|
|
$("#newOwnerModal input[name=street]").val("");
|
|
$("#newOwnerModal input[name=zip]").val("");
|
|
$("#newOwnerModal input[name=city]").val("");
|
|
$("#newOwnerModal input[name=country]").val("");
|
|
$("#newOwnerModal input[name=phone]").val("");
|
|
$("#newOwnerModal input[name=phone2]").val("");
|
|
$("#newOwnerModal input[name=fax]").val("");
|
|
$("#newOwnerModal input[name=email]").val("");
|
|
$("#newOwnerModal input[name=birthdate]").val("");
|
|
$("#newOwnerModal input[name=id]").val("");
|
|
|
|
$("#newOwnerModelLabel").text("Neuen Besitzer hinzufügen");
|
|
|
|
$("#newOwnerModal").modal("show");
|
|
}
|
|
|
|
function editOwner(owner_id) {
|
|
if(!owner_id) return;
|
|
|
|
$("#newOwnerModal input[name=title]").val($("#owner-data-" + owner_id).data("title"));
|
|
$("#newOwnerModal input[name=firstname]").val($("#owner-data-" + owner_id).data("firstname"));
|
|
$("#newOwnerModal input[name=lastname]").val($("#owner-data-" + owner_id).data("lastname"));
|
|
$("#newOwnerModal input[name=street]").val($("#owner-data-" + owner_id).data("street"));
|
|
$("#newOwnerModal input[name=zip]").val($("#owner-data-" + owner_id).data("zip"));
|
|
$("#newOwnerModal input[name=city]").val($("#owner-data-" + owner_id).data("city"));
|
|
$("#newOwnerModal input[name=country]").val($("#owner-data-" + owner_id).data("country"));
|
|
$("#newOwnerModal input[name=phone]").val($("#owner-data-" + owner_id).data("phone"));
|
|
$("#newOwnerModal input[name=phone2]").val($("#owner-data-" + owner_id).data("phone2"));
|
|
$("#newOwnerModal input[name=fax]").val($("#owner-data-" + owner_id).data("fax"));
|
|
$("#newOwnerModal input[name=email]").val($("#owner-data-" + owner_id).data("email"));
|
|
$("#newOwnerModal input[name=birthdate]").val($("#owner-data-" + owner_id).data("birthdate"));
|
|
$("#newOwnerModal input[name=id]").val(owner_id);
|
|
|
|
$("#newOwnerModelLabel").text("Besitzer bearbeiten");
|
|
|
|
$("#newOwnerModal").modal("show");
|
|
|
|
}
|
|
|
|
function editContact(contact_id) {
|
|
if(!contact_id) return;
|
|
|
|
$("#newContactModal input[name=contact_id]").val(contact_id);
|
|
$("#newContactModal input[name=type]").val($("#contact-data-" + contact_id).data("type"));
|
|
$("#newContactModal textarea[name=name]").val($("#contact-data-" + contact_id).data("name"));
|
|
$("#newContactModal input[name=street]").val($("#contact-data-" + contact_id).data("street"));
|
|
$("#newContactModal input[name=zip]").val($("#contact-data-" + contact_id).data("zip"));
|
|
$("#newContactModal input[name=city]").val($("#contact-data-" + contact_id).data("city"));
|
|
$("#newContactModal input[name=phone]").val($("#contact-data-" + contact_id).data("phone"));
|
|
$("#newContactModal input[name=fax]").val($("#contact-data-" + contact_id).data("fax"));
|
|
$("#newContactModal input[name=email]").val($("#contact-data-" + contact_id).data("email"));
|
|
|
|
$("#newContactModelLabel").text("Ansprechpartner bearbeiten");
|
|
|
|
$("#newContactModal").modal("show");
|
|
|
|
}
|
|
|
|
function toggleStatusControl(oid) {
|
|
// set select to current status id
|
|
$("#status-" + oid + "-input select").val($("#status-" + oid + "-text").data("status-id"));
|
|
|
|
// toggle controls
|
|
$("#status-" + oid + "-text").toggle();
|
|
$("#status-" + oid + "-input").toggle();
|
|
|
|
return false;
|
|
}
|
|
|
|
function saveStatusControl(oid) {
|
|
if(!Number.isInteger(oid) || oid < 1) {
|
|
return false;
|
|
}
|
|
|
|
var value = $("#status-" + oid + "-input select").val();
|
|
|
|
$.post("<?=self::getUrl("ConstructionConsentOwner","Api")?>",
|
|
{
|
|
'do': "updateStatus",
|
|
id: oid,
|
|
status: value
|
|
},
|
|
function(success) {
|
|
if(success.status == "OK") {
|
|
var update = success.result.update;
|
|
|
|
$("#status-" + update.id + "-statustext").text(update.status_text);
|
|
$("#status-" + update.id + "-text")
|
|
.addClass("text-success")
|
|
.data("status-id", update.status);
|
|
|
|
// find result-id-text and result-it-resulttext and set it to "Offen" / open if data-result-id has nothing
|
|
if($("#result-" + update.id + "-text").data("result-id") == "") {
|
|
$("#result-" + update.id + "-text").data("result-id", "open").addClass("text-success");
|
|
$("#result-" + update.id + "-resulttext").text("Offen");
|
|
}
|
|
|
|
setTimeout(() => {
|
|
$("#status-" + update.id + "-text").removeClass("text-success")
|
|
$("#result-" + update.id + "-text").removeClass("text-success")
|
|
}, 1500);
|
|
|
|
toggleStatusControl(oid);
|
|
|
|
}
|
|
|
|
},
|
|
'json');
|
|
}
|
|
|
|
|
|
function toggleResultControl(oid) {
|
|
// set select to current result id
|
|
$("#result-" + oid + "-input select").val($("#result-" + oid + "-text").data("result-id"));
|
|
|
|
// toggle controls
|
|
$("#result-" + oid + "-text").toggle();
|
|
$("#result-" + oid + "-input").toggle();
|
|
|
|
return false;
|
|
}
|
|
|
|
function saveResultControl(oid) {
|
|
if(!Number.isInteger(oid) || oid < 1) {
|
|
return false;
|
|
}
|
|
|
|
var value = $("#result-" + oid + "-input select").val();
|
|
|
|
$.post("<?=self::getUrl("ConstructionConsentOwner","Api")?>",
|
|
{
|
|
'do': "updateResult",
|
|
id: oid,
|
|
result: value
|
|
},
|
|
function(success) {
|
|
if(success.status == "OK") {
|
|
var update = success.result.update;
|
|
|
|
$("#result-" + update.id + "-resulttext").text(update.result_text);
|
|
$("#result-" + update.id + "-text")
|
|
.addClass("text-success")
|
|
.data("result-id", update.result);
|
|
|
|
setTimeout(() => {
|
|
$("#result-" + update.id + "-text").removeClass("text-success")
|
|
}, 1500);
|
|
|
|
if(update.result == "accepted" || update.result == "denied") {
|
|
if(!$("#status-" + update.id + "-input select").is(":visible")) {
|
|
toggleStatusControl(update.id);
|
|
}
|
|
$("#status-" + update.id + "-input select").val("returned");
|
|
saveStatusControl(parseInt(update.id));
|
|
}
|
|
|
|
toggleResultControl(update.id);
|
|
|
|
}
|
|
|
|
},
|
|
'json');
|
|
}
|
|
|
|
|
|
/*var inspectionToggleLock = false;
|
|
function toggleInspection(type) {
|
|
if(inspectionToggleLock) return;
|
|
|
|
var iplan = 0;
|
|
var ielec = 0;
|
|
|
|
console.log(type);
|
|
|
|
if(type != "planner" && type != "electrician") return false;
|
|
|
|
iplan = $("#inspection_planner").prop("checked") ? 1 : 0;
|
|
ielec = $("#inspection_electrician").prop("checked") ? 1 : 0;
|
|
|
|
$.ajax({
|
|
method: "POST",
|
|
url: "<?=self::getUrl("ConstructionConsent", "api")?>",
|
|
data: {
|
|
'do': "saveInspection",
|
|
id: <?=$item->id?>,
|
|
inspection_planner: iplan,
|
|
inspection_electrician: ielec
|
|
},
|
|
context: {
|
|
type: type
|
|
},
|
|
success: function(success) {
|
|
if (success.status != "OK") {
|
|
console.log("#inspection_" + this.type);
|
|
console.log($("#inspection_" + this.type));
|
|
inspectionToggleLock = true;
|
|
$("#inspection_" + this.type).click();
|
|
notify("error", "Status konnte nicht gespeichert werden");
|
|
inspectionToggleLock = false;
|
|
}
|
|
},
|
|
returnType: 'json'
|
|
});
|
|
|
|
}*/
|
|
|
|
var checkboxToggleLock = false;
|
|
function saveCheckbox(type) {
|
|
if(checkboxToggleLock) return;
|
|
console.log(type);
|
|
|
|
if(type != "inspection_planner" && type != "inspection_electrician" && type != "conduit_installed_building" && type != "conduit_installed_ftu" && type != "inhouse_cabling") return false;
|
|
|
|
let update_data = {
|
|
'do': "saveCheckbox",
|
|
id: <?=$item->id?>,
|
|
};
|
|
|
|
update_data[type] = $("#" + type).prop("checked") ? 1 : 0;
|
|
/*if(type == "inspection_electrician") update_data.inspection_electrician = $("#inspection_electrician").prop("checked") ? 1 : 0;
|
|
if(type == "conduit_installed_building") update_data.conduit_installed_building = $("#conduit_installed_building").prop("checked") ? 1 : 0;
|
|
if(type == "conduit_installed_ftu") update_data.conduit_installed_ftu = $("#conduit_installed_ftu").prop("checked") ? 1 : 0;
|
|
if(type == "inhouse_cabling") update_data.inhouse_cabling = $("#inhouse_cabling").prop("checked") ? 1 : 0;*/
|
|
|
|
$.ajax({
|
|
method: "POST",
|
|
url: "<?=self::getUrl("ConstructionConsent", "api")?>",
|
|
data: update_data,
|
|
context: {
|
|
type: type
|
|
},
|
|
success: function(success) {
|
|
if (success.status != "OK") {
|
|
console.log("#" + this.type);
|
|
console.log($("#" + this.type));
|
|
checkboxToggleLock = true;
|
|
$("#" + this.type).click();
|
|
notify("error", "Status konnte nicht gespeichert werden");
|
|
checkboxToggleLock = false;
|
|
} else {
|
|
notify("success", "Status erfolgreich gespeichert");
|
|
}
|
|
},
|
|
returnType: 'json'
|
|
});
|
|
}
|
|
|
|
|
|
$(document).ready(function() {
|
|
$('#search-owner').select2({
|
|
dropdownParent: $('#newOwnerModal'),
|
|
ajax: {
|
|
url: "<?=self::getUrl("ConstructionConsentOwner", "searchOwner")?>",
|
|
dataType: 'json',
|
|
delay: 250,
|
|
data: function(params) {
|
|
return {
|
|
search: params.term
|
|
};
|
|
},
|
|
processResults: function(data) {
|
|
return {
|
|
results: data.map(function(item) {
|
|
return {
|
|
id: item.id,
|
|
text: item.text,
|
|
fullData: item
|
|
};
|
|
})
|
|
};
|
|
},
|
|
cache: true
|
|
},
|
|
minimumInputLength: 2,
|
|
placeholder: 'Besitzer suchen...'
|
|
});
|
|
|
|
$('#search-owner').on('select2:select', function(e) {
|
|
var selectedData = e.params.data.fullData;
|
|
$("#newOwnerModal input[name=firstname]").val(selectedData.firstname);
|
|
$("#newOwnerModal input[name=lastname]").val(selectedData.lastname);
|
|
$("#newOwnerModal input[name=street]").val(selectedData.street);
|
|
$("#newOwnerModal input[name=zip]").val(selectedData.zip);
|
|
$("#newOwnerModal input[name=city]").val(selectedData.city);
|
|
$("#newOwnerModal input[name=phone]").val(selectedData.phone);
|
|
$("#newOwnerModal input[name=email]").val(selectedData.email);
|
|
});
|
|
|
|
$("#approve_override").on("change", function() {
|
|
const reason = prompt("Bitte geben Sie einen Grund für das Überschreiben der Genehmigung ein:");
|
|
if (reason != null) {
|
|
$.post("<?php echo self::getUrl("ConstructionConsentJournal", "save")?>", {
|
|
consent_id: <?=$item->id?>,
|
|
text: `Genehmigung überschreiben wurde ${$(this).prop("checked") ? "aktiviert" : "deaktiviert"} | Begründung: ${reason}`
|
|
}, function(success) {
|
|
if (success.status != "OK") {
|
|
notify("error", "Status konnte nicht gespeichert werden");
|
|
} else {
|
|
notify("success", "Status erfolgreich gespeichert");
|
|
}
|
|
}, 'json');
|
|
|
|
$.get("<?php echo self::getUrl("ConstructionConsent", "approveOverride")?>", {
|
|
consent_id: <?=$item->id?>,
|
|
checked: $(this).prop("checked") ? 1 : 0
|
|
}, function(success) {
|
|
if (success.status != "OK") {
|
|
notify("error", "Status konnte nicht gespeichert werden");
|
|
setTimeout(() => {location.reload()}, 150);
|
|
} else {
|
|
notify("success", "Status erfolgreich gespeichert");
|
|
setTimeout(() => {location.reload()}, 150);
|
|
}
|
|
}, 'json');
|
|
}
|
|
});
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
$('#company').on('input', function() {
|
|
if ($(this).val().length > 0) {
|
|
$('#firstname').prop('required', false);
|
|
$('#lastname').prop('required', false);
|
|
} else {
|
|
$('#firstname').prop('required', true);
|
|
$('#lastname').prop('required', true);
|
|
}
|
|
});
|
|
|
|
$('#firstname, #lastname').on('input', function() {
|
|
if ($('#firstname').val().length > 0 && $('#lastname').val().length > 0) {
|
|
$('#company').prop('required', false);
|
|
} else {
|
|
$('#company').prop('required', true);
|
|
}
|
|
});
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const highlightOwnerId = urlParams.get('highlight_owner_id');
|
|
|
|
if (highlightOwnerId) {
|
|
const targetRow = document.querySelector(`#owner-data-${highlightOwnerId}`);
|
|
if (targetRow) {
|
|
targetRow.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
targetRow.classList.add('highlight');
|
|
setTimeout(() => {
|
|
targetRow.classList.remove('highlight');
|
|
}, 1500);
|
|
}
|
|
}
|
|
|
|
})
|
|
</script>
|
|
|
|
|
|
<style>
|
|
.highlight {
|
|
background-color: #ffeb3b !important;
|
|
transition: background-color 0.5s ease;
|
|
}
|
|
/* Styles for the status circle */
|
|
.status-circle {
|
|
width: 14px;
|
|
height: 14px;
|
|
border-radius: 50%;
|
|
display: inline-block;
|
|
}
|
|
.status-circle.red {
|
|
background-color: #d9534f; /* Red */
|
|
}
|
|
.status-circle.yellow {
|
|
background-color: #f0ad4e; /* Yellow */
|
|
}
|
|
.status-circle.green {
|
|
background-color: #5cb85c; /* Green */
|
|
}
|
|
.status-circle.blue {
|
|
background-color: #337ab7; /* Blue */
|
|
}
|
|
|
|
.ConstructionConsentOwnerResult-denied {
|
|
/*red background color here for this tr*/
|
|
background-color: #f9a39f
|
|
}
|
|
|
|
.ConstructionConsentOwnerResult-open {
|
|
/*grey background color here for this tr*/
|
|
background-color: #ffe58e
|
|
}
|
|
|
|
.ConstructionConsentOwnerResult-accepted {
|
|
/*green background color here for this tr*/
|
|
background-color: #9cf89c
|
|
}
|
|
|
|
.ConstructionConsentOwnerResult-unresolvable {
|
|
/*orange background color here for this tr*/
|
|
background-color: #ffe58e
|
|
}
|
|
|
|
.ConstructionConsentOwnerResult-moved {
|
|
/*orange background color here for this tr*/
|
|
background-color: #ffe58e
|
|
}
|
|
|
|
|
|
</style>
|
|
|
|
|
|
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
|