added contact edit button

This commit is contained in:
Luca Haid
2025-03-25 10:38:20 +01:00
parent 7be3446383
commit 321726718f
11 changed files with 157 additions and 50 deletions
@@ -11,7 +11,11 @@ class ConstructionConsentOwnerController extends mfBaseController
$this->me = $me;
$this->layout()->set("me", $me);
if (!($me->is(["Admin","netowner","salespartner"]) && in_array($me->address_id, [1,209,5908,2187]))) $this->redirect("Dashboard");
if ($this->me->is("Admin")) $this->constructionConsentProjects = array_column(ConstructionConsentProject::getAll(), 'id');
else {
$constructionConsentProjects = json_decode((new WorkerFlag($this->me->id, "constructionConsent_projects"))->value() ?? '[]');
empty($constructionConsentProjects) ? $this->redirect("Dashboard") : $this->constructionConsentProjects = $constructionConsentProjects;
}
}
protected function uploadDocumentAction() {
@@ -76,6 +80,11 @@ class ConstructionConsentOwnerController extends mfBaseController
$this->redirect("ConstructionConsent");
}
if (!in_array($cc->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Sie sind nicht berechtigt, diese Zustimmungserklärung zu bearbeiten", "error");
$this->redirect("ConstructionConsent");
}
$data = [];
$data["constructionconsent_id"] = $cc_id;
$data["title"] = $r->title;
@@ -128,6 +137,11 @@ class ConstructionConsentOwnerController extends mfBaseController
$consent = $owner->consent;
if (!in_array($consent->constructionconsentproject_id, $this->constructionConsentProjects)) {
$this->layout()->setFlash("Sie sind nicht berechtigt, diese Zustimmungserklärung zu bearbeiten", "error");
$this->redirect("ConstructionConsent");
}
foreach($owner->files as $file) {
$file->file->delete();
$file->delete();