You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.3 KiB
PHTML

<?php
4 years ago
use Engelsystem\Models\Room;
use Engelsystem\ShiftCalendarRenderer;
8 years ago
use Engelsystem\ShiftsFilterRenderer;
/**
*
4 years ago
* @param Room $room
* @param ShiftsFilterRenderer $shiftsFilterRenderer
* @param ShiftCalendarRenderer $shiftCalendarRenderer
* @return string
*/
4 years ago
function Room_view(Room $room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer)
8 years ago
{
$user = auth()->user();
$assignNotice = '';
if (config('signup_requires_arrival') && !$user->state->arrived) {
$assignNotice = info(render_user_arrived_hint(), true);
}
$description = '';
4 years ago
if ($room->description) {
$description = '<h3>' . __('Description') . '</h3>';
$parsedown = new Parsedown();
4 years ago
$description .= '<div class="well">' . $parsedown->parse($room->description) . '</div>';
}
$tabs = [];
4 years ago
if ($room->map_url) {
$tabs[__('Map')] = sprintf(
'<div class="map">'
7 years ago
. '<iframe style="width: 100%%; min-height: 400px; border: 0 none;" src="%s"></iframe>'
. '</div>',
4 years ago
$room->map_url
);
}
$tabs[__('Shifts')] = div('first', [
$shiftsFilterRenderer->render(page_link_to('rooms', [
'action' => 'view',
4 years ago
'room_id' => $room->id
])),
8 years ago
$shiftCalendarRenderer->render()
]);
$selected_tab = 0;
$request = request();
if ($request->has('shifts_filter_day')) {
$selected_tab = count($tabs) - 1;
}
4 years ago
return page_with_title(glyph('map-marker') . $room->name, [
$assignNotice,
$description,
auth()->can('admin_rooms') ? buttons([
button(
page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room->id]),
__('edit'),
'btn'
),
button(
page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room->id]),
__('delete'),
'btn'
)
]) : '',
tabs($tabs, $selected_tab),
], true);
}
/**
*
4 years ago
* @param Room $room
* @return string
*/
4 years ago
function Room_name_render(Room $room)
8 years ago
{
if (auth()->can('view_rooms')) {
4 years ago
return '<a href="' . room_link($room) . '">' . glyph('map-marker') . $room->name . '</a>';
8 years ago
}
4 years ago
return glyph('map-marker') . $room->name;
}