i18n support

This commit is contained in:
Astro 2015-04-10 00:40:58 +02:00
parent 1cc845215a
commit 0077e0b98a
30 changed files with 248 additions and 161 deletions

View file

@ -11,6 +11,32 @@ import Settings.StaticFiles
--snip --snip
import qualified Data.Text as T import qualified Data.Text as T
import Network.Wai as Wai import Network.Wai as Wai
import Data.List (tail)
import Data.List.Split
import Text.Printf
prependZero :: Text -> Text
prependZero t0 = if T.null t1
then t1
else if T.head t1 == '.'
then '0' `T.cons` t1
else if "-." `T.isPrefixOf` t1
then "-0." `T.append` (T.drop 2 t1)
else t1
where t1 = T.dropWhile ((==) ' ') t0
formatFloat :: Double -> Text
formatFloat d = T.pack (t ++ c)
where
t = reverse (intercalate "." $ chunksOf 3 $ reverse $ fst sp)
c = "," ++ tail (snd sp)
sp = (break (== '.') (printf "%.2f" d))
-- T.pack . (splitEvery 3) . (printf "%,2f")
formatIntCurrency :: Int -> Text
formatIntCurrency x = formatFloat $ ((fromIntegral x) / 100)
-- | The foundation datatype for your application. This can be a good place to -- | The foundation datatype for your application. This can be a good place to
-- keep settings and values requiring initialization before your application -- keep settings and values requiring initialization before your application
@ -27,6 +53,13 @@ data App = App
instance HasHttpManager App where instance HasHttpManager App where
getHttpManager = appHttpManager getHttpManager = appHttpManager
mkMessage "App" "messages" "de"
renderMessage' e = do
m <- getYesod
l <- languages
return $ renderMessage m l e
-- This is where we define all of the routes in our application. For a full -- This is where we define all of the routes in our application. For a full
-- explanation of the syntax, please see: -- explanation of the syntax, please see:
-- http://www.yesodweb.com/book/routing-and-handlers -- http://www.yesodweb.com/book/routing-and-handlers
@ -168,3 +201,4 @@ instance RenderMessage App FormMessage where
-- https://github.com/yesodweb/yesod/wiki/Sending-email -- https://github.com/yesodweb/yesod/wiki/Sending-email
-- https://github.com/yesodweb/yesod/wiki/Serve-static-files-from-a-separate-domain -- https://github.com/yesodweb/yesod/wiki/Serve-static-files-from-a-separate-domain
-- https://github.com/yesodweb/yesod/wiki/i18n-messages-in-the-scaffolding -- https://github.com/yesodweb/yesod/wiki/i18n-messages-in-the-scaffolding

View file

@ -16,7 +16,7 @@ getBuyR uId bId = do
defaultLayout $ do defaultLayout $ do
$(widgetFile "buy") $(widgetFile "buy")
Nothing -> do Nothing -> do
setMessage "Benutzer oder Artikel unbekannt" setMessageI MsgUserOrArticleUnknown
redirect $ HomeR redirect $ HomeR
postBuyR :: UserId -> BeverageId -> Handler Html postBuyR :: UserId -> BeverageId -> Handler Html
@ -38,19 +38,19 @@ postBuyR uId bId = do
liftIO $ notifyUser user bev price master liftIO $ notifyUser user bev price master
case sw of case sw of
False -> do False -> do
setMessage "Viel Vergnügen" setMessageI MsgPurchaseSuccess
redirect $ HomeR redirect $ HomeR
True -> do True -> do
setMessage "Achtung: Guthaben im negativen Bereich" setMessageI MsgPurchaseDebtful
redirect $ HomeR redirect $ HomeR
True -> do True -> do
setMessage "So viele Artikel sind nicht vorhanden" setMessageI MsgNotEnoughItems
redirect $ BuyR uId bId redirect $ BuyR uId bId
_ -> do _ -> do
setMessage "Etwas ist schief gelaufen" setMessageI MsgErrorOccured
redirect $ HomeR redirect $ HomeR
Nothing -> do Nothing -> do
setMessage "Benutzer oder Artikel unbekannt" setMessageI MsgUserUnknown
redirect $ HomeR redirect $ HomeR
notifyUser :: User -> Beverage -> Int -> App -> IO () notifyUser :: User -> Beverage -> Int -> App -> IO ()
@ -84,7 +84,7 @@ getBuyCashR bId = do
defaultLayout $ do defaultLayout $ do
$(widgetFile "buyCash") $(widgetFile "buyCash")
Nothing -> do Nothing -> do
setMessage "Getrank unbekannt" setMessageI MsgItemUnknown
redirect $ HomeR redirect $ HomeR
postBuyCashR :: BeverageId -> Handler Html postBuyCashR :: BeverageId -> Handler Html
@ -102,20 +102,17 @@ postBuyCashR bId = do
runDB $ update bId [BeverageAmount -=. quant] runDB $ update bId [BeverageAmount -=. quant]
updateCashier price "Barzahlung" updateCashier price "Barzahlung"
checkAlert bId checkAlert bId
setMessage $ Content $ Text $ "Viel Vergnügen. Bitte Zahle " let currency = appCurrency $ appSettings master
`T.append` (formatIntCurrency price) setMessageI $ MsgPurchaseSuccessCash price currency
`T.append` " " redirect HomeR
`T.append` (appCurrency $ appSettings master)
`T.append` " in die Kasse ein"
redirect $ HomeR
True -> do True -> do
setMessage "So viele Artikel sind nicht vorhanden" setMessageI MsgNotEnoughItems
redirect $ BuyCashR bId redirect $ BuyCashR bId
_ -> do _ -> do
setMessage "Etwas ist schief gelaufen" setMessageI MsgItemDisappeared
redirect $ HomeR redirect $ HomeR
Nothing -> do Nothing -> do
setMessage "Artikel unbekannt" setMessageI MsgItemUnknown
redirect $ HomeR redirect $ HomeR
checkData :: UserId -> BeverageId -> Handler (Maybe (User, Beverage)) checkData :: UserId -> BeverageId -> Handler (Maybe (User, Beverage))
@ -131,4 +128,4 @@ checkData uId bId = do
buyForm :: Form Int buyForm :: Form Int
buyForm = renderDivs buyForm = renderDivs
$ areq amountField "Anzahl" (Just 1) $ areq amountField (fieldSettingsLabel MsgAmount) (Just 1)

