Display helpful messages when importing assets

This commit is contained in:
Marcus Moore 2023-03-29 13:23:45 -07:00
parent 4cbe683a1a
commit e05546d1fa
No known key found for this signature in database
2 changed files with 15 additions and 1 deletions

View file

@ -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

View file

@ -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': !!@this.update,
'send-welcome': !!@this.send_welcome,
'import-type': @this.activeFile.import_type,
'run-backup': !!@this.run_backup,
'A': !!@this.run_backup,
'column-mappings': mappings
}),
headers: {