2015-04-26 20:18:24 +00:00
|
|
|
module Handler.Wallet where
|
|
|
|
|
|
|
|
import Import
|
|
|
|
|
2015-08-06 22:07:48 +00:00
|
|
|
import Data.Time.Clock
|
2015-07-24 19:12:18 +00:00
|
|
|
|
2015-04-26 20:18:24 +00:00
|
|
|
getWalletR :: Handler Html
|
2015-08-06 22:07:48 +00:00
|
|
|
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]
|
2015-07-20 20:10:30 +00:00
|
|
|
defaultLayout $ [whamlet|
|
2015-08-06 22:07:48 +00:00
|
|
|
<a href=@{WalletDetailsR 168 days}>show last 7 days
|
|
|
|
<h1>Transactions in the last #{hrs} hours
|
|
|
|
<table>
|
|
|
|
$forall Entity _ t <- trans
|
|
|
|
<tr>
|
|
|
|
<td>#{show $ transactionDateTime t}
|
|
|
|
<td>#{transactionPriceCents t}
|
|
|
|
<td>#{transactionClientName t}
|
2015-07-20 20:10:30 +00:00
|
|
|
|
2015-08-06 22:07:48 +00:00
|
|
|
<h1>Statistices for the last #{days} days
|
2015-07-24 19:12:18 +00:00
|
|
|
|]
|
|
|
|
)
|
2015-07-20 20:10:30 +00:00
|
|
|
|