Skip to content
Snippets Groups Projects
Commit b4f508cf authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

add room request actions to action menu on times rooms for irregular dates, fixes #4003

Closes #4003

Merge request studip/studip!2861
parent 39178af5
No related branches found
No related tags found
No related merge requests found
...@@ -331,11 +331,6 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -331,11 +331,6 @@ class Course_TimesroomsController extends AuthenticatedController
$this->date = CourseDate::find($termin_id) ?: CourseExDate::find($termin_id); $this->date = CourseDate::find($termin_id) ?: CourseExDate::find($termin_id);
$this->attributes = []; $this->attributes = [];
if ($request = RoomRequest::findByDate($this->date->id)) {
$this->params = ['request_id' => $request->getId()];
} else {
$this->params = ['new_room_request_type' => 'date_' . $this->date->id];
}
$this->only_bookable_rooms = Request::submitted('only_bookable_rooms'); $this->only_bookable_rooms = Request::submitted('only_bookable_rooms');
if (Config::get()->RESOURCES_ENABLE) { if (Config::get()->RESOURCES_ENABLE) {
......
...@@ -82,8 +82,8 @@ $is_exTermin = $termin instanceof CourseExDate; ...@@ -82,8 +82,8 @@ $is_exTermin = $termin instanceof CourseExDate;
<?= $room_holiday ?: '' ?> <?= $room_holiday ?: '' ?>
<? endif ?> <? endif ?>
<? $room_request_exists = RoomRequest::existsByDate($termin->id, true) ?> <? $room_request = RoomRequest::findByDate($termin->id) ?>
<? if ($room_request_exists): ?> <? if ($room_request && $room_request->closed == ResourceRequest::STATE_OPEN): ?>
<? $msg_info = _('Für diesen Termin existiert eine Raumanfrage.') ?> <? $msg_info = _('Für diesen Termin existiert eine Raumanfrage.') ?>
<?= tooltipIcon($msg_info) ?> <?= tooltipIcon($msg_info) ?>
<? endif ?> <? endif ?>
...@@ -123,9 +123,33 @@ $is_exTermin = $termin instanceof CourseExDate; ...@@ -123,9 +123,33 @@ $is_exTermin = $termin instanceof CourseExDate;
<? $actionMenu->addLink( <? $actionMenu->addLink(
$controller->url_for('course/timesrooms/editDate/' . $termin->id, $linkAttributes), $controller->url_for('course/timesrooms/editDate/' . $termin->id, $linkAttributes),
_('Termin bearbeiten'), _('Termin bearbeiten'),
Icon::create('edit', Icon::ROLE_CLICKABLE, ['title' => _('Diesen Termin bearbeiten')]), Icon::create('edit'),
['data-dialog' => ''] ['data-dialog' => '']
) ?> ) ?>
<? $actionMenu
->conditionAll(Config::get()->RESOURCES_ENABLE && Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS)
->condition((bool) $room_request)
->addLink(
$controller->url_for(
'course/room_requests/request_show_summary',
$room_request
),
_('Raumanfrage bearbeiten'),
Icon::create('room-occupied'),
['data-dialog' => 'size=big']
)
->condition(!$room_request)
->addLink(
$controller->url_for(
'course/room_requests/new_request',
['range_str' => 'date', 'range_id' => $termin->id]
),
_('Neue Raumanfrage'),
Icon::create('room-request'),
['data-dialog' => 'size=big']
)
->conditionAll(true)
?>
<? $actionMenu->addLink( <? $actionMenu->addLink(
$controller->url_for( $controller->url_for(
......
...@@ -223,25 +223,5 @@ ...@@ -223,25 +223,5 @@
), ),
['data-dialog' => 'size=big']) ?> ['data-dialog' => 'size=big']) ?>
<? endif ?> <? endif ?>
<? if (Request::isXhr() && !$locked && Config::get()->RESOURCES_ENABLE && Config::get()->RESOURCES_ALLOW_ROOM_REQUESTS): ?>
<? if (isset($request_id)) : ?>
<?= Studip\LinkButton::create(
_('Zur Raumanfrage wechseln'),
$controller->url_for(
'course/room_requests/request_show_summary/' . $request_id
),
['data-dialog' => 'size=big']
) ?>
<? else : ?>
<?= Studip\LinkButton::create(
_('Raumanfrage erstellen'),
$controller->url_for(
'course/room_requests/new_request',
array_merge($params, ['range_str' => 'date', 'range_id' => $date->id])
),
['data-dialog' => 'size=big']
) ?>
<? endif ?>
<? endif ?>
</footer> </footer>
</form> </form>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment