Vue.component('tt-chip', { props: { checked: { type: Boolean, default: false } }, template: `
` }); Vue.component('Cpeprovisioning', { template: `
Loading...

Daten werden geladen...

Keine Einträge für die aktuellen Filter gefunden.

{{ item.customer }}#{{ item.owner_customer_number }} SPIN: {{ item.spin }}
Netzgebiet: {{ item.network || 'N/A' }}
{{ item.owner_phone }}
Adresse: {{ item.owner_full_address || 'N/A' }}
{{ item.owner_email }}
Router Konfiguration
Versand & Abschluss
Produkt & VLANs

{{ item.product_name }} {{ item.product_code }}

{{ item.access_type }} {{ item.access_type_down }} {{ item.access_type_up }}

Aktionen
Loading...
Lade weitere Einträge...
`, data() { return { window, loading: true, items: [], filteredItems: [], filters: { network_id: '', routerconfig_finished: '0', hide_delayed_finish: '1', owner: '' }, statusOptions: [ { value: '0', text: 'Offen' }, { value: '1', text: 'Abgeschlossen' } ], delayOptions: [ { value: '1', text: 'Nicht anzeigen' }, { value: '0', text: 'Anzeigen' } ], page: 1, pagination: {}, debouncedFetchData: null, extensionId: 'jglijfiddilckddlmbnlojmmlahboffh', showExtensionIdModal: false } }, computed: { networkOptions() { const networks = window.TT_CONFIG.NETWORKS || []; return [{ value: '', text: 'Alle Gebiete' }, ...networks.map(net => ({ value: net.id, text: net.name }))]; }, routerOptions() { return window.TT_CONFIG.ROUTER_OPTIONS || []; } }, created() { this.debouncedFetchData = _.debounce(this.fetchData.bind(this, true), 400); const savedExtensionId = localStorage.getItem('radiusExtensionId'); if (savedExtensionId) { this.extensionId = savedExtensionId; } window.addEventListener('keydown', this.handleKeydown); }, beforeDestroy() { window.removeEventListener('keydown', this.handleKeydown); }, methods: { handleKeydown(e) { if (e.code === 'KeyE' && e.ctrlKey && e.altKey) { e.preventDefault(); this.openExtensionIdModal(); } }, openExtensionIdModal() { this.showExtensionIdModal = true; }, saveExtensionId() { localStorage.setItem('radiusExtensionId', this.extensionId); this.showExtensionIdModal = false; window.notify('success', 'Extension ID gespeichert.'); }, isValidMac(mac) { if (!mac) return false; const macRegex = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/; return macRegex.test(mac); }, async fetchData(isNewSearch = false) { if (isNewSearch) { this.page = 1; this.items = []; this.filteredItems = []; this.pagination = {}; } if (!isNewSearch && this.pagination.total_pages && this.page > this.pagination.total_pages) { return; } this.loading = true; const payload = { pagination: { page: this.page, per_page: 25 }, filters: { ...this.filters }, order: { key: 'order_id', order: 'desc' } }; try { const { data } = await axios.post(window.TT_CONFIG.CPE_PROV_API_GET_URL, payload); const newItems = (data.rows || []).map(item => ({ ...item, isDirty: false, isSaving: false, isCreatingRadius: false, pop_name: item.pop_name || 'N/A', owner_address: `${item.owner_street || ''} ${item.owner_housenumber || ''}, ${item.owner_zip || ''} ${item.owner_city || ''}`, owner_phone: item.owner_phone || '', owner_email: item.owner_email || '', })); if (isNewSearch) { this.items = newItems; } else { this.items.push(...newItems); } this.pagination = data.pagination; this.page++; this.filteredItems = this.items; } catch (error) { console.error("Error fetching CPE data:", error); window.notify('error', 'Fehler beim Laden der Daten.'); } finally { this.loading = false; } }, resetFilters() { this.filters = { network_id: '', routerconfig_finished: '0', hide_delayed_finish: '1', owner: '' }; this.fetchData(true); }, markDirty(item) { this.$set(item, 'isDirty', true); }, checkShipping(item) { if (item.cpe_data.shipping && item.cpe_data.routertype) { const shippingData = this.window.TT_CONFIG.ROUTER_SHIPPING_DATA[item.cpe_data.routertype]; if (shippingData) { item.cpe_data.ship_weight = shippingData.weight; item.cpe_data.ship_length = shippingData.length; item.cpe_data.ship_width = shippingData.width; item.cpe_data.ship_height = shippingData.height; item.cpe_data = { ...item.cpe_data }; // Trigger reactivity this.window.notify('success', 'Versanddaten wurden automatisch ausgefüllt.'); } } else if (!item.cpe_data.shipping) { item.cpe_data.ship_weight = ''; item.cpe_data.ship_length = ''; item.cpe_data.ship_width = ''; item.cpe_data.ship_height = ''; item.cpe_data = { ...item.cpe_data }; // Trigger reactivity } }, isVlanSelected(item) { return item.vlans && Object.values(item.vlans).some(v => v.checked); }, async createRadiusUser(item) { // Disable button during request this.$set(item, 'isCreatingRadius', true); try { const { data } = await axios.post(window.TT_CONFIG.CPE_PROV_API_CREATE_RADIUS_USER_URL, { mac: item.cpe_data.mac }); if (data.success) { window.notify('success', `RADIUS User erfolgreich angelegt! Kundennr: ${data.data.customer_number}`); console.log('RADIUS User created:', data.data); } else { window.notify('error', data.message || 'Fehler beim Anlegen des RADIUS Users.'); } } catch (error) { const errorMsg = error.response?.data?.message || 'Ein unerwarteter Fehler ist aufgetreten.'; window.notify('error', errorMsg); console.error('Error creating RADIUS user:', error); } finally { this.$set(item, 'isCreatingRadius', false); } }, async testAcsVlan(item) { const button = this.$el.querySelector(`[data-orderproduct-id="${item.orderproduct_id}"] .btn-info`); if (button) { button.disabled = true; } try { const { data } = await axios.post(window.TT_CONFIG.CPE_PROV_API_TEST_ACS_VLAN_URL, { mac: item.cpe_data.mac }); if (data.success) { window.notify('success', `ACS VLAN Zuweisung erfolgreich: VLAN ${data.vlan_id}`); } else { window.notify('error', data.message || 'Fehler bei der ACS VLAN Zuweisung.'); } } catch (error) { window.notify('error', 'Ein unerwarteter Fehler ist aufgetreten.'); } finally { if (button) { button.disabled = false; } } }, _buildSavePayload(item) { return { id: item.cpe_id, order_id: item.order_id, orderproduct_id: item.orderproduct_id, termination_id: item.termination_id, ont_sn: item.ont_sn, vlans: item.vlans, ...item.cpe_data, shipping: item.cpe_data.shipping ? 1 : 0, routerconfig_finished: item.cpe_data.routerconfig_finished ? 1 : 0, }; }, async saveCpe(item) { this.$set(item, 'isSaving', true); const payload = this._buildSavePayload(item); try { const { data } = await axios.post(this.window.TT_CONFIG.CPE_PROV_API_SAVE_URL, payload); if (data.success) { this.window.notify('success', data.message); if (this.filters.routerconfig_finished === '0' && payload.routerconfig_finished) { this.items = this.items.filter(i => i.orderproduct_id !== item.orderproduct_id); this.filteredItems = this.items; } else { const index = this.items.findIndex(i => i.orderproduct_id === item.orderproduct_id); if (index !== -1) { this.$set(this.items[index], 'isDirty', false); } } } else { this.window.notify('error', data.message || 'Fehler beim Speichern.'); } } catch (error) { this.window.notify('error', 'Ein unerwarteter Fehler ist aufgetreten.'); } finally { this.$set(item, 'isSaving', false); } } }, mounted() { this.fetchData(true); window.addEventListener('keydown', this.handleKeydown); } });