View file

@ -15,13 +15,13 @@ postCashCheckR = do
case res of case res of
FormSuccess c -> do FormSuccess c -> do
runDB $ insert_ c runDB $ insert_ c
setMessage "Kassensturz durchgeführt. Kasse aktualisiert" setMessageI MsgCashChecked
redirect $ HomeR redirect $ HomeR
_ -> do _ -> do
setMessage "Fehler im Kassensturz" setMessageI MsgCashCheckError
redirect $ CashCheckR redirect $ CashCheckR
createCashierForm :: Form Cashier createCashierForm :: Form Cashier
createCashierForm = renderDivs $ Cashier createCashierForm = renderDivs $ Cashier
<$> areq currencyField "Gezählter Betrag" Nothing <$> areq currencyField (fieldSettingsLabel MsgCountedValue) Nothing
<*> lift (liftIO getCurrentTime) <*> lift (liftIO getCurrentTime)

View file

@ -5,12 +5,9 @@ import Data.FileEmbed (embedFile)
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Text.Lazy.Encoding as E import qualified Data.Text.Lazy.Encoding as E
import qualified Data.Text.Read as R import qualified Data.Text.Read as R
import Data.List (tail)
import Data.List.Split
import Yesod.Form.Functions import Yesod.Form.Functions
import Text.Shakespeare.Text import Text.Shakespeare.Text
import Network.Mail.Mime import Network.Mail.Mime
import Text.Printf
import Import import Import
-- These handlers embed files in the executable at compile time to avoid a -- These handlers embed files in the executable at compile time to avoid a
@ -113,25 +110,3 @@ sendMail to subject body =
, partContent = E.encodeUtf8 body , partContent = E.encodeUtf8 body
}]] }]]
} }
prependZero :: Text -> Text
prependZero t0 = if T.null t1
then t1
else if T.head t1 == '.'
then '0' `T.cons` t1
else if "-." `T.isPrefixOf` t1
then "-0." `T.append` (T.drop 2 t1)
else t1
where t1 = T.dropWhile ((==) ' ') t0
formatFloat :: Double -> Text
formatFloat d = T.pack (t ++ c)
where
t = reverse (intercalate "." $ chunksOf 3 $ reverse $ fst sp)
c = "," ++ tail (snd sp)
sp = (break (== '.') (printf "%.2f" d))
-- T.pack . (splitEvery 3) . (printf "%,2f")
formatIntCurrency :: Int -> Text
formatIntCurrency x = formatFloat $ ((fromIntegral x) / 100)

View file

@ -39,8 +39,8 @@ getUserReactivateR uId = do
time <- liftIO getCurrentTime time <- liftIO getCurrentTime
secs <- return $ R.read $ formatTime defaultTimeLocale "%s" time secs <- return $ R.read $ formatTime defaultTimeLocale "%s" time
runDB $ update uId [UserTimestamp =. secs] runDB $ update uId [UserTimestamp =. secs]
setMessage "Nutzer reaktiviert" setMessageI MsgUserReactivated
redirect $ HomeR redirect $ HomeR
Nothing -> do Nothing -> do
setMessage "Nutzer unbekannt" setMessageI MsgUserUnknown
redirect $ HomeR redirect $ HomeR

