Skip to content

Commit

Permalink
reuses the last default location. Fixes #41
Browse files Browse the repository at this point in the history
  • Loading branch information
KelvinTegelaar committed Oct 20, 2021
1 parent 2856ea4 commit 9e684c1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion js/UserFormOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ $(document).ready(function () {
if (searchParams.has('Tenantfilter')) {
TenantID = searchParams.get('Tenantfilter')
}
//checks if the default location has been set, and if so, use that again.

//checks if a userid is present, and if so, we prefill the form.
if (searchParams.has('UserID')) {
var UserID = searchParams.get('UserID')
Expand Down Expand Up @@ -57,9 +59,14 @@ $(document).ready(function () {
option.text = item.Name;
UsageLocationList.appendChild(option);
});
var LastLocation = localStorage.getItem('DefaultLocation')
if (LastLocation) {
$('#LocationDataList').val(LastLocation)
}
}).fail(function () {
console.log("An error has occurred.");
});

//Creates licenses checkboxes

(function () {
Expand Down Expand Up @@ -111,8 +118,12 @@ $(document).ready(function () {
})();

//append tenant in back to users
if(TenantID !== '') {
if (TenantID !== '') {
var href = $(".back-to-users").attr("href");
$(".back-to-users").attr("href", href + "&Tenantfilter=" + TenantID);
}
//checks if a user location has been filled in, and if so, add it as the default
$("#LocationDataList").change(function () {
localStorage.setItem('DefaultLocation', $(this).val())
});
});

0 comments on commit 9e684c1

Please sign in to comment.