fix templates

This commit is contained in:
Dennis Eichhorn 2024-04-17 17:45:07 +00:00
parent c74dfde014
commit 084f93c9ab
5 changed files with 18 additions and 31 deletions

View File

@ -149,18 +149,6 @@ class Session implements \JsonSerializable
$this->busy = $busyTime;
}
/**
* Get all session elements
*
* @return SessionElement[]
*
* @since 1.0.0
*/
public function getSessionElements() : array
{
return $this->sessionElements;
}
/**
* Compare session elements
*

View File

@ -21,7 +21,7 @@ echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Status'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="employeeList" class="default sticky">
@ -54,6 +54,7 @@ echo $this->data['nav']->render(); ?>
<td><?= $session !== null ? ((int) ($session->busy / 3600)) . 'h' : ''; ?> <?= $session !== null ? ((int) ($session->busy / 60) % 60) . 'm' : ''; ?>
<?php endforeach; ?>
</table>
</div>
</div>
</section>
</div>
</div>

View File

@ -14,28 +14,34 @@ declare(strict_types=1);
/** @var \Modules\HumanResourceTimeRecording\Models\Session $session */
$session = $this->data['session'];
$elements = $session->getSessionElements();
$elements = $session->sessionElements;
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="box wf-100">
<section class="portlet">
<div class="portlet-head"><?= $session->start->format('Y-m-d'); ?></div>
<table id="sessionList" class="default sticky">
<caption><?= $session->start->format('Y-m-d'); ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
<td><?= $this->getHtml('Status'); ?>
<td class="wf-100"><?= $this->getHtml('Time'); ?>
<td class="wf-100"><?= $this->getHtml('Date'); ?>
<tbody>
<?php foreach ($elements as $element) : ?>
<?php
$c = 0;
foreach ($elements as $element) :
++$c;
?>
<tr>
<td><?= $this->getHtml('CS' . $element->getStatus()); ?>
<td><?= $this->getHtml('CS' . $element->status); ?>
<td><?= $element->datetime->format('H:i:s'); ?>
<td><?= $element->datetime->format('Y-m-d'); ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>

View File

@ -81,7 +81,7 @@ echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="box wf-100">
<table id="accountList" class="default sticky">
<table id="accountList" class="default sticky">
<caption><?= $this->getHtml('Recordings'); ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>

View File

@ -41,7 +41,7 @@ final class SessionTest extends \PHPUnit\Framework\TestCase
self::assertEquals(0, $this->session->id);
self::assertEquals(0, $this->session->busy);
self::assertEquals(0, $this->session->getBreak());
self::assertEquals([], $this->session->getSessionElements());
self::assertEquals([], $this->session->sessionElements);
self::assertEquals(ClockingType::OFFICE, $this->session->type);
self::assertEquals(ClockingStatus::START, $this->session->getStatus());
self::assertEquals((new \DateTime('now'))->format('Y-m-d'), $this->session->start->format('Y-m-d'));
@ -107,14 +107,6 @@ final class SessionTest extends \PHPUnit\Framework\TestCase
self::assertEquals(7 * 60 * 60, $this->session->busy);
}
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSessionElementInputOutput() : void
{
$element = new SessionElement(null, new \DateTime('now'));
$this->session->addSessionElement($element);
self::assertCount(1, $this->session->getSessionElements());
}
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{