Fix worklog edit user & rename user on profile page
This commit is contained in:
parent
63c70c0ec2
commit
fc9b4d6da4
|
@ -11,9 +11,9 @@
|
||||||
{{ csrf() }}
|
{{ csrf() }}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{{ m.alert(__('worklog.delete.info', [m.user(user)]), 'danger', true) }}
|
{{ m.alert(__('worklog.delete.info', [m.user(userdata)]), 'danger', true) }}
|
||||||
{{ m.button(__('form.cancel'),
|
{{ m.button(__('form.cancel'),
|
||||||
url('/users?action=view&user_id=' ~ user.id),
|
url('/users?action=view&user_id=' ~ userdata.id),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>
|
<h1>
|
||||||
{{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: user.id}),
|
{{ m.button(m.icon('chevron-left'), url('/users', {action: 'view', user_id: userdata.id}),
|
||||||
null, 'sm', __('general.back')) }}
|
null, 'sm', __('general.back')) }}
|
||||||
{{ block('title') }}
|
{{ block('title') }}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<div>
|
<div>
|
||||||
<label class="form-label">{{ __('general.user') }}</label>
|
<label class="form-label">{{ __('general.user') }}</label>
|
||||||
</div>
|
</div>
|
||||||
{{ m.user(user, {'pronoun': true}) }}
|
{{ m.user(userdata, {'pronoun': true}) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ f.input('work_date', __('worklog.date'), {
|
{{ f.input('work_date', __('worklog.date'), {
|
||||||
|
|
|
@ -19,14 +19,14 @@
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
{{ f.input('nick', __('general.nick'), {
|
{{ f.input('nick', __('general.nick'), {
|
||||||
'value': user.name,
|
'value': userdata.name,
|
||||||
'disabled': true,
|
'disabled': true,
|
||||||
}) }}
|
}) }}
|
||||||
</div>
|
</div>
|
||||||
{% if config('enable_pronoun') %}
|
{% if config('enable_pronoun') %}
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
{{ f.input('pronoun', __('settings.profile.pronoun'), {
|
{{ f.input('pronoun', __('settings.profile.pronoun'), {
|
||||||
'value': user.personalData.pronoun,
|
'value': userdata.personalData.pronoun,
|
||||||
'max_length': 15,
|
'max_length': 15,
|
||||||
'required': isPronounRequired,
|
'required': isPronounRequired,
|
||||||
'required_icon': isPronounRequired,
|
'required_icon': isPronounRequired,
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
{{ f.input('first_name', __('settings.profile.firstname'), {
|
{{ f.input('first_name', __('settings.profile.firstname'), {
|
||||||
'value': user.personalData.first_name,
|
'value': userdata.personalData.first_name,
|
||||||
'max_length': 64,
|
'max_length': 64,
|
||||||
'required': isFirstnameRequired,
|
'required': isFirstnameRequired,
|
||||||
'required_icon': isFirstnameRequired,
|
'required_icon': isFirstnameRequired,
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
{{ f.input('last_name', __('settings.profile.lastname'), {
|
{{ f.input('last_name', __('settings.profile.lastname'), {
|
||||||
'value': user.personalData.last_name,
|
'value': userdata.personalData.last_name,
|
||||||
'max_length': 64,
|
'max_length': 64,
|
||||||
'required': isLastnameRequired,
|
'required': isLastnameRequired,
|
||||||
'required_icon': isLastnameRequired,
|
'required_icon': isLastnameRequired,
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
{% if config('enable_planned_arrival') %}
|
{% if config('enable_planned_arrival') %}
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
{% set planned_arrival_date = user.personalData.planned_arrival_date %}
|
{% set planned_arrival_date = userdata.personalData.planned_arrival_date %}
|
||||||
{{ f.input('planned_arrival_date', __('settings.profile.planned_arrival_date'), {
|
{{ f.input('planned_arrival_date', __('settings.profile.planned_arrival_date'), {
|
||||||
'type': 'date',
|
'type': 'date',
|
||||||
'value': planned_arrival_date ? planned_arrival_date.format('Y-m-d') : '',
|
'value': planned_arrival_date ? planned_arrival_date.format('Y-m-d') : '',
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
}) }}
|
}) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
{% set planned_departure_date = user.personalData.planned_departure_date %}
|
{% set planned_departure_date = userdata.personalData.planned_departure_date %}
|
||||||
{{ f.input('planned_departure_date', __('settings.profile.planned_departure_date'), {
|
{{ f.input('planned_departure_date', __('settings.profile.planned_departure_date'), {
|
||||||
'type': 'date',
|
'type': 'date',
|
||||||
'value': planned_departure_date ? planned_departure_date.format('Y-m-d') : '',
|
'value': planned_departure_date ? planned_departure_date.format('Y-m-d') : '',
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
{% if config('enable_dect') %}
|
{% if config('enable_dect') %}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ f.input('dect', __('general.dect'), {
|
{{ f.input('dect', __('general.dect'), {
|
||||||
'value': user.contact.dect,
|
'value': userdata.contact.dect,
|
||||||
'max_length': 40,
|
'max_length': 40,
|
||||||
'required': isDectRequired,
|
'required': isDectRequired,
|
||||||
'required_icon': isDectRequired,
|
'required_icon': isDectRequired,
|
||||||
|
@ -95,14 +95,14 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ f.input('mobile', __('settings.profile.mobile'), {
|
{{ f.input('mobile', __('settings.profile.mobile'), {
|
||||||
'value': user.contact.mobile,
|
'value': userdata.contact.mobile,
|
||||||
'max_length': 40,
|
'max_length': 40,
|
||||||
'required': isMobileRequired,
|
'required': isMobileRequired,
|
||||||
'required_icon': isMobileRequired,
|
'required_icon': isMobileRequired,
|
||||||
}) }}
|
}) }}
|
||||||
{% if config('enable_mobile_show') %}
|
{% if config('enable_mobile_show') %}
|
||||||
{{ f.checkbox('mobile_show', __('settings.profile.mobile_show'), {
|
{{ f.checkbox('mobile_show', __('settings.profile.mobile_show'), {
|
||||||
'checked': user.settings.mobile_show,
|
'checked': userdata.settings.mobile_show,
|
||||||
}) }}
|
}) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ f.input('email', __('general.email'), {
|
{{ f.input('email', __('general.email'), {
|
||||||
'type': 'email',
|
'type': 'email',
|
||||||
'value': user.email,
|
'value': userdata.email,
|
||||||
'max_length': 254,
|
'max_length': 254,
|
||||||
'required': true,
|
'required': true,
|
||||||
'required_icon': true,
|
'required_icon': true,
|
||||||
|
@ -122,16 +122,16 @@
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label">{{ __('settings.profile.email-preferences') }}</label>
|
<label class="form-label">{{ __('settings.profile.email-preferences') }}</label>
|
||||||
{{ f.checkbox('email_shiftinfo', __('settings.profile.email_shiftinfo', [config('app_name')]), {
|
{{ f.checkbox('email_shiftinfo', __('settings.profile.email_shiftinfo', [config('app_name')]), {
|
||||||
'checked': user.settings.email_shiftinfo,
|
'checked': userdata.settings.email_shiftinfo,
|
||||||
}) }}
|
}) }}
|
||||||
{{ f.checkbox('email_news', __('settings.profile.email_news'), {
|
{{ f.checkbox('email_news', __('settings.profile.email_news'), {
|
||||||
'checked': user.settings.email_news,
|
'checked': userdata.settings.email_news,
|
||||||
}) }}
|
}) }}
|
||||||
{{ f.checkbox('email_messages', __('settings.profile.email_messages'), {
|
{{ f.checkbox('email_messages', __('settings.profile.email_messages'), {
|
||||||
'checked': user.settings.email_messages,
|
'checked': userdata.settings.email_messages,
|
||||||
}) }}
|
}) }}
|
||||||
{{ f.checkbox('email_human', __('settings.profile.email_by_human_allowed'), {
|
{{ f.checkbox('email_human', __('settings.profile.email_by_human_allowed'), {
|
||||||
'checked': user.settings.email_human,
|
'checked': userdata.settings.email_human,
|
||||||
}) }}
|
}) }}
|
||||||
{% if goodie_enabled %}
|
{% if goodie_enabled %}
|
||||||
{% set privacy_email = config('privacy_email') %}
|
{% set privacy_email = config('privacy_email') %}
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
(privacy_email ? ' ' ~ __('settings.profile.privacy', [privacy_email]) : '')
|
(privacy_email ? ' ' ~ __('settings.profile.privacy', [privacy_email]) : '')
|
||||||
%}
|
%}
|
||||||
{{ f.checkbox('email_goody', email_goody_label, {
|
{{ f.checkbox('email_goody', email_goody_label, {
|
||||||
'checked': user.settings.email_goody,
|
'checked': userdata.settings.email_goody,
|
||||||
'raw_label': true,
|
'raw_label': true,
|
||||||
}) }}
|
}) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -150,11 +150,11 @@
|
||||||
{% if goodie_tshirt %}
|
{% if goodie_tshirt %}
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{ f.select('shirt_size', __('settings.profile.shirt_size'), config('tshirt_sizes'), {
|
{{ f.select('shirt_size', __('settings.profile.shirt_size'), config('tshirt_sizes'), {
|
||||||
'selected': user.personalData.shirt_size,
|
'selected': userdata.personalData.shirt_size,
|
||||||
'required': isTShirtSizeRequired,
|
'required': isTShirtSizeRequired,
|
||||||
'required_icon': isTShirtSizeRequired,
|
'required_icon': isTShirtSizeRequired,
|
||||||
'default_option': __('form.select_placeholder'),
|
'default_option': __('form.select_placeholder'),
|
||||||
'disabled': user.state.got_shirt,
|
'disabled': userdata.state.got_shirt,
|
||||||
'info': __('settings.profile.shirt_size.hint'),
|
'info': __('settings.profile.shirt_size.hint'),
|
||||||
'raw_form_text': true,
|
'raw_form_text': true,
|
||||||
'form_text': (tShirtLink ? m.icon('info-circle')
|
'form_text': (tShirtLink ? m.icon('info-circle')
|
||||||
|
|
|
@ -115,7 +115,7 @@ class UserWorkLogController extends BaseController
|
||||||
|
|
||||||
return $this->response->withView(
|
return $this->response->withView(
|
||||||
'admin/user/delete-worklog.twig',
|
'admin/user/delete-worklog.twig',
|
||||||
['user' => $user]
|
['userdata' => $user]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class UserWorkLogController extends BaseController
|
||||||
return $this->response->withView(
|
return $this->response->withView(
|
||||||
'admin/user/edit-worklog.twig',
|
'admin/user/edit-worklog.twig',
|
||||||
[
|
[
|
||||||
'user' => $user,
|
'userdata' => $user,
|
||||||
'work_date' => $work_date,
|
'work_date' => $work_date,
|
||||||
'work_hours' => $work_hours,
|
'work_hours' => $work_hours,
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
|
|
|
@ -45,7 +45,7 @@ class SettingsController extends BaseController
|
||||||
'pages/settings/profile',
|
'pages/settings/profile',
|
||||||
[
|
[
|
||||||
'settings_menu' => $this->settingsMenu(),
|
'settings_menu' => $this->settingsMenu(),
|
||||||
'user' => $user,
|
'userdata' => $user,
|
||||||
'goodie_enabled' => $this->config->get('goodie_type') !== GoodieType::None->value,
|
'goodie_enabled' => $this->config->get('goodie_type') !== GoodieType::None->value,
|
||||||
'goodie_tshirt' => $this->config->get('goodie_type') === GoodieType::Tshirt->value,
|
'goodie_tshirt' => $this->config->get('goodie_type') === GoodieType::Tshirt->value,
|
||||||
'tShirtLink' => $this->config->get('tshirt_link'),
|
'tShirtLink' => $this->config->get('tshirt_link'),
|
||||||
|
|
|
@ -50,7 +50,7 @@ class UserWorkLogControllerTest extends ControllerTest
|
||||||
->method('withView')
|
->method('withView')
|
||||||
->willReturnCallback(function (string $view, array $data) {
|
->willReturnCallback(function (string $view, array $data) {
|
||||||
$this->assertEquals('admin/user/edit-worklog.twig', $view);
|
$this->assertEquals('admin/user/edit-worklog.twig', $view);
|
||||||
$this->assertEquals($this->user->id, $data['user']->id);
|
$this->assertEquals($this->user->id, $data['userdata']->id);
|
||||||
$this->assertEquals(Carbon::today(), $data['work_date']);
|
$this->assertEquals(Carbon::today(), $data['work_date']);
|
||||||
$this->assertEquals(0, $data['work_hours']);
|
$this->assertEquals(0, $data['work_hours']);
|
||||||
$this->assertEquals('', $data['comment']);
|
$this->assertEquals('', $data['comment']);
|
||||||
|
@ -96,7 +96,7 @@ class UserWorkLogControllerTest extends ControllerTest
|
||||||
$this->response->expects($this->once())
|
$this->response->expects($this->once())
|
||||||
->method('withView')
|
->method('withView')
|
||||||
->willReturnCallback(function (string $view, array $data) {
|
->willReturnCallback(function (string $view, array $data) {
|
||||||
$this->assertEquals($this->user->id, $data['user']->id);
|
$this->assertEquals($this->user->id, $data['userdata']->id);
|
||||||
$this->assertEquals(new Carbon('2022-01-01'), $data['work_date']);
|
$this->assertEquals(new Carbon('2022-01-01'), $data['work_date']);
|
||||||
$this->assertEquals(3.14, $data['work_hours']);
|
$this->assertEquals(3.14, $data['work_hours']);
|
||||||
$this->assertEquals('a comment', $data['comment']);
|
$this->assertEquals('a comment', $data['comment']);
|
||||||
|
@ -252,7 +252,7 @@ class UserWorkLogControllerTest extends ControllerTest
|
||||||
$this->response->expects($this->once())
|
$this->response->expects($this->once())
|
||||||
->method('withView')
|
->method('withView')
|
||||||
->willReturnCallback(function (string $view, array $data) {
|
->willReturnCallback(function (string $view, array $data) {
|
||||||
$this->assertEquals($this->user->id, $data['user']->id);
|
$this->assertEquals($this->user->id, $data['userdata']->id);
|
||||||
return $this->response;
|
return $this->response;
|
||||||
});
|
});
|
||||||
$this->controller->showDeleteWorklog($request);
|
$this->controller->showDeleteWorklog($request);
|
||||||
|
|
|
@ -96,8 +96,8 @@ class SettingsControllerTest extends ControllerTest
|
||||||
->method('withView')
|
->method('withView')
|
||||||
->willReturnCallback(function ($view, $data) {
|
->willReturnCallback(function ($view, $data) {
|
||||||
$this->assertEquals('pages/settings/profile', $view);
|
$this->assertEquals('pages/settings/profile', $view);
|
||||||
$this->assertArrayHasKey('user', $data);
|
$this->assertArrayHasKey('userdata', $data);
|
||||||
$this->assertEquals($this->user, $data['user']);
|
$this->assertEquals($this->user, $data['userdata']);
|
||||||
return $this->response;
|
return $this->response;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue