From cee87df542279650d0e8b382c233518b14231011 Mon Sep 17 00:00:00 2001 From: merve karaman <107546467+mervekaraman@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:09:33 +0300 Subject: [PATCH 1/2] Dashboard slider style --- resources/assets/js/mixins/global.js | 26 +++++++++++ .../views/common/dashboards/show.blade.php | 46 +++++++++---------- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/resources/assets/js/mixins/global.js b/resources/assets/js/mixins/global.js index fc66494b7..192e7ef9e 100644 --- a/resources/assets/js/mixins/global.js +++ b/resources/assets/js/mixins/global.js @@ -258,8 +258,34 @@ export default { } } //swiper slider for long tabs items + + const slider = document.getElementById('dashboard-slider'); + const scrollLeft = document.getElementById('dashboard-left'); + const scrollRight = document.getElementById('dashboard-right'); + + scrollLeft.addEventListener('click', () => scrollToItem('left')); + scrollRight.addEventListener('click', () => scrollToItem('right')); + + function scrollToItem(direction) { + const visibleItems = Array.from(slider.children); + const sliderRect = slider.getBoundingClientRect(); + + const currentIndex = visibleItems.findIndex(item => { + const itemRect = item.getBoundingClientRect(); + return itemRect.left >= sliderRect.left && itemRect.right <= sliderRect.right; + }); + + const nextIndex = direction === 'right' ? currentIndex + 1 : currentIndex - 1; + if (nextIndex >= 0 && nextIndex < visibleItems.length) { + const nextItem = visibleItems[nextIndex]; + slider.scrollBy({ left: nextItem.getBoundingClientRect().left - sliderRect.left, behavior: 'smooth' }); + } + } + // Dashboard slider }, + + methods: { // Check Default set notify > store / update action checkNotify: function () { diff --git a/resources/views/common/dashboards/show.blade.php b/resources/views/common/dashboards/show.blade.php index 81f5c1023..4d5c09cbe 100644 --- a/resources/views/common/dashboards/show.blade.php +++ b/resources/views/common/dashboards/show.blade.php @@ -106,31 +106,29 @@ @endsection -
-
- - - @foreach ($user_dashboards as $user_dashboard) - - @endforeach - - - - +
+
+ + +
+ @foreach ($user_dashboards as $user_dashboard) + + @endforeach +
+ +
-
+
@can('create-common-widgets') - + \ No newline at end of file From c7049427af4ace896c7d3424d35f97b670cc27f5 Mon Sep 17 00:00:00 2001 From: merve karaman <107546467+mervekaraman@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:15:42 +0300 Subject: [PATCH 2/2] Action buttons style fixed --- resources/views/common/dashboards/show.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/common/dashboards/show.blade.php b/resources/views/common/dashboards/show.blade.php index 4d5c09cbe..235e84fad 100644 --- a/resources/views/common/dashboards/show.blade.php +++ b/resources/views/common/dashboards/show.blade.php @@ -143,7 +143,7 @@ @endcan @can('create-common-dashboards') - + {{ trans('general.title.new', ['type' => trans_choice('general.dashboards', 1)]) }} @endcan