commit 35168e5f93569072cba4fad064febc3917a673ff
Author: zemanm98@students.zcu.cz <Farnhait123*>
Date:   Sat May 14 16:16:40 2022 +0200

    Fixed minor issues. View on keyman devices changed. Changed database for new keyman x license connection.

diff --git a/server/sql_app/api/devices_web.py b/server/sql_app/api/devices_web.py
index 0d82a6b..73fdf61 100644
--- a/server/sql_app/api/devices_web.py
+++ b/server/sql_app/api/devices_web.py
@@ -8,7 +8,7 @@ from fastapi_jwt_auth import AuthJWT
 from pydantic import BaseModel
 from sqlalchemy.orm import Session
 from sql_app.api.auth import fake_users_db
-from sql_app import crud, models
+from sql_app import crud, models, schemas
 from ..database import SessionLocal, engine
 
 models.Base.metadata.create_all(bind=engine)
@@ -38,23 +38,31 @@ async def read_devices(request: Request, skip: int = 0, limit: int = 100, db: Se
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
 
+    device_dict = []
     devices = crud.get_devices(db, skip=skip, limit=limit)
-    statuses = []
-    # adding state for each device in list
-    for i in range(0, len(devices)):
-        statuses.append(devices[i].logs[len(devices[i].logs) - 1].status)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    # adding dictionary entry with all inforamtions needed in template
+    for dev in devices:
+        if len(dev.licenses) > 0:
+            for lic in dev.licenses:
+                device_dict.append({"device": dev, "license": lic.licenses, "log": dev.logs[len(dev.logs) - 1]})
+        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 current_user == "admin":
-        return templates.TemplateResponse("devices.html", {"request": request, "devs": len(devices), "devices": devices,
-                                                           "statuses": statuses, "licenses": licenses, "user": current_user})
+        return templates.TemplateResponse("devices.html", {"request": request, "devices": device_dict,
+                                                           "licenses": licenses, "devs": devices,
+                                                           "teams": teams, "user": current_user})
     else:
         current_user = "guest"
-        return templates.TemplateResponse("devices_normal.html", {"request": request, "devs": len(devices), "devices": devices,
-                                                                  "statuses": statuses, "licenses": licenses, "user": current_user})
+        return templates.TemplateResponse("devices_normal.html", {"request": request, "devices": device_dict,
+                                                                  "licenses": licenses, "user": current_user})
 
 
 @device_web.post("/devices-web", response_class=HTMLResponse)
-async def filter_devices(request: Request, skip: int = 0, limit: int = 100, lic: str = Form("all"),
+async def filter_devices(request: Request, skip: int = 0, limit: int = 100,
+                         keyman_id: str = Form("all"), lic_name: str = Form("all"),
+                         lic_id: str = Form("all"), team: str = Form("all"),
                          db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     """
     Endpoint used for filtering devices by license. returns html template with only
@@ -62,28 +70,29 @@ async def filter_devices(request: Request, skip: int = 0, limit: int = 100, lic:
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
-    devices = crud.get_devices(db, skip=skip, limit=limit)
-    def_devices = []
+    device_dict = []
+    devices_f = crud.get_filtered_devices(db, keyman_id, lic_name, lic_id, team)
+    ids = []
+    for d in devices_f:
+        ids.append(d[0])
+    devices = crud.get_devices_with_ids(db, ids)
+    teams = crud.get_teams(db, skip=skip, limit=limit)
+    # adding dictionary entry with all inforamtions needed in template
     for dev in devices:
-        for l in dev.licenses:
-            if dev not in def_devices and l.licenses.name == lic:
-                def_devices.append(dev)
-    # if input was default all
-    if lic == "all":
-        def_devices = devices
-    statuses = []
-    for i in range(0, len(def_devices)):
-        statuses.append(def_devices[i].logs[len(def_devices[i].logs) - 1].status)
+        if len(dev.licenses) > 0:
+            for lic in dev.licenses:
+                device_dict.append({"device": dev, "license": lic.licenses, "log": dev.logs[len(dev.logs) - 1]})
+        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 current_user == "admin":
-        return templates.TemplateResponse("devices.html",
-                                          {"request": request, "devs": len(def_devices), "devices": def_devices,
-                                           "statuses": statuses, "licenses": licenses, "user": current_user})
+        return templates.TemplateResponse("devices.html", {"request": request, "devices": device_dict,
+                                                           "licenses": licenses, "devs": devices,
+                                                           "teams": teams, "user": current_user})
     else:
         current_user = "guest"
-        return templates.TemplateResponse("devices_normal.html",
-                                          {"request": request, "devs": len(def_devices), "devices": def_devices,
-                                           "statuses": statuses, "licenses": licenses, "user": current_user})
+        return templates.TemplateResponse("devices_normal.html", {"request": request, "devices": device_dict,
+                                                                  "licenses": licenses, "user": current_user})
 
 
 @device_web.get("/device-license/{device_id}", response_class=HTMLResponse)
@@ -98,19 +107,21 @@ async def connect_dev_lic(request: Request, device_id: int, db: Session = Depend
         return RedirectResponse(url=f"/logs-web", status_code=303)
     device = crud.get_device(db, device_id)
     dev_licenses = crud.get_device_licenses(db, device_id)
-    lic_names = []
+    lic_ids = []
     dev_lics = []
     for dev_lic in dev_licenses:
         dev_lics.append(dev_lic.licenses)
     for dev_lic in dev_licenses:
-        lic_names.append(dev_lic.licenses.name)
+        lic_ids.append(dev_lic.licenses.license_id)
     licenses = crud.get_licenses(db, 0, 100)
     lic_left = []
     for lic in licenses:
-        if lic.name not in lic_names and lic not in lic_left:
+        if lic.license_id not in lic_ids and lic not in lic_left:
             lic_left.append(lic)
+    teams = crud.get_teams(db, 0, 100)
     return templates.TemplateResponse("devicelicense.html",
-                                      {"request": request, "device": device, "licenses": lic_left, "dev_lic": dev_lics})
+                                      {"request": request, "device": device, "licenses": lic_left, "dev_lic": dev_lics,
+                                       "teams": teams})
 
 
 @device_web.post("/devices-web/{device_id}")
@@ -141,3 +152,45 @@ async def delete_post(device_id: int, lic_del: str = Form(...), db: Session = De
         return RedirectResponse(url=f"/logs-web", status_code=303)
     crud.delete_device_license(db, device_id, int(lic_del))
     return RedirectResponse(url=f"/devices-web", status_code=303)
+
+@device_web.post("/devices-web-team/{device_id}")
+async def dev_team_con(device_id: int, team_con: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from template for deleting device-license connection. Adds entry to bodydevices_licenses
+    table and redirects to devices-web endpoint
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_device(db, device_id, team_con)
+    return RedirectResponse(url=f"/devices-web", status_code=303)
+
+@device_web.post("/devices-web-inv/{device_id}")
+async def dev_inv_new(device_id: int, dev_inv: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from template for deleting device-license connection. Adds entry to bodydevices_licenses
+    table and redirects to devices-web endpoint
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_device_inv(db, device_id, dev_inv)
+    return RedirectResponse(url=f"/devices-web", status_code=303)
+
+@device_web.post("/devices-web-comment/{device_id}")
+async def dev_comm_new(device_id: int, dev_com: str = Form(...), db: Session = Depends(get_db),
+                      Authorize: AuthJWT = Depends()):
+    """
+    Endpoint called from template for deleting device-license connection. Adds entry to bodydevices_licenses
+    table and redirects to devices-web endpoint
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    crud.update_device_com(db, device_id, dev_com)
+    return RedirectResponse(url=f"/devices-web", status_code=303)
diff --git a/server/sql_app/api/licenses_web.py b/server/sql_app/api/licenses_web.py
index f402a1b..3d9bdf5 100644
--- a/server/sql_app/api/licenses_web.py
+++ b/server/sql_app/api/licenses_web.py
@@ -1,5 +1,5 @@
 from typing import List
-
+from typing import Optional
 from fastapi import Depends, FastAPI, HTTPException, APIRouter, Form
 from sqlalchemy.orm import Session
 from datetime import date
@@ -60,8 +60,8 @@ async def read_licenses_web(request: Request, skip: int = 0, limit: int = 100, d
                                                             "user": current_user})
 
 @licenses_web.post("/licenses-web")
-def create_license(name: str = Form(...), expdate: date = Form(...), db: Session = Depends(get_db),
-                   Authorize: AuthJWT = Depends()):
+def create_license(name: str = Form(...), lic_id: str = Form(...), expdate: Optional[date] = Form(None),
+                   db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     """
     Endpoint called from create license form. Creates new license and redirects to devices-web endpoint
     """
@@ -70,11 +70,11 @@ def create_license(name: str = Form(...), expdate: date = Form(...), db: Session
     if current_user != "admin":
         return RedirectResponse(url=f"/logs-web", status_code=303)
     licenses = crud.get_licenses(db, 0, 100)
-    licenses_names = []
+    licenses_ids = []
     for l in licenses:
-        licenses_names.append(l.name)
-    if name not in licenses_names:
-        db_license = crud.create_license(db, name, expdate)
+        licenses_ids.append(l.license_id)
+    if lic_id not in licenses_ids:
+        db_license = crud.create_license(db, name, lic_id, expdate)
         if db_license is None:
             print("something went wrong")
-    return RedirectResponse(url=f"/devices-web", status_code=303)
+    return RedirectResponse(url=f"/licenses-web", status_code=303)
diff --git a/server/sql_app/api/pcs_web.py b/server/sql_app/api/pcs_web.py
index 2779e46..39dfac5 100644
--- a/server/sql_app/api/pcs_web.py
+++ b/server/sql_app/api/pcs_web.py
@@ -42,32 +42,3 @@ async def read_pcs(request: Request, skip: int = 0, limit: int = 100, db: Sessio
         current_user = "guest"
         return templates.TemplateResponse("pcs_normal.html", {"request": request, "pcs": pcs, "user": current_user})
 
-
-@pcs_web.get("/pc-team/{pc_id}", response_class=HTMLResponse)
-async def connect_pc_team(request: Request, pc_id: int, db: Session = Depends(get_db),
-                          Authorize: AuthJWT = Depends()):
-    """
-    Returns template with Form for connecting pc with team
-    """
-    Authorize.jwt_optional()
-    current_user = Authorize.get_jwt_subject()
-    if current_user != "admin":
-        return RedirectResponse(url=f"/logs-web", status_code=303)
-    pc = crud.get_pc(db, pc_id)
-    teams = crud.get_teams(db, 0, 100)
-    return templates.TemplateResponse("pcteam.html",
-                                      {"request": request, "pc": pc, "teams": teams})
-
-
-@pcs_web.post("/pcs-web/{pc_id}")
-async def connect_post(pc_id: int, team: str = Form(...), db: Session = Depends(get_db),
-                       Authorize: AuthJWT = Depends()):
-    """
-    Endpoint called from within form for connecting pc with team. Updates certain pc with new team.
-    """
-    Authorize.jwt_optional()
-    current_user = Authorize.get_jwt_subject()
-    if current_user != "admin":
-        return RedirectResponse(url=f"/logs-web", status_code=303)
-    old_pc = crud.update_pc(db, pc_id, team)
-    return RedirectResponse(url=f"/pcs-web", status_code=303)
diff --git a/server/sql_app/api/teams_web.py b/server/sql_app/api/teams_web.py
index 616c1c7..15c44b7 100644
--- a/server/sql_app/api/teams_web.py
+++ b/server/sql_app/api/teams_web.py
@@ -59,7 +59,7 @@ async def team_create_web(request: Request, Authorize: AuthJWT = Depends()):
 @teams_web.post("/teams-web-con")
 def create_team(name: str = Form(...), db: Session = Depends(get_db), Authorize: AuthJWT = Depends()):
     """
-    Endpoint called from within form for creating new team. Creates new team and returns all teams in database
+    Endpoint called from within form for creating new team. Creates new team and redirects to view with all teams
     """
     Authorize.jwt_optional()
     current_user = Authorize.get_jwt_subject()
@@ -74,3 +74,30 @@ def create_team(name: str = Form(...), db: Session = Depends(get_db), Authorize:
         if team is None:
             print("something went wrong")
     return RedirectResponse(url=f"/teams-web", status_code=303)
+
+
+@teams_web.get("/team-change/{team_id}", response_class=HTMLResponse)
+async def team_change_web(request: Request, team_id: int, db: Session = Depends(get_db),
+                          Authorize: AuthJWT = Depends()):
+    """
+    Returns template with form for changing teams name
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    team = crud.get_team(db, team_id)
+    return templates.TemplateResponse("team_change.html", {"request": request, "team": team})
+
+@teams_web.post("/teams-change-process/{team_id}")
+async def team_change_process(team_id: int, db:Session = Depends(get_db), name: str = Form(...),
+                              Authorize: AuthJWT = Depends()):
+    """
+    Changes teams name to a new one given by user
+    """
+    Authorize.jwt_optional()
+    current_user = Authorize.get_jwt_subject()
+    if current_user != "admin":
+        return RedirectResponse(url=f"/logs-web", status_code=303)
+    team = crud.change_team(db, team_id, name)
+    return RedirectResponse(url=f"/teams-web", status_code=303)
\ No newline at end of file
diff --git a/server/sql_app/crud.py b/server/sql_app/crud.py
index f2b3a9b..d20873b 100644
--- a/server/sql_app/crud.py
+++ b/server/sql_app/crud.py
@@ -19,21 +19,37 @@ def get_devices(db: Session, skip: int = 0, limit: int = 100):
     return db.query(models.Device).offset(skip).limit(limit).all()
 
 
-def find_device(db: Session, device: schemas.DeviceBase):
+def find_device(db: Session, device: schemas.DeviceTemp):
     """
-    finds one device with product_id, vendor_id and serial_number same as in given DeviceBase object
+    finds one device with  serial_number same as in given DeviceBase object
     """
-    return db.query(models.Device).filter(and_(models.Device.product_id == device.product_id,
-                                               models.Device.vendor_id == device.vendor_id,
-                                               models.Device.serial_number == device.serial_number)).first()
+    return db.query(models.Device).filter(and_(models.Device.serial_number == device.serial_number)).first()
 
 
-def create_device(db: Session, device: schemas.DeviceBase):
+def find_device_by_serial(db: Session, ser: str):
+    """
+    finds one device with serial_number same as in given DeviceBase object
+    """
+    return db.query(models.Device).filter(and_(models.Device.serial_number == ser)).first()
+
+def get_devices_with_ids(db: Session, ids: []):
+    """
+    returns all devices with given ids
+    """
+    return db.query(models.Device).filter(models.Device.id.in_(ids)).all()
+
+def get_devices_by_team(db: Session, team: int):
+    """
+    returns all devices with same team
+    """
+    return db.query(models.Device).filter(models.Device.team_id == team).all()
+
+def create_device(db: Session, device: schemas.DeviceTemp):
     """
     creates new device with data from given DeviceBase object
     """
     db_device = models.Device(vendor_id=device.vendor_id, product_id=device.product_id,
-                              serial_number=device.serial_number, assigned=False)
+                              serial_number=device.serial_number, inventory_number="", comment="")
     db.add(db_device)
     db.commit()
     db.refresh(db_device)
@@ -58,14 +74,18 @@ def find_license(db: Session, name: str):
     """
     finds one license by given string name
     """
-    return db.query(models.License).filter(models.License.name == name).first()
+    return db.query(models.License).filter(models.License.license_id == name).first()
+
 
+def get_licenses_by_name(db: Session, name: str):
+    return db.query(models.License).filter(models.License.name == name).all()
 
-def create_license(db: Session, name: str, expdate: date):
+
+def create_license(db: Session, name: str, lic_id: str, expdate: date):
     """
     creates new license with given name and expiration date
     """
-    db_license = models.License(name=name, expiration_date=expdate)
+    db_license = models.License(name=name, license_id=lic_id, expiration_date=expdate)
     db.add(db_license)
     db.commit()
     db.refresh(db_license)
@@ -79,9 +99,16 @@ def get_license_devices(db: Session, license_id: int):
     return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id == license_id).all()
 
 
+def find_devicelicenses_by_licid_array(db: Session, lcs: []):
+    """
+    Finds all device_licenses with license_id in given id array
+    """
+    return db.query(models.DeviceLicense).filter(models.DeviceLicense.license_id.in_(lcs)).all()
+
+
 def get_device_licenses(db: Session, device_id: int):
     """
-    returns all entries in devices_licenses table with given license_id
+    returns all entries in devices_licenses table with given device_id
     """
     return db.query(models.DeviceLicense).filter(models.DeviceLicense.device_id == device_id).all()
 
@@ -174,19 +201,61 @@ def get_pc(db: Session, pc_id: int):
     return db.query(models.PC).filter(models.PC.id == pc_id).first()
 
 
-def update_pc(db: Session, pc_id: int, team: str):
+def update_device(db: Session, device_id: int, team: str):
     """
     Updates team of one specific pc
     """
-    old_pc = get_pc(db, pc_id)
+    old_dev = get_device(db, device_id)
     team = get_team(db, int(team))
-    new = {'id': old_pc.id, 'username': old_pc.username, 'hostname': old_pc.hostname, 'assigned': True,
-           'team_id': team.id}
+    new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
+           'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
+           'comment': old_dev.comment, 'team_id': team.id}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_device_inv(db: Session, device_id: int, inv: str):
+    """
+    Updates inventory number of one specific pc
+    """
+    old_dev = get_device(db, device_id)
+    if old_dev.team_id != None:
+        team = get_team(db, int(old_dev.team_id))
+        teamid = team.id
+    else:
+        teamid = None
+    new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
+           'serial_number': old_dev.serial_number, 'inventory_number': inv,
+           'comment': old_dev.comment, 'team_id': teamid}
+    for key, value in new.items():
+        setattr(old_dev, key, value)
+    db.commit()
+    db.refresh(old_dev)
+    return old_dev
+
+
+def update_device_com(db: Session, device_id: int, comm: str):
+    """
+    Updates team of one specific pc
+    """
+    old_dev = get_device(db, device_id)
+    if old_dev.team_id != None:
+        team = get_team(db, int(old_dev.team_id))
+        teamid = team.id
+    else:
+        teamid = None
+    new = {'id': old_dev.id, 'vendor_id': old_dev.vendor_id, 'product_id': old_dev.product_id,
+           'serial_number': old_dev.serial_number, 'inventory_number': old_dev.inventory_number,
+           'comment': comm, 'team_id': teamid}
     for key, value in new.items():
-        setattr(old_pc, key, value)
+        setattr(old_dev, key, value)
     db.commit()
-    db.refresh(old_pc)
-    return old_pc
+    db.refresh(old_dev)
+    return old_dev
+
 
 def change_role(db: Session, usr_id: int, role: str):
     """
@@ -237,18 +306,11 @@ def find_pcs(db: Session, pcs: []):
     return db.query(models.PC).filter(models.PC.id.in_(pcs)).all()
 
 
-def get_pcs_by_team(db: Session, team_id: int):
-    """
-    returns all pcs in given team by team id
-    """
-    return db.query(models.PC).filter(models.PC.team_id == team_id).all()
-
-
 def create_pc(db: Session, user: str, host: str):
     """
     creates new pc with given username and hostname
     """
-    db_pc = models.PC(username=user, hostname=host, assigned=False)
+    db_pc = models.PC(username=user, hostname=host)
     db.add(db_pc)
     db.commit()
     db.refresh(db_pc)
@@ -287,6 +349,19 @@ def create_team(db: Session, name: str):
     return db_team
 
 
+def change_team(db: Session, team_id: int, name: str):
+    """
+    Updates name of one specific team
+    """
+    old_team = get_team(db, team_id)
+    new = {'id': old_team.id, 'name': name}
+    for key, value in new.items():
+        setattr(old_team, key, value)
+    db.commit()
+    db.refresh(old_team)
+    return old_team
+
+
 def get_head_device(db: Session, head_id: int):
     """
     Returns one specific head device by given id
@@ -410,19 +485,19 @@ def get_filtered_ldlogs(db: Session, pc: str, tema: str, lic: str):
     if tema != "all":
         team = find_team(db, tema)
         if team is not None:
-            pcst = get_pcs_by_team(db, team.id)
-            pc_ids = "("
-            for p in pcst:
-                pc_ids += str(p.id) + ", "
-            def_pc_ids = pc_ids[:-2] + ")"
+            devs = get_devices_by_team(db, team.id)
+            d_ids = "("
+            for p in devs:
+                d_ids += str(p.id) + ", "
+            def_d_ids = d_ids[:-2] + ")"
             if pc != "all" and pcs is not None:
-                if len(def_pc_ids) > 1:
-                    execute_string += " AND logs.pc_id IN " + def_pc_ids
+                if len(def_d_ids) > 1:
+                    execute_string += " AND logs.device_id IN " + def_d_ids
             else:
-                if len(def_pc_ids) > 1:
-                    execute_string += " WHERE logs.pc_id IN " + def_pc_ids
+                if len(def_d_ids) > 1:
+                    execute_string += " WHERE logs.device_id IN " + def_d_ids
     if lic != "all":
-        license = find_license(db, lic)
+        license = get_licenses_by_name(db, lic)
         if license is not None:
             device_licenses = get_license_bodydevice(db, license.id)
             dev_ids = "("
@@ -454,19 +529,19 @@ def get_filtered_logs(db: Session, pc: str, tema: str, lic: str):
     if tema != "all":
         team = find_team(db, tema)
         if team is not None:
-            pcst = get_pcs_by_team(db, team.id)
-            pc_ids = "("
-            for p in pcst:
-                pc_ids += str(p.id) + ", "
-            def_pc_ids = pc_ids[:-2] + ")"
+            devs = get_devices_by_team(db, team.id)
+            d_ids = "("
+            for p in devs:
+                d_ids += str(p.id) + ", "
+            def_d_ids = d_ids[:-2] + ")"
             if pc != "all" and pcs is not None:
-                if len(def_pc_ids) > 1:
-                    execute_string += " AND logs.pc_id IN " + def_pc_ids
+                if len(def_d_ids) > 1:
+                    execute_string += " AND logs.device_id IN " + def_d_ids
             else:
-                if len(def_pc_ids) > 1:
-                    execute_string += " WHERE logs.pc_id IN " + def_pc_ids
+                if len(def_d_ids) > 1:
+                    execute_string += " WHERE logs.device_id IN " + def_d_ids
     if lic != "all":
-        license = find_license(db, lic)
+        license = get_licenses_by_name(db, lic)
         if license is not None:
             device_licenses = get_license_devices(db, license.id)
             dev_ids = "("
@@ -485,6 +560,72 @@ def get_filtered_logs(db: Session, pc: str, tema: str, lic: str):
     return result
 
 
+def get_filtered_devices(db: Session, keyman_id: str, license_name: str, license_id: str, team: str):
+    """
+    returns filtered devices based on given atributes
+    """
+    execute_string = "SELECT * FROM devices AS device WHERE"
+    before_me = False
+    all_all = True
+    if keyman_id != "all":
+        all_all = False
+        keyman_dev = find_device_by_serial(db, keyman_id)
+        if keyman_dev != None:
+            if before_me:
+                execute_string += " AND device.id = " + str(keyman_dev.id)
+            else:
+                before_me = True
+                execute_string += " device.id = " + str(keyman_dev.id)
+    if license_name != "all":
+        all_all = False
+        license = get_licenses_by_name(db, license_name)
+        if len(license) > 0:
+            lic_ids = []
+            for l in license:
+                lic_ids.append(l.id)
+            dev_lics = find_devicelicenses_by_licid_array(db, lic_ids)
+            lic_ids = "("
+            for l in dev_lics:
+                lic_ids += str(l.device_id) + ", "
+            def_lic_ids = lic_ids[:-2] + ")"
+            if before_me:
+                execute_string += " AND device.id IN " + def_lic_ids
+            else:
+                before_me = True
+                execute_string += " device.id IN " + def_lic_ids
+    if license_id != "all":
+        all_all = False
+        license = find_license(db, license_id)
+        licen_devs = get_license_devices(db, license.id)
+        ids = "("
+        for lic in licen_devs:
+            ids += str(lic.device_id) + ", "
+        def_ids = ids[:-2] + ")"
+        if license != None:
+            if before_me:
+                execute_string += " AND device.id IN " + def_ids
+            else:
+                before_me = True
+                execute_string += " device.id IN " + def_ids
+    if team != "all":
+        all_all = False
+        tem = find_team(db, team)
+        if tem != None:
+            if before_me:
+                execute_string += " AND device.team_id = " + str(tem.id)
+            else:
+                before_me = True
+                execute_string += " device.team_id = " + str(tem.id)
+    if all_all:
+        before_me = True
+        execute_string = "SELECT * FROM devices AS devices"
+
+    if not before_me:
+        execute_string = "SELECT * FROM devices AS devices WHERE devices.id = -1"
+    result = db.execute(execute_string)
+    return result
+
+
 def create_device_logs(db: Session, item: schemas.USBTempBase, dev_id: int, pc_id: int, date: datetime):
     """
     Creates new USB log for usb_logs database table
diff --git a/server/sql_app/main.py b/server/sql_app/main.py
index 224d136..637bfaf 100644
--- a/server/sql_app/main.py
+++ b/server/sql_app/main.py
@@ -38,5 +38,5 @@ app.include_router(auth)
 
 '''
 if __name__ == "__main__":
-    uvicorn.run(app, host="192.168.0.22", port=8000)
+    uvicorn.run(app, host="192.168.64.1", port=8000)
 '''
diff --git a/server/sql_app/models.py b/server/sql_app/models.py
index d91cfa5..e3e40a5 100644
--- a/server/sql_app/models.py
+++ b/server/sql_app/models.py
@@ -14,13 +14,16 @@ class Device(Base):
     vendor_id = Column(String, index=True, nullable=False)
     product_id = Column(String, index=True, nullable=False)
     serial_number = Column(String, index=True, nullable=False)
-    assigned = Column(Boolean, index=True, nullable=False)
+    inventory_number = Column(String, index=True, nullable=True)
+    comment = Column(String, index=True, nullable=True)
+
+    team_id = Column(Integer, ForeignKey("teams.id"))
 
     # relationships for foreign keys, thus connecting table with usb_logs and licenses
     # tables
     logs = relationship("USBLog", back_populates="device")
     licenses = relationship("DeviceLicense", back_populates="device_lic")
-
+    team = relationship("Team", back_populates="devices")
 
 class USBLog(Base):
     """
@@ -48,7 +51,8 @@ class License(Base):
 
     id = Column(Integer, primary_key=True, index=True)
     name = Column(String, index=True, nullable=False)
-    expiration_date = Column(DateTime(timezone=True), server_default=func.now())
+    license_id = Column(String, index=True, nullable=False)
+    expiration_date = Column(DateTime(timezone=True), nullable=True)
 
     # relationships for foreign keys, thus connecting table with devices table
     devices = relationship("DeviceLicense", back_populates="licenses")
@@ -97,12 +101,9 @@ class PC(Base):
     id = Column(Integer, primary_key=True, index=True)
     username = Column(String, index=True, nullable=False)
     hostname = Column(String, index=True, nullable=False)
-    assigned = Column(Boolean, index=True, nullable=False)
-    team_id = Column(Integer, ForeignKey("teams.id"))
 
     # relationships for foreign keys, thus connecting table with teams, usb_logs and ld_logs
     # tables
-    team = relationship("Team", back_populates="pcs")
     logs_pc = relationship("USBLog", back_populates="pc")
     ld_pc = relationship("LDLog", back_populates="ldpc")
 
@@ -116,9 +117,7 @@ class Team(Base):
     id = Column(Integer, primary_key=True, index=True)
     name = Column(String, index=True, nullable=False)
 
-    # relationships for foreign keys, thus connecting table with pc table
-    pcs = relationship("PC", back_populates="team")
-
+    devices = relationship("Device", back_populates="team")
 
 class HeadDevice(Base):
     """
diff --git a/server/sql_app/schemas.py b/server/sql_app/schemas.py
index 79becdc..4a7e381 100644
--- a/server/sql_app/schemas.py
+++ b/server/sql_app/schemas.py
@@ -48,6 +48,8 @@ class DeviceBase(BaseModel):
     vendor_id: str
     product_id: str
     serial_number: str
+    inventory_number: str
+    comment: str
 
 
 class DeviceCreate(DeviceBase):
@@ -59,7 +61,6 @@ class Device(DeviceCreate):
     Class used for creating and reading devices entries
     """
     id: int
-    assigned: bool
     logs: List[USBLog] = []
     licenses: List[DeviceLicense] = []
 
@@ -67,6 +68,12 @@ class Device(DeviceCreate):
         orm_mode = True
 
 
+class DeviceTemp(BaseModel):
+    vendor_id: str
+    product_id: str
+    serial_number: str
+
+
 class LDLogBase(BaseModel):
     timestamp: datetime
     status: str
@@ -140,8 +147,8 @@ class PC(PCCreate):
     Class used for creating and reading pc entries
     """
     id: int
-    assigned: bool
     logs_pc: List[USBLog] = []
+    logs_ld: List[LDLog] = []
 
     class Config:
         orm_mode = True
@@ -160,7 +167,7 @@ class Team(TeamCreate):
     Class used for creating and reading team entries
     """
     id: int
-    pcs: List[PC] = []
+    devices: List[Device] = []
 
     class Config:
         orm_mode = True
@@ -168,6 +175,7 @@ class Team(TeamCreate):
 
 class LicenseBase(BaseModel):
     name: str
+    license_id: str
     expiration_date: date
 
 
@@ -193,7 +201,7 @@ class USBTempBase(BaseModel):
     username: str
     hostname: str
     timestamp: str
-    device: DeviceBase
+    device: DeviceTemp
     status: str
 
 
@@ -242,6 +250,7 @@ class UserBase(BaseModel):
     password: str
     role: str
 
+
 class UserCreate(UserBase):
     pass
 
@@ -251,3 +260,4 @@ class User(UserCreate):
 
     class Config:
         orm_mode = True
+
diff --git a/server/templates/body-devices/body_devices.html b/server/templates/body-devices/body_devices.html
index b36a923..255a851 100644
--- a/server/templates/body-devices/body_devices.html
+++ b/server/templates/body-devices/body_devices.html
@@ -22,11 +22,10 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
-      <option value="/body-devices-web">Body Devices</option>
+      <option value="/body-devices-web" selected>Body Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
@@ -47,7 +46,7 @@
 <table>
     <TR>
         <TH>ID</TH>
-        <TH>Serial Number</TH>
+        <TH>Lauterbach Body ID</TH>
         <TH>Licenses</TH>
         <TH>Status</TH>
     </TR>
diff --git a/server/templates/body-devices/body_devices_normal.html b/server/templates/body-devices/body_devices_normal.html
index ece156d..8a3452e 100644
--- a/server/templates/body-devices/body_devices_normal.html
+++ b/server/templates/body-devices/body_devices_normal.html
@@ -22,11 +22,10 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
-      <option value="/body-devices-web">Body Devices</option>
+      <option value="/body-devices-web" selected>Body Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
@@ -46,7 +45,7 @@
 <table>
     <TR>
         <TH>ID</TH>
-        <TH>Serial Number</TH>
+        <TH>Lauterbach Body ID</TH>
         <TH>Licenses</TH>
         <TH>Status</TH>
     </TR>
diff --git a/server/templates/devices/devicelicense.html b/server/templates/devices/devicelicense.html
index b8f8833..e72d585 100644
--- a/server/templates/devices/devicelicense.html
+++ b/server/templates/devices/devicelicense.html
@@ -7,25 +7,52 @@
 <body>
 <h6><p>Vendor ID: {{device.vendor_id}}</p>
     <p>Product ID: {{device.product_id}}</p>
-    <p>Serial Number: {{device.serial_number}}</p>
 </h6>
+<h4>Serial Number: {{device.serial_number}}</h4>
 <form action="/devices-web/{{device.id}}" method="post">
   <label for="lic">Licenses:</label>
   <select id="lic" name="lic">
       {% for license in licenses %}
-    <option value={{license.id}}>{{license.name}}</option>
+    <option value={{license.id}}>{{license.name}} : {{license.license_id}}</option>
       {% endfor %}
   </select>
   <input type="submit" value="Connect">
 </form>
+<div style='padding-top:20px'>
 <form action="/devices-web-del/{{device.id}}" method="post">
   <label for="lic_del">Licenses:</label>
   <select id="lic_del" name="lic_del">
       {% for license in dev_lic %}
-    <option value={{license.id}}>{{license.name}}</option>
+    <option value={{license.id}}>{{license.name}} : {{license.license_id}}</option>
       {% endfor %}
   </select>
   <input type="submit" value="Delete">
 </form>
+</div>
+<div style='padding-top:20px'>
+<form action="/devices-web-team/{{device.id}}" method="post">
+  <label for="team_con">Teams:</label>
+  <select id="team_con" name="team_con">
+      {% for team in teams %}
+    <option value={{team.id}}>{{team.name}}</option>
+      {% endfor %}
+  </select>
+  <input type="submit" value="Connect">
+</form>
+</div>
+<div style='padding-top:20px'>
+<form action="/devices-web-inv/{{device.id}}" method="post">
+  <label for="dev_inv">Inventory Number:</label><br>
+  <input type="text" id="dev_inv" name="dev_inv" value="{{device.inventory_number}}">
+  <input type="submit" value="Submit">
+</form>
+</div>
+<div style='padding-top:20px'>
+<form action="/devices-web-comment/{{device.id}}" method="post">
+  <label for="dev_com">Comment:</label><br>
+  <input type="text" id="dev_com" name="dev_com" value="{{device.comment}}">
+  <input type="submit" value="Submit">
+</form>
+</div>
 </body>
 </html>
\ No newline at end of file
diff --git a/server/templates/devices/devices.html b/server/templates/devices/devices.html
index e2f0bb7..33a1a21 100644
--- a/server/templates/devices/devices.html
+++ b/server/templates/devices/devices.html
@@ -1,5 +1,29 @@
 <html>
 <head>
+    <style>
+        #devices {
+  font-family: Arial, Helvetica, sans-serif;
+  border-collapse: collapse;
+  width: 100%;
+}
+
+#devices td, #devices th {
+  border: 1px solid #ddd;
+  padding: 8px;
+}
+
+#devices tr:nth-child(even){background-color: #f2f2f2;}
+
+#devices tr:hover {background-color: #ddd;}
+
+#devices th {
+  padding-top: 12px;
+  padding-bottom: 12px;
+  text-align: left;
+  background-color: #47BBF5;
+  color: black;
+}
+    </style>
     <title>Devices Details</title>
 </head>
 <body>
@@ -22,10 +46,9 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
-      <option value="/devices-web">Devices</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
+      <option value="/devices-web" selected>Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
@@ -35,49 +58,65 @@
   <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="" placeholder="all">
+    <datalist id="keyman_ids">
+        {% for dev in devs %}
+        <option value="{{dev.serial_number}}"></option>
+        {% endfor %}
+    </datalist>
+    <label for="lic_name">License Name:</label>
+    <input id="lic_name" name="lic_name" type="text" list="licenses_names" value="" placeholder="all">
+    <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">
+    <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">
+    <datalist id="teams">
+        {% for team in teams %}
+        <option value="{{team.name}}">{{team.name}}</option>
+        {% endfor %}
+    </datalist>
   <input type="submit" value="Filter">
 </form>
-<table>
+<table id="devices">
     <TR>
         <TH>ID</TH>
-        <TH>Vendor ID</TH>
-        <TH>Product ID</TH>
-        <TH>Serial Number</TH>
-        <TH>Licenses</TH>
+        <TH>Keyman ID</TH>
+        <TH>License Type</TH>
+        <TH>License ID</TH>
+        <TH>Inventory Number</TH>
+        <TH>Team</TH>
+        <TH>Last Username</TH>
+        <TH>Last Hostname</TH>
+        <TH>Last Detection</TH>
         <TH>Status</TH>
+        <TH>Comment</TH>
     </TR>
-    {% for i in range(devs) %}
+    {% for dev in devices %}
     <TR>
-        <TD class="ID"><a href="/device-license/{{devices[i].id}}">{{devices[i].id}}</a></TD>
-        <TD class="Vendor ID">{{devices[i].vendor_id}}</TD>
-        <TD class="Product ID">{{devices[i].product_id}}</TD>
-        <TD class="Serial Number">{{devices[i].serial_number}}</TD>
-        <TD class="License">
-            {% for lic in devices[i].licenses %}
-                {{lic.licenses.name}}<BR>
-            {% endfor %}
-        </TD>
-        <TD class="Status">{{statuses[i]}}</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>
+        <TD class="Inventory Number">{{dev['device'].inventory_number}}</TD>
+        <TD class="Team">{{dev['device'].team.name}}</TD>
+        <TD class="Last Username">{{dev['log'].pc.username}}</TD>
+        <TD class="Last Hostname">{{dev['log'].pc.hostname}}</TD>
+        <TD class="Last Detection">{{dev['log'].timestamp}}</TD>
+        <TD class="Status">{{dev['log'].status}}</TD>
+        <TD class="Comment">{{dev['device'].comment}}</TD>
     </TR>
     {% endfor %}
-    <TR>
-        <TD class="ID"></TD>
-        <TD class="Vendor ID"></TD>
-        <TD class="Product ID"></TD>
-        <TD class="Serial Number"></TD>
-        <TD class="License">
-            <form action="/license-create" method="get">
-                <input type="submit" value="Add">
-            </form>
-        </TD>
-    </TR>
 </table>
 </body>
 </html>
diff --git a/server/templates/devices/devices_normal.html b/server/templates/devices/devices_normal.html
index 4e0813f..ac38f54 100644
--- a/server/templates/devices/devices_normal.html
+++ b/server/templates/devices/devices_normal.html
@@ -1,5 +1,29 @@
 <html>
 <head>
+    <style>
+        #devices {
+  font-family: Arial, Helvetica, sans-serif;
+  border-collapse: collapse;
+  width: 100%;
+}
+
+#devices td, #devices th {
+  border: 1px solid #ddd;
+  padding: 8px;
+}
+
+#devices tr:nth-child(even){background-color: #f2f2f2;}
+
+#devices tr:hover {background-color: #ddd;}
+
+#devices th {
+  padding-top: 12px;
+  padding-bottom: 12px;
+  text-align: left;
+  background-color: #47BBF5;
+  color: black;
+}
+    </style>
     <title>Devices Details</title>
 </head>
 <body>
@@ -22,10 +46,9 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
-      <option value="/devices-web">Devices</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
+      <option value="/devices-web" selected>Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
@@ -43,27 +66,33 @@
     </datalist>
   <input type="submit" value="Filter">
 </form>
-<table>
+<table id="devices">
     <TR>
         <TH>ID</TH>
-        <TH>Vendor ID</TH>
-        <TH>Product ID</TH>
-        <TH>Serial Number</TH>
-        <TH>Licenses</TH>
+        <TH>Keyman ID</TH>
+        <TH>License Type</TH>
+        <TH>License ID</TH>
+        <TH>Inventory Number</TH>
+        <TH>Team</TH>
+        <TH>Last Username</TH>
+        <TH>Last Hostname</TH>
+        <TH>Last Detection</TH>
         <TH>Status</TH>
+        <TH>Comment</TH>
     </TR>
-    {% for i in range(devs) %}
+    {% for dev in devices %}
     <TR>
-        <TD class="ID">{{devices[i].id}}</TD>
-        <TD class="Vendor ID">{{devices[i].vendor_id}}</TD>
-        <TD class="Product ID">{{devices[i].product_id}}</TD>
-        <TD class="Serial Number">{{devices[i].serial_number}}</TD>
-        <TD class="License">
-            {% for lic in devices[i].licenses %}
-                {{lic.licenses.name}}<BR>
-            {% endfor %}
-        </TD>
-        <TD class="Status">{{statuses[i]}}</TD>
+        <TD class="ID">{{dev['device'].id}}</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>
+        <TD class="Inventory Number">{{dev['device'].inventory_number}}</TD>
+        <TD class="Team">{{dev['device'].team.name}}</TD>
+        <TD class="Last Username">{{dev['log'].pc.username}}</TD>
+        <TD class="Last Hostname">{{dev['log'].pc.hostname}}</TD>
+        <TD class="Last Detection">{{dev['log'].timestamp}}</TD>
+        <TD class="Status">{{dev['log'].status}}</TD>
+        <TD class="Comment">{{dev['device'].comment}}</TD>
     </TR>
     {% endfor %}
 </table>
diff --git a/server/templates/ld-logs/ldlogs.html b/server/templates/ld-logs/ldlogs.html
index deda9b0..f7afdf1 100644
--- a/server/templates/ld-logs/ldlogs.html
+++ b/server/templates/ld-logs/ldlogs.html
@@ -22,9 +22,8 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web" selected>Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
@@ -66,8 +65,8 @@
         <TH>Team</TH>
         <TH>Timestamp</TH>
         <TH>Status</TH>
-        <TH>Head Device Serial Number</TH>
-        <TH>Body Device Serial Number</TH>
+        <TH>Lauterbach Head ID</TH>
+        <TH>Lauterbach Body ID</TH>
     </TR>
     {% for log in logs %}
     <TR>
diff --git a/server/templates/ld-logs/ldlogs_normal.html b/server/templates/ld-logs/ldlogs_normal.html
index 0487981..27060e6 100644
--- a/server/templates/ld-logs/ldlogs_normal.html
+++ b/server/templates/ld-logs/ldlogs_normal.html
@@ -22,9 +22,8 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web" selected>Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
@@ -65,8 +64,8 @@
         <TH>Team</TH>
         <TH>Timestamp</TH>
         <TH>Status</TH>
-        <TH>Head Device Serial Number</TH>
-        <TH>Body Device Serial Number</TH>
+        <TH>Lauterbach Head ID</TH>
+        <TH>Lauterbach Body ID</TH>
     </TR>
     {% for log in logs %}
     <TR>
diff --git a/server/templates/licenses/license_create.html b/server/templates/licenses/license_create.html
index 861174a..707ce4e 100644
--- a/server/templates/licenses/license_create.html
+++ b/server/templates/licenses/license_create.html
@@ -8,6 +8,8 @@
 <form action="/licenses-web" method="post">
   <label for="name">Name:</label><br>
   <input type="text" id="name" name="name"><br><br>
+    <label for="lic_id">License ID:</label><br>
+  <input type="text" id="lic_id" name="lic_id"><br><br>
     <label for="expdate">Expiration Date</label>
   <input type="date" id="expdate" name="expdate" min={{minimum_date}}>
   <input type="submit" value="Submit">
diff --git a/server/templates/licenses/licenses.html b/server/templates/licenses/licenses.html
index 57a9b61..05c0f43 100644
--- a/server/templates/licenses/licenses.html
+++ b/server/templates/licenses/licenses.html
@@ -22,14 +22,13 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
-      <option value="/licenses-web">Licenses</option>
+      <option value="/licenses-web" selected>Licenses</option>
       <option value="/users-web">Users</option>
   </select>
   <input type="submit" value="OK">
@@ -37,14 +36,16 @@
 <table>
     <TR>
         <TH>ID</TH>
-        <TH>Name</TH>
+        <TH>License Type</TH>
+        <TH>License ID</TH>
         <TH>Expiration Date</TH>
     </TR>
     {% for license in licenses %}
     <TR>
         <TD class="ID">{{license.id}}</TD>
-        <TD class="Vendor ID">{{license.name}}</TD>
-        <TD class="Product ID">{{license.expiration_date}}</TD>
+        <TD class="License Type">{{license.name}}</TD>
+        <TD class="License ID">{{license.license_id}}</TD>
+        <TD class="Expiration Date">{{license.expiration_date}}</TD>
     </TR>
     {% endfor %}
 </table>
diff --git a/server/templates/licenses/licenses_normal.html b/server/templates/licenses/licenses_normal.html
index 2f580d4..63414bc 100644
--- a/server/templates/licenses/licenses_normal.html
+++ b/server/templates/licenses/licenses_normal.html
@@ -22,14 +22,13 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
-      <option value="/licenses-web">Licenses</option>
+      <option value="/licenses-web" selected>Licenses</option>
   </select>
   <input type="submit" value="OK">
 </form>
@@ -37,12 +36,14 @@
     <TR>
         <TH>ID</TH>
         <TH>Name</TH>
+        <TH>License ID</TH>
         <TH>Expiration Date</TH>
     </TR>
     {% for license in licenses %}
     <TR>
         <TD class="ID">{{license.id}}</TD>
         <TD class="Vendor ID">{{license.name}}</TD>
+        <TD class="License ID">{{license.license_id}}</TD>
         <TD class="Product ID">{{license.expiration_date}}</TD>
     </TR>
     {% endfor %}
diff --git a/server/templates/pcs/pcs.html b/server/templates/pcs/pcs.html
index 72295e2..89abe1a 100644
--- a/server/templates/pcs/pcs.html
+++ b/server/templates/pcs/pcs.html
@@ -22,13 +22,12 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
-      <option value="/pcs-web">PCs</option>
+      <option value="/pcs-web" selected>PCs</option>
       <option value="/licenses-web">Licenses</option>
       <option value="/users-web">Users</option>
   </select>
@@ -39,18 +38,12 @@
         <TH>ID</TH>
         <TH>Username</TH>
         <TH>Hostname</TH>
-        <TH>Team</TH>
     </TR>
     {% for pc in pcs %}
     <TR>
-        <TD class="ID"><a href="/pc-team/{{pc.id}}">{{pc.id}}</a></TD>
-        <TD class="Vendor ID">{{pc.username}}</TD>
-        <TD class="Product ID">{{pc.hostname}}</TD>
-        {% if pc.team == None %}
-            <TD class="Team">NONE</TD>
-        {% else %}
-            <TD class="Team">{{pc.team.name}}</TD>
-        {% endif %}
+        <TD class="ID">{{pc.id}}</TD>
+        <TD class="Username">{{pc.username}}</TD>
+        <TD class="Hostname">{{pc.hostname}}</TD>
     </TR>
     {% endfor %}
 </table>
diff --git a/server/templates/pcs/pcs_normal.html b/server/templates/pcs/pcs_normal.html
index b6b6cd5..b41000e 100644
--- a/server/templates/pcs/pcs_normal.html
+++ b/server/templates/pcs/pcs_normal.html
@@ -22,13 +22,12 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
-      <option value="/pcs-web">PCs</option>
+      <option value="/pcs-web" selected>PCs</option>
       <option value="/licenses-web">Licenses</option>
   </select>
   <input type="submit" value="OK">
@@ -38,18 +37,12 @@
         <TH>ID</TH>
         <TH>Username</TH>
         <TH>Hostname</TH>
-        <TH>Team</TH>
     </TR>
     {% for pc in pcs %}
     <TR>
         <TD class="ID">{{pc.id}}</TD>
-        <TD class="Vendor ID">{{pc.username}}</TD>
-        <TD class="Product ID">{{pc.hostname}}</TD>
-        {% if pc.team == None %}
-            <TD class="Team">NONE</TD>
-        {% else %}
-            <TD class="Team">{{pc.team.name}}</TD>
-        {% endif %}
+        <TD class="Username">{{pc.username}}</TD>
+        <TD class="Hostname">{{pc.hostname}}</TD>
     </TR>
     {% endfor %}
 </table>
diff --git a/server/templates/teams/team_change.html b/server/templates/teams/team_change.html
new file mode 100644
index 0000000..3ef6f23
--- /dev/null
+++ b/server/templates/teams/team_change.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Change team name</title>
+</head>
+<body>
+<h4>Team: {{team.name}}</h4>
+<form action="/teams-change-process/{{team.id}}" method="post">
+  <label for="name">Name:</label><br>
+  <input type="text" id="name" name="name"><br><br>
+  <input type="submit" value="Submit">
+</form>
+</body>
+</html>
\ No newline at end of file
diff --git a/server/templates/teams/teams.html b/server/templates/teams/teams.html
index f6945e6..f16933b 100644
--- a/server/templates/teams/teams.html
+++ b/server/templates/teams/teams.html
@@ -22,12 +22,11 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
-      <option value="/teams-web">Teams</option>
+      <option value="/teams-web" selected>Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
       <option value="/users-web">Users</option>
@@ -38,17 +37,11 @@
     <TR>
         <TH>ID</TH>
         <TH>Name</TH>
-        <TH>Members</TH>
     </TR>
     {% for team in teams %}
     <TR>
-        <TD class="ID">{{team.id}}</TD>
+        <TD class="ID"><a href="/team-change/{{team.id}}">{{team.id}}</a></TD>
         <TD class="Name">{{team.name}}</TD>
-        <TD class="Members">
-        {% for ppl in team.pcs %}
-            {{ppl.username}}<BR>
-        {% endfor %}
-        </TD>
     </TR>
     {% endfor %}
 </table>
diff --git a/server/templates/teams/teams_normal.html b/server/templates/teams/teams_normal.html
index d25b5b9..a10f217 100644
--- a/server/templates/teams/teams_normal.html
+++ b/server/templates/teams/teams_normal.html
@@ -22,12 +22,11 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
-      <option value="/teams-web">Teams</option>
+      <option value="/teams-web" selected>Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
   </select>
@@ -37,17 +36,11 @@
     <TR>
         <TH>ID</TH>
         <TH>Name</TH>
-        <TH>Members</TH>
     </TR>
     {% for team in teams %}
     <TR>
         <TD class="ID">{{team.id}}</TD>
         <TD class="Vendor ID">{{team.name}}</TD>
-        <TD class="Members">
-        {% for ppl in team.pcs %}
-            {{ppl.username}}<BR>
-        {% endfor %}
-        </TD>
     </TR>
     {% endfor %}
 </table>
diff --git a/server/templates/usb-logs/logs.html b/server/templates/usb-logs/logs.html
index 4f1bb07..a9d6901 100644
--- a/server/templates/usb-logs/logs.html
+++ b/server/templates/usb-logs/logs.html
@@ -22,9 +22,8 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web" selected>Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
@@ -66,8 +65,7 @@
         <TH>Team</TH>
         <TH>Timestamp</TH>
         <TH>Status</TH>
-        <TH>Device Product ID</TH>
-        <TH>Device Serial Number</TH>
+        <TH>Keyman ID</TH>
     </TR>
     {% for log in logs %}
     <TR>
@@ -77,11 +75,10 @@
         {% if log.pc.team == None %}
             <TD class="Team">NONE</TD>
         {% else %}
-            <TD class="Team">{{log.pc.team.name}}</TD>
+            <TD class="Team">{{log.device.team.name}}</TD>
         {% endif %}
         <TD class="Timestamp">{{log.timestamp}}</TD>
         <TD class="Status">{{log.status}}</TD>
-        <TD class="DeviceProductID">{{log.device.product_id}}</TD>
         <TD class="DeviceSerialNumber">{{log.device.serial_number}}</TD>
     </TR>
     {% endfor %}
diff --git a/server/templates/usb-logs/logs_normal.html b/server/templates/usb-logs/logs_normal.html
index aaf52e8..5132d64 100644
--- a/server/templates/usb-logs/logs_normal.html
+++ b/server/templates/usb-logs/logs_normal.html
@@ -22,9 +22,8 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web" selected>Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
@@ -65,8 +64,7 @@
         <TH>Team</TH>
         <TH>Timestamp</TH>
         <TH>Status</TH>
-        <TH>Device Product ID</TH>
-        <TH>Device Serial Number</TH>
+        <TH>Keyman ID</TH>
     </TR>
     {% for log in logs %}
     <TR>
@@ -76,11 +74,10 @@
         {% if log.pc.team == None %}
             <TD class="Team">NONE</TD>
         {% else %}
-            <TD class="Team">{{log.pc.team.name}}</TD>
+            <TD class="Team">{{log.device.team.name}}</TD>
         {% endif %}
         <TD class="Timestamp">{{log.timestamp}}</TD>
         <TD class="Status">{{log.status}}</TD>
-        <TD class="DeviceProductID">{{log.device.product_id}}</TD>
         <TD class="DeviceSerialNumber">{{log.device.serial_number}}</TD>
     </TR>
     {% endfor %}
diff --git a/server/templates/users/users.html b/server/templates/users/users.html
index dfb9e87..9952d85 100644
--- a/server/templates/users/users.html
+++ b/server/templates/users/users.html
@@ -19,15 +19,14 @@
 <form action="" method="get">
   <label for="view">Choose view:</label>
   <select id="view" name="view" onchange="this.form.action=this.value;">
-      <option value=""></option>
-      <option value="/logs-web">Logs</option>
-      <option value="/ldlogs-web">LD Logs</option>
+      <option value="/logs-web">Vector Logs</option>
+      <option value="/ldlogs-web">Lauterbach Logs</option>
       <option value="/devices-web">Devices</option>
       <option value="/body-devices-web">Body Devices</option>
       <option value="/teams-web">Teams</option>
       <option value="/pcs-web">PCs</option>
       <option value="/licenses-web">Licenses</option>
-      <option value="/users-web">Users</option>
+      <option value="/users-web" selected>Users</option>
   </select>
   <input type="submit" value="OK">
 </form>
