module Handler.Wallet where
import Import
import Data.Time.Clock
getWalletR :: Handler Html
getWalletR = getWalletDetailsR 6 7
getWalletDetailsR :: Int64 -> Int64 -> Handler Html
getWalletDetailsR hrs days = loginOrDo (\(uid,user) -> do
now <- liftIO getCurrentTime
trans <- runDB $ selectList [TransactionDateTime >. (addUTCTime ((fromIntegral $ -(hrs*3600)) :: NominalDiffTime) now)] [Desc TransactionDateTime]
defaultLayout $ [whamlet|
show last 7 days
Transactions in the last #{hrs} hours
#{show $ transactionDateTime t} | #{transactionPriceCents t} | #{transactionClientName t}
Statistices for the last #{days} days |] ) |