summaryrefslogtreecommitdiff
path: root/templates/index.html
blob: 99bfc313c3182cfa3759e57099f00e67e300d981 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Tidsreg</title>

    <!-- TODO REMOVE -->
    <script src="https://unpkg.com/htmx.org@1.9.12/dist/htmx.js" integrity="sha384-qbtR4rS9RrUMECUWDWM2+YGgN3U4V4ZncZ0BvUcg9FGct0jqXz3PUdVpU1p0yrXS" crossorigin="anonymous"></script>
    <script src="https://unpkg.com/htmx.org@1.9.12/dist/ext/response-targets.js"></script>

    <style>
.flex {
  display: flex;
}

.dir-column {
  flex-direction: column;
}

.flex-grow {
  flex-grow: 1;
}

.just-start {
  justify-content: flex-start;
}

.just-space-between {
  justify-content: space-between;
}

#task-bar {
  margin-left: 10px;
  border: 1px solid black;
}

.short {
  max-width: 50px;
}

.status-started {
  background-color: lightgreen;
}

.status-stopped {
  background-color: lightblue;
}

.status-detached {
  background-color: lightyellow;
}

#entry-bar {
  border: 1px solid black;
  padding-top: 10px;
}

#entry-form {
  padding: 10px;
  margin-buttom: 10px;
}

.entry-box {
}

#controls-bar {
  margin-bottom: 10px;
}

#taskForm {
  background-color: lightblue;
  padding: 10px;
  max-width: 500px;
}

#error-box {
  color: red;
  font-weight: bold;
}
    </style>

  </head>
  <body hx-ext="response-targets">
    <div id="controls-bar">
      <button hx-get="/" hx-replace-url="true" hx-params="date" hx-vals='{"date": "{{.DateInfo.Yesterday}}"}' hx-target="body">I går</button>
      <input type="date" hx-get="/" hx-replace-url="true" hx-params="date" hx-vals='js:{date: event.target.value}' autocomplete="off" hx-target="body" hx-trigger="change" value="{{.DateInfo.Date}}" />
      <button hx-get="/" hx-replace-url="true" hx-params="date" hx-vals='{"date": "{{.DateInfo.Tomorrow}}"}' hx-target="body">I morgen</button>
      <div id="error-box"></div>
    </div>
    <div class="flex" hx-target-*="#error-box">
      <div id="entry-bar">
        {{template "entry.html" .Entry}}
        <div>
          <div>
            <table>
              <thead>
                <tr>
                  <th>Id</th>
                  <th>Fra</th>
                  <th>Til</th>
                  <th>Mærker</th>
                  <th>Beskrivelse</th>
                  <th>Handlinger</th>
                </tr>
              </thead>
              {{ template "entryRows.html" . }}
            </table>
          </div>
        </div>
      </div>
      <div id="task-bar">
        <form autocomplete="off">
          <label for="timeRangeSelect">Vis fra: </label>
          <select id="timeRangeSelect">
            <option value="week">Uge</option>
            <option value="month">Måned</option>
            <option value="all">Altid</option>
          </select>
          <label for="roundTimeSelect">Rund til: </label>
          <select id="roundTimeSelect">
            <option value="m6">6 min</option>
            <option value="m12">12 min</option>
            <option value="m15">15 min</option>
            <option value="m30">30 min</option>
          </select>
        </form>
        {{ template "task.html" .Task }}
        {{ template "taskRows.html" .Tasks }}
      </div>
    </div>
  </body>
</html>