added tiefbau flag
This commit is contained in:
@@ -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' }}
|
||||
</button>
|
||||
</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>
|
||||
<div v-if="isDetailsLoading" class="space-y-3 animate-pulse">
|
||||
<div v-for="i in 4" :key="i" class="flex items-center">
|
||||
@@ -693,7 +718,7 @@
|
||||
</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>
|
||||
<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>
|
||||
@@ -718,7 +743,7 @@
|
||||
</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>
|
||||
<div v-if="isDetailsLoading" class="animate-pulse">
|
||||
<div class="flex items-start">
|
||||
@@ -748,6 +773,10 @@
|
||||
|
||||
<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>
|
||||
<template v-if="isCivilEngineering">
|
||||
<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>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="relative">
|
||||
<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>
|
||||
<transition name="fade">
|
||||
@@ -760,6 +789,7 @@
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
</footer>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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/>
|
||||
<tt-checkbox label="Technische Daten anzeigen (Patchposition, AHA Blatt)"
|
||||
v-model="editableItem.showTechnicalData" sm/>
|
||||
<tt-checkbox label="Tiefbau sieht normale Dokumentationsschritte"
|
||||
v-model="editableItem.tiefbauSeesNormalDocs" sm/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<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>Kabeltyp-Doku: <strong>{{ config.requireCableType ? '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 class="col-md-6">
|
||||
@@ -337,6 +340,7 @@ Vue.component('workorder-tenant-config', {
|
||||
requireCableLength: 0,
|
||||
requireCableType: 0,
|
||||
showTechnicalData: 0,
|
||||
tiefbauSeesNormalDocs: 0,
|
||||
enableWorkorder: 1,
|
||||
enableWorkorderMph: 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user