10 display: inline-block;
16 border: 1px solid black;
18 display: inline-block;
25 .events-box .btnline {
38 <form style="position: absolute; right: 15%; width: 15%; height: 15%;">
39 <button type="button" id="logout_button" onclick="logout()" style="width: 100%; height: 100%;">logout</button>
42 <h1>Hello, {{ name }}!</h1>
47 {% if counts|length > 0 %}
50 {%- if counts|length > 1 -%}
52 {%- if counts|length > 2 -%}
56 {%- elif not loop.first -%}
66 {%- if c[1] != 1 -%}s{%- endif -%}
71 <img src="{{ url_for('coffee_graph_history', _external=True, stamp=stamp) }}">
72 <img src="{{ url_for('coffee_graph_flavors', _external=True, stamp=stamp) }}">
77 {% for flavor in flavors %}
78 <input type="button" value="{{ flavor }}" onclick="addCoffee(this.value)" style="padding: 1.2%; margin: 3px">
84 <p>Use your card/token to log in...</p>
86 <img src="{{ url_for('coffee_graph_history', _external=True, stamp=stamp) }}">
87 <img src="{{ url_for('coffee_graph_flavors', _external=True, stamp=stamp, days=7) }}">
95 {%- macro event_box(title, events) -%}
96 <div class="events-box">
97 <h4>{{title | capitalize}}</h4>
98 {#- The first item in the list is used as button label, last item in the overview -#}
100 "COFFEE_MACHINE_CLEANED": ["cleaned"],
101 "COFFEE_PACK_OPENED": ["opened"],
102 "LAST_COFFEE_PACK_OPENED": ["last opened"],
103 "MILK_CONTAINER_CLEANED": ["cleaned (water)", "cleaned"],
104 "MILK_CONTAINER_CLEANED_WITH_TABLET": ["cleaned (tablet)"],
107 {% if name -%} {# User logged in - show action buttons #}
108 {%- for event in events %}
109 <div class="btnline">
110 <input type="button" value="{{ verb[event]|first }}"
111 onclick="addEvent('{{ event }}', '{{ verb[events[0]]|last }} the {{ title }}')" />
112 ({{ last_events[event] | humanize(max_interval="days") if event in last_events else "never" }})
115 {%- else -%} {# Nobody logged in - show overview with summary times #}
116 {# Calculate maximum timestamp of all relevant events #}
117 {%- set when = last_events.items() | selectattr(0, 'in',
118 events) | map(attribute=1) | max | humanize(max_interval="days") -%}
120 {{ verb[events[0]]|last }} {{ when }}
122 never {{ verb[events[0]]|last }}
128 <h3>{{ ("Record<br />event" if name else "Events") | safe }}:</h3>
129 {{ event_box('coffee machine', ['COFFEE_MACHINE_CLEANED'] ) }}
130 {{ event_box('milk container', ['MILK_CONTAINER_CLEANED', 'MILK_CONTAINER_CLEANED_WITH_TABLET'] ) }}
132 {{ event_box('coffee pack', ['COFFEE_PACK_OPENED'] ) }}
136 {##################################}
137 {# User name and chip idnetifiers #}
138 {##################################}
143 <label for="username">Username:</label>
144 <input id="username" type="text" name="name">
145 <input type="button" value="rename" onclick="renameUser()">
149 <table style="padding: 2px">
151 <td colspan="4" align="center"><b>Identifiers:</b></td>
153 {% for id in identifiers %}
155 <td><input type="text" id="identifier_name_{{ loop.index }}" value="{{ id[2] }}" /></td>
156 <td {% if iid == id[1] %} style="font-weight: bold" {% endif %}>#<span id="identifier_{{ loop.index }}">{{ id[1] }}</span></td>
157 <td><input type="button" value="rename" onclick="renameIdentifier({{ loop.index }})" /></td>
158 <td><input type="button" value="remove" onclick="disableIdentifier('{{ id[1] }}')" /></td>
162 <td><input type="button" id="addIdentifier" value="add identifier" onclick="addIdentifier_start()" /></td>
163 <td colspan="2" style="visibility: hidden" id="labelIdentifier"><b>Use your identifier.</b></td>
164 <td><input type="button" id="abortIdentifier" value="abort" disabled onclick="addIdentifier_finish()" /></td>