aboutsummaryrefslogtreecommitdiff
path: root/app/views/consultation/overview/ungrouped.php
blob: 023d499d9a1d5467c07679ceebd89ce2baeb44c0 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?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>
        <col>
        <col>
        <col>
        <col>
        <col>
        <col>
        <col style="width: 96px">
    </colgroup>
    <thead>
        <tr>
            <th><?= _('Tag') ?></th>
            <th><?= _('Zeit') ?></th>
            <th><?= _('Bei') ?></th>
            <th><?= _('Ort') ?></th>
            <th><?= _('Status') ?></th>
            <th><?= _('Person(en)') ?></th>
            <th><?= _('Grund') ?></th>
            <th class="actions"><?= _('Optionen') ?></th>
        </tr>
    </thead>
<? foreach ($blocks as $block): ?>
    <tbody id="block-<?= htmlReady($block->id) ?>">
    <? foreach ($block->slots as $slot):
        if (!$slot->block->show_participants && $slot->isOccupied() && !$slot->isOccupied($GLOBALS['user']->id)) continue;
    ?>
        <tr id="slot-<?= htmlReady($slot->id) ?>">
            <td>
                <?= strftime(_('%A, %x'), $slot->start_time) ?>
            </td>
            <td>
                <?= strftime('%H:%M', $slot->start_time) ?>
                -
                <?= strftime('%H:%M', $slot->end_time) ?>

                <?= $displayNote($slot->note, 29, 'below') ?>
            </td>
            <td>
            <? if (count($block->responsibilities) > 0): ?>
                <ul class="default">
                <? foreach ($block->responsibilities as $responsibility): ?>
                    <li>
                        <a href="<?= URLHelper::getLink($responsibility->getURL(), [], true) ?>">
                            <?= htmlReady($responsibility->getName()) ?>
                        </a>
                    </li>
                <? endforeach; ?>
                </ul>
            <? endif; ?>
            </td>
            <td>
                <?= formatLinks($block->room) ?>
            </td>
            <td>
                <?= $this->render_partial('consultation/slot-occupation.php', compact('slot')) ?>
            </td>
            <td>
                <?= $this->render_partial('consultation/slot-bookings.php', compact('slot')) ?>
            </td>
            <td>
            <? if ($slot->isOccupied($GLOBALS['user']->id)): ?>
                <?= htmlReady($slot->bookings->findOneBy('user_id', $GLOBALS['user']->id)->reason) ?>
            <? endif; ?>
            </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="8">
                <?= Pagination::create($count, $page, $limit)->asLinks(function ($page) use ($controller) {
                    return $controller->index($page);
                }) ?>
            </td>
        </tr>
    </tfoot>
<? endif; ?>
</table>

<? endif; ?>