From 77792d40eb7fa62ae97fc9b424efffd97c96c683 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sat, 6 Apr 2024 03:01:15 +1100 Subject: [PATCH] Custom dropdown box for chart of accounts setup --- drcr/static/js/combobox.js | 7 +-- drcr/templates/chart_of_accounts.html | 70 ++++++++++++++++++++++++--- 2 files changed, 64 insertions(+), 13 deletions(-) diff --git a/drcr/static/js/combobox.js b/drcr/static/js/combobox.js index 755e65f..2a4573a 100644 --- a/drcr/static/js/combobox.js +++ b/drcr/static/js/combobox.js @@ -49,11 +49,8 @@ document.querySelectorAll('.combobox').forEach((elCombobox) => { elCombobox.querySelector('button').addEventListener('click', (evt) => { elInput.focus(); }); -}); - -// Update combobox value on select -document.querySelectorAll('.combobox').forEach((elCombobox) => { - const elInput = elCombobox.querySelector('input'); + + // Update combobox value on select elCombobox.querySelector('ul').querySelectorAll('li').forEach((elLi) => { elLi.addEventListener('mousedown', (evt) => { const liText = elLi.querySelector('.combobox-text').innerText; diff --git a/drcr/templates/chart_of_accounts.html b/drcr/templates/chart_of_accounts.html index ea06e5b..fab314e 100644 --- a/drcr/templates/chart_of_accounts.html +++ b/drcr/templates/chart_of_accounts.html @@ -25,16 +25,30 @@
-
- {# FIXME: Hardcoded default #} +
@@ -69,3 +83,43 @@ {% endblock %} + +{% block scripts %} + +{% endblock %}