View file

@ -12,7 +12,7 @@ getModifyR bId = do
defaultLayout $ do defaultLayout $ do
$(widgetFile "modify") $(widgetFile "modify")
Nothing -> do Nothing -> do
setMessage "Artikel unbekannt" setMessageI MsgItemUnknown
redirect $ SummaryR redirect $ SummaryR
postModifyR :: BeverageId -> Handler Html postModifyR :: BeverageId -> Handler Html
@ -29,21 +29,21 @@ postModifyR bId = do
, BeverageAmount =. beverageAmount nBev , BeverageAmount =. beverageAmount nBev
, BeverageAlertAmount =. beverageAlertAmount nBev , BeverageAlertAmount =. beverageAlertAmount nBev
] ]
setMessage "Bearbeitung erfolgreich" setMessageI MsgEditSuccess
redirect $ SummaryR redirect $ SummaryR
_ -> do _ -> do
setMessage "Bearbeitung nicht möglich" setMessageI MsgEditFail
redirect $ SummaryR redirect $ SummaryR
Nothing -> do Nothing -> do
setMessage "Artikel unbekannt" setMessageI MsgItemUnknown
redirect $ SummaryR redirect $ SummaryR
modifyForm :: Beverage -> Form Beverage modifyForm :: Beverage -> Form Beverage
modifyForm bev = renderDivs $ Beverage modifyForm bev = renderDivs $ Beverage
<$> areq textField "Name" (Just $ beverageIdent bev) <$> areq textField (fieldSettingsLabel MsgName) (Just $ beverageIdent bev)
<*> areq currencyField "Preis" (Just $ beveragePrice bev) <*> areq currencyField (fieldSettingsLabel MsgPrice) (Just $ beveragePrice bev)
<*> areq amountField "aktueller Bestand" (Just $ beverageAmount bev) <*> areq amountField (fieldSettingsLabel MsgCurrentStock) (Just $ beverageAmount bev)
<*> areq amountField "Meldebestand" (Just $ beverageAlertAmount bev) <*> areq amountField (fieldSettingsLabel MsgAnnouncedStock) (Just $ beverageAlertAmount bev)
getDeleteBeverageR :: BeverageId -> Handler Html getDeleteBeverageR :: BeverageId -> Handler Html
getDeleteBeverageR bId = do getDeleteBeverageR bId = do
@ -51,8 +51,8 @@ getDeleteBeverageR bId = do
case mBev of case mBev of
Just bev -> do Just bev -> do
runDB $ delete bId runDB $ delete bId
setMessage "Artikel gelöscht" setMessageI MsgItemDeleted
redirect $ HomeR redirect $ HomeR
Nothing -> do Nothing -> do
setMessage "Artikel unbekannt" setMessageI MsgItemUnknown
redirect $ HomeR redirect $ HomeR

View file

@ -21,19 +21,19 @@ postNewUserR = do
case res of case res of
FormSuccess user -> do FormSuccess user -> do
_ <- runDB $ insert user _ <- runDB $ insert user
setMessage "Benutzer angelegt" setMessageI MsgUserCreated
redirect $ HomeR redirect $ HomeR
_ -> do _ -> do
setMessage "Benutzer konnte nicht angelegt werden" setMessageI MsgUserNotCreated
redirect $ NewUserR redirect $ NewUserR
newUserForm :: Int -> Form User newUserForm :: Int -> Form User
newUserForm secs = renderDivs $ User newUserForm secs = renderDivs $ User
<$> areq textField "Nickname" Nothing <$> areq textField (fieldSettingsLabel MsgName) Nothing
<*> pure 0 <*> pure 0
<*> pure secs <*> pure secs
<*> aopt emailField "E-mail" Nothing <*> aopt emailField (fieldSettingsLabel MsgEmail) Nothing
<*> areq boolField "Benachrichtigung bei Kauf" (Just False) <*> areq boolField (fieldSettingsLabel MsgBuyNotification) (Just False)
data UserConf = UserConf data UserConf = UserConf
{ userConfEmail :: Maybe Text { userConfEmail :: Maybe Text
@ -49,7 +49,7 @@ getModifyUserR uId = do
defaultLayout $ do defaultLayout $ do
$(widgetFile "modifyUser") $(widgetFile "modifyUser")
Nothing -> do Nothing -> do
setMessage "Benutzer unbekannt" setMessageI MsgUserUnknown
redirect $ HomeR redirect $ HomeR
postModifyUserR :: UserId -> Handler Html postModifyUserR :: UserId -> Handler Html
@ -65,19 +65,19 @@ postModifyUserR uId = do
, UserNotify =. userConfNotify conf , UserNotify =. userConfNotify conf
] ]
liftIO $ notify user conf liftIO $ notify user conf
setMessage "Nutzerdaten aktualisiert" setMessageI MsgUserEdited
redirect $ SelectR uId redirect $ SelectR uId
_ -> do _ -> do
setMessage "Nutzerdatenaktualisierung nicht erfolgreich" setMessageI MsgUserNotEdited
redirect $ SelectR uId redirect $ SelectR uId
Nothing -> do Nothing -> do
setMessage "Nutzer unbekannt" setMessageI MsgUserUnknown
redirect $ HomeR redirect $ HomeR
modifyUserForm :: User -> Form UserConf modifyUserForm :: User -> Form UserConf
modifyUserForm user = renderDivs $ UserConf modifyUserForm user = renderDivs $ UserConf
<$> aopt emailField "E-Mail" (Just $ userEmail user) <$> aopt emailField (fieldSettingsLabel MsgEmail) (Just $ userEmail user)
<*> areq boolField "Benachrichtigung bei Kauf" (Just $ userNotify user) <*> areq boolField (fieldSettingsLabel MsgBuyNotification) (Just $ userNotify user)
notify :: User -> UserConf -> IO () notify :: User -> UserConf -> IO ()
notify user conf notify user conf

