From f4623bd27768910c524cb71016d24560f395a4c2 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 15 Jan 2018 20:31:10 -0800 Subject: [PATCH 1/9] Add user group membership to user view page --- resources/views/users/view.blade.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index 797660393b..063b20cbff 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -141,6 +141,25 @@ {{ $user->username }} + + {{ trans('general.groups') }} + + @if ($user->groups->count() > 0) + @foreach ($user->groups as $group) + + @can('superadmin') + {{ $group->name }} + @else + {{ $group->name }} + @endcan + + @endforeach + @else + -- + @endif + + + @if ($user->jobtitle) From 6bfd428c2e5d4d456212b52ebf3fc416e876b818 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 15 Jan 2018 21:03:26 -0800 Subject: [PATCH 2/9] Use real status label names, even if deployed --- app/Http/Transformers/AssetsTransformer.php | 3 +- app/Presenters/AssetPresenter.php | 41 +++++++++++++++++++ resources/views/hardware/view.blade.php | 13 ++++-- .../views/partials/bootstrap-table.blade.php | 14 ++++--- 4 files changed, 61 insertions(+), 10 deletions(-) diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index c37a534783..76c9bd9f9d 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -34,7 +34,8 @@ class AssetsTransformer 'eol' => ($asset->purchase_date!='') ? Helper::getFormattedDateObject($asset->present()->eol_date(), 'date') : null , 'status_label' => ($asset->assetstatus) ? [ 'id' => (int) $asset->assetstatus->id, - 'name'=> e($asset->present()->statusText), + 'name'=> e($asset->assetstatus->name), + 'status_type'=> e($asset->assetstatus->getStatuslabelType()), 'status_meta' => e($asset->present()->statusMeta), ] : null, 'category' => ($asset->model->category) ? [ diff --git a/app/Presenters/AssetPresenter.php b/app/Presenters/AssetPresenter.php index 872e37ffea..833428b5a7 100644 --- a/app/Presenters/AssetPresenter.php +++ b/app/Presenters/AssetPresenter.php @@ -417,6 +417,47 @@ class AssetPresenter extends Presenter return $this->model->assetstatus->name; } + /** + * @return string + * This handles the status label "meta" status of "deployed" if + * it's assigned. Results look like: + * + * (if assigned and the status label is "Ready to Deploy"): + * (Deployed) + * + * (f assigned and status label is not "Ready to Deploy":) + * Deployed (Another Status Label) + * + * (if not deployed:) + * Another Status Label + */ + public function fullStatusText() { + // Make sure the status is valid + if ($this->assetstatus) { + + // If the status is assigned to someone or something... + if ($this->model->assigned) { + + // If it's assigned and not set to the default "ready to deploy" status + if ($this->assetstatus->name != trans('general.ready_to_deploy')) { + return trans('general.deployed'). ' (' . $this->model->assetstatus->name.')'; + } + + // If it's assigned to the default "ready to deploy" status, just + // say it's deployed - otherwise it's confusing to have a status that is + // both "ready to deploy" and deployed at the same time. + return trans('general.deployed'); + } + + // Return just the status name + return $this->model->assetstatus->name; + } + + // This status doesn't seem valid - either data has been manually edited or + // the status label was deleted. + return 'Invalid status'; + } + /** * Date the warantee expires. * @return false|string diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 944db03b10..84002885e9 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -90,7 +90,12 @@ @if (($asset->assignedTo) && ($asset->deleted_at=='')) - {{ trans('general.deployed') }} {!! $asset->assignedTo->present()->glyph() !!} + + {{ $asset->assetstatus->name }} + + + + {!! $asset->assignedTo->present()->glyph() !!} {!! $asset->assignedTo->present()->nameUrl() !!} @else @if (($asset->assetstatus) && ($asset->assetstatus->deployable=='1')) @@ -555,13 +560,13 @@
'; break; - case 'deployable': + case '{{ strtolower(trans('admin/hardware/general.deployable')) }}': text_color = 'green'; icon_style = 'fa-circle'; + text_help = ''; break; - case 'pending': + case '{{ strtolower(trans('general.pending')) }}': text_color = 'orange'; icon_style = 'fa-circle'; + text_help = ''; break; default: text_color = 'red'; icon_style = 'fa-times'; + text_help = ''; } - return ' ' + value.name + ''; + return ' ' + value.name + ' ' + text_help + ' '; } else if ((value) && (value.name)) { return ' ' + value.name + ''; } From dc4472e9e9a0228baae0624d5ec1a6930c67a66d Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 15 Jan 2018 21:03:46 -0800 Subject: [PATCH 3/9] Misc export table fixes --- resources/views/dashboard.blade.php | 1 + resources/views/hardware/index.blade.php | 1 + resources/views/licenses/index.blade.php | 1 + resources/views/locations/index.blade.php | 1 + resources/views/manufacturers/index.blade.php | 5 +++-- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 2c6da09c5e..209f987ca0 100755 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -152,6 +152,7 @@ id="table" data-sort-order="desc" data-height="400" + data-show-export="false" data-url="{{ route('api.activity.index', ['limit' => 25]) }}"> diff --git a/resources/views/hardware/index.blade.php b/resources/views/hardware/index.blade.php index c922efb2d6..4133187e51 100755 --- a/resources/views/hardware/index.blade.php +++ b/resources/views/hardware/index.blade.php @@ -79,6 +79,7 @@ class="table table-striped snipe-table" id="table" data-advanced-search="true" + data-show-export="true" data-id-table="advancedTable" data-url="{{ route('api.assets.index', array('status' => e(Input::get('status')), diff --git a/resources/views/licenses/index.blade.php b/resources/views/licenses/index.blade.php index d236cea3f9..28b61d15ac 100755 --- a/resources/views/licenses/index.blade.php +++ b/resources/views/licenses/index.blade.php @@ -29,6 +29,7 @@ data-url="{{ route('api.licenses.index') }}" class="table table-striped snipe-table" data-cookie="true" + data-show-export="true" data-click-to-select="true" data-cookie-id-table="licenseTable">
diff --git a/resources/views/locations/index.blade.php b/resources/views/locations/index.blade.php index c1034fdd6a..3ef6731380 100755 --- a/resources/views/locations/index.blade.php +++ b/resources/views/locations/index.blade.php @@ -23,6 +23,7 @@ id="table" data-url="{{ route('api.locations.index') }}" data-cookie="true" + data-show-export="true" data-click-to-select="true" data-cookie-id-table="locationsTable-{{ config('version.hash_version') }}"> diff --git a/resources/views/manufacturers/index.blade.php b/resources/views/manufacturers/index.blade.php index bec997713c..78e746dfed 100755 --- a/resources/views/manufacturers/index.blade.php +++ b/resources/views/manufacturers/index.blade.php @@ -23,11 +23,12 @@ + data-cookie-id-table="manufacturersTable">
From 66a590b77473bd8a219ebba9afcea26c475be57d Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 16 Jan 2018 07:36:03 -0800 Subject: [PATCH 4/9] =?UTF-8?q?Account=20for=20user=E2=80=99s=20that=20hav?= =?UTF-8?q?e=20been=20deleted=20in=20the=20requested=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/hardware/requested.blade.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/views/hardware/requested.blade.php b/resources/views/hardware/requested.blade.php index 94a99ac1ef..c6c131f723 100644 --- a/resources/views/hardware/requested.blade.php +++ b/resources/views/hardware/requested.blade.php @@ -86,9 +86,13 @@ @endif + @if ($request->requestingUser()) {{ $request->requestingUser()->present()->fullName() }} + @else + (deleted user) + @endif {{ App\Helpers\Helper::getFormattedDateObject($request->created_at, 'datetime', false) }} From 1d3472b5c45dd9c7541bc9abb1cc7008a52602d3 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 16 Jan 2018 07:36:14 -0800 Subject: [PATCH 5/9] Truncate the checkout_requests field on seed --- database/seeds/AssetSeeder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/database/seeds/AssetSeeder.php b/database/seeds/AssetSeeder.php index 4afd1fd3df..79e47d6113 100644 --- a/database/seeds/AssetSeeder.php +++ b/database/seeds/AssetSeeder.php @@ -44,6 +44,7 @@ class AssetSeeder extends Seeder unlink($del_file); // delete file } + DB::table('checkout_requests')->truncate(); } } From aac379daeb1ebe360323df31d00cceecbaf48032 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 16 Jan 2018 07:37:06 -0800 Subject: [PATCH 6/9] If nopages is passed, hide page numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This seems weird since we’re checking for a negative, but there are only a few spots where we wouldn’t want page numbers, namely the dashboard sruff --- resources/views/partials/bootstrap-table.blade.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 47515911f5..300f21c308 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -50,8 +50,10 @@ paginationVAlign: 'both', sidePagination: '{{ (isset($clientSearch)) ? 'client' : 'server' }}', sortable: true, + @if (!isset($nopages)) pageSize: 20, pagination: true, + @endif cookie: true, cookieExpire: '2y', cookieIdTable: '{{ Route::currentRouteName() }}', @@ -72,7 +74,7 @@ paginationSwitchDown: 'fa-caret-square-o-down', paginationSwitchUp: 'fa-caret-square-o-up', columns: 'fa-columns', - @if( isset($multiSort)) + @if (isset($multiSort)) sort: 'fa fa-sort-amount-desc', plus: 'fa fa-plus', minus: 'fa fa-minus', From 69a7ea63e2c29d4b1d9afdbd97c251233acfccee Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 16 Jan 2018 07:37:20 -0800 Subject: [PATCH 7/9] Pass nopages to dashboard stuff --- resources/views/dashboard.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/dashboard.blade.php b/resources/views/dashboard.blade.php index 209f987ca0..39f2bcda1b 100755 --- a/resources/views/dashboard.blade.php +++ b/resources/views/dashboard.blade.php @@ -249,7 +249,7 @@ @stop @section('moar_scripts') -@include ('partials.bootstrap-table', ['simple_view' => true]) +@include ('partials.bootstrap-table', ['simple_view' => true, 'nopages' => true]) @if ($snipeSettings->load_remote=='1') From 3b5e4c44ebbc6fa405c1775b229724fae4029986 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 16 Jan 2018 07:46:34 -0800 Subject: [PATCH 8/9] Fixed depreciation report not showing assigned to --- resources/views/reports/depreciation.blade.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/views/reports/depreciation.blade.php b/resources/views/reports/depreciation.blade.php index 383c6ddd52..f36f24483a 100644 --- a/resources/views/reports/depreciation.blade.php +++ b/resources/views/reports/depreciation.blade.php @@ -74,13 +74,14 @@ @endif - @if ($asset->assignedTo) - @if ($asset->assignedTo->deleted_at!='') - {{ $asset->assignedTo->present()->name() }} + @if ($asset->checkedOutToUser()) + {{ $asset->assigned->getFullNameAttribute() }} @else - {!! $asset->assignedTo->present()->nameUrl() !!} + + @if ($asset->assigned) + {{ $asset->assigned->name }} + @endif @endif - @endif @if ($asset->location) From 409f5cc4fd445e0fde2c2151a4e8769b71c896de Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 16 Jan 2018 16:26:24 -0800 Subject: [PATCH 9/9] Added - display asset model category on hardware view page --- resources/views/hardware/view.blade.php | 27 ++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 84002885e9..9e3797f288 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -180,11 +180,34 @@ @endif + + + + {{ trans('general.category') }} + + @if ($asset->model->category) + + @can('view', \App\Models\Category::class) + + + {{ $asset->model->category->name }} + + @else + {{ $asset->model->category->name }} + @endcan + @else + Invalid category + @endif + + + + + {{ trans('admin/hardware/form.model') }} - @can('view', \App\Models\AssetModel::class) + @can('view', \App\Models\AssetModel::class) {{ $asset->model->name }} @@ -193,6 +216,8 @@ @endcan + + {{ trans('admin/models/table.modelnumber') }}