rvv041 - AddressBook - Record ID added to address book entries.

This commit is contained in:
Rene V. Vergara A. 2024-08-29 14:42:58 -04:00
parent 67d334a60b
commit 73ad2f0eb3
2 changed files with 14 additions and 5 deletions

View file

@ -20,7 +20,7 @@ import Data.Maybe (fromJust, fromMaybe, isJust, isNothing)
import qualified Data.Text as T
import qualified Data.Text.Encoding as E
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
import Database.Esqueleto.Experimental (ConnectionPool)
import Database.Esqueleto.Experimental (ConnectionPool, fromSqlKey)
import Database.Persist
import Lens.Micro ((&), (+~), (.~), (?~), (^.), set)
import Lens.Micro.TH
@ -60,6 +60,7 @@ import Zenith.Utils
, validBarValue
, validateAddressBool
, isValidString
, padWithZero
)
data AppEvent
@ -805,7 +806,10 @@ buildUI wenv model = widgetTree
[onClick $ ShowTx idx, alignLeft]
(hstack
[
(label "Descr: ") `styleBasic` [textFont "Bold"]
label
(T.pack $
padWithZero 3 $
show (fromSqlKey (entityKey ab))) `styleBasic` [textFont "Bold"]
, spacer
, label
(T.pack $

View file

@ -153,3 +153,8 @@ isValidString c = do
let a = T.unpack c
isValidContent a
padWithZero :: Int -> String -> String
padWithZero n s
| (length s) >= n = s
| otherwise = padWithZero n ("0" ++ s)