ConstructionConsent live
This commit is contained in:
@@ -30,9 +30,9 @@ $pagination_entity_name = "Adressen";
|
||||
|
||||
|
||||
<?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>
|
||||
<!--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>
|
||||
<!--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>
|
||||
@@ -114,8 +114,52 @@ $pagination_entity_name = "Adressen";
|
||||
<tr>
|
||||
<td colspan="2"><h4>Metadaten</h4></td>
|
||||
</tr><tr>
|
||||
<th>Anzahl Bestellungen</th>
|
||||
<td><?=$item->preorder_count?></td>
|
||||
<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>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>Bauvortschritt</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; ?>
|
||||
|
||||
@@ -203,7 +247,7 @@ $pagination_entity_name = "Adressen";
|
||||
<small><a data-toggle="modal" data-target="#newOwnerModal" href="#"><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>
|
||||
<!--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>
|
||||
@@ -538,9 +582,158 @@ $pagination_entity_name = "Adressen";
|
||||
</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"));
|
||||
});
|
||||
}
|
||||
});
|
||||
//var blah = new Switchery();
|
||||
/*$(".switchery").each(() => {
|
||||
console.log($(this).id);
|
||||
|
||||
});*/
|
||||
|
||||
$("#inspection_date_planner,#inspection_date_electrician").datepicker({
|
||||
language: 'de',
|
||||
format: "dd.mm.yyyy",
|
||||
showWeekDays: true,
|
||||
todayBtn: 'linked',
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
function openOwnerUploadModal(oid) {
|
||||
$('#owner-upload-owner_id').val(oid);
|
||||
$("#consentOwnerUpload").val("");
|
||||
@@ -642,10 +835,88 @@ $pagination_entity_name = "Adressen";
|
||||
'json');
|
||||
}
|
||||
|
||||
function toggleJournal(order_id) {
|
||||
$("#journal-container").find("div.opener").remove();
|
||||
$("#journal-container").css("max-height", "750px").css("overflow", "auto");
|
||||
}
|
||||
|
||||
/*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'
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -26,12 +26,6 @@ $pagination_entity_name = "Zustimmungserklärungsprojekte";
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<a href="<?=self::getUrl("ConstructionConsent")?>" class="btn btn-outline-secondary"><i class="fas fa-fw fa-arrow-left"></i> Zurück zu Zustimmungserklärungen</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body mb-3">
|
||||
<h4 class="header-title mb-3"><i class="fad fa-filter fa-fw"></i> Filter</h4>
|
||||
@@ -65,9 +59,11 @@ $pagination_entity_name = "Zustimmungserklärungsprojekte";
|
||||
<div class="float-left">
|
||||
<h4 class="header-title">Liste aller Zustimmmungserklärungsprojekte</h4>
|
||||
</div>
|
||||
<?php if($me->isAdmin()): ?>
|
||||
<div class="float-right">
|
||||
<a class="btn btn-primary" href="<?=self::getUrl("ConstructionConsentProject", "add")?>"><i class="fas fa-plus"></i> Neue Zustimmungserklärungsprojekt erstellen</a>
|
||||
<a class="btn btn-primary" href="<?=self::getUrl("ConstructionConsentProject", "add")?>"><i class="fas fa-plus"></i> Neues Zustimmungserklärungsprojekt erstellen</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<link href="<?=self::getResourcePath()?>plugins/notification/notify.min.css" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>plugins/ekko-lightbox/ekko-lightbox.css" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>datatables/datatables.min.css?<?=$git_merge_ts?>" rel="stylesheet" type="text/css" />
|
||||
<link href="<?=self::getResourcePath()?>assets/libs/switchery/switchery.min.css?<?=$git_merge_ts?>" rel="stylesheet" type="text/css" />
|
||||
|
||||
<?php if(isset($additionalCSS) && is_array($additionalCSS) && count($additionalCSS)): ?>
|
||||
<?php foreach($additionalCSS as $css): ?>
|
||||
@@ -55,6 +56,7 @@
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>js/bootstrap-autocomplete.min.js"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>datatables/datatables.min.js?<?=$git_merge_ts?>"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>plugins/notification/notify.js"></script>
|
||||
<script type="text/javascript" src="<?=self::getResourcePath()?>assets/libs/switchery/switchery.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.mfNotify = <?=isset($mfNotify) ? json_encode($mfNotify) : "null"; ?>;
|
||||
|
||||
@@ -188,6 +188,9 @@
|
||||
<i class="fal fa-fw fa-money-bill-wave"></i>Verkauf <div class="arrow-down"></div>
|
||||
</a>
|
||||
<ul class="submenu">
|
||||
<?php if($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209])): ?>
|
||||
<li><a href="<?=self::getUrl("ConstructionConsentProject")?>"><i class="far fa-fw fa-clipboard-question text-info"></i> Zustimmungserklärungen</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($me->is(["Admin","netowner","salespartner"]) || $me->can("Preorder")): ?>
|
||||
<li><a href="<?=self::getUrl("Preordercampaign")?>"><i class="far fa-fw fa-calendar-lines text-info"></i> Vorbestellung</a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -14,6 +14,8 @@ class ConstructionConsent extends mfBaseModel {
|
||||
private $preorder_count;
|
||||
private $journal;
|
||||
private $history;
|
||||
private $inspection_protocol_planner;
|
||||
private $inspection_protocol_electrician;
|
||||
|
||||
private $footer_text = "Energie Steiermark Breitband GmbH, A-8010 Graz, Leonhardgürtel 10, Telefon +43 (0)316 9000-0\nSitz Graz, FN 576705x, Landesgericht für ZRS Graz, ATU 77949678, breitband@e-steiermark.com, www.e-steiermark.com";
|
||||
private $footer_font = "ITC Officina Sans Std";
|
||||
@@ -184,6 +186,23 @@ class ConstructionConsent extends mfBaseModel {
|
||||
return $this->file;
|
||||
}
|
||||
|
||||
if($name == "inspection_protocol_planner") {
|
||||
if(!$this->id) return [];
|
||||
$file = ConstructionConsentFile::getFirst(["constructionconsent_id" => $this->id, "filename" => "inspection_protocol_planner"]);
|
||||
if($file) {
|
||||
$this->inspection_protocol_planner = $file;
|
||||
}
|
||||
return $this->inspection_protocol_planner;
|
||||
}
|
||||
|
||||
if($name == "inspection_protocol_electrician") {
|
||||
if(!$this->id) return [];
|
||||
$file = ConstructionConsentFile::getFirst(["constructionconsent_id" => $this->id, "filename" => "inspection_protocol_electrician"]);
|
||||
if($file) {
|
||||
$this->inspection_protocol_electrician = $file;
|
||||
}
|
||||
return $this->inspection_protocol_electrician;
|
||||
}
|
||||
|
||||
if($name == "creator") {
|
||||
$this->creator = mfValuecache::singleton()->get("Worker-id-".$this->create_by);
|
||||
|
||||
@@ -314,6 +314,133 @@ class ConstructionConsentController extends mfBaseController {
|
||||
|
||||
}
|
||||
|
||||
protected function saveDate() {
|
||||
$r = $this->request;
|
||||
|
||||
$id = $r->consent_id;
|
||||
if(is_numeric($id) && $id > 0) {
|
||||
$mode = "edit";
|
||||
$item = new ConstructionConsent($id);
|
||||
if(!$item->id) {
|
||||
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
} else {
|
||||
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$data = [];
|
||||
if($r->inspection_date_planner) {
|
||||
$data["inspection_date_planner"] = Layout::dateToInt($r->inspection_date_planner);
|
||||
}
|
||||
if($r->inspection_date_electrician) {
|
||||
$data["inspection_date_electrician"] = Layout::dateToInt($r->inspection_date_electrician);
|
||||
}
|
||||
|
||||
if(count($data)) {
|
||||
$item->update($data);
|
||||
|
||||
if(!$item->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern", "error");
|
||||
return $this->addAction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$this->layout()->setFlash("Zustimmungserklärung erfolgreich gespeichert", "success");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $item->id]);
|
||||
}
|
||||
|
||||
protected function uploadFileAction() {
|
||||
$id = $this->request->consent_id;
|
||||
if(!is_numeric($id) || $id < 1) {
|
||||
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$item = new ConstructionConsent($id);
|
||||
if(!$item || !$item->id) {
|
||||
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$upload_type = $this->request->upload_type;
|
||||
if($upload_type != "planner" && $upload_type != "electrician") {
|
||||
$this->layout()->setFlash("Falscher Dateityp", "error");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $item->id]);
|
||||
}
|
||||
|
||||
if(is_array($_FILES) && array_key_exists("inspection_protocol_file", $_FILES) && !$_FILES['inspection_protocol_file']['error']) {
|
||||
try {
|
||||
// returns File object or throws Exception on error
|
||||
$file = mfUpload::handleFormUpload("inspection_protocol_file", false, TT_CONSTRUCTIONCONSENT_FILE_UPLOAD_SUBFOLDER);
|
||||
} catch (Exception $ex) {
|
||||
$this->layout()->setFlash("Fehler beim Hochladen: " . $ex->getMessage(), "warning");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $item->id]);
|
||||
}
|
||||
|
||||
$history = ConstructionConsentHistory::create([
|
||||
"constructionconsent_id" => $item->id,
|
||||
"key" => "inspection_protocol_$upload_type",
|
||||
"old_value" => ($item->{"inspection_protocol_$upload_type"}) ? $item->{"inspection_protocol_$upload_type"}->file->id : null,
|
||||
"new_value" => $file->id
|
||||
]);
|
||||
|
||||
|
||||
$ccf = ConstructionConsentFile::create([
|
||||
'constructionconsent_id' => $item->id,
|
||||
'file_id' => $file->id,
|
||||
'filename' => "inspection_protocol_$upload_type",
|
||||
]);
|
||||
|
||||
// delete previous image
|
||||
if($item->{"inspection_protocol_$upload_type"}) {
|
||||
$item->{"inspection_protocol_$upload_type"}->file->delete();
|
||||
$item->{"inspection_protocol_$upload_type"}->delete();
|
||||
}
|
||||
|
||||
if (!$ccf->save()) {
|
||||
$this->layout()->setFlash("Fehler beim Speichern des Begehungsprotokolls", "warning");
|
||||
}
|
||||
|
||||
$history->save();
|
||||
|
||||
$this->layout()->setFlash("Begehungsprotokoll erfolgreich hochgeladen", "success");
|
||||
}
|
||||
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $item->id]);
|
||||
}
|
||||
|
||||
protected function deleteFileAction()
|
||||
{
|
||||
$id = $this->request->id;
|
||||
if (!is_numeric($id) || $id < 1) {
|
||||
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$item = new ConstructionConsent($id);
|
||||
if (!$item || !$item->id) {
|
||||
$this->layout()->setFlash("Zustimmungserklärung nicht gefunden", "error");
|
||||
$this->redirect("ConstructionConsent");
|
||||
}
|
||||
|
||||
$file_id = $this->request->file_id;
|
||||
|
||||
$file = ConstructionConsentFile::getFirst(["constructionconsent_id" => $id, "file_id" => $file_id]);
|
||||
if(!$file) {
|
||||
$this->layout()->setFlash("Datei nicht gefunden", "error");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $id]);
|
||||
}
|
||||
|
||||
$file->file->delete();
|
||||
$file->delete();
|
||||
|
||||
$this->layout()->setFlash("Datei gelöscht", "success");
|
||||
$this->redirect("ConstructionConsent", "View", ["id" => $id]);
|
||||
}
|
||||
|
||||
protected function apiAction() {
|
||||
if(!$this->me->is(["Admin","netowner"]) && !$this->me->can("Preorder")) {
|
||||
$this->redirect("Dashboard");
|
||||
@@ -334,6 +461,9 @@ class ConstructionConsentController extends mfBaseController {
|
||||
case "saveRimoPlanPreview":
|
||||
$return = $this->saveRimoPlanPreviewApi();
|
||||
break;
|
||||
case "saveCheckbox":
|
||||
$return = $this->saveCheckboxApi();
|
||||
break;
|
||||
default:
|
||||
$this->log->warn(__METHOD__ . ": Called API function '$do' does not exist");
|
||||
$return = false;
|
||||
@@ -732,22 +862,42 @@ class ConstructionConsentController extends mfBaseController {
|
||||
|
||||
return ["image_mimetype" => $file->mimetype, "image_base64" => base64_encode($image_content), "file_id" => $file->id];
|
||||
|
||||
/*$pf = PreorderFile::create([
|
||||
"preorder_id" => $this->id,
|
||||
"file_id" => $file->id,
|
||||
"filename" => $filename
|
||||
]);
|
||||
|
||||
if(!$pf->save()) {
|
||||
$this->log->error(__METHOD__.": Error saving PreorderFile Object");
|
||||
return false;
|
||||
}*/
|
||||
|
||||
//return $pf;
|
||||
}
|
||||
|
||||
private function saveRimoPlanPreviewApi() {
|
||||
$adb_hausnummer_id = $this->request->building_id;
|
||||
$consent_id = $this->request->constructionconsent_id;
|
||||
}
|
||||
|
||||
private function saveCheckboxApi() {
|
||||
$r = $this->request;
|
||||
$consent_id = $r->id;
|
||||
|
||||
$consent = new ConstructionConsent($consent_id);
|
||||
if(!$consent->id) return false;
|
||||
|
||||
$data = [];
|
||||
if($r->isset("inspection_planner")) {
|
||||
$data["inspection_planner"] = ($r->inspection_planner > 0) ? date("U") : 0;
|
||||
}
|
||||
if($r->isset("inspection_electrician")) {
|
||||
$data["inspection_electrician"] = ($r->inspection_electrician > 0) ? date("U") : 0;
|
||||
}
|
||||
if($r->isset("conduit_installed_building")) {
|
||||
$data["conduit_installed_building"] = ($r->conduit_installed_building > 0) ? date("U") : 0;
|
||||
}
|
||||
if($r->isset("conduit_installed_ftu")) {
|
||||
$data["conduit_installed_ftu"] = ($r->conduit_installed_ftu > 0) ? date("U") : 0;
|
||||
}
|
||||
if($r->isset("inhouse_cabling")) {
|
||||
$data["inhouse_cabling"] = ($r->inhouse_cabling > 0) ? date("U") : 0;
|
||||
}
|
||||
if(count($data)) {
|
||||
$consent->update($data);
|
||||
$consent->save();
|
||||
}
|
||||
|
||||
|
||||
return ["message" => "ConstructionConsent saved successfully"];
|
||||
}
|
||||
}
|
||||
@@ -174,6 +174,13 @@ class ConstructionConsentFile extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists("filename", $filter)) {
|
||||
$filename = $db->escape($filter['filename']);
|
||||
if($filename) {
|
||||
$where .= " AND ConstructionConsentFile.`filename` = '$filename'";
|
||||
}
|
||||
}
|
||||
|
||||
//var_dump($filter, $where);exit;
|
||||
return $where;
|
||||
}
|
||||
|
||||
@@ -77,6 +77,17 @@ class ConstructionConsentHistory extends mfBaseModel {
|
||||
return "Plan/Skizze Upload";
|
||||
case "constructionconsentproject_id":
|
||||
return "Projekt";
|
||||
|
||||
case "inspection_planner":
|
||||
return "Status Begehung mit Planer";
|
||||
case "inspection_electrician";
|
||||
return "Status Begehung mit Elektriker";
|
||||
case "conduit_installed_building":
|
||||
return "Status Leerohr in FTTx Location";
|
||||
case "conduit_installed_ftu":
|
||||
return "Status Leerohr bis HAK";
|
||||
case "inhouse_cabling":
|
||||
return "Status Inhouseverkabelung";
|
||||
}
|
||||
return $key;
|
||||
}
|
||||
@@ -96,6 +107,14 @@ class ConstructionConsentHistory extends mfBaseModel {
|
||||
}
|
||||
}
|
||||
|
||||
if($this->key == "inspection_date_planner" || $this->key == "inspection_date_electrician" && $value) {
|
||||
$value = date("d.m.Y", $value);
|
||||
}
|
||||
|
||||
if(in_array($this->key, ["inspection_planner","inspection_electrician","conduit_installed_building","conduit_installed_ftu","inhouse_cabling"])) {
|
||||
$value = ($value > 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
if(!is_object($value)) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,11 @@ final class ConstructionConsentChangeStatusAndResult extends AbstractMigration
|
||||
$table->addColumn("inhouse_cabling", "integer", ["null" => true, "default" => null, "after" => "conduit_installed_ftu"]);
|
||||
$table->update();
|
||||
|
||||
$this->execute("UPDATE ConstructionConsentOwner SET status=NULL, result=NULL");
|
||||
$cco = $this->table("ConstructionConsentOwner");
|
||||
$cco->changeColumn("status", "enum", ["null" => true, "default" => null, "values" => "new,requested,answered"]);
|
||||
$cco->changeColumn("result", "enum", ["null" => true, "default" => null, "values" => "success,failure"]);
|
||||
|
||||
$this->execute("UPDATE ConstructionConsentOwner SET status=NULL, result=NULL");
|
||||
$cco->changeColumn("status", "enum", ["null" => true, "default" => null, "values" => "new,sent,returned,outstanding"]);
|
||||
$cco->changeColumn("result", "enum", ["null" => true, "default" => null, "values" => "open,accepted,denied,unresolvable"]);
|
||||
$cco->update();
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Phinx\Migration\AbstractMigration;
|
||||
|
||||
final class ConstructionConsentAddDateDone extends AbstractMigration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
$table = $this->table("ConstructionConsent");
|
||||
$table->addColumn("inspection_planner", "integer", ["null" => true, "default" => null, "after" => "inspection_date_planner"]);
|
||||
$table->addColumn("inspection_electrician", "integer", ["null" => true, "default" => null, "after" => "inspection_date_electrician"]);
|
||||
|
||||
$table->update();
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if($this->getEnvironment() == "thetool") {
|
||||
|
||||
}
|
||||
|
||||
if($this->getEnvironment() == "addressdb") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user