update/sort assets
This commit is contained in:
3 files changed
+75
-6
No files matched your search
@@ -150,6 +150,41 @@ function selectIcon(selectedIcon, assetId="") {
|
||||
`;
|
||||
}
|
||||
|
||||
/**
|
||||
* selectFilter to filter assets by type
|
||||
* @param {button elemenbt} filter
|
||||
*/
|
||||
function selectFilter(filter) {
|
||||
const types = ["other", "saving", "stock"];
|
||||
|
||||
console.log(filter.value);
|
||||
|
||||
types.forEach((type) => {
|
||||
if (filter.value == "all") {
|
||||
document.querySelectorAll(`.${type}-asset`).forEach((preview) => {
|
||||
preview.style.display = "block";
|
||||
});
|
||||
} else if (type != filter.value) {
|
||||
document.querySelectorAll(`.${type}-asset`).forEach((preview) => {
|
||||
preview.style.display = "none";
|
||||
});
|
||||
} else if (type == filter.value) {
|
||||
document.querySelectorAll(`.${type}-asset`).forEach((preview) => {
|
||||
preview.style.display = "block";
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById("dropdown-filters-button").innerHTML = `
|
||||
<span class="inline-flex items-center">
|
||||
${filter.value.charAt(0).toUpperCase() + filter.value.slice(1)} Assets
|
||||
<svg class="w-2.5 h-2.5 ms-2.5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 10 6">
|
||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
||||
</svg>
|
||||
</span>
|
||||
`;
|
||||
}
|
||||
|
||||
/**
|
||||
* toggleYear shows or hides year input
|
||||
* @param {string} type of asset
|
||||
|
||||
Reference in new issue
Block a user