View file

@ -20,14 +20,15 @@ postPayoutR = do
((res, _), _) <- runFormPost payoutForm ((res, _), _) <- runFormPost payoutForm
case res of case res of
FormSuccess payment -> do FormSuccess payment -> do
updateCashier (- (paymentAmount payment)) ("Auszahlung: " `T.append` paymentDesc payment) msg <- renderMessage' $ MsgPayout $ paymentDesc payment
setMessage "Betrag ausgezahlt" updateCashier (- (paymentAmount payment)) msg
setMessageI MsgPaidOut
redirect $ HomeR redirect $ HomeR
_ -> do _ -> do
setMessage "Auszahlung nicht möglich" setMessageI MsgNotPaidOut
redirect $ JournalR redirect $ JournalR
payoutForm :: Form Payment payoutForm :: Form Payment
payoutForm = renderDivs $ Payment payoutForm = renderDivs $ Payment
<$> areq currencyField "Betrag" Nothing <$> areq currencyField (fieldSettingsLabel MsgValue) Nothing
<*> areq textField "Beschreibung" Nothing <*> areq textField (fieldSettingsLabel MsgDescription) Nothing

View file

@ -18,7 +18,7 @@ getUpstockR bId = do
defaultLayout $ do defaultLayout $ do
$(widgetFile "upstock") $(widgetFile "upstock")
Nothing -> do Nothing -> do
setMessage "Artikel unbekannt" setMessageI MsgItemUnknown
redirect $ HomeR redirect $ HomeR
postUpstockR :: BeverageId -> Handler Html postUpstockR :: BeverageId -> Handler Html
@ -32,21 +32,21 @@ postUpstockR bId = do
case c > 0 of case c > 0 of
True -> do True -> do
runDB $ update bId [BeverageAmount +=. c] runDB $ update bId [BeverageAmount +=. c]
setMessage "Bestand aufgefüllt" setMessageI MsgStockedUp
redirect $ HomeR redirect $ HomeR
False -> do False -> do
setMessage "Bestand kann nicht negativ aufgefüllt werden" setMessageI MsgNotStockedUp
redirect $ UpstockR bId redirect $ UpstockR bId
_ -> do _ -> do
setMessage "Fehler beim Auffüllen" setMessageI MsgStockupError
redirect $ UpstockR bId redirect $ UpstockR bId
Nothing -> do Nothing -> do
setMessage "Artikel unbekannt" setMessageI MsgItemUnknown
redirect $ HomeR redirect $ HomeR
upstockForm :: Form Int upstockForm :: Form Int
upstockForm = renderDivs upstockForm = renderDivs
$ areq amountField "Anzahl hinzugefügt" (Just 0) $ areq amountField (fieldSettingsLabel MsgAmountAdded) (Just 0)
getNewArticleR :: Handler Html getNewArticleR :: Handler Html
getNewArticleR = do getNewArticleR = do
@ -60,15 +60,15 @@ postNewArticleR = do
case result of case result of
FormSuccess bev -> do FormSuccess bev -> do
runDB $ insert_ bev runDB $ insert_ bev
setMessage "Neuer Artikel hinzugefügt" setMessageI MsgItemAdded
redirect $ HomeR redirect $ HomeR
_ -> do _ -> do
setMessage "Fehler beim Hinzufügen" setMessageI MsgItemNotAdded
redirect $ HomeR redirect $ HomeR
newArticleForm :: Form Beverage newArticleForm :: Form Beverage
newArticleForm = renderDivs $ Beverage newArticleForm = renderDivs $ Beverage
<$> areq textField "Name" Nothing <$> areq textField (fieldSettingsLabel MsgName) Nothing
<*> areq currencyField "Preis" (Just 100) <*> areq currencyField (fieldSettingsLabel MsgPrice) (Just 100)
<*> areq amountField "Anzahl Elemente" (Just 0) <*> areq amountField (fieldSettingsLabel MsgAmount) (Just 0)
<*> areq amountField "Warnung bei Anzahl" (Just 0) <*> areq amountField (fieldSettingsLabel MsgAmountWarning) (Just 0)

