<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/645-1_Ecotronic/header/headerAdmin.inc';
include $_SERVER['DOCUMENT_ROOT'] . '/645-1_Ecotronic/functions/cryption.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/645-1_Ecotronic/database/class.Controller.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/645-1_Ecotronic/dto/class.Device.php';
$controller = new Controller();
$types = $controller->getAllTypes();
$brands = $controller->getAllBrands();
$efficiencyClasses = $controller->getAllEfficiencyClasses();
$consumptions = array();
$itemsFiltered = array();
$currentItemsArray = array();
$searchBarContent = null;
$selectedCategoryChoice = null;
$selectedBrandChoice = null;
$selectedEfficiencyClassChoice = null;
if (isset($_POST['searchBar'])) {
    $searchBarContent = $_POST['searchBar'];
}
if (isset($_POST['selectedType'])) {
    $selectedCategoryChoice = $_POST['selectedType'];
}
if (isset($_POST['selectedBrand'])) {
    $selectedBrandChoice = $_POST['selectedBrand'];
}
if (isset($_POST['selectedEfficiencyClass'])) {
    $selectedEfficiencyClassChoice = $_POST['selectedEfficiencyClass'];
}
if (!empty($selectedCategoryChoice) && empty($searchBarContent)) {
    if ($selectedCategoryChoice == 'Category') {