mirror of
https://github.com/grokability/snipe-it.git
synced 2026-03-12 17:52:00 +08:00
Fixed #10284: Added mobile phone to users
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
@@ -43,6 +43,8 @@ class IconHelper
|
||||
return 'fa-regular fa-envelope';
|
||||
case 'phone':
|
||||
return 'fa-solid fa-phone';
|
||||
case 'mobile':
|
||||
return 'fas fa-mobile-screen-button';
|
||||
case 'long-arrow-right':
|
||||
return 'fas fa-long-arrow-alt-right';
|
||||
case 'download':
|
||||
|
||||
@@ -70,6 +70,7 @@ class UsersController extends Controller
|
||||
'users.notes',
|
||||
'users.permissions',
|
||||
'users.phone',
|
||||
'users.mobile',
|
||||
'users.state',
|
||||
'users.two_factor_enrolled',
|
||||
'users.two_factor_optin',
|
||||
@@ -121,6 +122,14 @@ class UsersController extends Controller
|
||||
$users = $users->where('users.company_id', '=', $request->input('company_id'));
|
||||
}
|
||||
|
||||
if ($request->filled('phone')) {
|
||||
$users = $users->where('users.phone', '=', $request->input('phone'));
|
||||
}
|
||||
|
||||
if ($request->filled('mobile')) {
|
||||
$users = $users->where('users.mobile', '=', $request->input('mobile'));
|
||||
}
|
||||
|
||||
if ($request->filled('location_id')) {
|
||||
$users = $users->where('users.location_id', '=', $request->input('location_id'));
|
||||
}
|
||||
@@ -293,6 +302,7 @@ class UsersController extends Controller
|
||||
'manages_users_count',
|
||||
'manages_locations_count',
|
||||
'phone',
|
||||
'mobile',
|
||||
'address',
|
||||
'city',
|
||||
'state',
|
||||
|
||||
@@ -45,6 +45,7 @@ class UsersTransformer
|
||||
'jobtitle' => ($user->jobtitle) ? e($user->jobtitle) : null,
|
||||
'vip' => ($user->vip == '1') ? true : false,
|
||||
'phone' => ($user->phone) ? e($user->phone) : null,
|
||||
'mobile' => ($user->mobile) ? e($user->mobile) : null,
|
||||
'website' => ($user->website) ? e($user->website) : null,
|
||||
'address' => ($user->address) ? e($user->address) : null,
|
||||
'city' => ($user->city) ? e($user->city) : null,
|
||||
|
||||
@@ -52,6 +52,7 @@ class UserImporter extends ItemImporter
|
||||
$this->item['email'] = trim($this->findCsvMatch($row, 'email'));
|
||||
$this->item['gravatar'] = trim($this->findCsvMatch($row, 'gravatar'));
|
||||
$this->item['phone'] = trim($this->findCsvMatch($row, 'phone_number'));
|
||||
$this->item['mobile'] = trim($this->findCsvMatch($row, 'mobile_number'));
|
||||
$this->item['website'] = trim($this->findCsvMatch($row, 'website'));
|
||||
$this->item['jobtitle'] = trim($this->findCsvMatch($row, 'jobtitle'));
|
||||
$this->item['address'] = trim($this->findCsvMatch($row, 'address'));
|
||||
|
||||
@@ -334,6 +334,7 @@ class Importer extends Component
|
||||
'manager_username' => trans('general.importer.manager_username'),
|
||||
'notes' => trans('general.notes'),
|
||||
'phone_number' => trans('admin/users/table.phone'),
|
||||
'mobile_number' => trans('admin/users/table.mobile'),
|
||||
'remote' => trans('admin/users/general.remote'),
|
||||
'start_date' => trans('general.start_date'),
|
||||
'state' => trans('general.state'),
|
||||
@@ -510,6 +511,13 @@ class Importer extends Component
|
||||
'telephone',
|
||||
'tel.',
|
||||
],
|
||||
'mobile_number' =>
|
||||
[
|
||||
'mobile',
|
||||
'mobile number',
|
||||
'cell',
|
||||
'cellphone',
|
||||
],
|
||||
|
||||
'serial' =>
|
||||
[
|
||||
|
||||
@@ -70,6 +70,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
'manager_id',
|
||||
'password',
|
||||
'phone',
|
||||
'mobile',
|
||||
'notes',
|
||||
'state',
|
||||
'username',
|
||||
@@ -139,6 +140,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
|
||||
'locale',
|
||||
'notes',
|
||||
'phone',
|
||||
'mobile',
|
||||
'state',
|
||||
'username',
|
||||
'website',
|
||||
|
||||
@@ -124,6 +124,15 @@ class UserPresenter extends Presenter
|
||||
'visible' => true,
|
||||
'formatter' => 'phoneFormatter',
|
||||
],
|
||||
[
|
||||
'field' => 'mobile',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('admin/users/table.mobile'),
|
||||
'visible' => false,
|
||||
'formatter' => 'mobileFormatter',
|
||||
],
|
||||
[
|
||||
'field' => 'website',
|
||||
'searchable' => true,
|
||||
|
||||
@@ -35,6 +35,7 @@ class UserFactory extends Factory
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'permissions' => '{}',
|
||||
'phone' => $this->faker->phoneNumber(),
|
||||
'mobile' => $this->faker->phoneNumber(),
|
||||
'state' => $this->faker->stateAbbr(),
|
||||
'username' => $this->faker->unique()->username(),
|
||||
'zip' => $this->faker->postcode(),
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('users', 'mobile')) {
|
||||
$table->text('mobile')->after('phone')->nullable()->default(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('mobile');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -27,6 +27,7 @@ return array(
|
||||
'password_confirm' => 'Confirm Password',
|
||||
'password' => 'Password',
|
||||
'phone' => 'Phone',
|
||||
'mobile' => 'Mobile',
|
||||
'show_current' => 'Show Current Users',
|
||||
'show_deleted' => 'Show Deleted Users',
|
||||
'title' => 'Title',
|
||||
|
||||
@@ -778,6 +778,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Create a linked phone number in the table list
|
||||
function mobileFormatter(value) {
|
||||
if (value) {
|
||||
return '<span style="white-space: nowrap;"><a href="tel:' + value + '" data-tooltip="true" title="{{ trans('general.call') }}"><x-icon type="mobile" /> ' + value + '</a></span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function deployedLocationFormatter(row, value) {
|
||||
if ((row) && (row!=undefined)) {
|
||||
|
||||
@@ -436,6 +436,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Mobile -->
|
||||
<div class="form-group {{ $errors->has('mobile') ? 'has-error' : '' }}">
|
||||
<label class="col-md-3 control-label" for="phone">{{ trans('admin/users/table.mobile') }}</label>
|
||||
<div class="col-md-6">
|
||||
<input class="form-control" type="text" name="mobile" id="mobile" value="{{ old('mobile', $user->mobile) }}" maxlength="191" />
|
||||
{!! $errors->first('mobile', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Website URL -->
|
||||
<div class="form-group {{ $errors->has('website') ? ' has-error' : '' }}">
|
||||
<label for="website" class="col-md-3 control-label">{{ trans('general.website') }}</label>
|
||||
|
||||
@@ -527,6 +527,19 @@
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($user->mobile)
|
||||
<!-- phone -->
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{{ trans('admin/users/table.mobile') }}
|
||||
</div>
|
||||
<div class="col-md-9">
|
||||
<a href="tel:{{ $user->mobile }}" data-tooltip="true" title="{{ trans('general.call') }}">
|
||||
<x-icon type="mobile" />
|
||||
{{ $user->mobile }}</a>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@if ($user->userloc)
|
||||
<!-- location -->
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user