Merge pull request #12406 from akemidx/vip_tag

Added a checkbox to notate VIP status
This commit is contained in:
snipe 2023-02-23 12:23:29 -08:00 committed by GitHub
commit 8e72da42e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 73 additions and 1 deletions

View file

@ -246,6 +246,7 @@ class UsersController extends Controller
'two_factor_optin',
'two_factor_enrolled',
'remote',
'vip',
'start_date',
'end_date',
];

View file

@ -272,6 +272,7 @@ class UsersController extends Controller
$user->activated = $request->input('activated', 0);
$user->zip = $request->input('zip', null);
$user->remote = $request->input('remote', 0);
$user->vip = $request->input('vip', 0);
$user->website = $request->input('website', null);
$user->start_date = $request->input('start_date', null);
$user->end_date = $request->input('end_date', null);

View file

@ -64,6 +64,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
'scim_externalid',
'avatar',
'gravatar',
'vip',
];
protected $casts = [
@ -71,6 +72,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
'manager_id' => 'integer',
'location_id' => 'integer',
'company_id' => 'integer',
'vip' => 'boolean',
];

View file

@ -85,6 +85,15 @@ class UserPresenter extends Presenter
'visible' => true,
'formatter' => 'usersLinkFormatter',
],
[
'field' => 'vip',
'searchable' => false,
'sortable' => true,
'switchable' => true,
'title' => trans('admin/users/general.vip_label'),
'visible' => false,
'formatter' => 'trueFalseFormatter',
],
[
'field' => 'remote',
'searchable' => false,

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddVipToUsers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('vip')->nullable()->default(0);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
if (Schema::hasColumn('users', 'vip')) {
$table->dropColumn('vip');
}
});
}
}

View file

@ -43,6 +43,8 @@ return [
'remote' => 'Remote',
'remote_help' => 'This can be useful if you need to filter by remote users who never or rarely come into your physical locations.',
'not_remote_label' => 'This is not a remote user',
'vip_label' => 'VIP user',
'vip_help' => 'This can be helpful to mark important people if you would like',
'create_user' => 'Create a user',
'create_user_page_explanation' => 'This is the account information you will use to access the site for the first time.',
'email_credentials' => 'Email credentials',

View file

@ -370,6 +370,19 @@
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.end_date'), 'fieldname' => 'end_date', 'item' => $user])
<!-- VIP checkbox -->
<div class="form-group">
<div class="col-md-7 col-md-offset-3">
<label for="vip">
<input type="checkbox" value="1" name="vip" class="minimal" {{ (old('vip', $user->vip)) == '1' ? ' checked="checked"' : '' }} aria-label="vip">
{{ trans('admin/users/general.vip_label') }}
</label>
<p class="help-block">{{ trans('admin/users/general.vip_help') }}
</p>
</div>
</div>
<!-- remote checkbox -->
<div class="form-group">

View file

@ -519,7 +519,17 @@
</div>
@endif
<!-- login enabled -->
<!-- login enabled -->
<div class="row">
<div class="col-md-3">
{{ trans('admin/users/general.vip_label') }}
</div>
<div class="col-md-9">
{!! ($user->vip=='1') ? '<i class="fas fa-check text-success" aria-hidden="true"></i> '.trans('general.yes') : '<i class="fas fa-times text-danger" aria-hidden="true"></i> '.trans('general.no') !!}
</div>
</div>
<!-- login enabled -->
<div class="row">
<div class="col-md-3">
{{ trans('admin/users/general.remote') }}