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(htmlspecialchars($location->description));
}
$neededAngelTypes = '';
if (auth()->can('admin_shifts') && $location->neededAngelTypes->isNotEmpty()) {
$neededAngelTypes .= '' . __('location.required_angels') . '
';
foreach ($location->neededAngelTypes as $neededAngelType) {
if ($neededAngelType->count) {
$neededAngelTypes .= '- ' . $neededAngelType->angelType->name
. ': '
. $neededAngelType->count
. '
';
}
}
$neededAngelTypes .= '
';
}
$dect = '';
if (config('enable_dect') && $location->dect) {
$dect = heading(__('Contact'), 3)
. description([__('general.dect') => sprintf(
'%1$s',
htmlspecialchars($location->dect)
)]);
}
$tabs = [];
if ($location->map_url) {
$tabs[__('location.map_url')] = sprintf(
''
. ''
. '
',
htmlspecialchars($location->map_url)
);
}
$tabs[__('general.shifts')] = div('first', [
$shiftsFilterRenderer->render(url('/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(url('/admin/locations'), icon('chevron-left'), 'btn-sm', '', __('general.back'));
return page_with_title(
(auth()->can('admin_locations') ? $link . ' ' : '') .
icon('pin-map-fill') . htmlspecialchars($location->name),
[
$assignNotice,
auth()->can('admin_locations') ? buttons([
button(
url('/admin/locations/edit/' . $location->id),
icon('pencil'),
'',
'',
__('form.edit')
),
]) : '',
$dect,
$description,
$neededAngelTypes,
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') . htmlspecialchars($location->name)
. '';
}
return icon('pin-map-fill') . htmlspecialchars($location->name);
}