web: add form: in description field also offer declared/used payees
This commit is contained in:
parent
422329fbfa
commit
3f095fb472
@ -14,7 +14,6 @@ module Hledger.Web.Widget.AddForm
|
|||||||
import Control.Monad.State.Strict (evalStateT)
|
import Control.Monad.State.Strict (evalStateT)
|
||||||
import Data.Bifunctor (first)
|
import Data.Bifunctor (first)
|
||||||
import Data.List (dropWhileEnd, intercalate, unfoldr)
|
import Data.List (dropWhileEnd, intercalate, unfoldr)
|
||||||
import Data.List.Extra (nubSort)
|
|
||||||
import Data.Maybe (isJust)
|
import Data.Maybe (isJust)
|
||||||
#if !(MIN_VERSION_base(4,13,0))
|
#if !(MIN_VERSION_base(4,13,0))
|
||||||
import Data.Semigroup ((<>))
|
import Data.Semigroup ((<>))
|
||||||
@ -28,6 +27,7 @@ import Yesod
|
|||||||
|
|
||||||
import Hledger
|
import Hledger
|
||||||
import Hledger.Web.Settings (widgetFile)
|
import Hledger.Web.Settings (widgetFile)
|
||||||
|
import Data.List.Extra (nubSort)
|
||||||
|
|
||||||
addModal ::
|
addModal ::
|
||||||
( MonadWidget m
|
( MonadWidget m
|
||||||
@ -72,7 +72,7 @@ addForm j today = identifyForm "add" $ \extra -> do
|
|||||||
let (postRes, displayRows) = validatePostings acctRes amtRes
|
let (postRes, displayRows) = validatePostings acctRes amtRes
|
||||||
|
|
||||||
-- bindings used in add-form.hamlet
|
-- bindings used in add-form.hamlet
|
||||||
let descriptions = nubSort $ tdescription <$> jtxns j
|
let descriptions = nubSort $ journalPayeesDeclaredOrUsed j ++ journalDescriptions j
|
||||||
journals = fst <$> jfiles j
|
journals = fst <$> jfiles j
|
||||||
|
|
||||||
pure (validateTransaction dateRes descRes postRes, $(widgetFile "add-form"))
|
pure (validateTransaction dateRes descRes postRes, $(widgetFile "add-form"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user