added netzgebiet copy button

This commit is contained in:
Luca Haid
2026-01-07 18:08:05 +01:00
parent 9b5144b147
commit e0458ef264
2 changed files with 56 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ const ADBNetzgebiet = {
</td>
<td class="col-actions">
<button class="icon-btn" @click.prevent="openEditModal(item)" title="Bearbeiten"><i class="fa-duotone fa-pen"></i></button>
<button class="icon-btn" @click.prevent="copyNetzgebiet(item)" title="Kopieren"><i class="fa-duotone fa-copy"></i></button>
<button class="icon-btn" @click.prevent="openHistoryModal(item)" title="Verlauf"><i class="fa-duotone fa-clock-rotate-left"></i></button>
</td>
</tr>
@@ -471,6 +472,25 @@ const ADBNetzgebiet = {
window.notify?.('success', `Felder von "${n.name}" kopiert.`);
this.copyFromId = '';
},
async copyNetzgebiet(item) {
if (!confirm(`Wollen Sie das Netzgebiet "${item.netzgebiet.name}" kopieren?`)) return;
this.isSaving = true;
try {
const response = await axios.post(window.TT_CONFIG.COPY_URL, { id: item.netzgebiet.id });
if (response.data.success) {
window.notify?.('success', response.data.message);
await this.fetchNetzgebiete();
} else {
window.notify?.('error', response.data.message || 'Fehler beim Kopieren.');
}
} catch (error) {
console.error('Fehler:', error);
window.notify?.('error', 'Netzwerkfehler beim Kopieren.');
} finally {
this.isSaving = false;
}
},
async saveNetzgebiet() {
if (!this.editItem?.name) return;
this.isSaving = true;