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