Add current state
This commit is contained in:
@ -3,21 +3,53 @@
|
||||
// Taken from https://stackoverflow.com/a/9393768/11317151 (and edited, like a lot)
|
||||
|
||||
// Also update on location change
|
||||
window.addEventListener("hashchange", function() {
|
||||
|
||||
|
||||
var hash = location.hash.replace(/^#/, ''); // ^ means starting, meaning only match the first hash
|
||||
window.addEventListener(
|
||||
'hashchange',
|
||||
function () {
|
||||
var hash = location.hash.replace(/^#/, ''); // ^ means starting, meaning only match the first hash
|
||||
if (hash) {
|
||||
bootstrap.Tab.getOrCreateInstance(document.querySelector('#' + hash)).show();
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
var hash = location.hash.replace(/^#/, ''); // ^ means starting, meaning only match the first hash
|
||||
if (hash) {
|
||||
bootstrap.Tab.getOrCreateInstance(document.querySelector('#' + hash)).show()
|
||||
}
|
||||
|
||||
}, false);
|
||||
var hash = location.hash.replace(/^#/, ''); // ^ means starting, meaning only match the first hash
|
||||
if (hash) {
|
||||
bootstrap.Tab.getOrCreateInstance(document.querySelector('#' + hash)).show()
|
||||
}
|
||||
bootstrap.Tab.getOrCreateInstance(document.querySelector('#' + hash)).show();
|
||||
}
|
||||
|
||||
// Change hash for page-reload
|
||||
$('.nav-link').on('click', function (e) {
|
||||
window.location.hash = e.target.id;
|
||||
})
|
||||
});
|
||||
|
||||
function primeCreateNew() {
|
||||
const form = document.getElementById('storageUnitModalForm');
|
||||
const form2 = document.getElementById('storageLocationModal');
|
||||
form.setAttribute('method', 'POST');
|
||||
form2.setAttribute('method', 'POST');
|
||||
return true;
|
||||
}
|
||||
|
||||
function primeEdit() {
|
||||
const form = document.getElementById('storageUnitModalForm');
|
||||
const form2 = document.getElementById('storageLocationModal');
|
||||
form.setAttribute('method', 'PATCH');
|
||||
form2.setAttribute('method', 'PATCH');
|
||||
return true;
|
||||
}
|
||||
|
||||
function handleSelector(){
|
||||
const selector = document.getElementById('storageUnitModalLocationSelect')
|
||||
const value = selector.options[selector.selectedIndex].value;
|
||||
if(value == "META_CREATENEW") {
|
||||
$('#storageUnitModalContactInfoCreator').removeClass('d-none')
|
||||
$('.requireOnCreate').attr('required', true)
|
||||
} else {
|
||||
$('#storageUnitModalContactInfoCreator').addClass('d-none')
|
||||
$('.requireOnCreate').attr('required', false)
|
||||
}
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
handleSelector()
|
Reference in New Issue
Block a user