commit 93d0ec10d1deeb8c7388559f49aa07ad536d5c52
Author: Matej Zeman <zeman339@gmail.com>
Date:   Mon May 16 17:08:02 2022 +0200

    re #9846 Filter text fields keeps their searched content.

diff --git a/server/sql_app/api/bodydevices_web.py b/server/sql_app/api/bodydevices_web.py
index b00c8d8..26ae5f9 100644
--- a/server/sql_app/api/bodydevices_web.py
+++ b/server/sql_app/api/bodydevices_web.py
@@ -48,12 +48,14 @@ async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Se
     if current_user == "admin":
         return templates.TemplateResponse("body_devices.html", {"request": request, "devices": device_dict,
                                                                 "devs": devices, "teams": teams, "licenses": licenses,
-                                                                "user": current_user})
+                                                                "user": current_user, "body_val": "", "lic_val": "",
+                                                                "team_val": ""})
     else:
         current_user = "guest"
         return templates.TemplateResponse("body_devices_normal.html", {"request": request, "devices": device_dict,
                                                                 "devs": devices, "teams": teams, "licenses": licenses,
-                                                                "user": current_user})
+                                                                "user": current_user, "body_val": "", "lic_val": "",
+                                                                "team_val": ""})
 
 
 @body_device_web.post("/body-devices-web", response_class=HTMLResponse)
@@ -77,16 +79,24 @@ async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
         lic = crud.get_license(db, dev.license_id)
         device_dict.append({"device": dev, "license": lic, "log": dev.b_logs[len(dev.b_logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if body_id == "all":
+        body_id = ""
+    if lic_id == "all":
+        lic_id = ""
+    if team == "all":
+        team = ""
     if current_user == "admin":
         return templates.TemplateResponse("body_devices.html", {"request": request, "devices": device_dict,
                                                                 "devs": devices, "teams": teams, "licenses": licenses,
-                                                                "user": current_user})
+                                                                "user": current_user, "body_val": body_id, "lic_val": lic_id,
+                                                                "team_val": team})
     else:
         current_user = "guest"
         return templates.TemplateResponse("body_devices_normal.html", {"request": request, "devices": device_dict,
                                                                        "devs": devices, "teams": teams,
                                                                        "licenses": licenses,
-                                                                       "user": current_user})
+                                                                       "user": current_user, "body_val": body_id, "lic_val": lic_id,
+                                                                       "team_val": team})
 
 
 @body_device_web.get("/body-device-license/{device_id}", response_class=HTMLResponse)
diff --git a/server/sql_app/api/devices_web.py b/server/sql_app/api/devices_web.py
index ff0f029..82f9458 100644
--- a/server/sql_app/api/devices_web.py
+++ b/server/sql_app/api/devices_web.py
@@ -51,12 +51,15 @@ async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Se
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
     if current_user == "admin":
         return templates.TemplateResponse("devices.html", {"request": request, "devices": device_dict,
-                                                           "licenses": licenses, "devs": devices,
+                                                           "licenses": licenses, "devs": devices, "keyman_val": "",
+                                                           "licn_val": "", "lici_val": "", "team_val": "",
                                                            "teams": teams, "user": current_user})
     else:
         current_user = "guest"
         return templates.TemplateResponse("devices_normal.html", {"request": request, "devices": device_dict,
-                                                                  "licenses": licenses, "user": current_user})
+                                                                  "licenses": licenses, "devs": devices, "keyman_val": "",
+                                                                  "licn_val": "", "lici_val": "", "team_val": "",
+                                                                  "teams": teams, "user": current_user})
 
 
 @device_web.post("/devices-web", response_class=HTMLResponse)
