Milestone 3: RPC server, ZIP-320 #104
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 as T
|
||||||
import qualified Data.Text.Encoding as E
|
import qualified Data.Text.Encoding as E
|
||||||
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
|
import Data.Time.Clock.POSIX (posixSecondsToUTCTime)
|
||||||
import Database.Esqueleto.Experimental (ConnectionPool)
|
import Database.Esqueleto.Experimental (ConnectionPool, fromSqlKey)
|
||||||
import Database.Persist
|
import Database.Persist
|
||||||
import Lens.Micro ((&), (+~), (.~), (?~), (^.), set)
|
import Lens.Micro ((&), (+~), (.~), (?~), (^.), set)
|
||||||
import Lens.Micro.TH
|
import Lens.Micro.TH
|
||||||
|
@ -60,6 +60,7 @@ import Zenith.Utils
|
||||||
, validBarValue
|
, validBarValue
|
||||||
, validateAddressBool
|
, validateAddressBool
|
||||||
, isValidString
|
, isValidString
|
||||||
|
, padWithZero
|
||||||
)
|
)
|
||||||
|
|
||||||
data AppEvent
|
data AppEvent
|
||||||
|
@ -802,11 +803,14 @@ buildUI wenv model = widgetTree
|
||||||
abookRow :: Int -> Entity AddressBook -> WidgetNode AppModel AppEvent
|
abookRow :: Int -> Entity AddressBook -> WidgetNode AppModel AppEvent
|
||||||
abookRow idx ab =
|
abookRow idx ab =
|
||||||
box_
|
box_
|
||||||
[onClick $ ShowTx idx, alignLeft]
|
[onClick $ ShowTx idx, alignLeft]
|
||||||
(hstack
|
(hstack
|
||||||
[
|
[
|
||||||
(label "Descr: ") `styleBasic` [textFont "Bold"]
|
label
|
||||||
, spacer
|
(T.pack $
|
||||||
|
padWithZero 3 $
|
||||||
|
show (fromSqlKey (entityKey ab))) `styleBasic` [textFont "Bold"]
|
||||||
|
, spacer
|
||||||
, label
|
, label
|
||||||
(T.pack $
|
(T.pack $
|
||||||
show (addressBookAbdescrip $ entityVal ab))
|
show (addressBookAbdescrip $ entityVal ab))
|
||||||
|
|
|
@ -152,4 +152,9 @@ isValidString :: T.Text -> Bool
|
||||||
isValidString c = do
|
isValidString c = do
|
||||||
let a = T.unpack c
|
let a = T.unpack c
|
||||||
isValidContent a
|
isValidContent a
|
||||||
|
|
||||||
|
padWithZero :: Int -> String -> String
|
||||||
|
padWithZero n s
|
||||||
|
| (length s) >= n = s
|
||||||
|
| otherwise = padWithZero n ("0" ++ s)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue