Merge branch 'Preorder/add-filter-template' into 'master'

added possibility to remove appointment

See merge request fronk/thetool!2043
This commit is contained in:
Luca Haid
2026-01-22 06:24:47 +00:00
2 changed files with 30 additions and 0 deletions

View File

@@ -121,6 +121,23 @@ class WorkorderCompanyController extends WorkorderBaseController {
self::returnJson(['success' => true, 'message' => 'Termin erfolgreich verschoben.']);
}
protected function clearAppointmentAction() {
if (empty($this->postData['workorderId'])) self::sendError("Arbeitsauftrags-ID fehlt.");
$workorder = WorkorderModel::get($this->postData['workorderId']);
if (!$workorder) self::sendError("Arbeitsauftrag nicht gefunden.");
$oldDateFormatted = $workorder->appointmentDate ? date('d.m.Y H:i', $workorder->appointmentDate) : 'N/A';
$workorder->appointmentDate = null;
$workorder->status = 'assigned';
WorkorderModel::update((array)$workorder);
WorkorderJournalModel::create([
'workorderId' => $workorder->id, 'text' => "Termin gelöscht (war: {$oldDateFormatted}).",
'create' => time(), 'createBy' => $this->user->id,
]);
self::returnJson(['success' => true, 'message' => 'Termin erfolgreich gelöscht.']);
}
protected function requestInterventionAction() {
if (empty($this->postData['workorderId']) || empty($this->postData['journalText'])) self::sendError("Erforderliche Felder fehlen.");
$workorder = WorkorderModel::get($this->postData['workorderId']);

View File

@@ -65,6 +65,9 @@ Vue.component('workorder-company', {
<tt-button v-if="!['completed', 'cancelled', 'documented'].includes(row.status)"
icon="fas fa-edit" @click="openRescheduleModal(row)"
additional-class="btn-link btn-sm p-0 ml-2" title="Termin ändern"/>
<tt-button v-if="!['completed', 'cancelled', 'documented'].includes(row.status)"
icon="fas fa-times" @click="clearAppointment(row)"
additional-class="btn-link btn-sm p-0 ml-1 text-danger" title="Termin löschen"/>
</div>
<span v-else></span>
</template>
@@ -157,6 +160,16 @@ Vue.component('workorder-company', {
this.rescheduleModalData = null;
} else window.notify('error', data.message || 'Ein Fehler ist aufgetreten.');
},
async clearAppointment(workorder) {
if (!confirm('Möchten Sie den Termin wirklich löschen?')) return;
const {data} = await axios.post(`${window.TT_CONFIG.BASE_PATH}/WorkorderCompany/clearAppointment`, {
workorderId: workorder.id
});
if (data.success) {
window.notify('success', data.message);
this.$refs.table.$refs.table.refreshTable();
} else window.notify('error', data.message || 'Ein Fehler ist aufgetreten.');
},
startAdditionalInfoEdit(row) {
this.editingAdditionalInfoId = row.id;
this.tempAdditionalInfo = row.additionalInfo || '';