Vue.component('construction-consent-faulty-entries', { //language=Vue template: `
`, data() { return { window: window, selectedProject: window['TT_CONFIG']['SELECTED_PROJECT'] || '', FaultyEntriesTableConfig: { key: 'FaultyEntriesTable', tableHeader: 'Fehlerhafte Eigentümer-Einträge', defaultPageSize: 20, headers: [ {text: 'Projekt', key: 'project_name', sortable: true, class: 'text-nowrap', priority: 10}, {text: 'Objekt', key: 'building_info', sortable: true, sortKey: 'building_name', class: 'text-nowrap', priority: 9}, {text: 'Eigentümer', key: 'owner_info', sortable: true, sortKey: 'lastname', class: '', priority: 8}, {text: 'Adresse', key: 'address_info', sortable: true, sortKey: 'city', class: '', priority: 7}, {text: 'Kontakt', key: 'contact_info', sortable: false, class: '', priority: 6}, {text: 'Status', key: 'status', sortable: true, class: 'text-center', priority: 5, filter: 'select', filterOptions: [ {text: 'Neu', value: 'new'}, {text: 'Gesendet', value: 'sent'}, {text: 'Zurückgekehrt', value: 'returned'}, {text: 'Ausstehend', value: 'outstanding'}, ]}, {text: 'Fehler', key: 'errors', sortable: false, class: '', priority: 4}, {text: 'Aktionen', key: 'actions', sortable: false, class: 'text-center', filter: false, priority: 3}, ], }, } }, methods: { formatDate(timestamp) { if (!timestamp) return 'N/A'; return this.window.moment.unix(timestamp).format('DD.MM.YYYY HH:mm:ss'); }, formatObjectType(type) { const types = { 'building': 'Gebäude', 'street': 'Straße' }; return types[type] || type; }, formatStatus(status) { const statuses = { 'new': 'Neu', 'sent': 'Gesendet', 'returned': 'Zurückgekehrt', 'outstanding': 'Ausstehend' }; return statuses[status] || status; }, formatResult(result) { const results = { 'open': 'Offen', 'accepted': 'Akzeptiert', 'denied': 'Abgelehnt', 'unresolvable': 'Nicht lösbar', 'moved': 'Umgezogen' }; return results[result] || result; }, formatErrorType(error) { const errors = { 'company': 'Fehlende Firma', 'firstname': 'Fehlender Vorname', 'lastname': 'Fehlender Nachname', 'city': 'Fehlende Stadt', 'zip': 'Ungültige PLZ', 'street': 'Ungültige Straße', 'country': 'Ungültiges Land (enthält Zahlen)' }; return errors[error] || error; }, getStatusBadgeClass(status) { const classes = { 'new': 'badge badge-secondary', 'sent': 'badge badge-primary', 'returned': 'badge badge-success', 'outstanding': 'badge badge-warning' }; return classes[status] || 'badge badge-secondary'; }, getResultBadgeClass(result) { const classes = { 'open': 'badge badge-info', 'accepted': 'badge badge-success', 'denied': 'badge badge-danger', 'unresolvable': 'badge badge-dark', 'moved': 'badge badge-warning' }; return classes[result] || 'badge badge-secondary'; }, isAustria(row) { const country = (row.country || '').toLowerCase(); return country === 'österreich' || country === 'austria' || country === ''; }, isGermany(row) { const country = (row.country || '').toLowerCase(); return country === 'deutschland' || country === 'germany'; }, filterByProject() { // Redirect to same page with project filter window.location.href = this.window['TT_CONFIG']['BASE_URL'] + '/ConstructionConsent/faultyEntries' + (this.selectedProject ? '?project_id=' + this.selectedProject : ''); }, refreshData() { // Reload the current page window.location.reload(); } } })