@@ -85,14 +88,25 @@ async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
         else:
             device_dict.append({"device": dev, "license": dev.licenses, "log": dev.logs[len(dev.logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if keyman_id == "all":
+        keyman_id = ""
+    if lic_name == "all":
+        lic_name = ""
+    if lic_id == "all":
+        lic_id = ""
+    if team == "all":
+        team = ""
     if current_user == "admin":
         return templates.TemplateResponse("devices.html", {"request": request, "devices": device_dict,
-                                                           "licenses": licenses, "devs": devices,
+                                                           "licenses": licenses, "devs": devices, "keyman_val": keyman_id,
+                                                           "licn_val": lic_name, "lici_val": lic_id, "team_val": team,
                                                            "teams": teams, "user": current_user})
     else:
         current_user = "guest"
         return templates.TemplateResponse("devices_normal.html", {"request": request, "devices": device_dict,
-                                                                  "licenses": licenses, "user": current_user})
+                                                                  "licenses": licenses, "devs": devices, "keyman_val": keyman_id,
+                                                                  "licn_val": lic_name, "lici_val": lic_id, "team_val": team,
+                                                                  "teams": teams, "user": current_user})
 
 
 @device_web.get("/device-license/{device_id}", response_class=HTMLResponse)
diff --git a/server/sql_app/api/headdevices_web.py b/server/sql_app/api/headdevices_web.py
index 2e6452b..974d128 100644
--- a/server/sql_app/api/headdevices_web.py
+++ b/server/sql_app/api/headdevices_web.py
@@ -48,12 +48,14 @@ async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Se
     if current_user == "admin":
         return templates.TemplateResponse("head_devices.html", {"request": request, "devices": device_dict,
                                                                 "devs": devices, "teams": teams, "licenses": licenses,
-                                                                "user": current_user})
+                                                                "user": current_user, "body_val": "", "lic_val": "",
+                                                                "team_val": ""})
     else:
         current_user = "guest"
         return templates.TemplateResponse("head_devices_normal.html", {"request": request, "devices": device_dict,
                                                                 "devs": devices, "teams": teams, "licenses": licenses,
-                                                                "user": current_user})
+                                                                "user": current_user, "body_val": "", "lic_val": "",
+                                                                "team_val": ""})
 
 
 @head_device_web.post("/head-devices-web", response_class=HTMLResponse)
@@ -77,16 +79,24 @@ async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
         lic = crud.get_license(db, dev.license_id)
         device_dict.append({"device": dev, "license": lic, "log": dev.h_logs[len(dev.h_logs) - 1]})
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if body_id == "all":
+        body_id = ""
+    if lic_id == "all":
+        lic_id = ""
+    if team == "all":
+        team = ""
     if current_user == "admin":
         return templates.TemplateResponse("head_devices.html", {"request": request, "devices": device_dict,
                                                                 "devs": devices, "teams": teams, "licenses": licenses,
-                                                                "user": current_user})
+                                                                "user": current_user, "body_val": body_id, "lic_val": lic_id,
+                                                                "team_val": team})
     else:
         current_user = "guest"
         return templates.TemplateResponse("head_devices_normal.html", {"request": request, "devices": device_dict,
                                                                        "devs": devices, "teams": teams,
                                                                        "licenses": licenses,
-                                                                       "user": current_user})
+                                                                       "user": current_user, "body_val": body_id, "lic_val": lic_id,
+                                                                       "team_val": team})
 
 
 @head_device_web.get("/head-device-license/{device_id}", response_class=HTMLResponse)
diff --git a/server/sql_app/api/ld_logs_web.py b/server/sql_app/api/ld_logs_web.py
index aef3733..c2059fb 100644
--- a/server/sql_app/api/ld_logs_web.py
+++ b/server/sql_app/api/ld_logs_web.py
@@ -46,12 +46,14 @@ async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Sessi
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
     if current_user == "admin":
         return templates.TemplateResponse("ldlogs.html", {"request": request, "logs": logs, "pcs": pc_obj, "teams": teams,
-                                                          "licenses": licenses, "user": current_user})
+                                                          "licenses": licenses, "user": current_user, "pc_val": "",
+                                                          "team_val": "", "lic_val": ""})
     else:
         current_user = "guest"
         return templates.TemplateResponse("ldlogs_normal.html",
                                           {"request": request, "logs": logs, "pcs": pc_obj, "teams": teams,
-                                           "licenses": licenses, "user": current_user})
+                                           "licenses": licenses, "user": current_user, "pc_val": "",
+                                                          "team_val": "", "lic_val": ""})
 
 
 @ldlogs_web.post("/ldlogs-web", response_class=HTMLResponse)