View file

@ -15,7 +15,7 @@ getSelectR uId = do
defaultLayout $ do defaultLayout $ do
$(widgetFile "select") $(widgetFile "select")
Nothing -> do Nothing -> do
setMessage "Benutzer unbekannt" setMessageI MsgUserUnknown
redirect $ HomeR redirect $ HomeR
getSelectCashR :: Handler Html getSelectCashR :: Handler Html
@ -30,10 +30,11 @@ getRechargeR uId = do
case mUser of case mUser of
Just user -> do Just user -> do
(rechargeWidget, enctype) <- generateFormPost rechargeForm (rechargeWidget, enctype) <- generateFormPost rechargeForm
currency <- appCurrency <$> appSettings <$> getYesod
defaultLayout $ do defaultLayout $ do
$(widgetFile "recharge") $(widgetFile "recharge")
Nothing -> do Nothing -> do
setMessage "Benutzer unbekannt" setMessageI MsgUserUnknown
redirect $ HomeR redirect $ HomeR
postRechargeR :: UserId -> Handler Html postRechargeR :: UserId -> Handler Html
@ -48,15 +49,15 @@ postRechargeR uId = do
time <- liftIO getCurrentTime time <- liftIO getCurrentTime
secs <- return $ R.read $ formatTime defaultTimeLocale "%s" time secs <- return $ R.read $ formatTime defaultTimeLocale "%s" time
runDB $ update uId [UserBalance +=. amount, UserTimestamp =. secs] runDB $ update uId [UserBalance +=. amount, UserTimestamp =. secs]
setMessage "Guthaben erfolgreich aufgeladen" setMessageI MsgRecharged
redirect $ HomeR redirect $ HomeR
_ -> do _ -> do
setMessage "Fehler beim Aufladen" setMessageI MsgRechargeError
redirect $ HomeR redirect $ HomeR
Nothing -> do Nothing -> do
setMessage "Benutzer unbekannt" setMessageI MsgUserUnknown
redirect $ HomeR redirect $ HomeR
rechargeForm :: Form Int rechargeForm :: Form Int
rechargeForm = renderDivs rechargeForm = renderDivs
$ areq currencyField "Betrag" (Just 0) $ areq currencyField (fieldSettingsLabel MsgValue) (Just 0)

75
messages/de.msg Normal file
View file

