From 819f6587bdafa6c9f6850b7ca2a991fb1842cc92 Mon Sep 17 00:00:00 2001 From: Burak Civan Date: Wed, 9 Nov 2022 17:52:22 +0300 Subject: [PATCH] mobile index actions --- public/akaunting-js/generalAction.js | 17 ++- .../views/components/table/actions.blade.php | 133 ++++++++++++++++++ 2 files changed, 149 insertions(+), 1 deletion(-) diff --git a/public/akaunting-js/generalAction.js b/public/akaunting-js/generalAction.js index cbf0431bc..7a7e06de8 100644 --- a/public/akaunting-js/generalAction.js +++ b/public/akaunting-js/generalAction.js @@ -11,7 +11,7 @@ document.querySelectorAll("[data-table-list]").forEach((row) => { //redirect edit or show page for table row click document.querySelectorAll("[data-table-body]").forEach((table) => { - if (document.body.clientWidth >= 991) { + if (document.body.clientWidth < 768 || document.body.clientWidth > 1200) { let rows = table.querySelectorAll("tr"); rows.forEach((row) => { @@ -27,6 +27,7 @@ document.querySelectorAll("[data-table-body]").forEach((table) => { if (row_href) { for (let i = first_selector; i < td.length - 1; i++) { let td_item = td[i]; + td_item.addEventListener("click", () => { window.location.href = row_href; }); @@ -42,6 +43,20 @@ document.querySelectorAll("[data-table-body]").forEach((table) => { } }); } + + if (document.body.clientWidth <= 768) { + table.querySelectorAll('[data-table-list]').forEach((actions) => { + actions.querySelector('[data-mobile-actions]').addEventListener('click', function() { + this.closest('td').querySelector('[data-mobile-actions-modal]').classList.add('show', 'flex'); + this.closest('td').querySelector('[data-mobile-actions-modal]').classList.remove('hidden'); + + this.closest('td').querySelector('[data-mobile-actions-modal]').addEventListener('click', function() { + this.classList.add('hidden'); + this.classList.remove('show', 'flex'); + }); + }); + }); + } }); //redirect edit or show page for table row click diff --git a/resources/views/components/table/actions.blade.php b/resources/views/components/table/actions.blade.php index 8ce6cd0cf..d2e273600 100644 --- a/resources/views/components/table/actions.blade.php +++ b/resources/views/components/table/actions.blade.php @@ -3,6 +3,138 @@ $more_actions = []; @endphp +@mobile +
+ + arrow_drop_up + +
+ + + +@else @endif +@endmobile