Newer
Older
<?php
/**
* @var Consultation_AdminController $controller
* @var int $page
* @var string $current_action
* @var array<int, array{block: ConsultationBlock, slots: ConsultationSlot[]> $blocks
* @var Pagination $pagination
<? if (count($blocks) === 0): ?>
<?= MessageBox::info(sprintf(
implode('<br>', [
_('Derzeit sind keine Termine eingetragen.'),

Jan-Hendrik Willms
committed
'<a href="%s" class="button" data-dialog="size=big">%s</a>',
]),
$controller->create(),
_('Terminblöcke anlegen')
))->hideClose() ?>
<? else: ?>
<form action="<?= $controller->bulk($page, $current_action === 'expired') ?>" method="post">
<table class="default consultation-overview">
<colgroup>
<col style="width: 24px">
<col style="width: 10%">
<col style="width: 12%">
<col style="width: 48px">
</colgroup>
<thead>
<tr>
<th>
data-proxyfor=".consultation-overview tbody th :checkbox"
data-activates=".consultation-overview tfoot button">
</th>
</th>
<th><?= _('Uhrzeit') ?></th>
<th><?= _('Status') ?></th>
<th colspan="2">
<div style="display: flex; justify-content: space-between">
<span><?= _('Informationen') ?></span>
<span>
<?= $pagination->asLinks(function ($page) use ($controller, $current_action) {
return $controller->action_link($current_action, $page);
}) ?>
</span>
</div>
</th>
</tr>
</thead>
<? foreach ($blocks as $block): ?>
<tbody id="block-<?= htmlReady($block['block']->id) ?>" <? if ($block['block']->is_expired) echo 'class="block-is-expired"'; ?>>
<tr class="<? if ($block['block']->has_bookings) echo 'is-occupied'; ?>">
<th>
<input type="checkbox" data-proxyfor="#block-<?= htmlReady($block['block']->id) ?> :checkbox[name^=slot]">
</th>
<th colspan="3">
<?= $this->render_partial('consultation/block-description.php', ['block' => $block['block']]) ?>
</th>
<th class="actions">
<?= ActionMenu::get()->setContext(strval($block['block']))->addLink(
_('Block bearbeiten'),
Icon::create('edit'),
['data-dialog' => 'size=auto']
)->addLink(
$controller->url_for("consultation/export/print/{$block['block']->id}"),
_('Druckansicht anzeigen'),
Icon::create('print'),
['target' => '_blank']
)->condition($block['block']->has_bookings)->addLink(
$controller->mailURL($block['block']),
_('Nachricht schreiben'),
Icon::create('mail'),
['data-dialog' => 'size=50%', 'class' => 'send-mail']
)->condition($block['block']->has_bookings && !$block['block']->is_expired)->addLink(
$controller->cancel_blockURL($block['block'], $page),
_('Termine absagen'),
Icon::create('decline'),
['data-dialog' => 'size=auto']
)->condition(!$block['block']->has_bookings || $block['block']->is_expired)->addButton(
'remove',
_('Termine entfernen'),
Icon::create('trash'),
[
'formaction' => $controller->removeURL($block['block'], 0, $page),
'data-confirm' => _('Wollen Sie diese Termine wirklich löschen?'),
]
) ?>
</th>
</tr>
<? foreach ($block['slots'] as $slot): ?>
<tr id="slot-<?= htmlReady($slot->id) ?>" class="<? if ($slot->is_expired) echo 'slot-is-expired'; ?> <? if (count($slot->bookings) > 0) echo 'is-occupied'; ?>">
<td>
<input type="checkbox" name="slot-id[]" value="<?= htmlReady($block['block']->id) ?>-<?= htmlReady($slot->id) ?>">
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
</td>
<td>
<?= strftime('%R', $slot->start_time) ?>
-
<?= strftime('%R', $slot->end_time) ?>
</td>
<td>
<?= $this->render_partial('consultation/slot-occupation.php', compact('slot')) ?>
</td>
<td>
<? if (!$slot->note && count($slot->bookings) === 0): ?>
–
<? else: ?>
<? if ($slot->note): ?>
<?= formatLinks($slot->note) ?>
<br>
<? endif; ?>
<? if (count($slot->bookings) > 0): ?>
<ul class="default">
<? foreach ($slot->bookings as $booking): ?>
<li>
<a href="<?= URLHelper::getLink('dispatch.php/profile', ['username' => $booking->user->username]) ?>">
<?= htmlReady($booking->user->getFullName()) ?>
</a>
-
<? if ($booking->reason): ?>
<?= _('Grund') ?>:
<?= htmlReady($booking->reason) ?>
<? else: ?>
<span class="consultation-no-reason">
<?= _('Kein Grund angegeben') ?>
</span>
<? endif; ?>
</li>
<? endforeach; ?>
</ul>
<? endif; ?>
<? endif; ?>
</td>
<td class="actions">
$controller->noteURL($block['block'], $slot, $page),
_('Information bearbeiten'),
Icon::create('edit'),
['data-dialog' => 'size=auto']
)->condition(!$slot->is_expired && count($slot->bookings) < $slot->block->size)->addLink(
$controller->bookURL($block['block'], $slot, $page),
_('Termin reservieren'),
Icon::create('consultation'),
['data-dialog' => 'size=auto']
)->condition($slot->has_bookings)->addLink(
$controller->reasonURL($block['block'], $slot, $slot->bookings->first(), $page),
_('Grund bearbeiten'),
Icon::create('edit'),
['data-dialog' => 'size=auto']
)->condition($slot->has_bookings)->addLink(
$controller->mailURL($block['block'], $slot),
_('Nachricht schreiben'),
Icon::create('mail'),
['data-dialog' => 'size=50%', 'class' => 'send-mail']
)->condition($slot->has_bookings && !$slot->is_expired)->addLink(
$controller->cancel_slotURL($block['block'], $slot, $page),
_('Termin absagen'),
Icon::create('decline'),
['data-dialog' => 'size=auto']
)->condition(!$slot->has_bookings || $slot->is_expired)->addButton(
'delete',
_('Termin entfernen'),
Icon::create('trash'),
[
'formaction' => $controller->removeURL($block['block'], $slot, $page),
'data-confirm' => _('Wollen Sie diesen Termin wirklich entfernen?'),
]
) ?>
</td>
</tr>
<? endforeach; ?>
</tbody>
<? endforeach; ?>
<tfoot>
<tr>
<td colspan="5">
<?= Studip\Button::create(_('Nachricht schreiben'), 'mail', [
'data-dialog' => 'size=50%',
'data-activates-condition' => '.consultation-overview tbody tr.is-occupied :checkbox:checked',
'formaction' => $controller->mailURL('bulk'),
]) ?>
<?= Studip\Button::create(_('Absagen'), 'cancel', [
'data-dialog' => 'size=auto',
'data-activates-condition' => '.consultation-overview tbody tr.is-occupied :checkbox:checked',
]) ?>
<?= Studip\Button::create(_('Löschen'), 'delete', [
'class' => 'consultation-delete-check',
'data-dialog' => 'size=auto',
]) ?>
<div class="actions">
<?= $pagination->asLinks(function ($page) use ($controller, $current_action) {