SeemGen/Components/Layout/MainLayout.razor

66 lines
1.7 KiB
Plaintext

@using BLAIzor.Services
@inherits LayoutComponentBase
<RadzenComponents @rendermode="InteractiveServer" />
@Body
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
@* <script>
window.getDivContent = (id) => {
let element = document.getElementById(id);
return element ? element.innerHTML : null;
};
</script> *@
<script>
window.getDivContent = (id) => {
const element = document.getElementById(id);
if (!element) return null;
// Get the HTML content of the div
const innerHtml = element.innerHTML;
// Collect all form inputs inside the div
const inputs = element.querySelectorAll('input, textarea, select');
const formData = {};
inputs.forEach(input => {
if (input.type === 'checkbox') {
formData[input.name || input.id] = input.checked;
} else if (input.type === 'radio') {
if (input.checked) {
formData[input.name || input.id] = input.value;
}
} else {
formData[input.name || input.id] = input.value;
}
});
return {
html: innerHtml,
values: formData
};
};
</script>
<script>
function collapseNavbar() {
const navbar = document.getElementById('navbarSupportedContent');
if (navbar && navbar.classList.contains('show')) {
const bsCollapse = bootstrap.Collapse.getInstance(navbar);
if (bsCollapse) {
bsCollapse.hide();
}
}
}
</script>
@code{
}