1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
-- | /journal/entries handlers.
module Handler.JournalEntriesR where
import Import
import Handler.Common
import Handler.Post
import Handler.Utils
import Hledger.Data
import Hledger.Query
import Hledger.Reports
import Hledger.Cli.Options
import Hledger.Web.Options
-- | The journal entries view, with sidebar.
getJournalEntriesR :: Handler RepHtml
getJournalEntriesR = do
vd@VD{..} <- getViewData
staticRootUrl <- (staticRoot . settings) <$> getYesod
let
sidecontent = sidebar vd
title = "Journal entries" ++ if m /= Any then ", filtered" else "" :: String
maincontent = entriesReportAsHtml opts vd $ entriesReport (reportopts_ $ cliopts_ opts) Any $ filterJournalTransactions m j
defaultLayout $ do
setTitle "hledger-web journal"
toWidget [hamlet|
^{topbar vd}
<div#content>
<div#sidebar>
^{sidecontent}
<div#main.journal>
<div#maincontent>
<h2#contenttitle>#{title}
^{searchform vd}
^{maincontent}
^{addform staticRootUrl vd}
^{editform vd}
^{importform}
|]
postJournalEntriesR :: Handler RepHtml
postJournalEntriesR = handlePost
|