// Cpeprovisioning.js Vue.component('tt-chip', { props: { checked: { type: Boolean, default: false } }, template: `
` }); Vue.component('Cpeprovisioning', { template: `
`, data() { return { window, 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' } ], tableConfig: { key: 'cpeProvisioning', tableHeader: 'CPE Provisioning', expandCondition: () => true, customRowClass: row => (row.isDirty ? 'is-dirty' : ''), headers: [ { key: 'customer', text: 'Kunde', sortable: false, filter: false, priority: 100 }, { key: 'product', text: 'Produkt', sortable: false, filter: false, priority: 90 }, { key: 'vlans', text: 'VLANs', sortable: false, filter: false, priority: 80 }, ] } } }, 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 || []; } }, methods: { applyFilters(fetch = true) { const table = this.$refs.cpeTable; if (table) { table.filters = JSON.parse(JSON.stringify(this.filters)); if (fetch) table.fetchData(1); } }, resetFilters() { this.filters = { network_id: '', routerconfig_finished: '0', hide_delayed_finish: '1', owner: '' }; this.applyFilters(); }, markDirty(row, field) { console.log(`Marking row as dirty for field ${field}`); this.$set(row, 'isDirty', true); }, async checkShipping (row) { await this.$nextTick(); if (row.cpe_data.shipping && row.cpe_data.routertype) { const shippingData = this.window.TT_CONFIG.ROUTER_SHIPPING_DATA[row.cpe_data.routertype]; if (shippingData) { if (!row.cpe_data.ship_weight) row.cpe_data.ship_weight = shippingData.weight; if (!row.cpe_data.ship_length) row.cpe_data.ship_length = shippingData.length; if (!row.cpe_data.ship_width) row.cpe_data.ship_width = shippingData.width; if (!row.cpe_data.ship_height) row.cpe_data.ship_height = shippingData.height; } } else { row.cpe_data.ship_weight = ''; row.cpe_data.ship_length = ''; row.cpe_data.ship_width = ''; row.cpe_data.ship_height = ''; } }, async saveCpe(row) { this.$set(row, 'isSaving', true); const payload = { id: row.cpe_id, order_id: row.order_id, orderproduct_id: row.orderproduct_id, termination_id: row.termination_id, ont_sn: row.ont_sn, vlans: row.vlans, ...row.cpe_data, shipping: row.cpe_data.shipping ? 1 : 0, routerconfig_finished: row.cpe_data.routerconfig_finished ? 1 : 0, }; 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); this.$set(row, 'isDirty', false); this.$refs.cpeTable.refreshTable(); } else { this.window.notify('error', data.message || 'Fehler beim Speichern.'); } } catch (error) { this.window.notify('error', 'Ein unerwarteter Fehler ist aufgetreten.'); } finally { this.$set(row, 'isSaving', false); } } }, mounted() { this.applyFilters(false); } });