Update WorkorderBase.js

This commit is contained in:
Luca Haid
2025-09-02 11:27:54 +00:00
parent 461c4bf3fc
commit a8e9ec9145

View File

@@ -287,21 +287,15 @@ Vue.component('workorder-details-manager', {
// Company state
uploading: false, completing: false, showCompleteModal: false,
uploadData: { files: [], documentType: 'photo_hup_mounted', description: '' },
interventionData: null, interventionTypes: [
{value: 'stuck', text: 'Ab X Laufmeter stecken geblieben'},
{value: 'stuck_fcp', text: 'Vom FCP nach HÜP nach X Laufmetern stecken geblieben'},
{value: 'stuck_hup', text: 'Vom HÜP nach FCP nach X Laufmetern stecken geblieben'},
{value: 'no_air', text: 'Keine Luftverbindung'}, {value: 'other', text: 'Sonstiges'}
],
interventionData: null,
interventionTypes: [],
// Admin state
selectedDocs: [], correctionText: '', correctionLoading: false, showAcceptModal: false,
}),
computed: {
isReadOnly() { return ['documented', 'completed', 'cancelled'].includes(this.workorder?.status); },
requiredDocTypes() {
if (this.tenantDocTypes) return this.tenantDocTypes;
// Default list as a fallback
return [{value: 'photo_hup_mounted', text: 'Foto vom montierten HÜP'}, {value: 'photo_hup_open', text: 'Foto von dem offenen HÜP'}, {value: 'photo_splice_cassette_hup', text: 'Foto der Spleißkassette HÜP'}, {value: 'photo_splice_cassette_fcp', text: 'Foto der Spleißkassette - FCP'}, {value: 'photo_hup_closed_stickers', text: 'Foto vom geschlossenen HÜP mit allen Aufklebern'}, {value: 'photo_fcp_labeled', text: 'Foto vom FCP beschriftet'}, {value: 'photo_patch_position_osp', text: 'Foto der Patch-Position - OSP-Seite'}, {value: 'photo_patch_position_anb', text: 'Foto der Patch-Position - ANB-Seite'}, {value: 'measurement_protocol_otdr', text: 'ODTR Messung (1310nm & 1550nm)'}];
return this.tenantDocTypes ?? [];
},
allDocTypes() { return [...this.requiredDocTypes, {value: 'other', text: 'Sonstiges Dokument (optional)'}]; },
canComplete() { return this.requiredDocTypes.every(docType => this.isUploaded(docType.value)); },
@@ -318,7 +312,6 @@ Vue.component('workorder-details-manager', {
},
methods: {
formatDate(timestamp) { return timestamp ? window.moment.unix(timestamp).format('DD.MM.YYYY HH:mm') : ''; },
// FIX: Added a guard to prevent calling .some() on an undefined value
isUploaded(docType) {
return Array.isArray(this.docs) && this.docs.some(doc => doc.documentType === docType);
},
@@ -345,7 +338,10 @@ Vue.component('workorder-details-manager', {
this.loadingConfig = true;
try {
const {data} = await axios.get(`${window.TT_CONFIG.BASE_PATH}/WorkorderCompany/getTenantConfig`, {params: {workorderId: this.workorderId}});
if (data.success) this.tenantDocTypes = data.documentationTypes;
if (data.success) {
this.tenantDocTypes = data.documentationTypes;
this.interventionTypes = data.interventionTypes;
}
} catch (e) { console.error("Mandantenkonfiguration nicht geladen", e); }
finally { this.loadingConfig = false; }
},
@@ -468,4 +464,4 @@ Vue.component('workorder-details-manager', {
await this.loadTenantConfig();
await this.fetchData();
}
});
});