added more to right quick access

This commit is contained in:
Nickiel12 2024-01-27 12:20:25 -08:00
parent 6d547e0585
commit bf84fcce29
6 changed files with 93 additions and 60 deletions

View file

@ -39,10 +39,26 @@ func getTransactionsRows(w http.ResponseWriter, req *http.Request) {
component.Render(context.Background(), w); component.Render(context.Background(), w);
} }
func getTransactionQuickAccess(w http.ResponseWriter, req *http.Request) { func getTransactionQuickAccessEntries(w http.ResponseWriter, req *http.Request) {
component := transaction_quick_access(); transactions := make([]types.HumanLegibleTransaction, 20)
component.Render(context.Background(), w);
// Populate the slice with dummy data (you can replace this with your actual data)
for i := 20; i > 0; i-- {
transaction := types.HumanLegibleTransaction{
Id: i,
Amount: fmt.Sprintf("%d.00", (i+1)*100),
Description: sql.NullString{String: fmt.Sprintf("Transaction %d", i+1), Valid: true},
AccountName: sql.NullString{String: "Savings", Valid: true},
Account: 123,
Bucket: sql.NullInt64{Int64: int64(i + 100), Valid: true},
BucketName: sql.NullString{String: fmt.Sprintf("Bucket %d", i+1), Valid: true},
Date: time.Now(),
}
transactions[20 - i] = transaction
}
component := transaction_quick_access_entries(&transactions);
component.Render(context.Background(), w);
} }
func getRightPanelQuickAccess(w http.ResponseWriter, req *http.Request) { func getRightPanelQuickAccess(w http.ResponseWriter, req *http.Request) {

View file

@ -57,34 +57,31 @@ templ account_summary_rows(accounts *[]types.TwoIntsItem){
} }
} }
templ transaction_quick_access() { templ transaction_quick_access_entries(transactions *[]types.HumanLegibleTransaction) {
<div id="transaction-quick-access-panel"> for _, value := range *transactions {
<div class="t-header"> <div class="card-item">
<button <div class="row">
class="borderless-btn btn-sm mx-auto c-green ch-teal" <div class="w-50 d-flex">
style="color: var(--pf-base);" <span class="mx-auto">{strconv.Itoa(value.Id)}</span>
> </div>
<i class="" data-feather="plus"></i> <div class="w-50 d-flex">
Add New if (len(value.Amount) > 0 && value.Amount[0] == '-') {
</button> <span class="mx-auto negative">{value.Amount}</span>
<div class="m-auto d-flex"> } else {
<input id="show-pending-transactions" type="checkbox"></input> <span class="mx-auto positive">+{value.Amount}</span>
<label for="show-pending-transactions"> }
Show Pending
</label>
</div> </div>
</div> </div>
<div class="t-list"> <div class="row">
<div class="tab-div"> <div class="w-50 d-flex">
<button id="open-draft"> <span class="mx-auto">{value.AccountName.String}</span>
<i data-feather="file-plus"></i>
</button>
</div> </div>
<div class="t-list-container"> <div class="w-50 d-flex">
<span class="mx-auto c-surface0">Description</span>
</div> </div>
</div> </div>
</div> </div>
}
} }
templ right_panel_quick_access() { templ right_panel_quick_access() {

View file

@ -31,12 +31,12 @@ 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/transactions_quick_access", getTransactionQuickAccess)
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)
r.Get("/components/data/expenditure_chart", getExpenditureChart) r.Get("/components/data/expenditure_chart", getExpenditureChart)
r.Get("/components/data/account_summary/{accountID}", getAccountSummaryChart) r.Get("/components/data/account_summary/{accountID}", getAccountSummaryChart)
r.Get("/components/data/transaction_quick_access", getTransactionQuickAccessEntries)
r.Handle("/static/*", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static/")))) r.Handle("/static/*", http.StripPrefix("/static/", http.FileServer(http.Dir("web/static/"))))
return r return r

View file

@ -49,9 +49,9 @@ nav {
} }
#transaction-quick-access-panel { #transaction-quick-access-panel {
height: 100%;
display:flex; display:flex;
flex-direction: column; flex-direction: column;
height: 60%;
.t-header { .t-header {
display: flex; display: flex;
@ -71,9 +71,7 @@ nav {
.t-list { .t-list {
display: flex; display: flex;
flex-grow: 1; height: inherit;
margin-left: 10px;
margin-right: 10px;
.tab-div { .tab-div {
height: 100%; height: 100%;
width: 50px; width: 50px;
@ -100,12 +98,19 @@ nav {
.t-list-container { .t-list-container {
overflow-y: scroll; overflow-y: scroll;
border: 2px solid var(--#{$prefix}-surface1); border: 2px solid var(--#{$prefix}-surface1);
margin: 5px;
margin-left: 0px;
background-color: var(--#{$prefix}-base); background-color: var(--#{$prefix}-base);
height: 100%;
flex-grow: 1; flex-grow: 1;
border-radius: $border-radius; border-radius: $border-radius;
.card-item {
border-radius: $border-radius;
background-color: var(--#{$prefix}-surface0);
margin: 10px;
.row {
width: 100%;
padding-top: 5px;
padding-bottom: 5px;
}
}
} }
} }
} }

View file

@ -49,17 +49,6 @@ $directions: (
padding-bottom: $val; padding-bottom: $val;
} }
} }
.m-auto {
margin: auto;
}
.my-auto {
margin-top: auto;
margin-bottom: auto;
}
.mx-auto {
margin-left: auto;
margin-right: auto;
}
$w_h_sizes: ( $w_h_sizes: (
'25': 25%, '25': 25%,
@ -124,6 +113,13 @@ $w_h_sizes: (
color: var(--#{$prefix}-text) !important; color: var(--#{$prefix}-text) !important;
} }
.positive {
color: var(--#{$prefix}-green);
}
.negative {
color: var(--#{$prefix}-red);
}
.borderless-btn.btn-sm { .borderless-btn.btn-sm {
padding: 4px 8px 4px 8px; padding: 4px 8px 4px 8px;
} }
@ -184,12 +180,6 @@ table.table-striped {
} }
} }
} }
.positive {
color: var(--#{$prefix}-green);
}
.negative {
color: var(--#{$prefix}-red);
}
} }
.popup-menu { .popup-menu {

View file

@ -56,13 +56,38 @@
{{.InnerHtml}} {{.InnerHtml}}
</div> </div>
<div id="right-col"> <div id="right-col">
<div id="transaction-quick-access-panel">
<div class="t-header">
<button
class="borderless-btn btn-sm mx-auto c-green ch-teal"
style="color: var(--pf-base);"
>
<i class="" data-feather="plus"></i>
Add New
</button>
<div class="m-auto d-flex">
<input id="show-pending-transactions" type="checkbox"></input>
<label for="show-pending-transactions">
Show Pending
</label>
</div>
</div>
<div class="t-list">
<div class="tab-div">
<button id="open-draft">
<i data-feather="file-plus"></i>
</button>
</div>
<div <div
id="transactions-quick-access" class="t-list-container"
hx-get="/components/transactions_quick_access" hx-get="/components/data/transaction_quick_access"
hx-swap="innerHtml swap:0.2s settle:0.2s"
hx-trigger="load" hx-trigger="load"
> >
</div> </div>
</div>
</div>
<div style="height: 25%"></div>
<div <div
class="" class=""