added stuff to the transactions pane
This commit is contained in:
parent
dc0b37e564
commit
67a2b1c4e2
7 changed files with 34 additions and 14 deletions
|
@ -74,3 +74,9 @@ templ dashboard() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
templ new_transaction_pane() {
|
||||||
|
<div style="position: absolute; width: 500px; height: 500px" class="c-green">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ func getTransactionQuickAccessEntries(w http.ResponseWriter, req *http.Request)
|
||||||
transactions := make([]types.HumanLegibleTransaction, 20)
|
transactions := make([]types.HumanLegibleTransaction, 20)
|
||||||
|
|
||||||
// Populate the slice with dummy data (you can replace this with your actual data)
|
// Populate the slice with dummy data (you can replace this with your actual data)
|
||||||
for i := 20; i > 0; i-- {
|
for i := 0; i < 20; i++ {
|
||||||
transaction := types.HumanLegibleTransaction{
|
transaction := types.HumanLegibleTransaction{
|
||||||
Id: i,
|
Id: i,
|
||||||
Amount: fmt.Sprintf("%d.00", (i+1)*100),
|
Amount: fmt.Sprintf("%d.00", (i+1)*100),
|
||||||
|
@ -55,12 +55,17 @@ func getTransactionQuickAccessEntries(w http.ResponseWriter, req *http.Request)
|
||||||
Date: time.Now(),
|
Date: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
transactions[20 - i] = transaction
|
transactions[i] = transaction
|
||||||
}
|
}
|
||||||
component := transaction_quick_access_entries(&transactions);
|
component := transaction_quick_access_entries(&transactions);
|
||||||
component.Render(context.Background(), w);
|
component.Render(context.Background(), w);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getNewTransactionPane(w http.ResponseWriter, req *http.Request) {
|
||||||
|
component := new_transaction_pane();
|
||||||
|
component.Render(context.Background(), w);
|
||||||
|
}
|
||||||
|
|
||||||
func getRightPanelQuickAccess(w http.ResponseWriter, req *http.Request) {
|
func getRightPanelQuickAccess(w http.ResponseWriter, req *http.Request) {
|
||||||
component := right_panel_quick_access();
|
component := right_panel_quick_access();
|
||||||
component.Render(context.Background(), w);
|
component.Render(context.Background(), w);
|
||||||
|
|
|
@ -31,6 +31,7 @@ func WebRouter() http.Handler {
|
||||||
r.Get("/transactions", getTransactionsPage)
|
r.Get("/transactions", getTransactionsPage)
|
||||||
|
|
||||||
r.Get("/components/account_summaries", getAccountSummaries)
|
r.Get("/components/account_summaries", getAccountSummaries)
|
||||||
|
r.Get("/components/new_transaction_pane", getNewTransactionPane)
|
||||||
r.Get("/components/right_panel_quick_access", getRightPanelQuickAccess)
|
r.Get("/components/right_panel_quick_access", getRightPanelQuickAccess)
|
||||||
|
|
||||||
r.Get("/components/data/transaction_table_rows", getTransactionsRows)
|
r.Get("/components/data/transaction_table_rows", getTransactionsRows)
|
||||||
|
@ -107,5 +108,4 @@ func getTransactionsPage(w http.ResponseWriter, req *http.Request) {
|
||||||
} else {
|
} else {
|
||||||
renderFullPage(w, component, "Transactions")
|
renderFullPage(w, component, "Transactions")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,7 @@ nav {
|
||||||
width: 50px;
|
width: 50px;
|
||||||
display:flex;
|
display:flex;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
cursor: pointer;
|
||||||
svg {
|
svg {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ div#below-header {
|
||||||
div#left-col {
|
div#left-col {
|
||||||
width: 15vw;
|
width: 15vw;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color: var(--#{$prefix}-nav-base);
|
background-color: var(--#{$prefix}-nav-bg);
|
||||||
border-radius: $border-radius;
|
border-radius: $border-radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {fill_charts, fill_chart} from "./chart_functions.js";
|
import {fill_chart} from "./chart_functions.js";
|
||||||
import {register_dropdowns} from "./dropdowns.js";
|
import {register_dropdowns} from "./dropdowns.js";
|
||||||
|
|
||||||
|
|
||||||
|
@ -22,6 +22,10 @@ function switch_nav(event) {
|
||||||
clicked.classList.add("active");
|
clicked.classList.add("active");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function open_drafts() {
|
||||||
|
console.log("Opening drafts panel");
|
||||||
|
}
|
||||||
|
|
||||||
function register_nav_links() {
|
function register_nav_links() {
|
||||||
var navAnchors = document.querySelectorAll("nav a");
|
var navAnchors = document.querySelectorAll("nav a");
|
||||||
navAnchors.forEach(function (a_el) {
|
navAnchors.forEach(function (a_el) {
|
||||||
|
@ -35,6 +39,7 @@ function register_handlers() {
|
||||||
register_nav_links();
|
register_nav_links();
|
||||||
//fill_charts();
|
//fill_charts();
|
||||||
register_dropdowns();
|
register_dropdowns();
|
||||||
|
document.querySelector("#open-draft").addEventListener("click", open_drafts);
|
||||||
}
|
}
|
||||||
|
|
||||||
function load_in_table() {
|
function load_in_table() {
|
||||||
|
@ -47,14 +52,13 @@ function load_in_table() {
|
||||||
if (index < rows.length - 1) {
|
if (index < rows.length - 1) {
|
||||||
processElement(rows[index + 1], index + 1);
|
processElement(rows[index + 1], index + 1);
|
||||||
}
|
}
|
||||||
}, 25); // 1000 milliseconds (1 second) delay, adjust as needed
|
}, 25);
|
||||||
};
|
};
|
||||||
|
|
||||||
processElement(rows[0], 0);
|
processElement(rows[0], 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const trigger_table_animation = debounce(load_in_table, 100);
|
const trigger_table_animation = debounce(load_in_table, 100);
|
||||||
|
|
||||||
const trigger_reset_handlers = debounce(register_handlers, 200);
|
const trigger_reset_handlers = debounce(register_handlers, 200);
|
||||||
|
|
||||||
export {trigger_reset_handlers, trigger_table_animation, fill_chart};
|
export {trigger_reset_handlers, trigger_table_animation, fill_chart};
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
<div id="right-col">
|
<div id="right-col">
|
||||||
<div id="transaction-quick-access-panel">
|
<div id="transaction-quick-access-panel">
|
||||||
<div class="t-header">
|
<div class="t-header">
|
||||||
|
<!--
|
||||||
<button
|
<button
|
||||||
class="borderless-btn btn-sm mx-auto c-green ch-teal"
|
class="borderless-btn btn-sm mx-auto c-green ch-teal"
|
||||||
style="color: var(--pf-base);"
|
style="color: var(--pf-base);"
|
||||||
|
@ -65,6 +66,7 @@
|
||||||
<i class="" data-feather="plus"></i>
|
<i class="" data-feather="plus"></i>
|
||||||
Add New
|
Add New
|
||||||
</button>
|
</button>
|
||||||
|
-->
|
||||||
<div class="m-auto d-flex">
|
<div class="m-auto d-flex">
|
||||||
<input id="show-pending-transactions" type="checkbox"></input>
|
<input id="show-pending-transactions" type="checkbox"></input>
|
||||||
<label for="show-pending-transactions">
|
<label for="show-pending-transactions">
|
||||||
|
@ -77,6 +79,12 @@
|
||||||
<button id="open-draft">
|
<button id="open-draft">
|
||||||
<i data-feather="file-plus"></i>
|
<i data-feather="file-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
|
<div
|
||||||
|
hx-get="/components/new_transaction_pane"
|
||||||
|
hx-trigger="load"
|
||||||
|
>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="t-list-container"
|
class="t-list-container"
|
||||||
|
@ -118,11 +126,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
document.body.addEventListener('htmx:beforeSwap', function (event) {
|
document.body.addEventListener('htmx:beforeSwap', function (event) {
|
||||||
// Get the target element where content will be replaced
|
var charts = event.detail.target.querySelectorAll('.chartjs-chart');
|
||||||
var target = event.detail.target;
|
|
||||||
|
|
||||||
// Check if the target has Chart.js charts
|
|
||||||
var charts = target.querySelectorAll('.chartjs-chart');
|
|
||||||
charts.forEach(function (chart) {
|
charts.forEach(function (chart) {
|
||||||
// Destroy each Chart.js chart before swapping content
|
// Destroy each Chart.js chart before swapping content
|
||||||
Chart.getChart(chart).destroy();
|
Chart.getChart(chart).destroy();
|
||||||
|
|
Loading…
Reference in a new issue