diff --git a/src/Entity/History.php b/src/Entity/History.php index 55f91a95a9fa376a16669a7035538bd80a176451..84615f1727bdc1bc5c8dabc15c9c386855447cee 100644 --- a/src/Entity/History.php +++ b/src/Entity/History.php @@ -92,4 +92,29 @@ class History return $this; } + + public function getCommandText(): string + { + return match ($this->command) { + 1 => 'short press', + 2 => 'long press', + 3 => 'set I2C address', + 4 => 'set short delay', + 5 => 'set long delay', + default => $this->command, + }; + } + + public function getValueText(): string + { + if($this->command > 2) + { + return $this->value; + } + return match ($this->value) { + 1 => 'power button', + 2 => 'reset button', + default => $this->value, + }; + } } diff --git a/templates/components/history_accordion.html.twig b/templates/components/history_accordion.html.twig index bd1a8d473ac7fb4afb644df2db3ebd40b3163413..40e93779e99adce9a9ffd1bb5adaa6bc2ae41aab 100644 --- a/templates/components/history_accordion.html.twig +++ b/templates/components/history_accordion.html.twig @@ -6,9 +6,11 @@ </h2> <div id="collapseHistory{{ history.id }}" class="accordion-collapse collapse" aria-labelledby="headingHistory{{ history.id }}" data-bs-parent="#accordionExample"> <div class="accordion-body"> - - - + <ul class="list-group"> + <li class="list-group-item"><b>User: </b>{{ history.user.name|capitalize }}</li> + <li class="list-group-item"><b>Command: </b>{{ history.commandText|capitalize }}</li> + <li class="list-group-item"><b>Value: </b>{{ history.valueText|capitalize }}</li> + </ul> </div> </div> </div> \ No newline at end of file