summaryrefslogtreecommitdiff
path: root/Handler/InventoryListing.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Handler/InventoryListing.hs')
-rw-r--r--Handler/InventoryListing.hs17
1 files changed, 15 insertions, 2 deletions
diff --git a/Handler/InventoryListing.hs b/Handler/InventoryListing.hs
index c2ec5d1..d87512a 100644
--- a/Handler/InventoryListing.hs
+++ b/Handler/InventoryListing.hs
@@ -11,8 +11,21 @@ postInventoryListingR = do
11 case insertResult of 11 case insertResult of
12 FormSuccess (Item{..} `WithType` t) -> runDB $ do 12 FormSuccess (Item{..} `WithType` t) -> runDB $ do
13 upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ] 13 upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ]
14 insert Item{..} 14 newItem <- insert Item{..}
15 return () 15 otherItems <- selectKeysList [ ItemNormKind ==. itemNormKind, ItemId !=. newItem ] []
16 when (not $ null otherItems) . addMessage "insertAmbiguous" $
17 [shamlet|
18 $newline never
19 There are other items of the same kind.
20 <ul>
21 $forall other <- otherItems
22 <li .itemId>#{humanId other}
23 |]
24 addMessage "insertSuccess" [shamlet|
25 $newline never
26 Inserted new item as #
27 <span .itemId>#{humanId newItem}
28 |]
16 FormFailure errors -> mapM_ (addMessage "formError" . toHtml) errors 29 FormFailure errors -> mapM_ (addMessage "formError" . toHtml) errors
17 _ -> return () 30 _ -> return ()
18 31