diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index bb75b00ce..24edcc667 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -203,7 +203,11 @@ function load_types() )' . ($isShico ? '' : 'WHERE angel_types.hide_on_shift_view = 0 - OR user_angel_type.user_id IS NOT NULL ') . + OR ( + user_angel_type.user_id IS NOT NULL + AND + NOT `user_angel_type`.`confirm_user_id` IS NULL + ) ') . 'ORDER BY `angel_types`.`name` ', [ diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index b48621d08..4eaa2f4ba 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -520,25 +520,36 @@ function AngelType_view( '', __('general.add') ) : ''); + + // Let's create the tabs as we go, so we can hide if needed + // Tab #1 -> INFO + $pagetabs = [ + __('Info') => AngelType_view_info( + $angeltype, + $members, + $admin_user_angeltypes, + $admin_angeltypes, + $supporter + ), + ]; + // Tab #2 -> Only if the user deserves :) + if ($admin_user_angeltypes || + !$angeltype->hide_on_shift_view || + ($angeltype->hide_on_shift_view && (!is_null($user_angeltype) && $user_angeltype->confirm_user_id))) { + // Yup, you can see this: admin, not to hide or confirmed user + $pagetabs[__('general.shifts')] = AngelType_view_shifts( + $angeltype, + $shiftsFilterRenderer, + $shiftCalendarRenderer + ); + } + return page_with_title( $back . ' ' . sprintf(__('Team %s'), htmlspecialchars($angeltype->name)) . ' ' . $add, [ AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_license, $user), msg(), - tabs([ - __('Info') => AngelType_view_info( - $angeltype, - $members, - $admin_user_angeltypes, - $admin_angeltypes, - $supporter - ), - __('general.shifts') => AngelType_view_shifts( - $angeltype, - $shiftsFilterRenderer, - $shiftCalendarRenderer - ), - ], $tab), + tabs($pagetabs, $tab), ], true );