Skip to content
Snippets Groups Projects
Commit a790d2e3 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

TIC #88

parent d669eb40
No related branches found
No related tags found
No related merge requests found
......@@ -1523,6 +1523,8 @@ class Resources_RoomRequestController extends AuthenticatedController
$resolve = Request::submitted('resolve') || $force_resolve;
$this->show_force_resolve_button = false;
$this->booked_room_infos = [];
if ($resolve) {
CSRFProtection::verifyUnsafeRequest();
$this->selected_rooms = array_filter(Request::getArray('selected_rooms'));
......@@ -1616,6 +1618,16 @@ class Resources_RoomRequestController extends AuthenticatedController
);
if ($booking instanceof ResourceBooking) {
$bookings[] = $booking;
if ($this->booked_room_infos[$room->id]) {
if ($this->booked_room_infos[$room->id]['first_booking_date'] > $booking->begin) {
$this->booked_room_infos[$room->id]['first_booking_date'] = $booking->begin;
}
} else {
$this->booked_room_infos[$room->id] = [
'room' => $room,
'first_booking_date' => $booking->begin
];
}
}
} catch (Exception $e) {
$errors[] = $e->getMessage();
......@@ -1731,6 +1743,22 @@ class Resources_RoomRequestController extends AuthenticatedController
);
}
}
if ($this->booked_room_infos) {
//Sort the array:
uasort(
$this->booked_room_infos,
function ($a, $b) {
if ($a['room']->name > $b['room']->name) {
return 1;
} elseif ($a['room']->name < $b['room']->name) {
return -1;
} else {
return 0;
}
}
);
}
}
}
......
......@@ -2,6 +2,35 @@
data-dialog="size=big;<?= Request::submitted('reload-on-close') ? 'reload-on-close' : ''; ?>"
action="<?= $controller->link_for('resources/room_request/resolve/' . $request->id) ?>">
<?= CSRFProtection::tokenTag() ?>
<? if ($booked_room_infos): ?>
<article class="studip">
<header>
<h1><?= _('Gebuchte Räume') ?></h1>
</header>
<section>
<ul class="list-csv">
<? foreach ($booked_room_infos as $room_info) : ?>
<li>
<a href="<?= $room_info['room']->getActionLink(
'booking_plan',
['defaultDate' => date('Y-m-d', $room_info['first_booking_date'])]
) ?>" target="_blank"
title="<?= _('Belegungsplan anzeigen') ?>">
<?= htmlReady($room_info['room']->getFullName()) ?>
<?= Icon::create('link-intern')->asImg(
[
'class' => 'text-bottom',
'title' => ''
]
) ?>
</a>
</li>
<? endforeach ?>
</ul>
</section>
</article>
<? endif ?>
<section class="splitted-layout">
<? if ($show_info) : ?>
<article class="studip left-part">
<header>
......@@ -328,6 +357,7 @@
</article>
<? endif ?>
<? endif ?>
</section>
<footer data-dialog-button>
<? if ($prev_request) : ?>
<?= \Studip\LinkButton::create(
......@@ -386,4 +416,4 @@
) ?>
<? endif ?>
</footer>
</form>
\ No newline at end of file
</form>
......@@ -452,87 +452,89 @@ form#resolve-request, form#decline-request {
@media all and (min-width: 1600px) {
form#resolve-request {
display: flex;
flex-direction: row;
flex-wrap: wrap;
article.assign-dates {
div {
overflow-x: auto;
max-height: 250px;
}
}
article.assign-dates, div[data-dialog-button] {
header {
margin: 0;
section.splitted-layout {
display: flex;
flex-direction: row;
flex-wrap: wrap;
article.assign-dates {
div {
overflow-x: auto;
max-height: 250px;
}
}
table {
> tbody:last-of-type {
> tr:last-child {
> td {
border-bottom: none;
}
}
article.assign-dates, div[data-dialog-button] {
header {
margin: 0;
}
&.default {
> thead {
> tr {
> th {
&:first-child {
z-index: 2;
background-color: $content-color-20;
min-width: 180px;
left: 0;
}
position: sticky;
top: 0;
z-index: 1;
border-top: none;
border-bottom: none !important;
box-shadow: inset 0 1px 0 $brand-color-darker;
table {
> tbody:last-of-type {
> tr:last-child {
> td {
border-bottom: none;
}
}
}
> tbody {
> tr {
> td {
&:first-child {
&.default {
> thead {
> tr {
> th {
&:first-child {
z-index: 2;
background-color: $content-color-20;
min-width: 180px;
left: 0;
}
position: sticky;
left: 0;
top: 0;
z-index: 1;
background: $white;
border-top: none;
border-bottom: none !important;
box-shadow: inset 0 1px 0 $brand-color-darker;
}
}
}
> tbody {
> tr {
> td {
&:first-child {
position: sticky;
left: 0;
z-index: 1;
background: $white;
}
}
}
}
}
}
}
margin: 0;
height: 100%;
overflow-y: auto;
width: 100%;
padding: 0;
}
margin: 0;
height: 100%;
overflow-y: auto;
width: 100%;
padding: 0;
}
article {
&.left-part, &.right-part {
article {
&.left-part, &.right-part {
flex-grow: 1;
margin-bottom: 10px;
}
flex-grow: 1;
margin-bottom: 10px;
}
&.left-part {
width: 50%;
}
&.right-part {
width: 40%;
padding-left: 1em;
}
&.left-part {
width: 50%;
}
&.right-part {
width: 40%;
padding-left: 1em;
}
section {
padding-top: 0;
section {
padding-top: 0;
}
}
}
}
......@@ -543,4 +545,4 @@ form#resolve-request, form#decline-request {
form#resolve-request article.right-part {
padding-bottom: 10px;
}
}
\ No newline at end of file
}
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