Recount-Server/web/dataendpoints.templ
2024-01-15 19:26:51 -08:00

28 lines
940 B
Text

package web
import (
"nickiel.net/recount_server/types"
"strconv"
)
templ transaction_rows(transactions *[]types.HumanLegibleTransaction) {
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>
}
}