Skip to content

A free open source IT asset/license management system

Display helpful messages when importing assets

Marcus Mooree05546d1fa24
diff --git a/app/Http/Livewire/Importer.php b/app/Http/Livewire/Importer.php
index 784d3b2982..1026a188b3 100644
--- a/app/Http/Livewire/Importer.php
+++ b/app/Http/Livewire/Importer.php
@@ -3,6 +3,7 @@
namespace App\Http\Livewire;
use App\Models\CustomField;
+use Illuminate\Support\Facades\Auth;
use Livewire\Component;
use App\Models\Import;
@@ -16,6 +17,8 @@ class Importer extends Component
{
use AuthorizesRequests;
+ public bool $userIsSuperUser;
+
public $files;
public $progress; //upload progress - '-1' means don't show
@@ -250,6 +253,7 @@ class Importer extends Component
public function mount()
{
$this->authorize('import');
+ $this->userIsSuperUser = Auth::user()->isSuperUser();
$this->progress = -1; // '-1' means 'don't show the progressbar'
$this->progress_bar_class = 'progress-bar-warning';
\Log::debug("Hey, we are calling MOUNT (in the importer-file) !!!!!!!!"); //fcuk
diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php
index fbe5802d28..22663bc503 100644
--- a/resources/views/livewire/importer.blade.php
+++ b/resources/views/livewire/importer.blade.php
@@ -156,6 +156,11 @@
'data-minimum-results-for-search' => '-1', // Remove this if the list gets long enough that we need to search
'data-livewire-component' => $_instance->id
]) }}
+ @if ($activeFile->import_type === 'asset' && $snipeSettings->auto_increment_assets == 0)
+ <span class="help-block">
+ Generating auto-incrementing asset tags is @if ($userIsSuperUser)<a href="{{ route('settings.asset_tags.index') }}">disabled</a> @else disabled @endif so all rows need to have the "Asset Tag" column populated.
+ </span>
+ @endif
</div>
</div>
@@ -163,6 +168,11 @@
<label for="update" class="col-md-9 col-md-offset-3 col-xs-12">
<input type="checkbox" class="minimal livewire-icheck" name="update" data-livewire-component="{{ $_instance->id }}" wire:model="update">
{{ trans('general.update_existing_values') }}
+ @if ($activeFile->import_type === 'asset' && $snipeSettings->auto_increment_assets == 1 && $update)
+ <span class="help-block">
+ Note: Generating auto-incrementing asset tags is @if ($userIsSuperUser)<a href="{{ route('settings.asset_tags.index') }}">disabled</a> @else enabled @endif so assets will be created for rows that do not have "Asset Tag" populated. Rows that do have "Asset Tag" populated will be updated with the provided information.
+ </span>
+ @endif
</label>
</div>
@@ -344,7 +354,7 @@
'import-update': [email protected],
'send-welcome': [email protected]_welcome,
'import-type': @this.activeFile.import_type,
- 'run-backup': [email protected]_backup,
+ 'A': [email protected]_backup,
'column-mappings': mappings
}),
headers: {