Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2023-02-23 15:00:03 -08:00
commit 1415c8c6e2
13 changed files with 109 additions and 51 deletions

View file

@ -26,7 +26,10 @@ class AccessoriesController extends Controller
*/ */
public function index(Request $request) public function index(Request $request)
{ {
$this->authorize('view', Accessory::class); 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 // 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. // Relations will be handled in query scopes a little further down.

View file

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

View file

@ -51,9 +51,8 @@ class ReportsController extends Controller
public function getAccessoryReport() public function getAccessoryReport()
{ {
$this->authorize('reports.view'); $this->authorize('reports.view');
$accessories = Accessory::orderBy('created_at', 'DESC')->with('company')->get();
return view('reports/accessories', compact('accessories')); return view('reports/accessories');
} }
/** /**

View file

@ -272,6 +272,7 @@ class UsersController extends Controller
$user->activated = $request->input('activated', 0); $user->activated = $request->input('activated', 0);
$user->zip = $request->input('zip', null); $user->zip = $request->input('zip', null);
$user->remote = $request->input('remote', 0); $user->remote = $request->input('remote', 0);
$user->vip = $request->input('vip', 0);
$user->website = $request->input('website', null); $user->website = $request->input('website', null);
$user->start_date = $request->input('start_date', null); $user->start_date = $request->input('start_date', null);
$user->end_date = $request->input('end_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', 'scim_externalid',
'avatar', 'avatar',
'gravatar', 'gravatar',
'vip',
]; ];
protected $casts = [ protected $casts = [
@ -71,6 +72,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
'manager_id' => 'integer', 'manager_id' => 'integer',
'location_id' => 'integer', 'location_id' => 'integer',
'company_id' => 'integer', 'company_id' => 'integer',
'vip' => 'boolean',
]; ];

View file

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

55
composer.lock generated
View file

@ -4,6 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "590171872e4a6a29c78efde99fbbf00e",
"packages": [ "packages": [
{ {
"name": "alek13/slack", "name": "alek13/slack",
@ -1809,24 +1810,24 @@
}, },
{ {
"name": "dompdf/dompdf", "name": "dompdf/dompdf",
"version": "v2.0.0", "version": "v2.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/dompdf/dompdf.git", "url": "https://github.com/dompdf/dompdf.git",
"reference": "79573d8b8a141ec8a17312515de8740eed014fa9" "reference": "e8d2d5e37e8b0b30f0732a011295ab80680d7e85"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/79573d8b8a141ec8a17312515de8740eed014fa9", "url": "https://api.github.com/repos/dompdf/dompdf/zipball/e8d2d5e37e8b0b30f0732a011295ab80680d7e85",
"reference": "79573d8b8a141ec8a17312515de8740eed014fa9", "reference": "e8d2d5e37e8b0b30f0732a011295ab80680d7e85",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"masterminds/html5": "^2.0", "masterminds/html5": "^2.0",
"phenx/php-font-lib": "^0.5.4", "phenx/php-font-lib": ">=0.5.4 <1.0.0",
"phenx/php-svg-lib": "^0.3.3 || ^0.4.0", "phenx/php-svg-lib": ">=0.3.3 <1.0.0",
"php": "^7.1 || ^8.0" "php": "^7.1 || ^8.0"
}, },
"require-dev": { "require-dev": {
@ -1857,25 +1858,17 @@
], ],
"authors": [ "authors": [
{ {
"name": "Fabien Ménager", "name": "The Dompdf Community",
"email": "fabien.menager@gmail.com" "homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md"
},
{
"name": "Brian Sweeney",
"email": "eclecticgeek@gmail.com"
},
{
"name": "Gabriel Bull",
"email": "me@gabrielbull.com"
} }
], ],
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf", "homepage": "https://github.com/dompdf/dompdf",
"support": { "support": {
"issues": "https://github.com/dompdf/dompdf/issues", "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", "name": "dragonmantank/cron-expression",
@ -5130,16 +5123,16 @@
}, },
{ {
"name": "masterminds/html5", "name": "masterminds/html5",
"version": "2.7.5", "version": "2.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Masterminds/html5-php.git", "url": "https://github.com/Masterminds/html5-php.git",
"reference": "f640ac1bdddff06ea333a920c95bbad8872429ab" "reference": "897eb517a343a2281f11bc5556d6548db7d93947"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f640ac1bdddff06ea333a920c95bbad8872429ab", "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/897eb517a343a2281f11bc5556d6548db7d93947",
"reference": "f640ac1bdddff06ea333a920c95bbad8872429ab", "reference": "897eb517a343a2281f11bc5556d6548db7d93947",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5193,9 +5186,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/Masterminds/html5-php/issues", "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", "name": "maximebf/debugbar",
@ -6430,21 +6423,21 @@
}, },
{ {
"name": "phenx/php-svg-lib", "name": "phenx/php-svg-lib",
"version": "0.4.1", "version": "0.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/dompdf/php-svg-lib.git", "url": "https://github.com/dompdf/php-svg-lib.git",
"reference": "4498b5df7b08e8469f0f8279651ea5de9626ed02" "reference": "76876c6cf3080bcb6f249d7d59705108166a6685"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/4498b5df7b08e8469f0f8279651ea5de9626ed02", "url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/76876c6cf3080bcb6f249d7d59705108166a6685",
"reference": "4498b5df7b08e8469f0f8279651ea5de9626ed02", "reference": "76876c6cf3080bcb6f249d7d59705108166a6685",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-mbstring": "*", "ext-mbstring": "*",
"php": "^7.1 || ^7.2 || ^7.3 || ^7.4 || ^8.0", "php": "^7.1 || ^8.0",
"sabberworm/php-css-parser": "^8.4" "sabberworm/php-css-parser": "^8.4"
}, },
"require-dev": { "require-dev": {
@ -6470,9 +6463,9 @@
"homepage": "https://github.com/PhenX/php-svg-lib", "homepage": "https://github.com/PhenX/php-svg-lib",
"support": { "support": {
"issues": "https://github.com/dompdf/php-svg-lib/issues", "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", "name": "php-http/message-factory",

View file

@ -44,7 +44,7 @@ class AssetFactory extends Factory
'user_id' => 1, 'user_id' => 1,
'asset_tag' => $this->faker->unixTime('now'), 'asset_tag' => $this->faker->unixTime('now'),
'notes' => 'Created by DB seeder', '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'), 'purchase_cost' => $this->faker->randomFloat(2, '299.99', '2999.99'),
'order_number' => $this->faker->numberBetween(1000000, 50000000), 'order_number' => $this->faker->numberBetween(1000000, 50000000),
'supplier_id' => Supplier::all()->random()->id, 'supplier_id' => Supplier::all()->random()->id,

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' => 'Remote',
'remote_help' => 'This can be useful if you need to filter by remote users who never or rarely come into your physical locations.', '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', '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' => 'Create a user',
'create_user_page_explanation' => 'This is the account information you will use to access the site for the first time.', 'create_user_page_explanation' => 'This is the account information you will use to access the site for the first time.',
'email_credentials' => 'Email credentials', 'email_credentials' => 'Email credentials',

View file

@ -27,6 +27,7 @@
data-sort-order="asc" data-sort-order="asc"
id="accessoriesReport" id="accessoriesReport"
class="table table-striped snipe-table" class="table table-striped snipe-table"
data-url="{{ route('api.accessories.index') }}"
data-export-options='{ data-export-options='{
"fileName": "accessory-report-{{ date('Y-m-d') }}", "fileName": "accessory-report-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"] "ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]
@ -34,27 +35,17 @@
<thead> <thead>
<tr> <tr>
<th class="col-sm-1">{{ trans('admin/companies/table.title') }}</th> <th class="col-sm-1" data-field="company">{{ trans('admin/companies/table.title') }}</th>
<th class="col-sm-1">{{ trans('admin/accessories/table.title') }}</th> <th class="col-sm-1" data-field="name">{{ trans('admin/accessories/table.title') }}</th>
<th class="col-sm-1">{{ trans('general.model_no') }}</th> <th class="col-sm-1" data-field="model_number">{{ trans('general.model_no') }}</th>
<th class="col-sm-1">{{ trans('admin/accessories/general.total') }}</th> <th class="col-sm-1" data-field="qty">{{ trans('admin/accessories/general.total') }}</th>
<th class="col-sm-1">{{ trans('admin/accessories/general.remaining') }}</th> <th class="col-sm-1" data-field="remaining_qty">{{ trans('admin/accessories/general.remaining') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <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> </tbody>
</table> </table>
</table>
</div> </div>
</div> </div>
</div> </div>

View file

@ -370,6 +370,19 @@
@include ('partials.forms.edit.datepicker', ['translated_name' => trans('general.end_date'), 'fieldname' => 'end_date', 'item' => $user]) @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 --> <!-- remote checkbox -->
<div class="form-group"> <div class="form-group">

View file

@ -519,7 +519,17 @@
</div> </div>
@endif @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="row">
<div class="col-md-3"> <div class="col-md-3">
{{ trans('admin/users/general.remote') }} {{ trans('admin/users/general.remote') }}