diff --git a/app/Http/Livewire/Importer.php b/app/Http/Livewire/Importer.php index 7899182a60..1663fac45e 100644 --- a/app/Http/Livewire/Importer.php +++ b/app/Http/Livewire/Importer.php @@ -484,8 +484,17 @@ class Importer extends Component public function selectFile($id) { + $this->clearMessage(); $this->activeFile = Import::find($id); + + if (!$this->activeFile) { + $this->message = trans('admin/hardware/message.import.file_missing'); + $this->message_type = 'danger'; + + return; + } + $this->field_map = null; foreach($this->activeFile->header_row as $element) { if(isset($this->activeFile->field_map[$element])) { @@ -520,6 +529,12 @@ class Importer extends Component } } + public function clearMessage() + { + $this->message = null; + $this->message_type = null; + } + public function render() { $this->files = Import::orderBy('id','desc')->get(); //HACK - slows down renders. diff --git a/resources/lang/en/admin/hardware/message.php b/resources/lang/en/admin/hardware/message.php index 18f3b3fa24..04be92a754 100644 --- a/resources/lang/en/admin/hardware/message.php +++ b/resources/lang/en/admin/hardware/message.php @@ -51,6 +51,7 @@ return [ 'success' => 'Your file has been imported', 'file_delete_success' => 'Your file has been been successfully deleted', 'file_delete_error' => 'The file was unable to be deleted', + 'file_missing' => 'The file selected is missing', 'header_row_has_malformed_characters' => 'One or more attributes in the header row contain malformed UTF-8 characters', 'content_row_has_malformed_characters' => 'One or more attributes in the first row of content contain malformed UTF-8 characters', ], diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index 5646d0928d..297dcc7b87 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -303,6 +303,7 @@ }; data.process().done( function () {data.submit();}); @this.progress = 0; + @this.clearMessage(); }, progress: function(e, data) { @this.progress = parseInt((data.loaded / data.total * 100, 10)); diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 5c7f1ce218..78f3d152d2 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -42,7 +42,7 @@ 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }, - reorderableColumns: true, + // reorderableColumns: true, stickyHeader: true, stickyHeaderOffsetLeft: parseInt($('body').css('padding-left'), 10), stickyHeaderOffsetRight: parseInt($('body').css('padding-right'), 10),