aboutsummaryrefslogtreecommitdiff
path: root/app/views/consultation/overview/index.php
blob: 63f35ba7297e4243c5f3a5ccfca3a4faf4156a24 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
 * @var ConsultationBlock[] $blocks
 * @var Consultation_OverviewController $controller
 * @var int $count
 * @var int $limit
 * @var int $page
 *
 * @var callable $displayNote
 */
?>
<? if (count($blocks) === 0): ?>

<?= MessageBox::info(_('Aktuell werden keine Termine angeboten.'))->hideClose() ?>

<? else: ?>

<table class="default">
    <colgroup>
        <col style="width: 10%">
        <col style="width: 10%">
        <col>
        <col style="width: 24px">
    </colgroup>
    <thead>
        <tr>
            <th><?= _('Uhrzeit') ?></th>
            <th><?= _('Status') ?></th>
            <th><?= _('Informationen') ?></th>
            <th></th>
        </tr>
    </thead>
<? foreach ($blocks as $block): ?>
    <tbody>
        <tr id="block-<?= htmlReady($block->id) ?>">
            <th colspan="4">
                <?= $this->render_partial('consultation/block-description.php', compact('block')) ?>
            </th>
        </tr>
    <? foreach ($block->slots as $slot): ?>
        <tr id="<?= htmlReady($slot->id) ?>">
            <td>
                <?= date('H:i', $slot->start_time) ?>
                -
                <?= date('H:i', $slot->end_time) ?>
            </td>
            <td>
                <?= $this->render_partial('consultation/slot-occupation.php', compact('slot')) ?>
            </td>
            <td>
                <?= $displayNote($slot->note, 2048) ?>
                <?= $this->render_partial('consultation/slot-bookings.php', compact('slot')) ?>
            </td>
            <td class="actions">
            <? if ($slot->isOccupied($GLOBALS['user']->id)): ?>
                <a href="<?= $controller->cancel($block, $slot) ?>" data-dialog="size=auto">
                    <?= Icon::create('trash')->asSvg(tooltip2(_('Termin absagen'))) ?>
                </a>
            <? elseif ($slot->userMayCreateBookingForSlot()): ?>
                <a href="<?= $controller->book($block, $slot) ?>" data-dialog="size=auto">
                    <?= Icon::create('add')->asSvg(tooltip2(_('Termin reservieren'))) ?>
                </a>
            <? else: ?>
                <?= Icon::create('decline', Icon::ROLE_INACTIVE)->asSvg(tooltip2(_('Dieser Termin ist für Buchungen gesperrt.'))) ?>
            <? endif; ?>
            </td>
        </tr>
    <? endforeach; ?>
    </tbody>
<? endforeach; ?>
<? if ($count > $limit): ?>
    <tfoot>
        <tr>
            <td colspan="4">
                <?= Pagination::create($count, $page, $limit)->asLinks(function ($page) use ($controller) {
                    return $controller->index($page);
                }) ?>
            </td>
        </tr>
    </tfoot>
<? endif; ?>
</table>

<? endif; ?>