diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 6e35f8217a..e340d70b09 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -141,6 +141,8 @@ class Handler extends ExceptionHandler $route = 'kits.index'; } elseif ($route == 'assetmaintenances.index') { $route = 'maintenances.index'; + } elseif ($route === 'licenseseats.index') { + $route = 'licenses.index'; } return redirect() @@ -203,4 +205,4 @@ class Handler extends ExceptionHandler // }); } -} \ No newline at end of file +} diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 4b752b736f..604666eda4 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -150,6 +150,11 @@ class UserFactory extends Factory return $this->appendPermission(['models.delete' => '1']); } + public function viewAssetModels() + { + return $this->appendPermission(['models.view' => '1']); + } + public function viewAccessories() { return $this->appendPermission(['accessories.view' => '1']); @@ -360,6 +365,11 @@ class UserFactory extends Factory return $this->appendPermission(['kits.delete' => '1']); } + public function viewPredefinedKits() + { + return $this->appendPermission(['kits.view' => '1']); + } + public function deleteStatusLabels() { return $this->appendPermission(['statuslabels.delete' => '1']); diff --git a/resources/views/blade/input/select.blade.php b/resources/views/blade/input/select.blade.php new file mode 100644 index 0000000000..9ddbbd6d7c --- /dev/null +++ b/resources/views/blade/input/select.blade.php @@ -0,0 +1,25 @@ +@props([ + // can either be provided as key => value pairs + // or passed in via the default $slot + 'options', + 'selected' => null, + 'includeEmpty' => false, + 'forLivewire' => false, +]) + + diff --git a/resources/views/categories/edit.blade.php b/resources/views/categories/edit.blade.php index ddf1b1cf76..7c12f677fa 100755 --- a/resources/views/categories/edit.blade.php +++ b/resources/views/categories/edit.blade.php @@ -15,7 +15,14 @@
- {{ Form::select('category_type', $category_types , old('category_type', $item->category_type), array('class'=>'select2', 'style'=>'min-width:350px', 'aria-label'=>'category_type', ($item->category_type!='') || ($item->itemCount() > 0) ? 'disabled' : '')) }} + {!! $errors->first('category_type', '') !!}
diff --git a/resources/views/custom_fields/fields/edit.blade.php b/resources/views/custom_fields/fields/edit.blade.php index 9b8449eb74..8ff41b7a41 100644 --- a/resources/views/custom_fields/fields/edit.blade.php +++ b/resources/views/custom_fields/fields/edit.blade.php @@ -94,7 +94,14 @@ } @endphp
- {{ Form::select("format",Helper::predefined_formats(), ($field_format == '') ? $field->format : $field_format, array('class'=>'format select2 form-control', 'aria-label'=>'format', 'style' => 'width:100%;')) }} + {!! $errors->first('format', '') !!}
diff --git a/resources/views/custom_fields/fieldsets/view.blade.php b/resources/views/custom_fields/fieldsets/view.blade.php index 59392b1db2..feef5566aa 100644 --- a/resources/views/custom_fields/fieldsets/view.blade.php +++ b/resources/views/custom_fields/fieldsets/view.blade.php @@ -95,8 +95,12 @@ - {{ Form::select("field_id",$custom_fields_list,"",['aria-label'=>'field_id', 'class'=>'select2', 'style' => 'min-width:400px;']) }} - +
- {{ Form::close() }} + diff --git a/resources/views/hardware/bulk.blade.php b/resources/views/hardware/bulk.blade.php index 4ac80e9820..e3cc9f5388 100755 --- a/resources/views/hardware/bulk.blade.php +++ b/resources/views/hardware/bulk.blade.php @@ -125,7 +125,13 @@ {{ trans('admin/hardware/form.status') }}
- {{ Form::select('status_id', $statuslabel_list , old('status_id'), array('class'=>'select2', 'style'=>'width:100%', 'aria-label'=>'status_id')) }} +

{{ trans('general.status_compatibility') }}

{!! $errors->first('status_id', '') !!}
diff --git a/resources/views/hardware/checkin.blade.php b/resources/views/hardware/checkin.blade.php index d08f91cf5b..5510ff89a5 100755 --- a/resources/views/hardware/checkin.blade.php +++ b/resources/views/hardware/checkin.blade.php @@ -84,7 +84,13 @@ {{ trans('admin/hardware/form.status') }}
- {{ Form::select('status_id', $statusLabel_list, '', array('class'=>'select2', 'style'=>'width:100%','id' =>'modal-statuslabel_types', 'aria-label'=>'status_id')) }} + {!! $errors->first('status_id', '') !!}
@@ -154,4 +160,4 @@ -@stop \ No newline at end of file +@stop diff --git a/resources/views/hardware/checkout.blade.php b/resources/views/hardware/checkout.blade.php index ba81709e13..b237a2d004 100755 --- a/resources/views/hardware/checkout.blade.php +++ b/resources/views/hardware/checkout.blade.php @@ -82,7 +82,13 @@ {{ trans('admin/hardware/form.status') }}
- {{ Form::select('status_id', $statusLabel_list, $asset->status_id, array('class'=>'select2', 'style'=>'width:100%','', 'aria-label'=>'status_id')) }} + {!! $errors->first('status_id', '') !!}
diff --git a/resources/views/hardware/quickscan-checkin.blade.php b/resources/views/hardware/quickscan-checkin.blade.php index bf3d2f5032..c69553246b 100644 --- a/resources/views/hardware/quickscan-checkin.blade.php +++ b/resources/views/hardware/quickscan-checkin.blade.php @@ -47,7 +47,13 @@ {{ trans('admin/hardware/form.status') }}
- {{ Form::select('status_id', $statusLabel_list, '', array('class'=>'select2', 'style'=>'width:100%','', 'aria-label'=>'status_id')) }} + {!! $errors->first('status_id', '') !!}
diff --git a/resources/views/livewire/custom-field-set-default-values-for-model.blade.php b/resources/views/livewire/custom-field-set-default-values-for-model.blade.php index fa123cf57f..aee5f38888 100644 --- a/resources/views/livewire/custom-field-set-default-values-for-model.blade.php +++ b/resources/views/livewire/custom-field-set-default-values-for-model.blade.php @@ -4,7 +4,16 @@ {{ trans('admin/models/general.fieldset') }}
- {{ Form::select('fieldset_id', Helper::customFieldsetList(), old('fieldset_id', $fieldset_id), array('class'=>'select2 js-fieldset-field livewire-select2', 'style'=>'width:100%; min-width:350px', 'aria-label'=>'custom_fieldset', 'data-livewire-component' => $this->getId())) }} + {!! $errors->first('custom_fieldset', '') !!}
diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index b0ba7e037b..3511a81bb2 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -155,15 +155,20 @@
- {{ Form::select('typeOfImport', $importTypes, $typeOfImport, [ - 'id' => 'import_type', - 'class' => 'livewire-select2', - 'style' => 'min-width: 350px', - 'data-placeholder' => trans('general.select_var', ['thing' => trans('general.import_type')]), - 'placeholder' => '', //needed so that the form-helper will put an empty option first - 'data-minimum-results-for-search' => '-1', // Remove this if the list gets long enough that we need to search - 'data-livewire-component' => $this->getId() - ]) }} + @if ($typeOfImport === 'asset' && $snipeSettings->auto_increment_assets == 0)

{{ trans('general.auto_incrementing_asset_tags_disabled_so_tags_required') }} @@ -238,17 +243,22 @@

- - {{ Form::select('field_map.'.$index, $columnOptions[$typeOfImport], @$field_map[$index], - [ - 'class' => 'mappings livewire-select2', - 'placeholder' => trans('general.importer.do_not_import'), - 'style' => 'min-width: 100%', - 'data-livewire-component' => $this->getId() - ],[ - '-' => ['disabled' => true] // this makes the "-----" line unclickable - ]) - }} + + + @foreach($columnOptions[$typeOfImport] as $key => $value) + + @endforeach +
@if (($this->activeFile->first_row) && (array_key_exists($index, $this->activeFile->first_row)))
diff --git a/resources/views/livewire/slack-settings-form.blade.php b/resources/views/livewire/slack-settings-form.blade.php index 48e0fb72ad..0ef9747a6c 100644 --- a/resources/views/livewire/slack-settings-form.blade.php +++ b/resources/views/livewire/slack-settings-form.blade.php @@ -66,13 +66,17 @@
- - @if (Helper::isDemoMode()) - {{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook'),'google' => trans('admin/settings/general.google_workspaces'), 'microsoft' => trans('admin/settings/general.ms_teams')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'style'=>'width:100%', 'disabled')) }} - @else - {{ Form::select('webhook_selected', array('slack' => trans('admin/settings/general.slack'), 'general' => trans('admin/settings/general.general_webhook'),'google' => trans('admin/settings/general.google_workspaces'), 'microsoft' => trans('admin/settings/general.ms_teams')), old('webhook_selected', $webhook_selected), array('class'=>'select2 form-control', 'aria-label' => 'webhook_selected', 'id' => 'select2', 'data-minimum-results-for-search' => '-1', 'style'=>'width:100%')) }} - @endif - +
diff --git a/resources/views/modals/partials/fieldset-select.blade.php b/resources/views/modals/partials/fieldset-select.blade.php index 3f4efc24b6..ec1e178f22 100644 --- a/resources/views/modals/partials/fieldset-select.blade.php +++ b/resources/views/modals/partials/fieldset-select.blade.php @@ -1,6 +1,14 @@
-
{{ Form::select('fieldset_id', Helper::customFieldsetList(),old('fieldset_id'), array('class'=>'select2', 'id'=>'modal-fieldset_id', 'style'=>'width:100%;')) }}
+
+ +
- \ No newline at end of file + diff --git a/resources/views/modals/statuslabel.blade.php b/resources/views/modals/statuslabel.blade.php index e7076f1bbb..a6676c9292 100644 --- a/resources/views/modals/statuslabel.blade.php +++ b/resources/views/modals/statuslabel.blade.php @@ -16,7 +16,15 @@
-
{{ Form::select('type', $statuslabel_types, '', array('class'=>'select2', 'style'=>'width:100%','id' =>'modal-type', 'required',)) }}
+
+ +
diff --git a/resources/views/models/bulk-edit.blade.php b/resources/views/models/bulk-edit.blade.php index 7a283fbba6..8dd0f5ba53 100644 --- a/resources/views/models/bulk-edit.blade.php +++ b/resources/views/models/bulk-edit.blade.php @@ -62,7 +62,13 @@ {{ trans('admin/models/general.fieldset') }}
- {{ Form::select('fieldset_id', $fieldset_list , old('fieldset_id', 'NC'), array('class'=>'select2 js-fieldset-field', 'style'=>'width:350px')) }} + {!! $errors->first('fieldset_id', '') !!}
@@ -74,7 +80,12 @@ {{ trans('general.depreciation') }}
- {{ Form::select('depreciation_id', $depreciation_list , old('depreciation_id', 'NC'), array('class'=>'select2', 'style'=>'width:350px')) }} + {!! $errors->first('depreciation_id', '') !!}
diff --git a/resources/views/models/custom_fields_form.blade.php b/resources/views/models/custom_fields_form.blade.php index 325540c6e1..3297c15c9e 100644 --- a/resources/views/models/custom_fields_form.blade.php +++ b/resources/views/models/custom_fields_form.blade.php @@ -17,8 +17,13 @@ @if ($field->element=='listbox') - {{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(), - old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))), ['class' => 'format select2 form-control', ($field->pivot->required=='1' ? ' required' : '') ]) }} + @elseif ($field->element=='textarea') diff --git a/resources/views/models/custom_fields_form_bulk_edit.blade.php b/resources/views/models/custom_fields_form_bulk_edit.blade.php index e048b38d09..cea495ccd2 100644 --- a/resources/views/models/custom_fields_form_bulk_edit.blade.php +++ b/resources/views/models/custom_fields_form_bulk_edit.blade.php @@ -24,8 +24,12 @@ @if ($field->element!='text') @if ($field->element=='listbox') - {{ Form::select($field->db_column_name(), $field->formatFieldValuesAsArray(), - old($field->db_column_name(),(isset($item) ? Helper::gracefulDecrypt($field, $item->{$field->db_column_name()}) : $field->defaultValue($model->id))), ['class'=>'format select2 form-control']) }} + @elseif ($field->element=='textarea') @if($field->is_unique) diff --git a/resources/views/partials/forms/edit/category.blade.php b/resources/views/partials/forms/edit/category.blade.php deleted file mode 100644 index 158cc3508b..0000000000 --- a/resources/views/partials/forms/edit/category.blade.php +++ /dev/null @@ -1,8 +0,0 @@ - -
- -
- {{ Form::select('category_id', $category_list , old('category_id', $item->category_id), array('class'=>'select2', 'style'=>'width:100%', 'required' => Helper::checkIfRequired($item, 'category_id') ? true : '')) }} - {!! $errors->first('category_id', '') !!} -
-
diff --git a/resources/views/partials/forms/edit/company.blade.php b/resources/views/partials/forms/edit/company.blade.php deleted file mode 100644 index 767bdeb9f4..0000000000 --- a/resources/views/partials/forms/edit/company.blade.php +++ /dev/null @@ -1,11 +0,0 @@ -@if (\App\Models\Company::isCurrentUserAuthorized()) -
-
- -
-
- {{ Form::select('company_id', $company_list , old('company_id', $item->company_id), array('class'=>'select2', 'style'=>'width:100%', 'required' => Helper::checkIfRequired($item, 'company_id') ? true : '')) }} - {!! $errors->first('company_id', '') !!} -
-
-@endif diff --git a/resources/views/partials/forms/edit/depreciation.blade.php b/resources/views/partials/forms/edit/depreciation.blade.php index 4478a9c05f..8195ac394e 100644 --- a/resources/views/partials/forms/edit/depreciation.blade.php +++ b/resources/views/partials/forms/edit/depreciation.blade.php @@ -2,7 +2,14 @@
- {{ Form::select('depreciation_id', $depreciation_list , old('depreciation_id', $item->depreciation_id), array('class'=>'select2', 'style'=>'width:350px', 'aria-label'=>'depreciation_id')) }} + {!! $errors->first('depreciation_id', '') !!}
diff --git a/resources/views/partials/forms/edit/location.blade.php b/resources/views/partials/forms/edit/location.blade.php deleted file mode 100644 index 49bc2976d0..0000000000 --- a/resources/views/partials/forms/edit/location.blade.php +++ /dev/null @@ -1,8 +0,0 @@ - -
- -
- {{ Form::select('location_id', $location_list , old('location_id', $item->location_id), array('class'=>'select2', 'style'=>'width:350px')) }} - {!! $errors->first('location_id', '') !!} -
-
diff --git a/resources/views/partials/forms/edit/maintenance_type.blade.php b/resources/views/partials/forms/edit/maintenance_type.blade.php index 24d008fa23..b82bead76b 100644 --- a/resources/views/partials/forms/edit/maintenance_type.blade.php +++ b/resources/views/partials/forms/edit/maintenance_type.blade.php @@ -3,7 +3,14 @@
- {{ Form::select('asset_maintenance_type', $assetMaintenanceType , old('asset_maintenance_type', $item->asset_maintenance_type), ['class'=>'select2', 'aria-label'=>'asset_maintenance_type', 'required' => Helper::checkIfRequired($item, 'asset_maintenance_type') ? true : '', 'style'=> 'width:100%;']) }} + {!! $errors->first('asset_maintenance_type', '') !!}
diff --git a/resources/views/partials/forms/edit/manufacturer.blade.php b/resources/views/partials/forms/edit/manufacturer.blade.php deleted file mode 100644 index 644b70d7ba..0000000000 --- a/resources/views/partials/forms/edit/manufacturer.blade.php +++ /dev/null @@ -1,8 +0,0 @@ - -
- -
- {{ Form::select('manufacturer_id', $manufacturer_list , old('manufacturer_id', $item->manufacturer_id), array('class'=>'select2', 'style'=>'width:100%', 'required' => Helper::checkIfRequired($item, 'manufacturer_id') ? true : '')) }} - {!! $errors->first('manufacturer_id', '') !!} -
-
diff --git a/resources/views/partials/forms/edit/status.blade.php b/resources/views/partials/forms/edit/status.blade.php index 8554f9a59c..01dd14612e 100644 --- a/resources/views/partials/forms/edit/status.blade.php +++ b/resources/views/partials/forms/edit/status.blade.php @@ -2,7 +2,16 @@
- {{ Form::select('status_id', $statuslabel_list , old('status_id', $item->status_id), array('class'=>'select2 status_id', 'style'=>'width:100%','id'=>'status_select_id', 'aria-label'=>'status_id', 'required' => 'required')) }} + {!! $errors->first('status_id', '') !!}
diff --git a/resources/views/partials/forms/edit/supplier.blade.php b/resources/views/partials/forms/edit/supplier.blade.php deleted file mode 100644 index 40c1e2b279..0000000000 --- a/resources/views/partials/forms/edit/supplier.blade.php +++ /dev/null @@ -1,11 +0,0 @@ - -
- -
- {{ Form::select('supplier_id', $supplier_list , old('supplier_id', $item->supplier_id), ['class'=>'select2', 'style'=>'min-width:350px', 'id' => 'supplier_select_id', 'required' => Helper::checkIfRequired($item, 'supplier_id') ? true : '']) }} - {!! $errors->first('supplier_id', '') !!} -
- -
diff --git a/resources/views/settings/branding.blade.php b/resources/views/settings/branding.blade.php index dcee8027f6..dcebbec48c 100644 --- a/resources/views/settings/branding.blade.php +++ b/resources/views/settings/branding.blade.php @@ -78,11 +78,19 @@
- {!! Form::select('brand', [ - '1'=> trans('admin/settings/general.logo_option_types.text'), - '2'=> trans('admin/settings/general.logo_option_types.logo'), - '3'=> trans('admin/settings/general.logo_option_types.logo_and_text')], old('brand', $setting->brand), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!} - + + {!! $errors->first('brand', '') !!}
@@ -277,10 +285,25 @@
@if (config('app.lock_passwords')===true) - {!! Form::select('support_footer', array('on'=>trans('admin/settings/general.enabled'),'off'=>trans('admin/settings/general.two_factor_disabled'),'admin'=>trans('admin/settings/general.super_admin_only')), old('support_footer', $setting->support_footer), ['class' => 'form-control select2 disabled', 'style'=>'width: 150px ;', 'disabled' => 'disabled']) !!} +

{{ trans('general.feature_disabled') }}

@else - {!! Form::select('support_footer', array('on'=>trans('admin/settings/general.enabled'),'off'=>trans('admin/settings/general.two_factor_disabled'),'admin'=>trans('admin/settings/general.super_admin_only')), old('support_footer', $setting->support_footer), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!} + @endif @@ -296,10 +319,25 @@
@if (config('app.lock_passwords')===true) - {!! Form::select('version_footer', array('on'=>trans('admin/settings/general.enabled'),'off'=>trans('admin/settings/general.two_factor_disabled'),'admin'=>trans('admin/settings/general.super_admin_only')), old('version_footer', $setting->version_footer), ['class' => 'form-control select2 disabled', 'style'=>'width: 150px ;', 'disabled' => 'disabled']) !!} +

{{ trans('general.feature_disabled') }}

@else - {!! Form::select('version_footer', array('on'=>trans('admin/settings/general.enabled'),'off'=>trans('admin/settings/general.two_factor_disabled'),'admin'=>trans('admin/settings/general.super_admin_only')), old('version_footer', $setting->version_footer), array('class' => 'form-control select2', 'style'=>'width: 150px ;')) !!} + @endif

{{ trans('admin/settings/general.version_footer_help') }}

diff --git a/resources/views/settings/general.blade.php b/resources/views/settings/general.blade.php index 20d8517546..1b123d3519 100644 --- a/resources/views/settings/general.blade.php +++ b/resources/views/settings/general.blade.php @@ -364,9 +364,12 @@
- {{ Form::select('dash_chart_type', array( - 'name' => 'Status Label Name', - 'type' => 'Status Label Type'), old('dash_chart_type', $setting->dash_chart_type), ['class' =>'select2', 'style' => 'width: 80%']) }} +
@@ -377,11 +380,13 @@
- {{ Form::select('depreciation_method', array( - 'default' => trans('admin/depreciations/general.linear_depreciation'), - 'half_1' => trans('admin/depreciations/general.half_1'), - 'half_2' => trans('admin/depreciations/general.half_2'), - ), old('username_format', $setting->depreciation_method), ['class' =>'select2', 'style' => 'width: 80%']) }} +
diff --git a/resources/views/settings/labels.blade.php b/resources/views/settings/labels.blade.php index 33bd46220d..92838d72ac 100644 --- a/resources/views/settings/labels.blade.php +++ b/resources/views/settings/labels.blade.php @@ -169,7 +169,14 @@ 'none' => trans('admin/settings/general.none'), ]; @endphp - {{ Form::select('label2_1d_type', $select1DValues, old('label2_1d_type', $setting->label2_1d_type), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_1d_type' ]) }} + {!! $errors->first('label2_1d_type', '') !!}

{{ trans('admin/settings/general.label2_1d_type_help') }}. @@ -213,7 +220,14 @@ 'none' => trans('admin/settings/general.none'), ]); @endphp - {{ Form::select('label2_2d_type', $select2DValues, old('label2_2d_type', $setting->label2_2d_type), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_2d_type' ]) }} + {!! $errors->first('label2_2d_type', '') !!}

{{ trans('admin/settings/general.label2_2d_type_help', ['current' => $setting->barcode_type]) }}. @@ -284,13 +298,14 @@

- {{ Form::select('label2_2d_target', [ - 'hardware_id' => trans('general.url') .': /hardware/{id} ('.trans('admin/settings/general.default').')', - 'ht_tag' => trans('general.url') .': /ht/{asset_tag}', - 'plain_asset_id' => trans('admin/settings/general.data') .': '. trans('admin/settings/general.asset_id') .' {id}', - 'plain_asset_tag' => trans('admin/settings/general.data') .': '. trans('general.asset_tag') .' {asset_tag}', - 'plain_serial_number' => trans('admin/settings/general.data') .': '. trans('general.serial_number') .' {serial}', - ], old('label2_2d_target', $setting->label2_2d_target), [ 'class'=>'select2 col-md-4', 'aria-label'=>'label2_2d_target' ]) }} + {!! $errors->first('label2_2d_target', '') !!}

{{ trans('admin/settings/general.label2_2d_target_help') }}

diff --git a/resources/views/statuslabels/edit.blade.php b/resources/views/statuslabels/edit.blade.php index 0c93db184c..138f0cb7b5 100755 --- a/resources/views/statuslabels/edit.blade.php +++ b/resources/views/statuslabels/edit.blade.php @@ -27,7 +27,13 @@ {{ trans('admin/statuslabels/table.status_type') }}
- {{ Form::select('statuslabel_types', $statuslabel_types, $item->getStatuslabelType(), array('class'=>'select2', 'style'=>'width: 100%; min-width:400px', 'aria-label'=>'statuslabel_types')) }} + {!! $errors->first('statuslabel_types', '') !!}
diff --git a/resources/views/users/confirm-bulk-delete.blade.php b/resources/views/users/confirm-bulk-delete.blade.php index 8e4ba33071..0234ce576b 100644 --- a/resources/views/users/confirm-bulk-delete.blade.php +++ b/resources/views/users/confirm-bulk-delete.blade.php @@ -109,7 +109,15 @@ - {{ Form::select('status_id', $statuslabel_list , old('status_id'), array('class'=>'select2', 'style'=>'width:250px', 'required' => true)) }} + @@ -159,4 +167,4 @@ } }); -@stop \ No newline at end of file +@stop diff --git a/tests/Feature/Modals/Ui/ShowModalsTest.php b/tests/Feature/Modals/Ui/ShowModalsTest.php new file mode 100644 index 0000000000..308460999f --- /dev/null +++ b/tests/Feature/Modals/Ui/ShowModalsTest.php @@ -0,0 +1,60 @@ +actingAs(User::factory()->createUsers()->create()) + ->get('modals/user') + ->assertOk(); + } + + public function testDepartmentModalRenders() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get('modals/model') + ->assertOk(); + } + + public function testStatusLabelModalRenders() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get('modals/statuslabel') + ->assertOk(); + } + + public function testLocationModalRenders() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get('modals/location') + ->assertOk(); + } + + public function testCategoryModalRenders() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get('modals/category') + ->assertOk(); + } + + public function testManufacturerModalRenders() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get('modals/manufacturer') + ->assertOk(); + } + + public function testSupplierModalRenders() + { + $this->actingAs(User::factory()->superuser()->create()) + ->get('modals/supplier') + ->assertOk(); + } + + +} diff --git a/tests/Feature/Redirects/ModelNotFoundRedirectTest.php b/tests/Feature/Redirects/ModelNotFoundRedirectTest.php new file mode 100644 index 0000000000..26401e9607 --- /dev/null +++ b/tests/Feature/Redirects/ModelNotFoundRedirectTest.php @@ -0,0 +1,51 @@ +actingAs(User::factory()->viewAssets()->create()) + ->get(route('hardware.checkout.create', 9999)) + ->assertRedirectToRoute('hardware.index'); + } + + public function testHandlesAssetMaintenance404() + { + $this->actingAs(User::factory()->viewAssets()->create()) + ->get(route('maintenances.show', 9999)) + ->assertRedirectToRoute('maintenances.index'); + } + + public function testHandlesAssetModel404() + { + $this->actingAs(User::factory()->viewAssetModels()->create()) + ->get(route('models.show', 9999)) + ->assertRedirectToRoute('models.index'); + } + + public function testHandlesLicenseSeat404() + { + $this->actingAs(User::factory()->viewLicenses()->create()) + ->get(route('licenses.checkin', 9999)) + ->assertRedirectToRoute('licenses.index'); + } + + public function testHandlesPredefinedKit404() + { + $this->actingAs(User::factory()->viewPredefinedKits()->create()) + ->get(route('kits.show', 9999)) + ->assertRedirectToRoute('kits.index'); + } + + public function testHandlesReportTemplate404() + { + $this->actingAs(User::factory()->canViewReports()->create()) + ->get(route('report-templates.show', 9999)) + ->assertRedirectToRoute('reports/custom'); + } +}