From 8f8e5cb7235d41fc7b0542720c0a22a0c76b67b9 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Mon, 23 Oct 2023 21:47:10 -0600 Subject: [PATCH 1/4] Adds condition to only process CSV if is not empty --- resources/views/livewire/importer.blade.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index 297dcc7b87..6a7e02e617 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -235,9 +235,11 @@ ]) }} + @if ($activeFile->first_row)

{{ str_limit($activeFile->first_row[$index], 50, '...') }}

+ @endif @endforeach @else From 49f6eef9df43bc28f046b09772ceabb7b5dc934c Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Mon, 23 Oct 2023 21:57:35 -0600 Subject: [PATCH 2/4] Places a text indicating that the file is empty and display it as an info text --- resources/views/livewire/importer.blade.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index 6a7e02e617..c134718429 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -239,6 +239,11 @@

{{ str_limit($activeFile->first_row[$index], 50, '...') }}

+ @else + @php + $statusText = trans('general.empty_file'); + $statusType = 'info'; + @endphp @endif @endforeach From 0c5d54dfdead1897ea2f1738bf1e23bb8558ca5a Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Mon, 23 Oct 2023 22:09:17 -0600 Subject: [PATCH 3/4] Create the language string to show in the importer GUI indicating the file is empty --- resources/lang/en/help.php | 3 ++- resources/views/livewire/importer.blade.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/lang/en/help.php b/resources/lang/en/help.php index a3a2ddd762..a59e0056be 100644 --- a/resources/lang/en/help.php +++ b/resources/lang/en/help.php @@ -30,5 +30,6 @@ return [ 'consumables' => 'Consumables are anything purchased that will be used up over time. For example, printer ink or copier paper.', 'depreciations' => 'You can set up asset depreciations to depreciate assets based on straight-line depreciation.', - + + 'empty_file' => 'The importer detects that this file is empty.' ]; diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index c134718429..48c1a2938c 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -241,7 +241,7 @@ @else @php - $statusText = trans('general.empty_file'); + $statusText = trans('help.empty_file'); $statusType = 'info'; @endphp @endif From f2f3931fa9251a66f2740fdee9d6593979e6607c Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Tue, 24 Oct 2023 11:26:37 -0600 Subject: [PATCH 4/4] Formatting correctly --- resources/views/livewire/importer.blade.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index 48c1a2938c..0134cfe7f2 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -235,16 +235,16 @@ ]) }} - @if ($activeFile->first_row) + @if ($activeFile->first_row)

{{ str_limit($activeFile->first_row[$index], 50, '...') }}

- @else - @php - $statusText = trans('help.empty_file'); - $statusType = 'info'; - @endphp - @endif + @else + @php + $statusText = trans('help.empty_file'); + $statusType = 'info'; + @endphp + @endif @endforeach @else