summaryrefslogtreecommitdiff
path: root/src/main/resources/templates/index.html
blob: ed1988b4d737b337e79ff404d5cf1cc045dd7624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<!DOCTYPE html>
<html lang="de" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>ETL-Processor</title>
    <link rel="stylesheet" th:href="@{/main.css}"/>
</head>
<body>
    <div th:replace="~{fragments.html :: nav}"></div>
    <main>

        <div class="search-form" sec:authorize="hasRole('USER') or hasRole('ADMIN')">
            <form th:action="@{/}" method="get">
                <input id="search-input" type="text" name="q" maxlength="64" placeholder="Suche nach Patienten-Pseudonym oder TAN" th:value="${query}"/>
                <select name="f" onchange="this.form.submit()">
                    <option value="">in allen Anfragen</option>
                    <option th:selected="${filter == 'all-dip'}" th:value="all-dip">in DNPM:DIP</option>
                    <option th:if="${postInitialSubmissionBlock}" th:selected="${filter == 'confirmed'}" th:value="confirmed">in DNPM:DIP mit Meldebestätigung</option>
                    <option th:if="${postInitialSubmissionBlock}" th:selected="${filter == 'unconfirmed'}" th:value="unconfirmed">in DNPM:DIP ohne Meldebestätigung</option>
                </select>
                <a th:href="@{/}">🞫</a>
            </form>
        </div>

        <h1>
            <th:block th:switch="${filter}">
                <th:block th:case="null">Alle Anfragen</th:block>
                <th:block th:case="'all-dip'">Alle Anfragen in DNPM:DIP</th:block>
                <th:block th:case="'confirmed'">Alle Anfragen in DNPM:DIP mit Meldebestätigung</th:block>
                <th:block th:case="'unconfirmed'">Alle Anfragen in DNPM:DIP ohne Meldebestätigung</th:block>
            </th:block>
            <a id="reload-notify" class="btn btn-red reload" title="Neue Anfragen laden" th:href="@{/}">
                <span>Neue Anfragen laden</span>
            </a>
        </h1>

        <div>
            <h2 th:if="${patientPseudonym != null}">
                Betreffend Patienten-Pseudonym <span class="monospace" th:text="${patientPseudonym}">***</span>
                <a class="btn btn-blue" th:href="@{/}">Alle anzeigen</a>
            </h2>

            <h2 th:if="not ${null == query || query.isBlank()}">
                Für die Suche nach &#8222;<span class="monospace" th:text="${query}">***</span>&#8220;
                <a class="btn btn-blue" th:href="@{/}">Alle anzeigen</a>
            </h2>
        </div>

        <div class="border" th:if="${requests.totalElements == 0}">
            <div class="notification info">Noch keine Anfragen eingegangen</div>
        </div>

        <div th:if="${requests.totalElements > 0}">
            <div class="paged">
                <th:block th:insert="~{fragments :: request}" th:each="request : ${requests}">
                </th:block>
            </div>
            <div th:if="${patientPseudonym == null}" class="page-control">
                <a id="first-page-link" th:href="@{/(q=${query},f=${filter},page=${0})}" title="Zum Anfang: Taste W" th:if="${not requests.isFirst()}">&#x23EE;</a><a th:if="${requests.isFirst()}">&#x23EE;</a>
                <a id="prev-page-link" th:href="@{/(q=${query},f=${filter},page=${requests.getNumber() - 1})}" title="Seite zurück: Taste A" th:if="${not requests.isFirst()}">&#x23F4;</a><a th:if="${requests.isFirst()}">&#x23F4;</a>
                <span>Seite [[ ${requests.getNumber() + 1} ]] von [[ ${requests.getTotalPages()} ]]</span>
                <a id="next-page-link" th:href="@{/(q=${query},f=${filter},page=${requests.getNumber() + 1})}" title="Seite vor: Taste D" th:if="${not requests.isLast()}">&#x23F5;</a><a th:if="${requests.isLast()}">&#x23F5;</a>
                <a id="last-page-link" th:href="@{/(q=${query},f=${filter},page=${requests.getTotalPages() - 1})}" title="Zum Ende: Taste S" th:if="${not requests.isLast()}">&#x23ED;</a><a th:if="${requests.isLast()}">&#x23ED;</a>
            </div>
            <div th:if="${patientPseudonym != null}" class="page-control">
                <a id="first-page-link" th:href="@{/patient/{patientPseudonym}(patientPseudonym=${patientPseudonym},page=${0})}" title="Zum Anfang: Taste W" th:if="${not requests.isFirst()}">&#x23EE;</a><a th:if="${requests.isFirst()}">&#x23EE;</a>
                <a id="prev-page-link" th:href="@{/patient/{patientPseudonym}(patientPseudonym=${patientPseudonym},page=${requests.getNumber() - 1})}" title="Seite zurück: Taste A" th:if="${not requests.isFirst()}">&#x23EE;</a><a th:if="${requests.isFirst()}">&#x23EE;</a>
                <span>Seite [[ ${requests.getNumber() + 1} ]] von [[ ${requests.getTotalPages()} ]]</span>
                <a id="next-page-link" th:href="@{/patient/{patientPseudonym}(patientPseudonym=${patientPseudonym},page=${requests.getNumber() + 1})}" title="Seite vor: Taste D" th:if="${not requests.isLast()}">&#x23F5;</a><a th:if="${requests.isLast()}">&#x23F5;</a>
                <a id="last-page-link" th:href="@{/patient/{patientPseudonym}(patientPseudonym=${patientPseudonym},page=${requests.getTotalPages() - 1})}" title="Zum Ende: Taste S" th:if="${not requests.isLast()}">&#x23ED;</a><a th:if="${requests.isLast()}">&#x23ED;</a>
            </div>
        </div>

    </main>
    <footer th:replace="~{fragments.html :: footer}"></footer>
    <script th:src="@{/main.js}"></script>
    <script>
        window.addEventListener('load', () => {
            let keyBindings = {
                'w': 'first-page-link',
                'a': 'prev-page-link',
                'd': 'next-page-link',
                's': 'last-page-link'
            };
            window.onkeydown = (event) => {
                if (document.activeElement.id !== 'search-input') {
                    for (const [key, elemId] of Object.entries(keyBindings)) {
                        if (event.key === key && document.getElementById(elemId)) {
                            document.getElementById(elemId).style.background = 'yellow';
                            document.getElementById(elemId).click();
                        }
                    }
                }
            };
        });

        window.onload = () => {
            const eventSource = new EventSource('statistics/events');
            eventSource.addEventListener('newrequest', event => {
                console.log(event);
                document.getElementById('reload-notify').style.display = 'inline';
            });
        }
    </script>
</body>
</html>