mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-11 08:04:09 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
1415c8c6e2
|
@ -26,7 +26,10 @@ class AccessoriesController extends Controller
|
|||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
if ($request->user()->cannot('reports.view')) {
|
||||
$this->authorize('view', Accessory::class);
|
||||
}
|
||||
|
||||
|
||||
// This array is what determines which fields should be allowed to be sorted on ON the table itself, no relations
|
||||
// Relations will be handled in query scopes a little further down.
|
||||
|
|
|
@ -246,6 +246,7 @@ class UsersController extends Controller
|
|||
'two_factor_optin',
|
||||
'two_factor_enrolled',
|
||||
'remote',
|
||||
'vip',
|
||||
'start_date',
|
||||
'end_date',
|
||||
];
|
||||
|
|
|
@ -51,9 +51,8 @@ class ReportsController extends Controller
|
|||
public function getAccessoryReport()
|
||||
{
|
||||
$this->authorize('reports.view');
|
||||
$accessories = Accessory::orderBy('created_at', 'DESC')->with('company')->get();
|
||||
|
||||
return view('reports/accessories', compact('accessories'));
|
||||
return view('reports/accessories');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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',
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
55
composer.lock
generated
55
composer.lock
generated
|
@ -4,6 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "590171872e4a6a29c78efde99fbbf00e",
|
||||
"packages": [
|
||||
{
|
||||
"name": "alek13/slack",
|
||||
|
@ -1809,24 +1810,24 @@
|
|||
},
|
||||
{
|
||||
"name": "dompdf/dompdf",
|
||||
"version": "v2.0.0",
|
||||
"version": "v2.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dompdf/dompdf.git",
|
||||
"reference": "79573d8b8a141ec8a17312515de8740eed014fa9"
|
||||
"reference": "e8d2d5e37e8b0b30f0732a011295ab80680d7e85"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/79573d8b8a141ec8a17312515de8740eed014fa9",
|
||||
"reference": "79573d8b8a141ec8a17312515de8740eed014fa9",
|
||||
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/e8d2d5e37e8b0b30f0732a011295ab80680d7e85",
|
||||
"reference": "e8d2d5e37e8b0b30f0732a011295ab80680d7e85",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-dom": "*",
|
||||
"ext-mbstring": "*",
|
||||
"masterminds/html5": "^2.0",
|
||||
"phenx/php-font-lib": "^0.5.4",
|
||||
"phenx/php-svg-lib": "^0.3.3 || ^0.4.0",
|
||||
"phenx/php-font-lib": ">=0.5.4 <1.0.0",
|
||||
"phenx/php-svg-lib": ">=0.3.3 <1.0.0",
|
||||
"php": "^7.1 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -1857,25 +1858,17 @@
|
|||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Ménager",
|
||||
"email": "fabien.menager@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Brian Sweeney",
|
||||
"email": "eclecticgeek@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Gabriel Bull",
|
||||
"email": "me@gabrielbull.com"
|
||||
"name": "The Dompdf Community",
|
||||
"homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md"
|
||||
}
|
||||
],
|
||||
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
|
||||
"homepage": "https://github.com/dompdf/dompdf",
|
||||
"support": {
|
||||
"issues": "https://github.com/dompdf/dompdf/issues",
|
||||
"source": "https://github.com/dompdf/dompdf/tree/v2.0.0"
|
||||
"source": "https://github.com/dompdf/dompdf/tree/v2.0.3"
|
||||
},
|
||||
"time": "2022-06-21T21:14:57+00:00"
|
||||
"time": "2023-02-07T12:51:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dragonmantank/cron-expression",
|
||||
|
@ -5130,16 +5123,16 @@
|
|||
},
|
||||
{
|
||||
"name": "masterminds/html5",
|
||||
"version": "2.7.5",
|
||||
"version": "2.7.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Masterminds/html5-php.git",
|
||||
"reference": "f640ac1bdddff06ea333a920c95bbad8872429ab"
|
||||
"reference": "897eb517a343a2281f11bc5556d6548db7d93947"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f640ac1bdddff06ea333a920c95bbad8872429ab",
|
||||
"reference": "f640ac1bdddff06ea333a920c95bbad8872429ab",
|
||||
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/897eb517a343a2281f11bc5556d6548db7d93947",
|
||||
"reference": "897eb517a343a2281f11bc5556d6548db7d93947",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -5193,9 +5186,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Masterminds/html5-php/issues",
|
||||
"source": "https://github.com/Masterminds/html5-php/tree/2.7.5"
|
||||
"source": "https://github.com/Masterminds/html5-php/tree/2.7.6"
|
||||
},
|
||||
"time": "2021-07-01T14:25:37+00:00"
|
||||
"time": "2022-08-18T16:18:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "maximebf/debugbar",
|
||||
|
@ -6430,21 +6423,21 @@
|
|||
},
|
||||
{
|
||||
"name": "phenx/php-svg-lib",
|
||||
"version": "0.4.1",
|
||||
"version": "0.5.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dompdf/php-svg-lib.git",
|
||||
"reference": "4498b5df7b08e8469f0f8279651ea5de9626ed02"
|
||||
"reference": "76876c6cf3080bcb6f249d7d59705108166a6685"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/4498b5df7b08e8469f0f8279651ea5de9626ed02",
|
||||
"reference": "4498b5df7b08e8469f0f8279651ea5de9626ed02",
|
||||
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/76876c6cf3080bcb6f249d7d59705108166a6685",
|
||||
"reference": "76876c6cf3080bcb6f249d7d59705108166a6685",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"php": "^7.1 || ^7.2 || ^7.3 || ^7.4 || ^8.0",
|
||||
"php": "^7.1 || ^8.0",
|
||||
"sabberworm/php-css-parser": "^8.4"
|
||||
},
|
||||
"require-dev": {
|
||||
|
@ -6470,9 +6463,9 @@
|
|||
"homepage": "https://github.com/PhenX/php-svg-lib",
|
||||
"support": {
|
||||
"issues": "https://github.com/dompdf/php-svg-lib/issues",
|
||||
"source": "https://github.com/dompdf/php-svg-lib/tree/0.4.1"
|
||||
"source": "https://github.com/dompdf/php-svg-lib/tree/0.5.0"
|
||||
},
|
||||
"time": "2022-03-07T12:52:04+00:00"
|
||||
"time": "2022-09-06T12:16:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-http/message-factory",
|
||||
|
|
|
@ -44,7 +44,7 @@ class AssetFactory extends Factory
|
|||
'user_id' => 1,
|
||||
'asset_tag' => $this->faker->unixTime('now'),
|
||||
'notes' => 'Created by DB seeder',
|
||||
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get()),
|
||||
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'),
|
||||
'purchase_cost' => $this->faker->randomFloat(2, '299.99', '2999.99'),
|
||||
'order_number' => $this->faker->numberBetween(1000000, 50000000),
|
||||
'supplier_id' => Supplier::all()->random()->id,
|
||||
|
|
34
database/migrations/2023_01_23_232933_add_vip_to_users.php
Normal file
34
database/migrations/2023_01_23_232933_add_vip_to_users.php
Normal 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');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -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',
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
data-sort-order="asc"
|
||||
id="accessoriesReport"
|
||||
class="table table-striped snipe-table"
|
||||
data-url="{{ route('api.accessories.index') }}"
|
||||
data-export-options='{
|
||||
"fileName": "accessory-report-{{ date('Y-m-d') }}",
|
||||
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
|
||||
|
@ -34,27 +35,17 @@
|
|||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-sm-1">{{ trans('admin/companies/table.title') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/accessories/table.title') }}</th>
|
||||
<th class="col-sm-1">{{ trans('general.model_no') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/accessories/general.total') }}</th>
|
||||
<th class="col-sm-1">{{ trans('admin/accessories/general.remaining') }}</th>
|
||||
<th class="col-sm-1" data-field="company">{{ trans('admin/companies/table.title') }}</th>
|
||||
<th class="col-sm-1" data-field="name">{{ trans('admin/accessories/table.title') }}</th>
|
||||
<th class="col-sm-1" data-field="model_number">{{ trans('general.model_no') }}</th>
|
||||
<th class="col-sm-1" data-field="qty">{{ trans('admin/accessories/general.total') }}</th>
|
||||
<th class="col-sm-1" data-field="remaining_qty">{{ trans('admin/accessories/general.remaining') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($accessories as $accessory)
|
||||
<tr>
|
||||
<td>{{ is_null($accessory->company) ? '' : $accessory->company->name }}</td>
|
||||
<td>{{ $accessory->name }}</td>
|
||||
<td>{{ $accessory->model_number }}</td>
|
||||
<td>{{ $accessory->qty }}</td>
|
||||
<td>{{ $accessory->numRemaining() }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -519,6 +519,16 @@
|
|||
</div>
|
||||
@endif
|
||||
|
||||
<!-- 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">
|
||||
|
|
Loading…
Reference in a new issue