From 60e3c7b765da6475660a1d43f8bc27501e69e8ca Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Tue, 27 Jan 2026 11:20:25 +0100 Subject: [PATCH] added tiefbau flag --- .../default/VueViews/WorkorderCompanyPWA.php | 64 ++++++++++++++----- .../WorkorderCompanyController.php | 1 + .../WorkorderTenantConfigModel.php | 1 + ...127120000_add_tiefbau_sees_normal_docs.php | 32 ++++++++++ .../WorkorderTenantConfig.js | 4 ++ 5 files changed, 85 insertions(+), 17 deletions(-) create mode 100644 db/migrations/20260127120000_add_tiefbau_sees_normal_docs.php diff --git a/Layout/default/VueViews/WorkorderCompanyPWA.php b/Layout/default/VueViews/WorkorderCompanyPWA.php index 37634e7dd..a6c1c3fe1 100644 --- a/Layout/default/VueViews/WorkorderCompanyPWA.php +++ b/Layout/default/VueViews/WorkorderCompanyPWA.php @@ -247,6 +247,14 @@ return documentation.journals.filter(j => !j.text.toLowerCase().includes('wurde zugewiesen.')); }); + const isCivilEngineering = computed(() => { + return selectedWorkorder.value?.status === 'civil_engineering_required'; + }); + + const showNormalDocsForCivilEng = computed(() => { + return isCivilEngineering.value && tenantConfig.value?.tiefbauSeesNormalDocs; + }); + // --- METHODS --- const applyTheme = () => { @@ -485,6 +493,22 @@ } }; + const completeCivilEngineering = async () => { + if (!confirm("Möchten Sie den Tiefbau wirklich abschließen?")) return; + try { + const response = await api.post('/completeCivilEngineering', { workorderId: selectedWorkorder.value.id }); + if (response.data.success) { + await fetchWorkorders(); + closeDetails(); + } else { + alert(response.data.message); + } + } catch(e) { + console.error("Failed to complete civil engineering", e); + alert(e.response?.data?.message || 'Fehler beim Abschließen des Tiefbaus.'); + } + }; + const selectFcp = (fcpValue) => { selectedFcp.value = fcpValue; isFcpSelectOpen.value = false; @@ -520,10 +544,11 @@ checklist, fullscreenViewer, missingTasksPopover, translatedDocs, filteredJournals, installModal, isStandalone, selectedFcp, isFcpSelectOpen, fcpOptions, selectedFcpText, fcpSearchTerm, filteredFcpOptions, fcpInputRef, isSettingsOpen, theme, showThemePicker, - savingData, // <-- ADDED + savingData, + isCivilEngineering, showNormalDocsForCivilEng, fetchWorkorders, openDetails, closeDetails, getStatusInfo, formatDate, googleMapsLink, startEditInfo, saveAdditionalInfo, handleFileSelect, executeUpload, addJournalEntry, submitProblem, handleCompleteClick, selectFcp, setTheme, - saveWorkorderData // <-- ADDED + saveWorkorderData, completeCivilEngineering }; }, template: ` @@ -673,7 +698,7 @@ {{ savingData ? 'Speichert...' : 'Daten speichern' }} -
+

Checkliste

@@ -693,7 +718,7 @@
-
+

Dokumentation

-
+

Journal

@@ -748,18 +773,23 @@
-
- - -
-

Fehlende Punkte:

-
    -
  • {{ task }}
  • -
- -
-
-
+ +
diff --git a/application/WorkorderCompany/WorkorderCompanyController.php b/application/WorkorderCompany/WorkorderCompanyController.php index 553465c3a..fd6f93d53 100644 --- a/application/WorkorderCompany/WorkorderCompanyController.php +++ b/application/WorkorderCompany/WorkorderCompanyController.php @@ -193,6 +193,7 @@ class WorkorderCompanyController extends WorkorderBaseController { 'requireCableLength' => $tenantConfig->requireCableLength, 'requireCableType' => $tenantConfig->requireCableType, 'showTechnicalData' => (bool)$tenantConfig->showTechnicalData, + 'tiefbauSeesNormalDocs' => (bool)$tenantConfig->tiefbauSeesNormalDocs, ]; if ($tenantConfig->showTechnicalData) { diff --git a/application/WorkorderTenantConfig/WorkorderTenantConfigModel.php b/application/WorkorderTenantConfig/WorkorderTenantConfigModel.php index ec380a89a..3386d18dc 100644 --- a/application/WorkorderTenantConfig/WorkorderTenantConfigModel.php +++ b/application/WorkorderTenantConfig/WorkorderTenantConfigModel.php @@ -13,6 +13,7 @@ class WorkorderTenantConfigModel extends TTCrudBaseModel { public int $requireCableLength; public int $requireCableType; public int $showTechnicalData = 0; + public int $tiefbauSeesNormalDocs = 0; public int $enableWorkorder; public int $enableWorkorderMph; public int $create; diff --git a/db/migrations/20260127120000_add_tiefbau_sees_normal_docs.php b/db/migrations/20260127120000_add_tiefbau_sees_normal_docs.php new file mode 100644 index 000000000..c896f981a --- /dev/null +++ b/db/migrations/20260127120000_add_tiefbau_sees_normal_docs.php @@ -0,0 +1,32 @@ +getEnvironment() == "thetool") { + $table = $this->table('WorkorderTenantConfig'); + + $table->addColumn('tiefbauSeesNormalDocs', 'boolean', [ + 'default' => false, + 'null' => false, + 'after' => 'showTechnicalData', + 'comment' => 'Allow civil engineering status to see and use normal documentation steps' + ]); + + $table->update(); + } + } + + public function down(): void + { + if ($this->getEnvironment() == "thetool") { + $this->table('WorkorderTenantConfig') + ->removeColumn('tiefbauSeesNormalDocs') + ->save(); + } + } +} diff --git a/public/js/pages/WorkorderTenantConfig/WorkorderTenantConfig.js b/public/js/pages/WorkorderTenantConfig/WorkorderTenantConfig.js index d2a1b36a4..4eaba32cb 100644 --- a/public/js/pages/WorkorderTenantConfig/WorkorderTenantConfig.js +++ b/public/js/pages/WorkorderTenantConfig/WorkorderTenantConfig.js @@ -91,6 +91,8 @@ Vue.component('workorder-tenant-config', { v-model="editableItem.requireCableType" sm/> +

Workorder: {{ config.enableWorkorder ? 'Aktiviert' : 'Deaktiviert' }}

@@ -100,6 +102,7 @@ Vue.component('workorder-tenant-config', {

Kabellänge-Doku: {{ config.requireCableLength ? 'Ja' : 'Nein' }}

Kabeltyp-Doku: {{ config.requireCableType ? 'Ja' : 'Nein' }}

Technische Daten: {{ config.showTechnicalData ? 'Ja' : 'Nein' }}

+

Tiefbau sieht Doku: {{ config.tiefbauSeesNormalDocs ? 'Ja' : 'Nein' }}

@@ -337,6 +340,7 @@ Vue.component('workorder-tenant-config', { requireCableLength: 0, requireCableType: 0, showTechnicalData: 0, + tiefbauSeesNormalDocs: 0, enableWorkorder: 1, enableWorkorderMph: 1 }