-
Notifications
You must be signed in to change notification settings - Fork 1
Zmskvr 670 tagessperre gesamtuebersicht #1420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
4780ed4
feat(zmskvr-670): Controllers for the closures
MoDaae e4eeceb
feat(zmskvr-670): closure in gesamtkalender
MoDaae 423b1e8
feat(zmskvr-670): extend Closure to get range
MoDaae fd9aaea
feat(zmskvr-670): Validate unique scopeIds and enforce correct date r…
MoDaae 79624d5
feat(zmskvr-670): unittest
MoDaae 29bcf84
feat(zmskvr-670): unittest2
MoDaae 1713fa8
Merge remote-tracking branch 'origin/next' into zmskvr-670-tagessperr…
MoDaae 7cca802
Merge remote-tracking branch 'origin/next' into zmskvr-670-tagessperr…
MoDaae 872f148
Merge remote-tracking branch 'origin/next' into zmskvr-670-tagessperr…
MoDaae 1a3b4c3
feat(zmskvr-670): unittest finale Anpasssung
MoDaae 8499ff4
Merge remote-tracking branch 'origin/next' into zmskvr-670-tagessperr…
MoDaae b7cc1ce
feat(zmskvr-670): Legende
MoDaae 62c2a26
feat(zmskvr-670): reinigen
MoDaae 87a8e19
feat(zmskvr-670): reinigen
MoDaae 29c2efe
feat(zmskvr-670): Closure.php use the object instead of array, test r…
MoDaae 1da5e5c
feat(zmskvr-670): Überschriften für die Legende angepasst
MoDaae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
namespace BO\Zmsadmin; | ||
|
||
use Psr\Http\Message\RequestInterface; | ||
use Psr\Http\Message\ResponseInterface; | ||
|
||
class OverallCalendarClosureLoadData extends BaseController | ||
{ | ||
public function readResponse( | ||
RequestInterface $request, | ||
ResponseInterface $response, | ||
array $args | ||
) { | ||
$scopeIds = $_GET['scopeIds'] ?? null; | ||
$dateFrom = $_GET['dateFrom'] ?? null; | ||
$dateUntil = $_GET['dateUntil'] ?? null; | ||
|
||
if ($scopeIds === null && $dateFrom === null && $dateUntil === null) { | ||
$response->getBody()->write(json_encode([])); | ||
return $response->withHeader('Content-Type', 'application/json'); | ||
} | ||
|
||
if (!$scopeIds || !$dateFrom || !$dateUntil) { | ||
$error = [ | ||
'error' => true, | ||
'message' => 'Missing required parameters: scopeIds, dateFrom, dateUntil', | ||
]; | ||
$response->getBody()->write(json_encode($error)); | ||
return $response | ||
->withStatus(400) | ||
->withHeader('Content-Type', 'application/json'); | ||
} | ||
|
||
$params = [ | ||
'scopeIds' => $scopeIds, | ||
'dateFrom' => $dateFrom, | ||
'dateUntil' => $dateUntil, | ||
]; | ||
|
||
$apiResult = \App::$http->readGetResult('/closure/', $params); | ||
$apiResponse = $apiResult->getResponse(); | ||
|
||
$lastMod = $apiResponse->getHeaderLine('Last-Modified'); | ||
if ($lastMod !== '') { | ||
$response = $response->withHeader('Last-Modified', $lastMod); | ||
} | ||
|
||
$contentType = $apiResponse->getHeaderLine('Content-Type'); | ||
$response = $response->withHeader( | ||
'Content-Type', | ||
$contentType !== '' ? $contentType : 'application/json' | ||
); | ||
|
||
$bodyStream = $apiResponse->getBody(); | ||
if ($bodyStream->isSeekable()) { | ||
$bodyStream->rewind(); | ||
} | ||
$rawBody = (string) $bodyStream; | ||
|
||
$response->getBody()->write($rawBody); | ||
|
||
return $response->withStatus($apiResponse->getStatusCode()); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,18 @@ | |
</div> | ||
</form> | ||
|
||
<div class="overall-calendar-legend" style="margin:10px 0;"> | ||
<strong>Legende:</strong> | ||
<span class="overall-calendar-seat overall-calendar-closed" style="display:inline-block; width:80px; height:18px; margin-left:8px; vertical-align:middle;"></span> | ||
<span style="margin-right:12px;">gesperrt</span> | ||
|
||
<span class="overall-calendar-seat overall-calendar-cancelled" style="display:inline-block; width:80px; height:18px; vertical-align:middle;"></span> | ||
<span style="margin-right:12px;">storniert</span> | ||
|
||
<span class="overall-calendar-seat overall-calendar-open" style="display:inline-block; width:80px; height:18px; vertical-align:middle;"></span> | ||
<span>frei</span> | ||
</div> | ||
Comment on lines
+75
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Replace inline styles and add accessible semantics to the legend Move presentational styles to SCSS and add ARIA for screen readers. Also reuse Bootstrap spacing utilities for consistency. Apply this diff to the Twig: - <div class="overall-calendar-legend" style="margin:10px 0;">
- <strong>Legende:</strong>
- <span class="overall-calendar-seat overall-calendar-closed" style="display:inline-block; width:80px; height:18px; margin-left:8px; vertical-align:middle;"></span>
- <span style="margin-right:12px;">gesperrt</span>
-
- <span class="overall-calendar-seat overall-calendar-cancelled" style="display:inline-block; width:80px; height:18px; vertical-align:middle;"></span>
- <span style="margin-right:12px;">storniert</span>
-
- <span class="overall-calendar-seat overall-calendar-open" style="display:inline-block; width:80px; height:18px; vertical-align:middle;"></span>
- <span>frei</span>
- </div>
+ <div class="overall-calendar-legend my-2" role="group" aria-labelledby="overall-calendar-legend-title">
+ <strong id="overall-calendar-legend-title" class="me-2">Legende:</strong>
+ <span class="overall-calendar-seat overall-calendar-closed overall-calendar-legend-swatch ms-2" aria-hidden="true"></span>
+ <span class="me-3">gesperrt</span>
+
+ <span class="overall-calendar-seat overall-calendar-cancelled overall-calendar-legend-swatch" aria-hidden="true"></span>
+ <span class="me-3">storniert</span>
+
+ <span class="overall-calendar-seat overall-calendar-open overall-calendar-legend-swatch" aria-hidden="true"></span>
+ <span>frei</span>
+ </div> Add this to SCSS (overallCalendar.scss): .overall-calendar-legend-swatch {
display: inline-block;
width: 80px;
height: 18px;
vertical-align: middle;
} 🤖 Prompt for AI Agents
|
||
|
||
<div class="overall-calendar-wrapper"> | ||
<div id="overall-calendar" class="overall-calendar"></div> | ||
</div> | ||
|
116 changes: 116 additions & 0 deletions
116
zmsadmin/tests/Zmsadmin/OverallCalendarClosureLoadDataTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php | ||
|
||
namespace BO\Zmsadmin\Tests; | ||
|
||
class OverallCalendarClosureLoadDataTest extends Base | ||
{ | ||
protected $arguments = []; | ||
protected $parameters = []; | ||
protected $classname = "OverallCalendarClosureLoadData"; | ||
|
||
public function testRenderingWithoutParameters() | ||
{ | ||
$_SERVER['HTTP_AUTHORIZATION'] = 'Bearer validtoken'; | ||
$_GET = []; | ||
|
||
$response = $this->render([], [], []); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$this->assertEquals('application/json', $response->getHeaderLine('Content-Type')); | ||
$body = json_decode((string)$response->getBody(), true); | ||
$this->assertIsArray($body); | ||
$this->assertEmpty($body); | ||
} | ||
|
||
public function testMissingParamsReturnsError() | ||
{ | ||
$_SERVER['HTTP_AUTHORIZATION'] = 'Bearer validtoken'; | ||
$_GET = [ | ||
'scopeIds' => '58,59' | ||
]; | ||
|
||
$response = $this->render([], [], []); | ||
|
||
$this->assertEquals(400, $response->getStatusCode()); | ||
$this->assertEquals('application/json', $response->getHeaderLine('Content-Type')); | ||
|
||
$body = json_decode((string)$response->getBody(), true); | ||
$this->assertIsArray($body); | ||
$this->assertArrayHasKey('error', $body); | ||
$this->assertTrue($body['error']); | ||
$this->assertStringContainsString('dateFrom', $body['message']); | ||
$this->assertStringContainsString('dateUntil', $body['message']); | ||
} | ||
|
||
|
||
public function testRendering() | ||
{ | ||
$_SERVER['HTTP_AUTHORIZATION'] = 'Bearer validtoken'; | ||
$_GET = [ | ||
'scopeIds' => '58,59', | ||
'dateFrom' => '2025-09-02', | ||
'dateUntil' => '2025-09-05', | ||
]; | ||
|
||
$this->setApiCalls([ | ||
[ | ||
'function' => 'readGetResult', | ||
'url' => '/closure/', | ||
'parameters' => [ | ||
'scopeIds' => '58,59', | ||
'dateFrom' => '2025-09-02', | ||
'dateUntil' => '2025-09-05', | ||
], | ||
'response' => $this->readFixture('GET_Closure_Data.json'), | ||
], | ||
]); | ||
|
||
$response = $this->render([], [], []); | ||
|
||
$this->assertEquals(200, $response->getStatusCode()); | ||
$this->assertEquals('application/json', $response->getHeaderLine('Content-Type')); | ||
|
||
$body = json_decode((string)$response->getBody(), true); | ||
$this->assertIsArray($body); | ||
$this->assertArrayHasKey('data', $body); | ||
$this->assertArrayHasKey('items', $body['data']); | ||
$this->assertIsArray($body['data']['items']); | ||
$this->assertNotEmpty($body['data']['items']); | ||
|
||
$first = $body['data']['items'][0]; | ||
$this->assertArrayHasKey('scopeId', $first); | ||
$this->assertArrayHasKey('date', $first); | ||
} | ||
|
||
public function testResponseStructure() | ||
{ | ||
$_SERVER['HTTP_AUTHORIZATION'] = 'Bearer validtoken'; | ||
$_GET = [ | ||
'scopeIds' => '58,59', | ||
'dateFrom' => '2025-09-02', | ||
'dateUntil' => '2025-09-05', | ||
]; | ||
|
||
$this->setApiCalls([ | ||
[ | ||
'function' => 'readGetResult', | ||
'url' => '/closure/', | ||
'parameters' => [ | ||
'scopeIds' => '58,59', | ||
'dateFrom' => '2025-09-02', | ||
'dateUntil' => '2025-09-05', | ||
], | ||
'response' => $this->readFixture('GET_Closure_Data.json'), | ||
], | ||
]); | ||
|
||
$response = $this->render([], [], []); | ||
$this->assertEquals('application/json', $response->getHeaderLine('Content-Type')); | ||
|
||
$body = json_decode((string)$response->getBody(), true); | ||
$this->assertArrayHasKey('$schema', $body); | ||
$this->assertArrayHasKey('meta', $body); | ||
$this->assertArrayHasKey('data', $body); | ||
$this->assertArrayHasKey('items', $body['data']); | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Prevent overlapping auto-refresh calls.
Auto-refresh every 60s can overlap on slow networks. Add an in-flight guard with try/finally.
Add once near the top with other module-level vars:
🤖 Prompt for AI Agents