{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PackageImports #-} module View.Product where import qualified Data.Text as T import Text.I18n import qualified Text.Blaze.Html5 as H import qualified Text.Blaze.Html5.Attributes as HA -- imports from "mateamt" import qualified "mateamt" Types as MT -- internal imports import Types import Util import View.Scaffold import API productPriceListPage :: L10n -> Locale -> maybe T.Text -> [MT.ProductShortOverview] -> UserHandler ProductPriceListPage productPriceListPage l10n loc mcookie list = scaffold l10n loc mcookie (initPage $ translate "Matebeamter" <> " - " <> translate "Price List" ) $ do H.table $ do H.thead $ H.tr $ do H.th (H.toHtml $ translate "ID") H.th (H.toHtml $ translate "Name") H.th (H.toHtml $ translate "Amount") H.th (H.toHtml $ translate "Volume") H.th (H.toHtml $ translate "Price") mapM_ (\(MT.ProductShortOverview pid ident price amount ml _) -> H.tr $ do H.td (H.toHtml $ show pid) H.td (H.toHtml ident) H.td (H.toHtml $ show amount) H.td (H.toHtml $ (fromString $ show ml) <> " ml") H.td (H.toHtml $ (formatMoney price) -- TODO: Add Currency symbol ) list where translate = localize l10n loc . gettext