From 099dd2d753093254fbd9389803d0ca18f09421db Mon Sep 17 00:00:00 2001 From: Burak Civan Date: Tue, 19 Jul 2022 10:48:46 +0300 Subject: [PATCH] code refactoring --- resources/assets/js/views/modules/apps.js | 19 ++++++++++++------- resources/lang/en-GB/modules.php | 1 + .../components/layouts/modules/bar.blade.php | 8 +++++--- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/resources/assets/js/views/modules/apps.js b/resources/assets/js/views/modules/apps.js index 91b2cbd6b..bffdda633 100644 --- a/resources/assets/js/views/modules/apps.js +++ b/resources/assets/js/views/modules/apps.js @@ -88,8 +88,11 @@ const app = new Vue({ addToCartLoading: false, loadMoreLoading: false, - live_search_modal: false, - live_search_data: [], + live_search: { + data: [], + modal: false, + not_found: false + }, route_url: url } }, @@ -301,7 +304,7 @@ const app = new Vue({ let target = event.target; if (el !== target && target.contains(el)) { - this.live_search_modal = false; + this.live_search.modal = false; } }, @@ -311,15 +314,17 @@ const app = new Vue({ if (target_length > 2) { window.axios.get(url + '/apps/search?keyword=' + event.target.value) .then(response => { - this.live_search_data = response.data.data.data; - this.live_search_modal = true; + this.live_search.data = response.data.data.data; + this.live_search.modal = true; + this.live_search.not_found = false; }) .catch(error => { - this.live_search_modal = false; + this.live_search.not_found = true; + this.live_search.data = []; console.log(error); }) } else if (target_length == 0) { - this.live_search_modal = false; + this.live_search.modal = false; } } } diff --git a/resources/lang/en-GB/modules.php b/resources/lang/en-GB/modules.php index 12c1115e6..ac9dda601 100644 --- a/resources/lang/en-GB/modules.php +++ b/resources/lang/en-GB/modules.php @@ -50,6 +50,7 @@ return [ 'hosted_on_akaunting' => 'Hosted on akaunting.com', 'only_works_cloud' => 'This app is available only on Cloud.', 'only_premium_plan' => 'This app is available only on Premium Cloud.', + 'not_found' => 'App not found', 'about' => 'About', diff --git a/resources/views/components/layouts/modules/bar.blade.php b/resources/views/components/layouts/modules/bar.blade.php index 6439e705f..b22d41daf 100644 --- a/resources/views/components/layouts/modules/bar.blade.php +++ b/resources/views/components/layouts/modules/bar.blade.php @@ -77,9 +77,9 @@ /> -
+
    -
  • +
  • + +
  • {{ trans('modules.not_found') }}
-
+
{{ trans('modules.see_more') }}