// Cpeprovisioning.js
Vue.component('tt-chip', {
props: {
checked: { type: Boolean, default: false }
},
template: `
`
});
Vue.component('Cpeprovisioning', {
template: `
{{ row.customer }}
SPIN: {{ row.spin }}
{{ row.network }}
{{ row.product_name }}
{{ row.product_code }}
{{ row.access_type }}
{{ row.access_type_down }} Mbit/s
{{ row.access_type_up }} Mbit/s
{{ key.charAt(0).toUpperCase() + key.slice(1) }}: {{ vlan.tag }}
Router Konfiguration
Versand
Abschluss
`,
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);
}
});