@ -0,0 +1,75 @@
UserReactivated: Nutzer reaktiviert
UserUnknown: Nutzer unbekannt
UserOrArticleUnknown: Benutzer oder Artikel unbekannt
PurchaseSuccess: Viel Vergnügen
PurchaseDebtful: Achtung: Guthaben im negativen Bereich
NotEnoughItems: So viele Artikel sind nicht vorhanden
ErrorOccured: Etwas ist schief gelaufen
ItemUnknown: Artikel unbekannt
PurchaseSuccessCash price@Int currency@Text: Viel Vergnügen. Bitte Zahle #{formatIntCurrency price} #{currency} in die Kasse ein
ItemDisappeared: Artikel ist verschwunden o_0
Amount: Anzahl
EditSuccess: Bearbeitung erfolgreich
EditFail: Bearbeitung nicht möglich
Name: Name
Price: Preis
CurrentStock: Aktueller Bestand
AnnouncedStock: Meldebestand
DeleteItem: Artikel löschen
ItemDeleted: Artikel gelöscht
UserCreated: Benutzer angelegt
UserNotCreated: Benutzer konnte nicht angelegt werden
Email: E-Mail
BuyNotification: Benachrichtigung bei Kauf
UserEdited: Nutzerdaten aktualisiert
UserNotEdited: Nutzerdatenaktualisierung nicht erfolgreich
Payout desc@Text: Auszahlung: #{desc}
PaidOut: Betrag ausgezahlt
NotPaidOut: Auszahlung nicht möglich
Value: Betrag
Description: Beschreibung
StockedUp: Bestand aufgefüllt
NotStockedUp: Bestand kann nicht negativ aufgefüllt werden
StockupError: Fehler beim Auffüllen
AmountAdded: Anzahl hinzugefügt
ItemAdded: Neuer Artikel hinzugefügt
ItemNotAdded: Fehler beim Hinzufügen
AmountWarning: Warnung bei Anzahl
Recharged: Guthaben erfolgreich aufgeladen
RechargeError: Fehler beim Aufladen
CashCheck: Kassensturz
CashChecked: Kassensturz durchgeführt. Kasse aktualisiert
CashCheckError: Fehler im Kassensturz
CountedValue: Gezählter Betrag
PurchaseOf name@Text: Kauf von #{name}
PricePerUnit price@Int currency@Text: Preis pro Einheit: #{formatIntCurrency price} #{currency}
Purchase: Kaufen
PleaseCountAndCheck: Bitte Kasse zählen und gezählten Betrag in unten stehendes Feld eintragen.
Submit: Absenden
Home: Nachhause
Restock: Lager befüllen
Journal: Journal
Summary: Inventar
PayCash: Bar bezahlen
CreateUser: Neuen Nutzer anlegen
ReactivateOldUser: Alten Nutzer reaktivieren
Time: Zeit
ValueIn currency@Text: Betrag in #{currency}
TotalValue: Gesamtbetrag
CashStock: Kassenbestand
PayoutFromCash: Aus der Kasse auszahlen
NothingToShow: Noch keine Bewegungen zu verzeichnen
NewItem: Neuer Artikel
NewUser: Neuer Benutzer
DoPayout: Auszahlen
ReactivateUser: Nutzer reaktivieren
Recharge: Guthaben aufladen
CurrentCharge charge@Int currency@Text: aktuelles Guthaben: #{formatIntCurrency charge} #{currency}
AddItem: neuen Artikel hinzufügen
EditUser: Nutzerdaten akutalisieren
ChoosePrompt text@Text: Wähle deinen Artikel, #{text}
SelectItem: Wähle deinen Artikel
CurrentAmount: Aktuelle Anzahl
NoItems: keine Getränke vorhanden
StockUp name@Text: Bestand von #{name} auffüllen
Fillup: Auffüllen

View file

@ -1,11 +1,11 @@
$doctype 5 $doctype 5
<h3>Kauf von #{beverageIdent bev} <h3>_{MsgPurchaseOf $ beverageIdent bev}
<p> <p>
Preis pro Einheit: #{formatIntCurrency (beveragePrice bev)} #{appCurrency $ appSettings master} _{MsgPricePerUnit (beveragePrice bev) (appCurrency $ appSettings master)}
<form method=post enctype=#{enctype}> <form method=post enctype=#{enctype}>
^{buyWidget} ^{buyWidget}
<div> <div>
<input type=submit value="Kaufen"> <input type=submit value="_{MsgPurchase}">

View file

@ -1,11 +1,11 @@
$doctype 5 $doctype 5
<h3>Kauf von #{beverageIdent bev} <h3>_{MsgPurchaseOf $ beverageIdent bev}
<p> <p>
Preis pro Einheit: #{formatIntCurrency (beveragePrice bev + 50)} #{appCurrency $ appSettings master} _{MsgPricePerUnit (beveragePrice bev + 50) (appCurrency $ appSettings master)}
<form method=post enctype=#{enctype}> <form method=post enctype=#{enctype}>
^{buyCashWidget} ^{buyCashWidget}
<div> <div>
<input type=submit value="Kaufen"> <input type=submit value="_{MsgPurchase}">

View file

@ -1,11 +1,12 @@
$doctype 5 $doctype 5
<h3>Kassensturz <h3>_{MsgCashCheck}
<p> <p>
Bitte Kasse zählen und gezählten Betrag in unten stehendes Feld eintragen. _{MsgPleaseCountAndCheck}
<form method=post enctype=#{enctype}> <form method=post enctype=#{enctype}>
^{cashCheckWidget} ^{cashCheckWidget}
<div> <div>
<input type=submit value="Absenden"> <input type=submit value="_{MsgSubmit}">

View file

@ -23,21 +23,7 @@ $newline never
<script> <script>
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/,'js'); document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/,'js');
<body> <body>
<div class="container"> ^{pageBody pc}
<header>
<nav>
<ul>
<li>
<a href=@{HomeR}>Home
<div id="main" role="main">
^{pageBody pc}
<footer>
<span>
<a href=@{RestockR}>Lager befüllen
<span>
<a href=@{JournalR}>Journal
<span>
<a href=@{SummaryR}>Inventar
$maybe analytics <- appAnalytics $ appSettings master $maybe analytics <- appAnalytics $ appSettings master
<script> <script>

View file

