Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 32 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| OlzTerminTemplatesListParams | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| OlzTerminTemplatesList | |
0.00% |
0 / 32 |
|
0.00% |
0 / 5 |
42 | |
0.00% |
0 / 1 |
| hasAccess | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| searchSqlWhenHasAccess | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| getPageTitle | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getPageDescription | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getHtmlWhenHasAccess | |
0.00% |
0 / 22 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Olz\Termine\Components\OlzTerminTemplatesList; |
| 4 | |
| 5 | use Olz\Components\Common\OlzRootComponent; |
| 6 | use Olz\Components\Page\OlzFooter\OlzFooter; |
| 7 | use Olz\Components\Page\OlzHeader\OlzHeader; |
| 8 | use Olz\Entity\Termine\TerminTemplate; |
| 9 | use Olz\Termine\Components\OlzTerminTemplatesListItem\OlzTerminTemplatesListItem; |
| 10 | use Olz\Utils\HttpParams; |
| 11 | |
| 12 | /** @extends HttpParams<array{}> */ |
| 13 | class OlzTerminTemplatesListParams extends HttpParams { |
| 14 | } |
| 15 | |
| 16 | /** @extends OlzRootComponent<array<string, mixed>> */ |
| 17 | class OlzTerminTemplatesList extends OlzRootComponent { |
| 18 | public function hasAccess(): bool { |
| 19 | return $this->authUtils()->hasPermission('termine'); |
| 20 | } |
| 21 | |
| 22 | public function searchSqlWhenHasAccess(array $terms): string|array|null { |
| 23 | $code_href = $this->envUtils()->getCodeHref(); |
| 24 | return $this->searchUtils()->getStaticResultQuery([ |
| 25 | 'link' => "{$code_href}termine/vorlagen", |
| 26 | 'icon' => "{$code_href}assets/icns/termine_type_all_20.svg", |
| 27 | 'title' => $this->getPageTitle(), |
| 28 | 'text' => $this->getPageDescription(), |
| 29 | ], $terms); |
| 30 | } |
| 31 | |
| 32 | public function getPageTitle(): string { |
| 33 | return "Termin-Vorlagen"; |
| 34 | } |
| 35 | |
| 36 | public function getPageDescription(): string { |
| 37 | return "Vorlagen, um Termine effizienter erstellen zu können."; |
| 38 | } |
| 39 | |
| 40 | public function getHtmlWhenHasAccess(mixed $args): string { |
| 41 | $this->httpUtils()->validateGetParams(OlzTerminTemplatesListParams::class); |
| 42 | $code_href = $this->envUtils()->getCodeHref(); |
| 43 | |
| 44 | $out = OlzHeader::render([ |
| 45 | 'back_link' => "{$code_href}termine", |
| 46 | 'title' => 'Termin-Vorlagen', |
| 47 | 'description' => "Vorlagen, um OL Zimmerberg-Termine zu erstellen.", |
| 48 | 'norobots' => true, |
| 49 | ]); |
| 50 | |
| 51 | $out .= <<<ZZZZZZZZZZ |
| 52 | <div class='content-right'> |
| 53 | </div> |
| 54 | <div class='content-middle'> |
| 55 | <button |
| 56 | id='create-termin-template-button' |
| 57 | class='btn btn-secondary' |
| 58 | onclick='return olz.initOlzEditTerminTemplateModal()' |
| 59 | > |
| 60 | <img src='{$code_href}assets/icns/new_white_16.svg' class='noborder' /> |
| 61 | Neue Vorlage erstellen |
| 62 | </button> |
| 63 | <h1>Termin-Vorlagen</h1> |
| 64 | ZZZZZZZZZZ; |
| 65 | $termin_template_repo = $this->entityManager()->getRepository(TerminTemplate::class); |
| 66 | $termin_templates = $termin_template_repo->findBy(['on_off' => 1]); |
| 67 | foreach ($termin_templates as $termin_template) { |
| 68 | $out .= OlzTerminTemplatesListItem::render([ |
| 69 | 'termin_template' => $termin_template, |
| 70 | ]); |
| 71 | } |
| 72 | |
| 73 | $out .= <<<'ZZZZZZZZZZ' |
| 74 | </div> |
| 75 | ZZZZZZZZZZ; |
| 76 | |
| 77 | $out .= OlzFooter::render(); |
| 78 | |
| 79 | return $out; |
| 80 | } |
| 81 | } |