@@ -71,11 +73,19 @@ async def filter_logs(request: Request, pc: str = Form("all"), team: str = Form(
     pc_obj = crud.get_pcs(db, skip=skip, limit=limit)
     teams = crud.get_teams(db, skip=skip, limit=limit)
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if team == "all":
+        team = ""
+    if pc == "all":
+        pc = ""
+    if lic == "all":
+        lic = ""
     if current_user == "admin":
         return templates.TemplateResponse("ldlogs.html", {"request": request, "logs": logs, "pcs": pc_obj, "teams": teams,
-                                                          "licenses": licenses, "user": current_user})
+                                                          "licenses": licenses, "user": current_user, "pc_val": pc,
+                                                          "team_val": team, "lic_val": lic})
     else:
         current_user = "guest"
         return templates.TemplateResponse("ldlogs_normal.html",
                                           {"request": request, "logs": logs, "pcs": pc_obj, "teams": teams,
-                                           "licenses": licenses, "user": current_user})
+                                           "licenses": licenses, "user": current_user, "pc_val": pc,
+                                                          "team_val": team, "lic_val": lic})
diff --git a/server/sql_app/api/usb_logs_web.py b/server/sql_app/api/usb_logs_web.py
index 75ebdc6..13729ef 100644
--- a/server/sql_app/api/usb_logs_web.py
+++ b/server/sql_app/api/usb_logs_web.py
@@ -46,17 +46,18 @@ async def read_logs(request: Request, skip: int = 0, limit: int = 100, db: Sessi
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
     if current_user == "admin":
         return templates.TemplateResponse("logs.html", {"request": request, "logs": logs, "pcs": pc_obj, "teams": teams,
-                                                        "licenses": licenses, "user": current_user})
+                                                        "licenses": licenses, "user": current_user, "pc_val": "",
+                                                        "team_val": "", "lic_val": ""})
     else:
         current_user = "guest"
         return templates.TemplateResponse("logs_normal.html", {"request": request, "logs": logs, "pcs": pc_obj, "teams": teams,
-                                                        "licenses": licenses, "user": current_user})
+                                                        "licenses": licenses, "user": current_user, "pc_val": "",
+                                                        "team_val": "", "lic_val": ""})
 
 
 @usblogs_web.post("/logs-web", response_class=HTMLResponse)
 async def filter_logs(request: Request, pc: str = Form("all"), team: str = Form("all"), lic: str = Form("all"),
-                      skip: int = 0, limit: int = 100,
-                      db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
+                      skip: int = 0, limit: int = 100, db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     """
     Endpoint used for filtering usb logs by user given form inputs.
     """
@@ -70,13 +71,21 @@ async def filter_logs(request: Request, pc: str = Form("all"), team: str = Form(
     pc_obj = crud.get_pcs(db, skip=skip, limit=limit)
     teams = crud.get_teams(db, skip=skip, limit=limit)
     licenses = crud.get_licenses(db, skip=skip, limit=limit)
+    if team == "all":
+        team = ""
+    if pc == "all":
+        pc = ""
+    if lic == "all":
+        lic = ""
     if current_user == "admin":
         return templates.TemplateResponse("logs.html", {"request": request, "logs": logs, "pcs": pc_obj, "teams": teams,
-                                                        "licenses": licenses, "user": current_user})
+                                                        "licenses": licenses, "user": current_user, "pc_val": pc,
+                                                        "team_val": team, "lic_val": lic})
     else:
         current_user = "guest"
         return templates.TemplateResponse("logs_normal.html", {"request": request, "logs": logs, "pcs": pc_obj, "teams": teams,
-                                                        "licenses": licenses, "user": current_user})
+                                                        "licenses": licenses, "user": current_user, "pc_val": pc,
+                                                        "team_val": team, "lic_val": lic})
 
 
 @usblogs_web.get("/", response_class=HTMLResponse)
