add titles to pages

This commit is contained in:
nek0 2018-09-04 18:06:12 +02:00
parent 9bb10c88c9
commit c23ac47ae4
17 changed files with 60 additions and 22 deletions

View file

@ -30,14 +30,16 @@ import Codec.Picture.ScaleDCT
getAvatarR :: Handler Html
getAvatarR = do
avatars <- runDB $ selectList [] [Asc AvatarIdent]
defaultLayout $
defaultLayout $ do
setTitleI MsgAvatars
$(widgetFile "avatars")
getNewAvatarR :: Handler Html
getNewAvatarR = do
(newAvatarWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm $ avatarNewForm
defaultLayout $
defaultLayout $ do
setTitleI MsgNewAvatar
$(widgetFile "newAvatar")
postNewAvatarR :: Handler Html
@ -77,7 +79,8 @@ getModifyAvatarR aId = do
(avatarModifyWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm
$ avatarModForm avatar
defaultLayout $
defaultLayout $ do
setTitleI MsgModifyAvatar
$(widgetFile "modifyAvatar")
Nothing -> do
setMessageI MsgAvatarUnknown

View file

@ -21,12 +21,13 @@ import Text.Shakespeare.Text
getBuyR :: UserId -> BeverageId -> Handler Html
getBuyR uId bId = do
(_, bev) <- checkData uId bId
(user, bev) <- checkData uId bId
master <- getYesod
(buyWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm
$ buyForm
defaultLayout $
defaultLayout $ do
setTitleI (MsgPurchaseOf (beverageIdent bev))
$(widgetFile "buy")
postBuyR :: UserId -> BeverageId -> Handler Html
@ -105,7 +106,8 @@ getBuyCashR bId = do
(buyCashWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm
$ buyForm
defaultLayout $
defaultLayout $ do
setTitleI (MsgPurchaseOf (beverageIdent bev))
$(widgetFile "buyCash")
Nothing -> do
setMessageI MsgItemUnknown

View file

@ -22,7 +22,8 @@ getCashCheckR :: Handler Html
getCashCheckR = do
(cashCheckWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm createCashCheckForm
defaultLayout $
defaultLayout $ do
setTitleI MsgCashCheck
$(widgetFile "cashCheck")
postCashCheckR :: Handler Html

View file

@ -35,6 +35,7 @@ getHomeR = do
ousers <- runDB $ selectList [UserTimestamp <. addDays (-30) today] [Asc UserIdent]
defaultLayout $ do
addScript $ StaticR js_barcode_js
setTitleI MsgMainPage
$(widgetFile "home")
getReactivateR :: Handler Html
@ -43,6 +44,7 @@ getReactivateR = do
users <- runDB $ selectList [UserTimestamp <. addDays (-30) today] [Asc UserIdent]
defaultLayout $ do
addScript $ StaticR js_barcode_js
setTitleI MsgUserReactivate
$(widgetFile "reactivate")
getUserReactivateR :: UserId -> Handler Html

View file

@ -32,7 +32,8 @@ getJournalR = do
cashChecks <- runDB $ selectList [CashCheckTime >=. timeLimit] [Asc CashCheckId]
let list = merge entries cashChecks
cashBalance <- getCashierBalance
defaultLayout $
defaultLayout $ do
setTitleI MsgJournal
$(widgetFile "journal")
merge :: [Entity Transaction] -> [Entity CashCheck] -> [Either Transaction CashCheck]
@ -57,5 +58,6 @@ getJournalPageR p = do
else return $ transactionTime $ entityVal $ L.last entries
cashChecks <- runDB $ selectList [CashCheckTime >=. lTimeLimit, CashCheckTime <. uTimeLimit] [Asc CashCheckId]
let list = merge entries cashChecks
defaultLayout $
defaultLayout $ do
setTitleI MsgJournal
$(widgetFile "journalPage")

View file

@ -28,7 +28,8 @@ getModifyR bId =
(modifyWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm
$ modifyForm (Just bev) bs
defaultLayout $
defaultLayout $ do
setTitleI (MsgModifyBeverage (beverageIdent bev))
$(widgetFile "modify")
)

View file

@ -32,7 +32,8 @@ getNewUserR = do
(newUserWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm
$ newUserForm today
defaultLayout $
defaultLayout $ do
setTitleI MsgNewUser
$(widgetFile "newUser")
postNewUserR :: Handler Html
@ -92,7 +93,8 @@ getModifyUserR uId =
(modifyUserWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm
$ modifyUserForm user bs
defaultLayout $
defaultLayout $ do
setTitleI (ModifyUser (userIdent user))
$(widgetFile "modifyUser")
)

View file

@ -28,7 +28,8 @@ getPayoutR :: Handler Html
getPayoutR = do
(payoutWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm payoutForm
defaultLayout $
defaultLayout $ do
setTitleI MsgPayoutFromCash
$(widgetFile "payout")
postPayoutR :: Handler Html

View file

@ -23,7 +23,8 @@ import Data.Maybe (fromJust)
getRestockR :: Handler Html
getRestockR = do
beverages <- runDB $ selectList [] [Asc BeverageIdent]
defaultLayout $
defaultLayout $ do
setTitleI MsgRestock
$(widgetFile "restock")
getUpstockR :: BeverageId -> Handler Html
@ -31,7 +32,8 @@ getUpstockR bId =
isBeverage bId RestockR >>= (\bev -> do
(upstockWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm upstockForm
defaultLayout $
defaultLayout $ do
setTitleI (MsgStockUp (beverageIdent bev))
$(widgetFile "upstock")
)

View file

@ -27,6 +27,7 @@ getSelectR uId =
beverages <- runDB $ selectList [BeverageAmount >. 0] [Asc BeverageIdent]
defaultLayout $ do
addScript $ StaticR js_barcode_js
setTitleI MsgSelectItem
$(widgetFile "select")
)
@ -35,6 +36,7 @@ getSelectCashR = do
beverages <- runDB $ selectList [BeverageAmount >. 0] [Asc BeverageIdent]
defaultLayout $ do
addScript $ StaticR js_barcode_js
setTitleI MsgSelectItem
$(widgetFile "selectCash")
getRechargeR :: UserId -> Handler Html
@ -43,7 +45,8 @@ getRechargeR uId =
(rechargeWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm rechargeForm
currency <- appCurrency <$> appSettings <$> getYesod
defaultLayout $
defaultLayout $ do
setTitleI MsgRecharge
$(widgetFile "recharge")
)

View file

@ -25,7 +25,8 @@ getSummaryR :: Handler Html
getSummaryR = do
master <- getYesod
bevs <- runDB $ selectList [] [Asc BeverageIdent]
defaultLayout $
defaultLayout $ do
setTitleI MsgSummary
$(widgetFile "summary")
getSummaryJsonR :: Handler RepJson

View file

@ -7,7 +7,8 @@ import Data.Maybe
getSupplierR :: Handler Html
getSupplierR = do
sups <- runDB $ selectList [] [Asc SupplierIdent]
defaultLayout $
defaultLayout $ do
setTitleI MsgSuppliers
$(widgetFile "supplier")
getNewSupplierR :: Handler Html
@ -15,6 +16,7 @@ getNewSupplierR = do
(newSupplierWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm newSupplierForm
defaultLayout $
setTitleI MsgNewSupplier
$(widgetFile "newSupplier")
postNewSupplierR :: Handler Html
@ -61,7 +63,8 @@ getModifySupplierR sId = do
(modifySupplierWidget, enctype) <- generateFormPost
$ renderBootstrap3 BootstrapBasicForm
$ modifySupplierForm sup
defaultLayout $
defaultLayout $ do
setTitleI MsgEditSupplier
$(widgetFile "modifySupplier")
Nothing -> do
setMessageI MsgSupplierUnknown

View file

@ -10,7 +10,8 @@ getSupplierActionsR sId = do
mSup <- runDB $ get sId
case mSup of
Just sup ->
defaultLayout $
defaultLayout $ do
setTitleI (MsgSupplieractions (supplierIdent sup))
$(widgetFile "supplierActions")
Nothing -> do
setMessageI MsgSupplierUnknown

View file

@ -24,7 +24,8 @@ getTransferSelectR :: UserId -> Handler Html
getTransferSelectR from =
isUser from HomeR >>= (\_ -> do
users <- runDB $ selectList [UserId !=. from] [Asc UserIdent]
defaultLayout $
defaultLayout $ do
setTitleI MsgTransfer
$(widgetFile "transferSelect")
)
@ -36,6 +37,7 @@ getTransferR from to =
$ renderBootstrap3 BootstrapBasicForm transferForm
currency <- appCurrency <$> appSettings <$> getYesod
defaultLayout $ do
setTitleI MsgTransfer
$(widgetFile "transfer")
)
)

View file

@ -147,3 +147,7 @@ Login: Přihlásit
Logout: Odhlásit
CreationBlocked: Nelze vytvořit nové uživatele.
NotEnoughFunds: Nedostatek kreditu
MainPage: Hlavní stránka
ModifyBeverage ident@Text: Změnit zboží #{ident}
ModifyUser ident@Text: Změnit uživatele #{ident}
SupplierActions ident@Text: Akce pro dodavatele #{ident}

View file

@ -109,7 +109,7 @@ BarcodeUnknown: Dieser Barcode ist unbekannt
BarcodeField: Barcodes
BarcodeAdded: Barcode erfolgreich hinzugefügt
BarcodeDuplicate: Dieser barcode wird schon verwendet
Transfer: Transferieren
Transfer: Guthaben Transferieren
TransferTo: Guthaben transferieren an
NegativeTransfer: Keine negativen Beträge transferieren
TransferComplete: Transfer abgeschlossen
@ -147,3 +147,7 @@ Login: Login
Logout: Logout
CreationBlocked: Es können keine neuen Nutzer angelegt werden.
NotEnoughFunds: Nicht genügen Guthaben
MainPage: Hauptseite
ModifyBeverage ident@Text: Artikel #{ident} bearbeiten
ModifyUser ident@Text: Benutzer #{ident} bearbeiten
SupplierActions ident@Text: Aktionen für Lieferant #{ident}

View file

@ -147,3 +147,7 @@ Login: Login
Logout: Logout
CreationBlocked: New users can not be created.
NotEnoughFunds: Not enough funds!
MainPage: Main page
ModifyBeverage ident@Text: Modify beverage #{ident}
ModifyUser ident@Text: Modify user #{ident}
SupplierActions ident@Text: Actions for supplier #{ident}