user();
$assignNotice = '';
if (config('signup_requires_arrival') && !$user->state->arrived) {
$assignNotice = info(render_user_arrived_hint(), true);
}
$description = '';
if ($location->description) {
$description = '
' . __('general.description') . '
';
$parsedown = new Parsedown();
$description .= $parsedown->parse($location->description);
}
$dect = '';
if (config('enable_dect') && $location->dect) {
$dect = heading(__('Contact'), 3)
. description([__('general.dect') => sprintf('%1$s', $location->dect)]);
}
$tabs = [];
if ($location->map_url) {
$tabs[__('location.map_url')] = sprintf(
''
. ''
. '
',
$location->map_url
);
}
$tabs[__('Shifts')] = div('first', [
$shiftsFilterRenderer->render(page_link_to('locations', [
'action' => 'view',
'location_id' => $location->id,
]), ['locations' => [$location->id]]),
$shiftCalendarRenderer->render(),
]);
$selected_tab = 0;
$request = request();
if ($request->has('shifts_filter_day')) {
$selected_tab = count($tabs) - 1;
}
$link = button(page_link_to('admin/locations'), icon('chevron-left'), 'btn-sm');
return page_with_title(
(auth()->can('admin_locations') ? $link . ' ' : '') .
icon('pin-map-fill') . $location->name,
[
$assignNotice,
auth()->can('admin_locations') ? buttons([
button(
page_link_to('admin/locations/edit/' . $location->id),
icon('pencil') . __('edit')
),
]) : '',
$dect,
$description,
tabs($tabs, $selected_tab),
],
true
);
}
/**
*
* @param Location $location
* @return string
*/
function location_name_render(Location $location)
{
if (auth()->can('view_locations')) {
return '' . icon('pin-map-fill') . $location->name . '';
}
return icon('pin-map-fill') . $location->name;
}