diff --git a/server/sql_app/api/users_web.py b/server/sql_app/api/users_web.py
index 523b22f..41a49d0 100644
--- a/server/sql_app/api/users_web.py
+++ b/server/sql_app/api/users_web.py
@@ -37,7 +37,7 @@ async def read_usrs(request: Request, skip: int = 0, limit: int = 100, db: Sessi
     current_user = Authorize.get_jwt_subject()
     users = crud.get_users(db, skip, limit)
     if current_user == "admin":
-        return templates.TemplateResponse("users.html", {"request": request, "users": users})
+        return templates.TemplateResponse("users.html", {"request": request, "users": users, "user": current_user})
     else:
         return RedirectResponse(url=f"/logs-web", status_code=303)
 
diff --git a/server/templates/body-devices/body_devices.html b/server/templates/body-devices/body_devices.html
index 3492e41..8eff2b3 100644
--- a/server/templates/body-devices/body_devices.html
+++ b/server/templates/body-devices/body_devices.html
@@ -60,21 +60,21 @@
 </form>
 <form action="/body-devices-web" method="post">
     <label for="body_id">Body Device ID:</label>
-    <input id="body_id" name="body_id" type="text" list="body_ids" value="" placeholder="all">
+    <input id="body_id" name="body_id" type="text" list="body_ids" value="{{body_val}}" placeholder="all" onClick="this.select();">
     <datalist id="body_ids">
         {% for dev in devs %}
         <option value="{{dev.serial_number}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic_id">License ID:</label>
-    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="{{lic_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses_ids">
         {% for license in licenses %}
         <option value="{{license.license_id}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}">{{team.name}}</option>
diff --git a/server/templates/body-devices/body_devices_normal.html b/server/templates/body-devices/body_devices_normal.html
index 39ba939..f312309 100644
--- a/server/templates/body-devices/body_devices_normal.html
+++ b/server/templates/body-devices/body_devices_normal.html
@@ -59,21 +59,21 @@
 </form>
 <form action="/body-devices-web" method="post">
     <label for="body_id">Body Device ID:</label>
-    <input id="body_id" name="body_id" type="text" list="body_ids" value="" placeholder="all">
+    <input id="body_id" name="body_id" type="text" list="body_ids" value="{{body_val}}" placeholder="all" onClick="this.select();">
     <datalist id="body_ids">
         {% for dev in devs %}
         <option value="{{dev.serial_number}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic_id">License ID:</label>
-    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="{{lic_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses_ids">
         {% for license in licenses %}
         <option value="{{license.license_id}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}">{{team.name}}</option>
diff --git a/server/templates/devices/devices.html b/server/templates/devices/devices.html
index 4d8c620..92620fe 100644
--- a/server/templates/devices/devices.html
+++ b/server/templates/devices/devices.html
@@ -60,28 +60,28 @@
 </form>
 <form action="/devices-web" method="post">
     <label for="keyman_id">Keyman ID:</label>
-    <input id="keyman_id" name="keyman_id" type="text" list="keyman_ids" value="" placeholder="all">
+    <input id="keyman_id" name="keyman_id" type="text" list="keyman_ids" value="{{keyman_val}}" placeholder="all" onClick="this.select();">
     <datalist id="keyman_ids">
         {% for dev in devs %}
         <option value="{{dev.serial_number}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic_name">License Type:</label>
-    <input id="lic_name" name="lic_name" type="text" list="licenses_names" value="" placeholder="all">
+    <input id="lic_name" name="lic_name" type="text" list="licenses_names" value="{{licn_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses_names">
         {% for license in licenses %}
         <option value="{{license.name}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic_id">License ID:</label>
-    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="{{lici_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses_ids">
         {% for license in licenses %}
         <option value="{{license.license_id}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}">{{team.name}}</option>
diff --git a/server/templates/devices/devices_normal.html b/server/templates/devices/devices_normal.html
index 1c77480..71f5fb9 100644
--- a/server/templates/devices/devices_normal.html
+++ b/server/templates/devices/devices_normal.html
@@ -58,13 +58,34 @@
   <input type="submit" value="OK">
 </form>
 <form action="/devices-web" method="post">
-    <label for="lic">License:</label>
-    <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
-    <datalist id="licenses">
+    <label for="keyman_id">Keyman ID:</label>
+    <input id="keyman_id" name="keyman_id" type="text" list="keyman_ids" value="{{keyman_val}}" placeholder="all" onClick="this.select();">
+    <datalist id="keyman_ids">
+        {% for dev in devs %}
+        <option value="{{dev.serial_number}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="lic_name">License Type:</label>
+    <input id="lic_name" name="lic_name" type="text" list="licenses_names" value="{{licn_val}}" placeholder="all" onClick="this.select();">
+    <datalist id="licenses_names">
         {% for license in licenses %}
         <option value="{{license.name}}"></option>
         {% endfor %}
     </datalist>
+    <label for="lic_id">License ID:</label>
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="{{lici_val}}" placeholder="all" onClick="this.select();">
+    <datalist id="licenses_ids">
+        {% for license in licenses %}
+        <option value="{{license.license_id}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="team">Team:</label>
+    <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
+    <datalist id="teams">
+        {% for team in teams %}
+        <option value="{{team.name}}">{{team.name}}</option>
+        {% endfor %}
+    </datalist>
   <input type="submit" value="Filter">
 </form>
 <table id="devices">
@@ -83,7 +104,7 @@
     </TR>
     {% for dev in devices %}
     <TR>
-        <TD class="ID">{{dev['device'].id}}</TD>
+        <TD class="ID"><a href="/device-license/{{dev['device'].id}}">{{dev['device'].id}}</a></TD>
         <TD class="Serial Number">{{dev['device'].serial_number}}</TD>
         <TD class="License">{{dev['license'].name}}</TD>
         <TD class="License ID">{{dev['license'].license_id}}</TD>
diff --git a/server/templates/head_devices/head_devices.html b/server/templates/head_devices/head_devices.html
index 42117e4..6c86bda 100644
--- a/server/templates/head_devices/head_devices.html
+++ b/server/templates/head_devices/head_devices.html
@@ -60,21 +60,21 @@
 </form>
 <form action="/head-devices-web" method="post">
     <label for="body_id">Head Device ID:</label>
-    <input id="body_id" name="body_id" type="text" list="body_ids" value="" placeholder="all">
+    <input id="body_id" name="body_id" type="text" list="body_ids" value="{{body_val}}" placeholder="all" onClick="this.select();">
     <datalist id="body_ids">
         {% for dev in devs %}
         <option value="{{dev.serial_number}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic_id">License ID:</label>
-    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="{{lic_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses_ids">
         {% for license in licenses %}
         <option value="{{license.license_id}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}">{{team.name}}</option>
diff --git a/server/templates/head_devices/head_devices_normal.html b/server/templates/head_devices/head_devices_normal.html
index 8df6d97..baf26a0 100644
--- a/server/templates/head_devices/head_devices_normal.html
+++ b/server/templates/head_devices/head_devices_normal.html
@@ -59,21 +59,21 @@
 </form>
 <form action="/head-devices-web" method="post">
     <label for="body_id">Head Device ID:</label>
-    <input id="body_id" name="body_id" type="text" list="body_ids" value="" placeholder="all">
+    <input id="body_id" name="body_id" type="text" list="body_ids" value="{{body_val}}" placeholder="all" onClick="this.select();">
     <datalist id="body_ids">
         {% for dev in devs %}
         <option value="{{dev.serial_number}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic_id">License ID:</label>
-    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="" placeholder="all">
+    <input id="lic_id" name="lic_id" type="text" list="licenses_ids" value="{{lic_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses_ids">
         {% for license in licenses %}
         <option value="{{license.license_id}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-    <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+    <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}">{{team.name}}</option>
diff --git a/server/templates/ld-logs/ldlogs.html b/server/templates/ld-logs/ldlogs.html
index e7f36cf..cb48627 100644
--- a/server/templates/ld-logs/ldlogs.html
+++ b/server/templates/ld-logs/ldlogs.html
@@ -60,21 +60,21 @@
 </form>
 <form action="/ldlogs-web" method="post">
   <label for="pc">PC:</label>
-  <input id="pc" name="pc" type="text" list="pcs" value="" placeholder="all">
+  <input id="pc" name="pc" type="text" list="pcs" value="{{pc_val}}" placeholder="all" onClick="this.select();">
     <datalist id="pcs">
         {% for pc in pcs %}
         <option value="{{pc.username}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-  <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+  <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic">License:</label>
-    <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
+    <input id="lic" name="lic" type="text" list="licenses" value="{{lic_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses">
         {% for license in licenses %}
         <option value="{{license.license_id}}"></option>
diff --git a/server/templates/ld-logs/ldlogs_normal.html b/server/templates/ld-logs/ldlogs_normal.html
index bcdf40a..c87571f 100644
--- a/server/templates/ld-logs/ldlogs_normal.html
+++ b/server/templates/ld-logs/ldlogs_normal.html
@@ -59,21 +59,21 @@
 </form>
 <form action="/ldlogs-web" method="post">
   <label for="pc">PC:</label>
-  <input id="pc" name="pc" type="text" list="pcs" value="" placeholder="all">
+  <input id="pc" name="pc" type="text" list="pcs" value="{{pc_val}}" placeholder="all" onClick="this.select();">
     <datalist id="pcs">
         {% for pc in pcs %}
         <option value="{{pc.username}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-  <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+  <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic">License:</label>
-    <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
+    <input id="lic" name="lic" type="text" list="licenses" value="{{lic_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses">
         {% for license in licenses %}
         <option value="{{license.name}} : {{license.license_id}}"></option>
diff --git a/server/templates/usb-logs/logs.html b/server/templates/usb-logs/logs.html
index fdecc00..3bafd19 100644
--- a/server/templates/usb-logs/logs.html
+++ b/server/templates/usb-logs/logs.html
@@ -60,21 +60,21 @@
 </form>
 <form action="/logs-web" method="post">
   <label for="pc">PC:</label>
-  <input id="pc" name="pc" type="text" list="pcs" value="" placeholder="all">
+  <input id="pc" name="pc" type="text" list="pcs" value="{{pc_val}}" placeholder="all" onClick="this.select();">
     <datalist id="pcs">
         {% for pc in pcs %}
         <option value="{{pc.username}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-  <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+  <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic">License:</label>
-    <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
+    <input id="lic" name="lic" type="text" list="licenses" value="{{lic_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses">
         {% for license in licenses %}
         <option value="{{license.name}}"></option>
diff --git a/server/templates/usb-logs/logs_normal.html b/server/templates/usb-logs/logs_normal.html
index d954447..a43a0e4 100644
--- a/server/templates/usb-logs/logs_normal.html
+++ b/server/templates/usb-logs/logs_normal.html
@@ -59,21 +59,21 @@
 </form>
 <form action="/logs-web" method="post">
   <label for="pc">PC:</label>
-  <input id="pc" name="pc" type="text" list="pcs" value="" placeholder="all">
+  <input id="pc" name="pc" type="text" list="pcs" value="{{pc_val}}" placeholder="all" onClick="this.select();">
     <datalist id="pcs">
         {% for pc in pcs %}
         <option value="{{pc.username}}"></option>
         {% endfor %}
     </datalist>
     <label for="team">Team:</label>
-  <input id="team" name="team" type="text" list="teams" value="" placeholder="all">
+  <input id="team" name="team" type="text" list="teams" value="{{team_val}}" placeholder="all" onClick="this.select();">
     <datalist id="teams">
         {% for team in teams %}
         <option value="{{team.name}}"></option>
         {% endfor %}
     </datalist>
     <label for="lic">License:</label>
-    <input id="lic" name="lic" type="text" list="licenses" value="" placeholder="all">
+    <input id="lic" name="lic" type="text" list="licenses" value="{{lic_val}}" placeholder="all" onClick="this.select();">
     <datalist id="licenses">
         {% for license in licenses %}
         <option value="{{license.name}}"></option>
diff --git a/server/templates/users/users.html b/server/templates/users/users.html
index bdbec4b..1f71950 100644
--- a/server/templates/users/users.html
+++ b/server/templates/users/users.html
@@ -27,6 +27,9 @@
     <title>Users Details</title>
 </head>
 <body>
+<div style='float:left;padding-right:20px'>
+<b>Your role: {{user}}</b>
+</div>
 <div style='float:left;padding-right:5px'>
 <form action="/login" method="get">
     <input type="submit" value="Login" />
