<!DOCTYPE html>
<html lang="fr" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="fragments.html :: head(#{recipe.touchup.title}, null)"></th:block>
</head>
<body>
<!-- Fragment de l'entête -->
<header th:include="fragments.html :: header(true)"></header>
<!-- Corps de la page -->
<section>
    <div th:include="fragments.html :: messages"></div>
</section>
<!-- Fragment du pied de page -->
<footer th:include="fragments.html :: footer(null, true)"></footer>
<script th:include="fragments.html :: printStrings"></script>
<script type="module">
    /*<![CDATA[*/
    import {PtouchPrinter} from "/js/ptouchPrint.js";

    const jobNumber = "[[${jobNumber}]]";

    $(async () => {
        const printer = new PtouchPrinter({
            template: "Touchup",
            lines: [
                {name: "job", value: jobNumber}
            ]
        });
        const errorCode = await printer.print();
        switch (errorCode) {
            case -1:
                showMessage(errorMsg, bpacNotInstalledError, false);
                break;
            case 99:
                showMessage(errorMsg, printError, false);
                break;
            case 1:
                showMessage(successMsg, printingMessage, false);
                break;
            default:
                showMessage(errorMsg, generalErrorText, false);
                break;
        }

        setTimeout(() => {
            window.location.href = referer;
        }, 3000);
    });
    /*]]>*/
</script>
</body>
</html>
