Merge branch 'Workorder/add-tiefbau-flag' into 'master'
added tiefbau flag See merge request fronk/thetool!2051
This commit is contained in:
@@ -247,6 +247,14 @@
|
|||||||
return documentation.journals.filter(j => !j.text.toLowerCase().includes('wurde zugewiesen.'));
|
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 ---
|
// --- METHODS ---
|
||||||
const applyTheme = () => {
|
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) => {
|
const selectFcp = (fcpValue) => {
|
||||||
selectedFcp.value = fcpValue;
|
selectedFcp.value = fcpValue;
|
||||||
isFcpSelectOpen.value = false;
|
isFcpSelectOpen.value = false;
|
||||||
@@ -520,10 +544,11 @@
|
|||||||
checklist, fullscreenViewer, missingTasksPopover, translatedDocs, filteredJournals, installModal, isStandalone,
|
checklist, fullscreenViewer, missingTasksPopover, translatedDocs, filteredJournals, installModal, isStandalone,
|
||||||
selectedFcp, isFcpSelectOpen, fcpOptions, selectedFcpText, fcpSearchTerm, filteredFcpOptions, fcpInputRef,
|
selectedFcp, isFcpSelectOpen, fcpOptions, selectedFcpText, fcpSearchTerm, filteredFcpOptions, fcpInputRef,
|
||||||
isSettingsOpen, theme, showThemePicker,
|
isSettingsOpen, theme, showThemePicker,
|
||||||
savingData, // <-- ADDED
|
savingData,
|
||||||
|
isCivilEngineering, showNormalDocsForCivilEng,
|
||||||
fetchWorkorders, openDetails, closeDetails, getStatusInfo, formatDate, googleMapsLink, startEditInfo, saveAdditionalInfo,
|
fetchWorkorders, openDetails, closeDetails, getStatusInfo, formatDate, googleMapsLink, startEditInfo, saveAdditionalInfo,
|
||||||
handleFileSelect, executeUpload, addJournalEntry, submitProblem, handleCompleteClick, selectFcp, setTheme,
|
handleFileSelect, executeUpload, addJournalEntry, submitProblem, handleCompleteClick, selectFcp, setTheme,
|
||||||
saveWorkorderData // <-- ADDED
|
saveWorkorderData, completeCivilEngineering
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
@@ -673,7 +698,7 @@
|
|||||||
{{ savingData ? 'Speichert...' : 'Daten speichern' }}
|
{{ savingData ? 'Speichert...' : 'Daten speichern' }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="bg-white dark:bg-slate-900 p-4 rounded-lg border border-slate-200 dark:border-slate-800">
|
<div v-if="!isCivilEngineering || showNormalDocsForCivilEng" class="bg-white dark:bg-slate-900 p-4 rounded-lg border border-slate-200 dark:border-slate-800">
|
||||||
<h3 class="font-bold text-slate-700 dark:text-secondary mb-3">Checkliste</h3>
|
<h3 class="font-bold text-slate-700 dark:text-secondary mb-3">Checkliste</h3>
|
||||||
<div v-if="isDetailsLoading" class="space-y-3 animate-pulse">
|
<div v-if="isDetailsLoading" class="space-y-3 animate-pulse">
|
||||||
<div v-for="i in 4" :key="i" class="flex items-center">
|
<div v-for="i in 4" :key="i" class="flex items-center">
|
||||||
@@ -693,7 +718,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bg-white dark:bg-slate-900 p-4 rounded-lg border border-slate-200 dark:border-slate-800">
|
<div v-if="!isCivilEngineering || showNormalDocsForCivilEng" class="bg-white dark:bg-slate-900 p-4 rounded-lg border border-slate-200 dark:border-slate-800">
|
||||||
<h3 class="font-bold text-slate-700 dark:text-secondary mb-2">Dokumentation</h3>
|
<h3 class="font-bold text-slate-700 dark:text-secondary mb-2">Dokumentation</h3>
|
||||||
<label for="file-upload" class="w-full inline-flex items-center justify-center px-4 py-2 border border-dashed border-slate-300 dark:border-slate-700 text-sm font-medium rounded-md text-slate-700 dark:text-slate-200 bg-slate-50 dark:bg-slate-800 hover:bg-slate-100 dark:hover:bg-slate-700 cursor-pointer">
|
<label for="file-upload" class="w-full inline-flex items-center justify-center px-4 py-2 border border-dashed border-slate-300 dark:border-slate-700 text-sm font-medium rounded-md text-slate-700 dark:text-slate-200 bg-slate-50 dark:bg-slate-800 hover:bg-slate-100 dark:hover:bg-slate-700 cursor-pointer">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" /></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12" /></svg>
|
||||||
@@ -718,7 +743,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bg-white dark:bg-slate-900 p-4 rounded-lg border border-slate-200 dark:border-slate-800">
|
<div v-if="!isCivilEngineering || showNormalDocsForCivilEng" class="bg-white dark:bg-slate-900 p-4 rounded-lg border border-slate-200 dark:border-slate-800">
|
||||||
<h3 class="font-bold text-slate-700 dark:text-secondary mb-4">Journal</h3>
|
<h3 class="font-bold text-slate-700 dark:text-secondary mb-4">Journal</h3>
|
||||||
<div v-if="isDetailsLoading" class="animate-pulse">
|
<div v-if="isDetailsLoading" class="animate-pulse">
|
||||||
<div class="flex items-start">
|
<div class="flex items-start">
|
||||||
@@ -748,18 +773,23 @@
|
|||||||
|
|
||||||
<footer class="bg-white dark:bg-slate-900 p-2 border-t border-slate-200 dark:border-slate-800 flex-shrink-0 grid grid-cols-2 gap-2 pt-2 px-2 pb-[calc(0.5rem+env(safe-area-inset-bottom))]">
|
<footer class="bg-white dark:bg-slate-900 p-2 border-t border-slate-200 dark:border-slate-800 flex-shrink-0 grid grid-cols-2 gap-2 pt-2 px-2 pb-[calc(0.5rem+env(safe-area-inset-bottom))]">
|
||||||
<button @click="problemModal.show = true" class="w-full px-4 py-3 bg-red-600 text-white font-bold rounded-md text-center">Problem melden</button>
|
<button @click="problemModal.show = true" class="w-full px-4 py-3 bg-red-600 text-white font-bold rounded-md text-center">Problem melden</button>
|
||||||
<div class="relative">
|
<template v-if="isCivilEngineering">
|
||||||
<button @click="handleCompleteClick" class="w-full px-4 py-3 bg-green-600 text-white font-bold rounded-md text-center disabled:bg-slate-300">Abschließen</button>
|
<button @click="completeCivilEngineering" class="w-full px-4 py-3 bg-green-600 text-white font-bold rounded-md text-center">Tiefbau abschließen</button>
|
||||||
<transition name="fade">
|
</template>
|
||||||
<div v-if="missingTasksPopover.show" class="absolute bottom-full right-0 mb-2 w-72 bg-red-700 text-white text-sm rounded-lg shadow-lg p-3">
|
<template v-else>
|
||||||
<h4 class="font-bold mb-1">Fehlende Punkte:</h4>
|
<div class="relative">
|
||||||
<ul class="list-disc list-inside space-y-1">
|
<button @click="handleCompleteClick" class="w-full px-4 py-3 bg-green-600 text-white font-bold rounded-md text-center disabled:bg-slate-300">Abschließen</button>
|
||||||
<li v-for="task in missingTasksPopover.tasks" :key="task">{{ task }}</li>
|
<transition name="fade">
|
||||||
</ul>
|
<div v-if="missingTasksPopover.show" class="absolute bottom-full right-0 mb-2 w-72 bg-red-700 text-white text-sm rounded-lg shadow-lg p-3">
|
||||||
<div class="absolute bottom-[-5px] right-[calc(6rem-8px)] w-0 h-0 border-x-8 border-x-transparent border-t-8 border-t-red-700"></div>
|
<h4 class="font-bold mb-1">Fehlende Punkte:</h4>
|
||||||
</div>
|
<ul class="list-disc list-inside space-y-1">
|
||||||
</transition>
|
<li v-for="task in missingTasksPopover.tasks" :key="task">{{ task }}</li>
|
||||||
</div>
|
</ul>
|
||||||
|
<div class="absolute bottom-[-5px] right-[calc(6rem-8px)] w-0 h-0 border-x-8 border-x-transparent border-t-8 border-t-red-700"></div>
|
||||||
|
</div>
|
||||||
|
</transition>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ class WorkorderCompanyController extends WorkorderBaseController {
|
|||||||
'requireCableLength' => $tenantConfig->requireCableLength,
|
'requireCableLength' => $tenantConfig->requireCableLength,
|
||||||
'requireCableType' => $tenantConfig->requireCableType,
|
'requireCableType' => $tenantConfig->requireCableType,
|
||||||
'showTechnicalData' => (bool)$tenantConfig->showTechnicalData,
|
'showTechnicalData' => (bool)$tenantConfig->showTechnicalData,
|
||||||
|
'tiefbauSeesNormalDocs' => (bool)$tenantConfig->tiefbauSeesNormalDocs,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($tenantConfig->showTechnicalData) {
|
if ($tenantConfig->showTechnicalData) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class WorkorderTenantConfigModel extends TTCrudBaseModel {
|
|||||||
public int $requireCableLength;
|
public int $requireCableLength;
|
||||||
public int $requireCableType;
|
public int $requireCableType;
|
||||||
public int $showTechnicalData = 0;
|
public int $showTechnicalData = 0;
|
||||||
|
public int $tiefbauSeesNormalDocs = 0;
|
||||||
public int $enableWorkorder;
|
public int $enableWorkorder;
|
||||||
public int $enableWorkorderMph;
|
public int $enableWorkorderMph;
|
||||||
public int $create;
|
public int $create;
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
use Phinx\Migration\AbstractMigration;
|
||||||
|
|
||||||
|
final class AddTiefbauSeesNormalDocs extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
if ($this->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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -91,6 +91,8 @@ Vue.component('workorder-tenant-config', {
|
|||||||
v-model="editableItem.requireCableType" sm/>
|
v-model="editableItem.requireCableType" sm/>
|
||||||
<tt-checkbox label="Technische Daten anzeigen (Patchposition, AHA Blatt)"
|
<tt-checkbox label="Technische Daten anzeigen (Patchposition, AHA Blatt)"
|
||||||
v-model="editableItem.showTechnicalData" sm/>
|
v-model="editableItem.showTechnicalData" sm/>
|
||||||
|
<tt-checkbox label="Tiefbau sieht normale Dokumentationsschritte"
|
||||||
|
v-model="editableItem.tiefbauSeesNormalDocs" sm/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<p>Workorder: <strong>{{ config.enableWorkorder ? 'Aktiviert' : 'Deaktiviert' }}</strong></p>
|
<p>Workorder: <strong>{{ config.enableWorkorder ? 'Aktiviert' : 'Deaktiviert' }}</strong></p>
|
||||||
@@ -100,6 +102,7 @@ Vue.component('workorder-tenant-config', {
|
|||||||
<p>Kabellänge-Doku: <strong>{{ config.requireCableLength ? 'Ja' : 'Nein' }}</strong></p>
|
<p>Kabellänge-Doku: <strong>{{ config.requireCableLength ? 'Ja' : 'Nein' }}</strong></p>
|
||||||
<p>Kabeltyp-Doku: <strong>{{ config.requireCableType ? 'Ja' : 'Nein' }}</strong></p>
|
<p>Kabeltyp-Doku: <strong>{{ config.requireCableType ? 'Ja' : 'Nein' }}</strong></p>
|
||||||
<p>Technische Daten: <strong>{{ config.showTechnicalData ? 'Ja' : 'Nein' }}</strong></p>
|
<p>Technische Daten: <strong>{{ config.showTechnicalData ? 'Ja' : 'Nein' }}</strong></p>
|
||||||
|
<p>Tiefbau sieht Doku: <strong>{{ config.tiefbauSeesNormalDocs ? 'Ja' : 'Nein' }}</strong></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
@@ -337,6 +340,7 @@ Vue.component('workorder-tenant-config', {
|
|||||||
requireCableLength: 0,
|
requireCableLength: 0,
|
||||||
requireCableType: 0,
|
requireCableType: 0,
|
||||||
showTechnicalData: 0,
|
showTechnicalData: 0,
|
||||||
|
tiefbauSeesNormalDocs: 0,
|
||||||
enableWorkorder: 1,
|
enableWorkorder: 1,
|
||||||
enableWorkorderMph: 1
|
enableWorkorderMph: 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user