@ -1,3 +1,19 @@
$maybe msg <- mmsg <div class="container">
<div #message>#{msg} <header>
^{widget} <nav>
<ul>
<li>
<a href=@{HomeR}>_{MsgHome}
<div id="main" role="main">
$maybe msg <- mmsg
<div #message>#{msg}
^{widget}
<footer>
<span>
<a href=@{RestockR}>_{MsgRestock}
<span>
<a href=@{JournalR}>_{MsgJournal}
<span>
<a href=@{SummaryR}>_{MsgSummary}

View file

@ -5,11 +5,11 @@ $if null beverages
<article .article #func> <article .article #func>
<a href=@{SelectCashR}> <a href=@{SelectCashR}>
<p>Bar bezahlen <p>_{MsgPayCash}
<article .article #func> <article .article #func>
<a href=@{NewUserR}> <a href=@{NewUserR}>
<p>Neuen Nutzer anlegen <p>_{MsgCreateUser}
$forall (Entity uId user) <- users $forall (Entity uId user) <- users
<article .article> <article .article>
@ -18,4 +18,4 @@ $forall (Entity uId user) <- users
<article .article #func> <article .article #func>
<a href=@{ReactivateR}> <a href=@{ReactivateR}>
<p>Alten Nutzer reaktivieren <p>_{MsgReactivateOldUser}

View file

@ -6,9 +6,9 @@ $if not $ L.null entries
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Zeit <th>_{MsgTime}
<th>Beschreibung <th>_{MsgDescription}
<th>Betrag in #{appCurrency $ appSettings master} <th>_{MsgValueIn $ appCurrency $ appSettings master}
$forall (eTransCash) <- list $forall (eTransCash) <- list
$case eTransCash $case eTransCash
$of Left trans $of Left trans
@ -19,21 +19,22 @@ $if not $ L.null entries
$of Right cash $of Right cash
<tr #check> <tr #check>
<td colspan="2"> <td colspan="2">
Kassensturz vom #{formatTime defaultTimeLocale "%A %F %H:%M" $ cashierCreated cash}: _{MsgCashCheckOf $ formatTime defaultTimeLocale "%A %F %H:%M" $ cashierCreated cash}:
<td>#{formatIntCurrency (cashierBalance cash)} #{appCurrency $ appSettings master} <td>#{formatIntCurrency (cashierBalance cash)} #{appCurrency $ appSettings master}
<tfoot> <tfoot>
<tr> <tr>
<td colspan="2">Gesamtbetrag: <td colspan="2">_{MsgTotalValue}:
<td>#{formatIntCurrency total} #{appCurrency $ appSettings master} <td>#{formatIntCurrency (fromIntegral total)} #{appCurrency $ appSettings master}
<p> <p>
Kassenbestand: #{formatIntCurrency (fromIntegral cashBalance)} #{appCurrency $ appSettings master} _{MsgCashStock}: #{formatIntCurrency (fromIntegral cashBalance)} #{appCurrency $ appSettings master}
<ul> <ul>
<li> <li>
<a href=@{PayoutR}> <a href=@{PayoutR}>
Aus der Kasse auszahlen _{MsgPayoutFromCash}
<li> <li>
<a href=@{CashCheckR}> <a href=@{CashCheckR}>
Kassensturz _{MsgCashCheck}
$else $else
<p>Noch keine Bewegungen zu verzeichnen <p>_{MsgNothingToShow}

View file

@ -8,4 +8,4 @@ $doctype 5
<input type=submit value="Absenden"> <input type=submit value="Absenden">
<a href=@{ModifyR bId}> <a href=@{ModifyR bId}>
Artikel löschen _{MsgDeleteItem}

View file

@ -1,8 +1,8 @@
$doctype 5 $doctype 5
<h3>Benutzer bearbeiten <h3>_{MsgEditUser}
<form method=post enctype=#{enctype}> <form method=post enctype=#{enctype}>
^{modifyUserWidget} ^{modifyUserWidget}
<div> <div>
<input type=submit value="Absenden"> <input type=submit value="_{MsgSubmit}">

View file

@ -1,8 +1,8 @@
$doctype 5 $doctype 5
<h3>Neuer Artikel <h3>_{MsgNewItem}
<form method=post enctype=#{enctype}> <form method=post enctype=#{enctype}>
^{newArticleWidget} ^{newArticleWidget}
<div> <div>
<input type=submit value="Absenden"> <input type=submit value="_{MsgSubmit}">

View file

@ -1,8 +1,8 @@
$doctype 5 $doctype 5
<h3>Neuer Benutzer <h3>_{MsgNewUser}
<form method=post enctype=#{enctype}> <form method=post enctype=#{enctype}>
^{newUserWidget} ^{newUserWidget}
<div> <div>
<input type=submit value="Absenden"> <input type=submit value="_{MsgSubmit}">

