refactor(letter): i18n renewal letter templating
This commit is contained in:
parent
a6782d8637
commit
d078257a70
@ -133,7 +133,7 @@ MenuLmsUpload: Hochladen
|
|||||||
MenuLmsDirect: Direkter Upload
|
MenuLmsDirect: Direkter Upload
|
||||||
|
|
||||||
MenuAvs: Schnittstelle AVS
|
MenuAvs: Schnittstelle AVS
|
||||||
MenuApc: Schnittstelle Druckerei
|
MenuApc: Druckerei
|
||||||
MenuPrintSend: Manueller Briefversand
|
MenuPrintSend: Manueller Briefversand
|
||||||
|
|
||||||
MenuApiDocs: API-Dokumentation (Englisch)
|
MenuApiDocs: API-Dokumentation (Englisch)
|
||||||
|
|||||||
@ -134,7 +134,7 @@ MenuLmsUpload: Upload
|
|||||||
MenuLmsDirect: Direct Upload
|
MenuLmsDirect: Direct Upload
|
||||||
|
|
||||||
MenuAvs: AVS Interface
|
MenuAvs: AVS Interface
|
||||||
MenuApc: Print Center Interface
|
MenuApc: Printing
|
||||||
MenuPrintSend: Send Letter
|
MenuPrintSend: Send Letter
|
||||||
|
|
||||||
MenuApiDocs: API documentation
|
MenuApiDocs: API documentation
|
||||||
|
|||||||
@ -286,8 +286,8 @@ getAdminTestPdfR = do
|
|||||||
now <- getCurrentTime
|
now <- getCurrentTime
|
||||||
return (now, letter_tp, din5008)
|
return (now, letter_tp, din5008)
|
||||||
case templates of
|
case templates of
|
||||||
(_,Left err,_) -> sendResponseStatus internalServerError500 $ tshow err
|
(_,Left err,_) -> sendResponseStatus internalServerError500 $ "Markdown template error: \n" <> err
|
||||||
(_,_,Left err) -> sendResponseStatus internalServerError500 $ tshow err
|
(_,_,Left err) -> sendResponseStatus internalServerError500 $ "LaTeX template error: \n" <> err
|
||||||
(now, Right templ, Right latex) -> do
|
(now, Right templ, Right latex) -> do
|
||||||
content <- liftIO . P.runIO $ do
|
content <- liftIO . P.runIO $ do
|
||||||
let texopts = []
|
let texopts = []
|
||||||
@ -305,5 +305,5 @@ getAdminTestPdfR = do
|
|||||||
Right (Right bs) -> do
|
Right (Right bs) -> do
|
||||||
liftIO $ L.writeFile "/tmp/generated.pdf" bs
|
liftIO $ L.writeFile "/tmp/generated.pdf" bs
|
||||||
sendByteStringAsFile "demoPDF.pdf" (L.toStrict bs) now
|
sendByteStringAsFile "demoPDF.pdf" (L.toStrict bs) now
|
||||||
Right (Left err) -> sendResponseStatus internalServerError500 $ tshow err
|
Right (Left err) -> sendResponseStatus internalServerError500 $ decodeUtf8 $ L.toStrict $ "LaTeX compile error: \n" <> err
|
||||||
Left err -> sendResponseStatus internalServerError500 $ P.renderError err
|
Left err -> sendResponseStatus internalServerError500 $ "Pandoc error: \n" <> P.renderError err
|
||||||
|
|||||||
@ -21,9 +21,7 @@ import qualified Control.Monad.State.Class as State
|
|||||||
import Handler.Utils
|
import Handler.Utils
|
||||||
|
|
||||||
data MetaPinRenewal = MetaPinRenewal
|
data MetaPinRenewal = MetaPinRenewal
|
||||||
{ mppOpening :: Maybe Text
|
{ mppDate :: Maybe Text
|
||||||
, mppClosing :: Maybe Text
|
|
||||||
, mppDate :: Maybe Text
|
|
||||||
, mppURL :: Maybe Text
|
, mppURL :: Maybe Text
|
||||||
, mppLogin :: Text
|
, mppLogin :: Text
|
||||||
, mppPin :: Text
|
, mppPin :: Text
|
||||||
@ -35,9 +33,7 @@ data MetaPinRenewal = MetaPinRenewal
|
|||||||
|
|
||||||
formToMetaValues :: MetaPinRenewal -> P.Meta
|
formToMetaValues :: MetaPinRenewal -> P.Meta
|
||||||
formToMetaValues MetaPinRenewal{..} = P.Meta $ mconcat
|
formToMetaValues MetaPinRenewal{..} = P.Meta $ mconcat
|
||||||
[ mbMeta "opening" mppOpening
|
[ mbMeta "date" mppDate
|
||||||
, mbMeta "closing" mppClosing
|
|
||||||
, mbMeta "date" mppDate
|
|
||||||
, mbMeta "url" mppURL
|
, mbMeta "url" mppURL
|
||||||
, toMeta "login" mppLogin
|
, toMeta "login" mppLogin
|
||||||
, toMeta "pin" mppPin
|
, toMeta "pin" mppPin
|
||||||
@ -51,13 +47,10 @@ formToMetaValues MetaPinRenewal{..} = P.Meta $ mconcat
|
|||||||
html2textlines :: StoredMarkup -> [Text]
|
html2textlines :: StoredMarkup -> [Text]
|
||||||
html2textlines sm = T.lines . LT.toStrict $ markupInput sm
|
html2textlines sm = T.lines . LT.toStrict $ markupInput sm
|
||||||
|
|
||||||
|
|
||||||
makeRenewalForm :: Maybe MetaPinRenewal -> Form MetaPinRenewal
|
makeRenewalForm :: Maybe MetaPinRenewal -> Form MetaPinRenewal
|
||||||
makeRenewalForm tmpl = identifyForm FIDLmsLetter . validateForm validateMetaPinRenewal $ \html ->
|
makeRenewalForm tmpl = identifyForm FIDLmsLetter . validateForm validateMetaPinRenewal $ \html ->
|
||||||
flip (renderAForm FormStandard) html $ MetaPinRenewal
|
flip (renderAForm FormStandard) html $ MetaPinRenewal
|
||||||
<$> aopt textField (fslI MsgMppOpening) (mppOpening <$> tmpl)
|
<$> aopt textField (fslI MsgMppDate) (mppDate <$> tmpl)
|
||||||
<*> aopt textField (fslI MsgMppClosing) (mppClosing <$> tmpl)
|
|
||||||
<*> aopt textField (fslI MsgMppDate) (mppDate <$> tmpl)
|
|
||||||
<*> aopt textField (fslI MsgMppURL) (mppURL <$> tmpl)
|
<*> aopt textField (fslI MsgMppURL) (mppURL <$> tmpl)
|
||||||
<*> areq textField (fslI MsgMppLogin) (mppLogin <$> tmpl)
|
<*> areq textField (fslI MsgMppLogin) (mppLogin <$> tmpl)
|
||||||
<*> areq textField (fslI MsgMppPin) (mppPin <$> tmpl)
|
<*> areq textField (fslI MsgMppPin) (mppPin <$> tmpl)
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
fromlogo=false, % don't show logo in letter head
|
fromlogo=false, % don't show logo in letter head
|
||||||
version=last, % latest version of KOMA letter
|
version=last, % latest version of KOMA letter
|
||||||
pagenumber=botright, % show pagenumbers on bottom right
|
pagenumber=botright, % show pagenumbers on bottom right
|
||||||
firstfoot=true % first-page footer
|
firstfoot=false % first-page footer
|
||||||
]{scrlttr2}
|
]{scrlttr2}
|
||||||
|
|
||||||
\PassOptionsToPackage{hyphens}{url}
|
\PassOptionsToPackage{hyphens}{url}
|
||||||
@ -76,6 +76,7 @@ $endif$
|
|||||||
\usepackage{parskip}
|
\usepackage{parskip}
|
||||||
|
|
||||||
\usepackage{graphics}
|
\usepackage{graphics}
|
||||||
|
\usepackage{xcolor}
|
||||||
|
|
||||||
\usepackage{booktabs}
|
\usepackage{booktabs}
|
||||||
\usepackage{longtable}
|
\usepackage{longtable}
|
||||||
@ -123,16 +124,28 @@ $endif$
|
|||||||
$endfor$
|
$endfor$
|
||||||
}
|
}
|
||||||
|
|
||||||
\opening{$opening$}
|
$if(is-de)$
|
||||||
|
\opening{$de-opening$}
|
||||||
|
$else$
|
||||||
|
\opening{$en-opening$}
|
||||||
|
$endif$
|
||||||
|
|
||||||
\begin{textblock}{13}(15,45)
|
\begin{textblock}{13}(15,45)
|
||||||
$pin$
|
\textcolor{gray}{
|
||||||
|
\begin{labeling}{Login:x}
|
||||||
|
\item[Login:] $login$
|
||||||
|
\item[Pin:] $pin$
|
||||||
|
\end{labeling}
|
||||||
|
~}
|
||||||
\end{textblock}
|
\end{textblock}
|
||||||
|
|
||||||
$body$
|
$body$
|
||||||
|
|
||||||
\vspace{1.2cm}
|
$if(is-de)$
|
||||||
\closing{$closing$}
|
\closing{$de-closing$}
|
||||||
|
$else$
|
||||||
|
\closing{$en-closing$}
|
||||||
|
$endif$
|
||||||
|
|
||||||
%\ps $postskriptum$
|
%\ps $postskriptum$
|
||||||
|
|
||||||
|
|||||||
@ -5,13 +5,18 @@ subject: Verlängerung Vorfeldführerschein
|
|||||||
author: Fraport AG - Fahrerausbildung (AVN-AR)
|
author: Fraport AG - Fahrerausbildung (AVN-AR)
|
||||||
phone: +49 69 690-30306
|
phone: +49 69 690-30306
|
||||||
email: fahrerausbildung@fraport.de
|
email: fahrerausbildung@fraport.de
|
||||||
|
url: <http://www.fraport.de/fahrerausbildung>
|
||||||
place: Frankfurt/Main
|
place: Frankfurt/Main
|
||||||
return-address:
|
return-address:
|
||||||
- 60547 Frankfurt
|
- 60547 Frankfurt
|
||||||
opening: Sehr geehrte Damen und Herren,
|
de-opening: Sehr geehrte Damen und Herren,
|
||||||
closing: |
|
en-opening: Dear driver,
|
||||||
|
de-closing: |
|
||||||
Mit freundlichen Grüßen,
|
Mit freundlichen Grüßen,
|
||||||
Ihre Fahrerausbildung.
|
Ihre Fahrerausbildung.
|
||||||
|
en-closing: |
|
||||||
|
Best wishes,
|
||||||
|
Your fraport driving instructors from "Fahrerausbildung".
|
||||||
encludes:
|
encludes:
|
||||||
hyperrefoptions: hidelinks
|
hyperrefoptions: hidelinks
|
||||||
|
|
||||||
@ -36,21 +41,13 @@ Durch die erfolgreiche Teilnahme an einem E-Lernen können Sie
|
|||||||
die Gültigkeit um 2 Jahre verlängern. Verwenden Sie dazu folgende
|
die Gültigkeit um 2 Jahre verlängern. Verwenden Sie dazu folgende
|
||||||
Login-Daten.
|
Login-Daten.
|
||||||
|
|
||||||
URL
|
Name
|
||||||
|
|
||||||
: <http://www.fraport.de/fahrerausbildung>
|
|
||||||
|
|
||||||
Name:
|
|
||||||
|
|
||||||
: $recipient$
|
: $recipient$
|
||||||
|
|
||||||
Login
|
URL
|
||||||
|
|
||||||
: $login$
|
: $url$
|
||||||
|
|
||||||
Pin
|
|
||||||
|
|
||||||
: $pin$
|
|
||||||
|
|
||||||
|
|
||||||
Sobald die Frist abgelaufen ist, muss zur Wiedererlangung des Vorfeldführerscheins
|
Sobald die Frist abgelaufen ist, muss zur Wiedererlangung des Vorfeldführerscheins
|
||||||
@ -66,21 +63,13 @@ your apron diving licence is about to expire soon.
|
|||||||
You may renew your apron driving licence by two years through successfully
|
You may renew your apron driving licence by two years through successfully
|
||||||
completing an e-learning course. Please use the following login data.
|
completing an e-learning course. Please use the following login data.
|
||||||
|
|
||||||
URL
|
Name
|
||||||
|
|
||||||
: <http://www.fraport.de/fahrerausbildung>
|
|
||||||
|
|
||||||
Name:
|
|
||||||
|
|
||||||
: $recipient$
|
: $recipient$
|
||||||
|
|
||||||
Login
|
URL
|
||||||
|
|
||||||
: $login$
|
: $url$
|
||||||
|
|
||||||
Pin
|
|
||||||
|
|
||||||
: $pin$
|
|
||||||
|
|
||||||
|
|
||||||
Should your apron driving licence expire before completing this
|
Should your apron driving licence expire before completing this
|
||||||
|
|||||||
Reference in New Issue
Block a user