added currency
This commit is contained in:
parent
380136d059
commit
2ab5f9b4c1
9 changed files with 12 additions and 5 deletions
|
@ -10,6 +10,7 @@ getBuyR uId bId = do
|
|||
mTup <- checkData uId bId
|
||||
case mTup of
|
||||
Just (user, bev) -> do
|
||||
master <- getYesod
|
||||
(buyWidget, enctype) <- generateFormPost buyForm
|
||||
defaultLayout $ do
|
||||
$(widgetFile "buy")
|
||||
|
@ -49,6 +50,7 @@ getBuyCashR bId = do
|
|||
mBev <- runDB $ get bId
|
||||
case mBev of
|
||||
Just bev -> do
|
||||
master <- getYesod
|
||||
(buyCashWidget, enctype) <- generateFormPost buyForm
|
||||
defaultLayout $ do
|
||||
$(widgetFile "buyCash")
|
||||
|
|
|
@ -10,6 +10,7 @@ getSelectR uId = do
|
|||
mUser <- runDB $ get uId
|
||||
case mUser of
|
||||
Just user -> do
|
||||
master <- getYesod
|
||||
beverages <- runDB $ selectList [BeverageAmount >=. 0] [Desc BeverageIdent]
|
||||
defaultLayout $ do
|
||||
$(widgetFile "select")
|
||||
|
|
|
@ -5,6 +5,7 @@ import Data.List as L
|
|||
|
||||
getSummaryR :: Handler Html
|
||||
getSummaryR = do
|
||||
master <- getYesod
|
||||
bevs <- runDB $ selectList [] [Asc BeverageIdent]
|
||||
defaultLayout $ do
|
||||
$(widgetFile "summary")
|
||||
|
|
|
@ -54,6 +54,7 @@ data AppSettings = AppSettings
|
|||
-- ^ Google Analytics code
|
||||
, appEmail :: Text
|
||||
-- ^ notification address
|
||||
, appCurrency :: Text
|
||||
}
|
||||
|
||||
instance FromJSON AppSettings where
|
||||
|
@ -80,6 +81,7 @@ instance FromJSON AppSettings where
|
|||
-- appCopyright <- o .: "copyright"
|
||||
appAnalytics <- o .:? "analytics"
|
||||
appEmail <- o .: "email"
|
||||
appCurrency <- o .: "currency"
|
||||
|
||||
return AppSettings {..}
|
||||
|
||||
|
|
|
@ -27,3 +27,4 @@ database:
|
|||
|
||||
#analytics: UA-YOURCODE
|
||||
email: "nek0@momen"
|
||||
currency: "€"
|
||||
|
|
|
@ -3,7 +3,7 @@ $doctype 5
|
|||
<h3>Kauf von #{beverageIdent bev}
|
||||
|
||||
<p>
|
||||
Preis pro Einheit: #{show ((fromIntegral (beveragePrice bev)) / 100)}
|
||||
Preis pro Einheit: #{show ((fromIntegral (beveragePrice bev)) / 100)} #{appCurrency $ appSettings master}
|
||||
|
||||
<form method=post enctype=#{enctype}>
|
||||
^{buyWidget}
|
||||
|
|
|
@ -3,7 +3,7 @@ $doctype 5
|
|||
<h3>Kauf von #{beverageIdent bev}
|
||||
|
||||
<p>
|
||||
Preis pro Einheit: #{show ((fromIntegral (beveragePrice bev + 50)) / 100)}
|
||||
Preis pro Einheit: #{show ((fromIntegral (beveragePrice bev + 50)) / 100)} #{appCurrency $ appSettings master}
|
||||
|
||||
<form method=post enctype=#{enctype}>
|
||||
^{buyCashWidget}
|
||||
|
|
|
@ -3,7 +3,7 @@ $doctype 5
|
|||
<div .header>
|
||||
<ul>
|
||||
<li>
|
||||
aktuelles Guthaben: #{show ((fromIntegral (userBalance user)) / 100)}
|
||||
aktuelles Guthaben: #{show ((fromIntegral (userBalance user)) / 100)} #{appCurrency $ appSettings master}
|
||||
<li>
|
||||
<a href=@{RechargeR uId}>
|
||||
Guthaben aufladen
|
||||
|
|
|
@ -9,14 +9,14 @@ $if not $ L.null bevs
|
|||
<th>Name
|
||||
<th>aktuelle Anzahl
|
||||
<th>Meldebestand
|
||||
<th>Preis
|
||||
<th>Preis in #{appCurrency $ appSettings master}
|
||||
<th>
|
||||
$forall (Entity bId bev) <- bevs
|
||||
<tr>
|
||||
<td>#{beverageIdent bev}
|
||||
<td>#{beverageAmount bev}
|
||||
<td>#{beverageAlertAmount bev}
|
||||
<td>#{show ((fromIntegral (beveragePrice bev)) / 100)}
|
||||
<td>#{show ((fromIntegral (beveragePrice bev)) / 100)} #{appCurrency $ appSettings master}
|
||||
<td><a href=@{ModifyR bId}>bearbeiten
|
||||
$else
|
||||
<p>keine Getränke vorhanden
|
||||
|
|
Loading…
Reference in a new issue