View file

@ -1,10 +1,10 @@
$doctype 5 $doctype 5
<h3>Auszahlung aus der Kasse <h3>_{MsgPayoutFromCash}
<p>Bitte gewünschten Betrag angeben <p>Bitte gewünschten Betrag angeben
<form method=post enctype='{enctype}> <form method=post enctype=#{enctype}>
^{payoutWidget} ^{payoutWidget}
<div> <div>
<input type=submit value="Auszahlen"> <input type=submit value="_{MsgDoPayout}">

View file

@ -1,6 +1,6 @@
$doctype 5 $doctype 5
<h3>Nutzer reaktivieren <h3>_{MsgReactivateUser}
$forall (Entity uId user) <- users $forall (Entity uId user) <- users
<article .article> <article .article>

View file

@ -1,12 +1,12 @@
$doctype 5 $doctype 5
<h3> <h3>
Guthaben aufladen _{MsgRecharge}
<p> <p>
aktuelles Guthaben: #{formatIntCurrency (userBalance user)} _{MsgCurrentCharge (userBalance user) currency}
<form method=post enctype=#{enctype}> <form method=post enctype=#{enctype}>
^{rechargeWidget} ^{rechargeWidget}
<div> <div>
<input type=submit value="Aufladen"> <input type=submit value="_{MsgRecharge}">

View file

@ -1,7 +1,7 @@
$doctype 5 $doctype 5
<h3> <h3>
Bestände wieder auffüllen _{MsgRestock}
$forall (Entity bId bev) <- beverages $forall (Entity bId bev) <- beverages
<article .article> <article .article>
@ -12,4 +12,4 @@ $forall (Entity bId bev) <- beverages
<article .article #func> <article .article #func>
<a href=@{NewArticleR}> <a href=@{NewArticleR}>
<p> <p>
neuen Artikel hinzufügen _{MsgAddItem}

View file

@ -3,15 +3,15 @@ $doctype 5
<div .header> <div .header>
<ul> <ul>
<li> <li>
aktuelles Guthaben: #{formatIntCurrency (userBalance user)} #{appCurrency $ appSettings master} _{MsgCurrentCharge (userBalance user) (appCurrency $ appSettings master)}
<li> <li>
<a href=@{RechargeR uId}> <a href=@{RechargeR uId}>
Guthaben aufladen _{MsgRecharge}
<li> <li>
<a href=@{ModifyUserR uId}> <a href=@{ModifyUserR uId}>
Nutzerdaten akutalisieren _{MsgEditUser}
<h3>Wähle deinen Artikel, #{userIdent user} <h3>_{MsgChoosePrompt $ userIdent user}
$if null beverages $if null beverages
<h1> <h1>

View file

@ -1,6 +1,6 @@
$doctype 5 $doctype 5
<h3>Wähle deinen Artikel <h3>_{MsgSelectItem}
$forall (Entity bId bev) <- beverages $forall (Entity bId bev) <- beverages
<article .article> <article .article>

View file

@ -1,15 +1,15 @@
$doctype 5 $doctype 5
<h3>Übersicht <h3>_{MsgSummary}
$if not $ L.null bevs $if not $ L.null bevs
<table> <table>
<thead> <thead>
<tr> <tr>
<th>Name <th>_{MsgName}
<th>aktuelle Anzahl <th>_{MsgCurrentAmount}
<th>Meldebestand <th>_{MsgAnnouncedStock}
<th>Preis in #{appCurrency $ appSettings master} <th>_{MsgValueIn $ appCurrency $ appSettings master}
<th> <th>
$forall (Entity bId bev) <- bevs $forall (Entity bId bev) <- bevs
<tr> <tr>
@ -19,4 +19,4 @@ $if not $ L.null bevs
<td>#{formatIntCurrency (beveragePrice bev)} #{appCurrency $ appSettings master} <td>#{formatIntCurrency (beveragePrice bev)} #{appCurrency $ appSettings master}
<td><a href=@{ModifyR bId}>bearbeiten <td><a href=@{ModifyR bId}>bearbeiten
$else $else
<p>keine Getränke vorhanden <p>_{MsgNoItems}

View file

@ -1,11 +1,11 @@
$doctype 5 $doctype 5
<h3>Bestand von #{beverageIdent bev} auffüllen <h3>_{MsgStockUp $ beverageIdent bev}
<p> <p>
Aktueller Bestand: #{beverageAmount bev} _{MsgCurrentStock}: #{beverageAmount bev}
<form method=post enctype=#{enctype}> <form method=post enctype=#{enctype}>
^{upstockWidget} ^{upstockWidget}
<div> <div>
<input type=submit value="Auffüllen"> <input type=submit value="_{MsgFillup}">