Merge pull request #2743 from brkcvn/mobile-index-actions

Actions development for mobile
This commit is contained in:
Cüneyt Şentürk
2022-11-16 10:11:43 +03:00
committed by GitHub
7 changed files with 319 additions and 122 deletions

View File

@ -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,7 +27,13 @@ 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", () => {
td_item.addEventListener("click", (event) => {
// click disabled when preview dialog is open
if (event.target.closest('[data-tooltip-target]')) {
return;
}
// click disabled when preview dialog is open
window.location.href = row_href;
});
@ -42,6 +48,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');
this.closest('td').querySelector('[data-mobile-actions-modal]').classList.remove('opacity-0', 'invisible');
this.closest('td').querySelector('[data-mobile-actions-modal]').addEventListener('click', function() {
this.classList.add('opacity-0', 'invisible');
this.classList.remove('show');
});
});
});
}
});
//redirect edit or show page for table row click