mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 15:01:56 +00:00
Added creation modal auto-popup when following create asset link
This commit is contained in:
@@ -256,6 +256,17 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
// Open modal if URL contains parameter: CreateModal=true
|
||||||
|
const urlParams = new URLSearchParams(window.location.search);
|
||||||
|
if (urlParams.get('CreateModal') === 'true') {
|
||||||
|
const button = document.querySelector('[data-bs-toggle="modal"][data-bs-target="#createAssetModal"]');
|
||||||
|
if (button) {
|
||||||
|
button.click();
|
||||||
|
urlParams.delete('CreateModal');
|
||||||
|
const newUrl = window.location.pathname + '?' + urlParams.toString();
|
||||||
|
history.replaceState({}, '', newUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
const attributesContainer = document.getElementById('attributesContainer');
|
const attributesContainer = document.getElementById('attributesContainer');
|
||||||
const addAttributeBtn = document.getElementById('addAttributeBtn');
|
const addAttributeBtn = document.getElementById('addAttributeBtn');
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<button id="scanBarcodeButton" class="btn btn-primary mt-3">@T["Scan barcode"]</button>
|
<button id="scanBarcodeButton" class="btn btn-primary mt-3">@T["Scan barcode"]</button>
|
||||||
@if (User.IsInRole("CanManageAssets"))
|
@if (User.IsInRole("CanManageAssets"))
|
||||||
{
|
{
|
||||||
<a asp-controller="Home" asp-action="Assets" class="mt-3" style="display: block;">@T["Add a new asset"]</a>
|
<a asp-controller="Home" asp-action="Assets" asp-route-CreateModal="true" class="mt-3" style="display: block;">@T["Add a new asset"]</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user