feat: Begins a generic htmx form context and template, integrates user form, begins views for vendor and purchase orders.
This commit is contained in:
26
Public/js/main.js
Normal file
26
Public/js/main.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// Close dropdown if user clicks outside of it.
|
||||
// Adapted from: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_js_dropdown
|
||||
//
|
||||
window.onClick = function(event) {
|
||||
if (!event.target.matches('.dropbtn')) {
|
||||
var dropdowns = document.getElementsByClassName("dropdown-content");
|
||||
var i;
|
||||
for (i=0; i < dropdowns.length; i++) {
|
||||
var openDropdown = dropdowns[i];
|
||||
if (openDropdown.classList.contains('show')) {
|
||||
openDropdown.classList.remove('show');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show the drop-down menu, with the given id.
|
||||
function showDropdownContent(id) {
|
||||
document.getElementById(id).classList.toggle("show");
|
||||
}
|
||||
|
||||
// Update the drop-down with the item that was clicked inside it's menu.
|
||||
function updateDropDownSelection(id, contentId) {
|
||||
let content = document.getElementById(contentId).innerHTML;
|
||||
document.getElementById(id).innerHTML = content;
|
||||
}
|
||||
Reference in New Issue
Block a user