Only show the shift "Comment" field for own entries
This commit is contained in:
parent
b6eda8dbfc
commit
ead56a89fe
|
@ -87,8 +87,11 @@ function user_myshifts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment = strip_request_item_nl('comment');
|
$comment = $shift['Comment'];
|
||||||
$user_source = User::find($shift['UID']);
|
$user_source = User::find($shift['UID']);
|
||||||
|
if (auth()->user()->id == $user_source->id) {
|
||||||
|
$comment = strip_request_item_nl('comment');
|
||||||
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
ShiftEntry_update([
|
ShiftEntry_update([
|
||||||
|
@ -111,7 +114,7 @@ function user_myshifts()
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShiftEntry_edit_view(
|
return ShiftEntry_edit_view(
|
||||||
User_Nick_render($shifts_user),
|
$shifts_user,
|
||||||
date('Y-m-d H:i', $shift['start']) . ', ' . shift_length($shift),
|
date('Y-m-d H:i', $shift['start']) . ', ' . shift_length($shift),
|
||||||
$shift['Name'],
|
$shift['Name'],
|
||||||
$shift['name'],
|
$shift['name'],
|
||||||
|
|
|
@ -154,7 +154,7 @@ function ShiftEntry_create_title()
|
||||||
/**
|
/**
|
||||||
* Display form for adding/editing a shift entry.
|
* Display form for adding/editing a shift entry.
|
||||||
*
|
*
|
||||||
* @param string $angel
|
* @param User $angel
|
||||||
* @param string $date
|
* @param string $date
|
||||||
* @param string $location
|
* @param string $location
|
||||||
* @param string $title
|
* @param string $title
|
||||||
|
@ -187,15 +187,22 @@ function ShiftEntry_edit_view(
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($angel->id == auth()->user()->id) {
|
||||||
|
$comment = form_textarea('comment', __('Comment (for your eyes only):'), $comment);
|
||||||
|
} else {
|
||||||
|
$comment = '';
|
||||||
|
}
|
||||||
|
|
||||||
return page_with_title(__('Edit shift entry'), [
|
return page_with_title(__('Edit shift entry'), [
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
form_info(__('Angel:'), $angel),
|
form_info(__('Angel:'), User_Nick_render($angel)),
|
||||||
form_info(__('Date, Duration:'), $date),
|
form_info(__('Date, Duration:'), $date),
|
||||||
form_info(__('Location:'), $location),
|
form_info(__('Location:'), $location),
|
||||||
form_info(__('Title:'), $title),
|
form_info(__('Title:'), $title),
|
||||||
form_info(__('Type:'), $type),
|
form_info(__('Type:'), $type),
|
||||||
form_textarea('comment', __('Comment (for your eyes only):'), $comment),
|
$comment,
|
||||||
join('', $freeload_form),
|
join('', $freeload_form),
|
||||||
form_submit('submit', __('Save'))
|
form_submit('submit', __('Save'))
|
||||||
])
|
])
|
||||||
|
|
|
@ -224,9 +224,10 @@ function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angelty
|
||||||
if ($shift_entry['freeloaded']) {
|
if ($shift_entry['freeloaded']) {
|
||||||
$entry = '<del>' . $entry . '</del>';
|
$entry = '<del>' . $entry . '</del>';
|
||||||
}
|
}
|
||||||
if ($user_shift_admin || $angeltype_supporter) {
|
$isUser = $shift_entry['UID'] == auth()->user()->id;
|
||||||
|
if ($user_shift_admin || $angeltype_supporter || $isUser) {
|
||||||
$entry .= ' <div class="btn-group">';
|
$entry .= ' <div class="btn-group">';
|
||||||
if ($user_shift_admin) {
|
if ($user_shift_admin || $isUser) {
|
||||||
$entry .= button_glyph(
|
$entry .= button_glyph(
|
||||||
page_link_to('user_myshifts', ['edit' => $shift_entry['id'], 'id' => $shift_entry['UID']]),
|
page_link_to('user_myshifts', ['edit' => $shift_entry['id'], 'id' => $shift_entry['UID']]),
|
||||||
'pencil',
|
'pencil',
|
||||||
|
|
Loading…
Reference in New Issue