add option to show mobile number of user in users view
This commit is contained in:
parent
4d6da1894a
commit
f9da096308
|
@ -259,6 +259,9 @@ return [
|
|||
// Whether the DECT field should be enabled
|
||||
'enable_dect' => (bool)env('ENABLE_DECT', true),
|
||||
|
||||
// Whether the mobile number can be shown to other users
|
||||
'enable_mobile_show' => (bool)env('ENABLE_MOBILE_SHOW', false),
|
||||
|
||||
// Enables prename and lastname
|
||||
'enable_user_name' => (bool)env('ENABLE_USER_NAME', false),
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ class SettingsFactory extends Factory
|
|||
'email_goody' => $this->faker->boolean(),
|
||||
'email_shiftinfo' => $this->faker->boolean(),
|
||||
'email_news' => $this->faker->boolean(),
|
||||
'mobile_show' => $this->faker->boolean(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace Engelsystem\Migrations;
|
||||
|
||||
use Engelsystem\Database\Migration\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class AddMobileShowToUsersSettings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$this->schema->table(
|
||||
'users_settings',
|
||||
function (Blueprint $table) {
|
||||
$table->boolean('mobile_show')->default(false)->after('email_news');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$this->schema->table(
|
||||
'users_settings',
|
||||
function (Blueprint $table) {
|
||||
$table->dropColumn('mobile_show');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -36,6 +36,7 @@ function guest_register()
|
|||
$min_password_length = config('min_password_length');
|
||||
$enable_password = config('enable_password');
|
||||
$enable_pronoun = config('enable_pronoun');
|
||||
$enable_mobile_show = config('enable_mobile_show');
|
||||
$config = config();
|
||||
$request = request();
|
||||
$session = session();
|
||||
|
@ -49,6 +50,7 @@ function guest_register()
|
|||
$preName = '';
|
||||
$dect = '';
|
||||
$mobile = '';
|
||||
$mobile_show = false;
|
||||
$email = '';
|
||||
$pronoun = '';
|
||||
$email_shiftinfo = false;
|
||||
|
@ -121,6 +123,10 @@ function guest_register()
|
|||
$msg .= error(__('Please enter a nickname.'), true);
|
||||
}
|
||||
|
||||
if ($request->has('mobile_show') && $enable_mobile_show) {
|
||||
$mobile_show = true;
|
||||
}
|
||||
|
||||
if ($request->has('email') && strlen(strip_request_item('email')) > 0) {
|
||||
$email = strip_request_item('email');
|
||||
if (!check_email($email)) {
|
||||
|
@ -255,6 +261,7 @@ function guest_register()
|
|||
'email_goody' => $email_goody,
|
||||
'email_shiftinfo' => $email_shiftinfo,
|
||||
'email_news' => $email_news,
|
||||
'mobile_show' => $mobile_show,
|
||||
]);
|
||||
$settings->user()
|
||||
->associate($user)
|
||||
|
@ -442,7 +449,12 @@ function guest_register()
|
|||
]) : '',
|
||||
|
||||
div('col', [
|
||||
form_text('mobile', __('Mobile'), $mobile, false, 40, 'tel-national')
|
||||
form_text('mobile', __('Mobile'), $mobile, false, 40, 'tel-national'),
|
||||
$enable_mobile_show ? form_checkbox(
|
||||
'mobile_show',
|
||||
__('Show mobile number to other users to contact me'),
|
||||
$mobile_show
|
||||
) : ''
|
||||
])
|
||||
]),
|
||||
|
||||
|
|
|
@ -91,6 +91,9 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
|
|||
}
|
||||
}
|
||||
$user_source->contact->mobile = strip_request_item('mobile', $user_source->contact->mobile);
|
||||
if (config('enable_mobile_show')) {
|
||||
$user_source->settings->mobile_show = $request->has('mobile_show');
|
||||
}
|
||||
|
||||
if ($valid) {
|
||||
$user_source->save();
|
||||
|
|
|
@ -34,6 +34,7 @@ function User_settings_view(
|
|||
$enable_dect = config('enable_dect');
|
||||
$enable_planned_arrival = config('enable_planned_arrival');
|
||||
$enable_goody = config('enable_goody');
|
||||
$enable_mobile_show = config('enable_mobile_show');
|
||||
|
||||
/** @var $urlGenerator UrlGeneratorInterface */
|
||||
$urlGenerator = app(UrlGeneratorInterface::class);
|
||||
|
@ -82,6 +83,11 @@ function User_settings_view(
|
|||
) : '',
|
||||
$enable_dect ? form_text('dect', __('DECT'), $user_source->contact->dect, false, 40) : '',
|
||||
form_text('mobile', __('Mobile'), $user_source->contact->mobile, false, 40),
|
||||
$enable_mobile_show ? form_checkbox(
|
||||
'mobile_show',
|
||||
__('Show mobile number to other users to contact me'),
|
||||
$user_source->settings->mobile_show
|
||||
): '',
|
||||
form_text('mail', __('E-Mail') . ' ' . entry_required(), $user_source->email, false, 254),
|
||||
form_checkbox(
|
||||
'email_shiftinfo',
|
||||
|
@ -676,7 +682,7 @@ function User_view(
|
|||
]),
|
||||
div('row user-info', [
|
||||
div('col-md-2', [
|
||||
config('enable_dect') ?
|
||||
config('enable_dect') && $user_source->contact->dect ?
|
||||
heading(
|
||||
icon('phone')
|
||||
. ' <a href="tel:' . $user_source->contact->dect . '">'
|
||||
|
@ -684,6 +690,16 @@ function User_view(
|
|||
. '</a>'
|
||||
)
|
||||
: '' ,
|
||||
config('enable_mobile_show') && $user_source->contact->mobile ?
|
||||
$user_source->settings->mobile_show ?
|
||||
heading(
|
||||
icon('phone')
|
||||
. ' <a href="tel:' . $user_source->contact->mobile . '">'
|
||||
. $user_source->contact->mobile
|
||||
. '</a>'
|
||||
)
|
||||
: ''
|
||||
: '' ,
|
||||
$auth->can('user_messages') ?
|
||||
heading(
|
||||
'<a href="' . page_link_to('/messages/' . $user_source->id) . '">'
|
||||
|
|
|
@ -2716,6 +2716,10 @@ msgstr "Keine Gutscheine bekommen"
|
|||
msgid "out of %s"
|
||||
msgstr "von %s"
|
||||
|
||||
#: includes/view/User_view.php:89
|
||||
msgid "Show mobile number to other users to contact me"
|
||||
msgstr "Mache meine Handynummer für andere Benutzer sichtbar"
|
||||
|
||||
#: includes/view/User_view.php:797
|
||||
msgid "Rights"
|
||||
msgstr "Rechte"
|
||||
|
|
|
@ -20,6 +20,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
|
|||
* @method static QueryBuilder|Room[] whereId($value)
|
||||
* @method static QueryBuilder|Room[] whereName($value)
|
||||
* @method static QueryBuilder|Room[] whereMapUrl($value)
|
||||
* @method static QueryBuilder|Room[] whereDect($value)
|
||||
* @method static QueryBuilder|Room[] whereDescription($value)
|
||||
* @method static QueryBuilder|Room[] whereCreatedAt($value)
|
||||
* @method static QueryBuilder|Room[] whereUpdatedAt($value)
|
||||
|
|
|
@ -12,6 +12,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
|
|||
* @property bool $email_goody
|
||||
* @property bool $email_shiftinfo
|
||||
* @property bool $email_news
|
||||
* @property bool $mobile_show
|
||||
*
|
||||
* @method static QueryBuilder|Settings[] whereLanguage($value)
|
||||
* @method static QueryBuilder|Settings[] whereTheme($value)
|
||||
|
@ -19,6 +20,7 @@ use Illuminate\Database\Query\Builder as QueryBuilder;
|
|||
* @method static QueryBuilder|Settings[] whereEmailGoody($value)
|
||||
* @method static QueryBuilder|Settings[] whereEmailShiftinfo($value)
|
||||
* @method static QueryBuilder|Settings[] whereEmailNews($value)
|
||||
* @method static QueryBuilder|Settings[] whereMobileShow($value)
|
||||
*/
|
||||
class Settings extends HasUserModel
|
||||
{
|
||||
|
@ -33,6 +35,7 @@ class Settings extends HasUserModel
|
|||
'email_goody' => false,
|
||||
'email_shiftinfo' => false,
|
||||
'email_news' => false,
|
||||
'mobile_show' => false,
|
||||
];
|
||||
|
||||
/** The attributes that are mass assignable */
|
||||
|
@ -44,6 +47,7 @@ class Settings extends HasUserModel
|
|||
'email_goody',
|
||||
'email_shiftinfo',
|
||||
'email_news',
|
||||
'mobile_show',
|
||||
];
|
||||
|
||||
/** @var string[] */
|
||||
|
@ -54,5 +58,6 @@ class Settings extends HasUserModel
|
|||
'email_goody' => 'boolean',
|
||||
'email_shiftinfo' => 'boolean',
|
||||
'email_news' => 'boolean',
|
||||
'mobile_show' => 'boolean',
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue