added new rml stuff
This commit is contained in:
@@ -183,7 +183,7 @@ Vue.component('workorder-details-manager', {
|
||||
:disabled="!canComplete || isReadOnly" :loading="completing"
|
||||
additional-class="btn-success w-100" icon="fas fa-check-double"/>
|
||||
<small v-if="!canComplete && !isReadOnly" class="form-text text-muted text-center mt-2">
|
||||
Bitte laden Sie alle benötigten Dokumente hoch, um den Auftrag abzuschließen.
|
||||
Bitte laden Sie alle benötigten Dokumente hoch und füllen Sie alle Zusatzdaten (z.B. Kabellänge/-typ) aus, um den Auftrag abzuschließen.
|
||||
</small>
|
||||
<div v-if="isReadOnly" class="alert alert-secondary text-center mt-2 p-2">
|
||||
Auftrag bereits abgeschlossen oder storniert. Keine Aktionen mehr möglich.
|
||||
@@ -245,6 +245,35 @@ Vue.component('workorder-details-manager', {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="(requireCableLength || requireCableType)" class="card mb-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Zusatzdaten</h5>
|
||||
<p class="small text-muted">Diese Daten werden für den Abschluss benötigt.</p>
|
||||
<tt-input
|
||||
v-if="requireCableLength"
|
||||
label="Kabellänge (m)"
|
||||
v-model="workorder.cableLength"
|
||||
:disabled="isReadOnly"
|
||||
sm row
|
||||
/>
|
||||
<tt-input
|
||||
v-if="requireCableType"
|
||||
label="Kabeltyp"
|
||||
v-model="workorder.cableType"
|
||||
:disabled="isReadOnly"
|
||||
sm row
|
||||
/>
|
||||
<tt-button
|
||||
text="Daten speichern"
|
||||
@click="saveWorkorderData"
|
||||
:loading="savingData"
|
||||
:disabled="isReadOnly || savingData"
|
||||
additional-class="btn-info float-right"
|
||||
icon="fas fa-save"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mb-3" v-if="isAdmin && selectedDocs.length > 0">
|
||||
<div class="card-header bg-warning"><h5><i class="fas fa-exclamation-triangle mr-2"></i>Korrektur anfordern</h5></div>
|
||||
<div class="card-body">
|
||||
@@ -296,6 +325,9 @@ Vue.component('workorder-details-manager', {
|
||||
uploadData: { files: [], documentType: 'photo_hup_mounted', description: '' },
|
||||
interventionData: null,
|
||||
interventionTypes: [],
|
||||
requireCableLength: false,
|
||||
requireCableType: false,
|
||||
savingData: false,
|
||||
// Admin state
|
||||
selectedDocs: [], correctionText: '', correctionLoading: false, showAcceptModal: false, showRevertModal: false,
|
||||
}),
|
||||
@@ -305,7 +337,19 @@ Vue.component('workorder-details-manager', {
|
||||
return this.tenantDocTypes ?? [];
|
||||
},
|
||||
allDocTypes() { return [...this.requiredDocTypes, {value: 'other', text: 'Sonstiges Dokument (optional)'}]; },
|
||||
canComplete() { return this.requiredDocTypes.every(docType => this.isUploaded(docType.value)); },
|
||||
canComplete() {
|
||||
const docsUploaded = this.requiredDocTypes.every(docType => this.isUploaded(docType.value));
|
||||
if (!docsUploaded) return false;
|
||||
|
||||
if (this.requireCableLength && (!this.workorder.cableLength || !this.workorder.cableLength.trim())) {
|
||||
return false;
|
||||
}
|
||||
if (this.requireCableType && (!this.workorder.cableType || !this.workorder.cableType.trim())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // All checks passed
|
||||
},
|
||||
docsWithStatus() {
|
||||
if (!this.journals?.length) return this.docs;
|
||||
const correctionJournal = [...this.journals].sort((a, b) => b.create - a.create).find(j => j.statusChange?.includes('correction_requested'));
|
||||
@@ -348,6 +392,8 @@ Vue.component('workorder-details-manager', {
|
||||
if (data.success) {
|
||||
this.tenantDocTypes = data.documentationTypes;
|
||||
this.interventionTypes = data.interventionTypes;
|
||||
this.requireCableLength = data.requireCableLength || false;
|
||||
this.requireCableType = data.requireCableType || false;
|
||||
}
|
||||
} catch (e) { console.error("Mandantenkonfiguration nicht geladen", e); }
|
||||
finally { this.loadingConfig = false; }
|
||||
@@ -404,6 +450,28 @@ Vue.component('workorder-details-manager', {
|
||||
} else window.notify('error', data.message);
|
||||
} catch (e) { window.notify('error', 'Netzwerkfehler'); }
|
||||
},
|
||||
async saveWorkorderData() {
|
||||
this.savingData = true;
|
||||
try {
|
||||
const { data } = await axios.post(`${window.TT_CONFIG.BASE_PATH}/WorkorderCompany/updateWorkorderData`, {
|
||||
workorderId: this.workorderId,
|
||||
cableLength: this.workorder.cableLength,
|
||||
cableType: this.workorder.cableType
|
||||
});
|
||||
if (data.success) {
|
||||
window.notify('success', data.message);
|
||||
if (data.journals) {
|
||||
this.journals = data.journals; // Update journal with new entry
|
||||
}
|
||||
} else {
|
||||
window.notify('error', data.message || 'Speichern fehlgeschlagen.');
|
||||
}
|
||||
} catch (e) {
|
||||
window.notify('error', 'Ein Netzwerkfehler ist aufgetreten.');
|
||||
} finally {
|
||||
this.savingData = false;
|
||||
}
|
||||
},
|
||||
openInterventionModal() {
|
||||
this.interventionData = { types: [], details: { stuck: {}, stuck_fcp: {}, stuck_hup: {}, other: {} } };
|
||||
},
|
||||
@@ -489,4 +557,4 @@ Vue.component('workorder-details-manager', {
|
||||
await this.loadTenantConfig();
|
||||
await this.fetchData();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -77,9 +77,19 @@ Vue.component('workorder-tenant-config', {
|
||||
<div class="row mt-3">
|
||||
<div class="col-md-6">
|
||||
<h6 class="mb-3">Optionen</h6>
|
||||
<tt-checkbox label="Dokumentation für Tiefbau erforderlich"
|
||||
v-model="editableItem.civilEngineeringDocsRequired" sm v-if="editingId === config.id"/>
|
||||
<p v-else>Tiefbau-Doku: {{ config.civilEngineeringDocsRequired ? 'Ja' : 'Nein' }}</p>
|
||||
<div v-if="editingId === config.id">
|
||||
<tt-checkbox label="Dokumentation für Tiefbau erforderlich"
|
||||
v-model="editableItem.civilEngineeringDocsRequired" sm/>
|
||||
<tt-checkbox label="Kabellänge erforderlich"
|
||||
v-model="editableItem.requireCableLength" sm/>
|
||||
<tt-checkbox label="Kabeltyp erforderlich"
|
||||
v-model="editableItem.requireCableType" sm/>
|
||||
</div>
|
||||
<div v-else>
|
||||
<p>Tiefbau-Doku: <strong>{{ config.civilEngineeringDocsRequired ? '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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h6>Zugeordnete Firmen</h6>
|
||||
@@ -312,7 +322,9 @@ Vue.component('workorder-tenant-config', {
|
||||
interventionTypes: [],
|
||||
workorderCreationFilters: '{}',
|
||||
workorderActiveFilters: '{}',
|
||||
civilEngineeringDocsRequired: 0
|
||||
civilEngineeringDocsRequired: 0,
|
||||
requireCableLength: 0,
|
||||
requireCableType: 0
|
||||
}
|
||||
: {visibleForAddressId: []};
|
||||
this.showModal = true;
|
||||
|
||||
Reference in New Issue
Block a user