From 8f4ca9da571d31b02ccb29bd3f24e16994b8343d Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 14 Sep 2023 21:20:21 +0100 Subject: [PATCH] Simplify upload messaging Signed-off-by: snipe --- resources/lang/en/general.php | 9 +++++--- resources/views/livewire/importer.blade.php | 24 +++++++++------------ resources/views/notifications.blade.php | 14 ++++++------ 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php index d8f5bb887d..b638682b14 100644 --- a/resources/lang/en/general.php +++ b/resources/lang/en/general.php @@ -369,9 +369,9 @@ return [ 'notification_error' => 'Error:', 'notification_error_hint' => 'Please check the form below for errors', 'notification_bulk_error_hint' => 'The following fields had validation errors and were not edited:', - 'notification_success' => 'Success:', - 'notification_warning' => 'Warning:', - 'notification_info' => 'Info:', + 'notification_success' => 'Success', + 'notification_warning' => 'Warning', + 'notification_info' => 'Info', 'asset_information' => 'Asset Information', 'model_name' => 'Model Name', 'asset_name' => 'Asset Name', @@ -481,5 +481,8 @@ return [ 'address2' => 'Address Line 2', 'import_note' => 'Imported using csv importer', ], + 'percent_complete' => '% complete', + 'uploading' => 'Uploading... ', + 'upload_error' => 'Error uploading file. Please check that there are no empty trailing rows.' ]; diff --git a/resources/views/livewire/importer.blade.php b/resources/views/livewire/importer.blade.php index 60f4502b22..3536d47f68 100644 --- a/resources/views/livewire/importer.blade.php +++ b/resources/views/livewire/importer.blade.php @@ -24,7 +24,7 @@
- {{ trans('general.warning', ['warning'=> trans('general.errors_importing')]) }} + {{ trans('general.warning', ['warning'=> trans('general.errors_importing')]) }}
@@ -65,17 +65,18 @@
+ @if($progress != -1) -
-
{{-- so someof these values are in importer.vue! --}} +
+
- {{ $progress_message }} +

{!! $progress_message !!}

@endif -
+
@if (!config('app.lock_passwords')) @@ -289,7 +290,7 @@ dataType: 'json', done: function(e, data) { @this.progress_bar_class = 'progress-bar-success'; - @this.progress_message = '{{ trans('general.notification_success') }}'; // TODO - we're already round-tripping to the server here - I'd love it if we could get internationalized text here + @this.progress_message = ' {{ trans('general.notification_success') }}'; @this.progress = 100; }, add: function(e, data) { @@ -302,17 +303,12 @@ }, progress: function(e, data) { @this.progress = parseInt((data.loaded / data.total * 100, 10)); - @this.progress_message = @this.progress+'% Complete'; // TODO - make this use general.percent_complete as a translation, passing :percent as a variable + @this.progress_message = '{{ trans('general.uploading') }}'; }, - fail: function(e, data) { + fail: function() { @this.progress_bar_class = "progress-bar-danger"; @this.progress = 100; - - var error_message = '' - for(var i in data.jqXHR.responseJSON.messages) { - error_message += i+": "+data.jqXHR.responseJSON.messages[i].join(", ") - } - @this.progress_message = error_message; + @this.progress_message = ' {{ trans('general.upload_error') }}'; } }) diff --git a/resources/views/notifications.blade.php b/resources/views/notifications.blade.php index ca7945d563..1811b3cdd7 100755 --- a/resources/views/notifications.blade.php +++ b/resources/views/notifications.blade.php @@ -3,7 +3,7 @@
- {{ trans('general.notification_error') }} + {{ trans('general.notification_error') }}: {{ trans('general.notification_error_hint') }}
@@ -16,7 +16,7 @@
- {{ trans('general.notification_success') }} + {{ trans('general.notification_success') }}: {{ $message }}
@@ -28,7 +28,7 @@
- {{ trans('general.notification_success') }} + {{ trans('general.notification_success') }}: {{ $message }}
@@ -67,7 +67,7 @@
- {{ trans('general.consumable_information') }} + {{ trans('general.consumable_information') }}
  • {{ trans('general.consumable_name') }} {{ $consumable->name }}
@@ -120,7 +120,7 @@
- {{ trans('general.notification_error') }} + {{ trans('general.notification_error') }}: {{ trans('general.notification_bulk_error_hint') }} @foreach($messages as $message)
    @@ -137,7 +137,7 @@
    - {{ trans('general.notification_warning') }} + {{ trans('general.notification_warning') }}: {{ $message }}
@@ -149,7 +149,7 @@
- {{ trans('general.notification_info') }} + {{ trans('general.notification_info') }}: {{ $message }}