rvv041 - AddressBook - Record ID added to address book entries.
This commit is contained in:
parent
67d334a60b
commit
73ad2f0eb3
2 changed files with 14 additions and 5 deletions
|
@ -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
|
||||
|
@ -802,11 +803,14 @@ buildUI wenv model = widgetTree
|
|||
abookRow :: Int -> Entity AddressBook -> WidgetNode AppModel AppEvent
|
||||
abookRow idx ab =
|
||||
box_
|
||||
[onClick $ ShowTx idx, alignLeft]
|
||||
[onClick $ ShowTx idx, alignLeft]
|
||||
(hstack
|
||||
[
|
||||
(label "Descr: ") `styleBasic` [textFont "Bold"]
|
||||
, spacer
|
||||
[
|
||||
label
|
||||
(T.pack $
|
||||
padWithZero 3 $
|
||||
show (fromSqlKey (entityKey ab))) `styleBasic` [textFont "Bold"]
|
||||
, spacer
|
||||
, label
|
||||
(T.pack $
|
||||
show (addressBookAbdescrip $ entityVal ab))
|
||||
|
|
|
@ -152,4 +152,9 @@ isValidString :: T.Text -> Bool
|
|||
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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue