Recount-Server/web/templates/dataendpoints.templ

91 lines
3.3 KiB
Text
Raw Permalink Normal View History

2024-02-10 08:51:27 -08:00
package templates
2024-01-15 19:26:51 -08:00
import (
"nickiel.net/recount_server/types"
"strconv"
)
2024-02-10 08:51:27 -08:00
templ TransactionRows(transactions *[]types.HumanLegibleTransaction) {
2024-01-15 19:26:51 -08:00
for i, value := range *transactions {
<tr class="row_awaiting_processing" data-rcnt-transaction-row-pos={strconv.Itoa(i)}>
<td></td>
<td><div>{strconv.Itoa(value.Id)}</div></td>
if value.AccountName.Valid {
<td><div>{value.AccountName.String}</div></td>
} else {
<td><div>{strconv.Itoa(value.Account)}</div></td>
}
<td><div>{value.Date.Format("01/02/2006")}</div></td>
<td><div>$</div></td>
if (len(value.Amount) > 0 && value.Amount[0] == '-') {
<td class="t-e negative"><div>{value.Amount}</div></td>
} else {
<td class="t-e positive"><div>+{value.Amount}</div></td>
}
</tr>
}
}
2024-01-19 21:05:08 -08:00
2024-02-10 08:51:27 -08:00
templ AccountSummaryRows(accounts *[]types.TwoIntsItem){
2024-01-19 21:05:08 -08:00
for _, value := range *accounts {
<div class="c-crust m-2" style="height: 90px">
<div class="w-100 d-flex" style="height:15px">
<span class="mx-auto">Account: {strconv.Itoa(value.Item2)}</span>
</div>
<div class="d-flex w-100">
<div class="w-75" style="height:75px">
<canvas
class="chartjs-chart sparkline-chart"
2024-01-24 18:58:29 -08:00
data-chart-endpoint={"/components/data/account_summary/" + strconv.Itoa(value.Item2)}
2024-01-19 21:05:08 -08:00
data-chart-type="sparkline_summary"
></canvas>
</div>
<div class="w-25 d-flex">
if value.Item1 > 0 {
<span class="my-auto w-100 t-m cr-all c-mantle" style="color: var(--pf-green)">
-${strconv.Itoa(value.Item1)}
</span>
} else {
<span class="my-auto w-100 t-m cr-all c-mantle" style="color: var(--pf-red)">
+${strconv.Itoa(value.Item1)}
</span>
}
</div>
</div>
</div>
}
}
2024-01-24 18:58:29 -08:00
2024-02-10 08:51:27 -08:00
templ TransactionQuickAccessEntries(transactions *[]types.HumanLegibleTransaction) {
2024-01-27 12:20:25 -08:00
for _, value := range *transactions {
<div class="card-item">
<div class="row">
<div class="w-50 d-flex">
<span class="mx-auto">{strconv.Itoa(value.Id)}</span>
</div>
<div class="w-50 d-flex">
if (len(value.Amount) > 0 && value.Amount[0] == '-') {
<span class="mx-auto negative">{value.Amount}</span>
} else {
<span class="mx-auto positive">+{value.Amount}</span>
}
</div>
2024-01-26 12:15:30 -08:00
</div>
2024-01-27 12:20:25 -08:00
<div class="row">
<div class="w-50 d-flex">
<span class="mx-auto">{value.AccountName.String}</span>
</div>
<div class="w-50 d-flex">
<span class="mx-auto c-surface0">Description</span>
</div>
2024-01-26 12:15:30 -08:00
</div>
</div>
2024-01-27 12:20:25 -08:00
}
2024-01-24 18:58:29 -08:00
}
2024-02-10 08:51:27 -08:00
templ QuickAccessPane() {
<div id="quick-access-pane" class="cr-all c-base">
2024-01-24 18:58:29 -08:00
</div>
}