diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index 86b305b..9a3b51a 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -323,7 +323,7 @@ function lastCrump() echo '
  • - ' . __(ucfirst($routes[count($routes) - 1])) . ' + ' . __(ucfirst($routes[count($routes) - 1])) . '
  • '; return; @@ -337,7 +337,7 @@ function lastCrump() echo '
  • - ' . __(Str::plural(ucfirst($routes[count($routes) - 2]))) . ' + ' . __(Str::plural(ucfirst($routes[count($routes) - 2]))) . '
  • '; } else { @@ -349,7 +349,7 @@ function lastCrump() echo '
  • - ' . __(ucfirst(Str::plural($routes[count($routes) - 2]))) . ' + ' . __(ucfirst(Str::plural($routes[count($routes) - 2]))) . '
  • '; switch ($route) { @@ -386,7 +386,7 @@ function lastCrump() echo '
  • - ' . $title . ' + ' . $title . '
  • '; } diff --git a/resources/js/app.js b/resources/js/app.js index 09a119a..525082b 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -30,6 +30,7 @@ import './panel/setting-section-controller.js'; import './panel/sotable-controller.js'; import './panel/prototypes.js'; import './panel/panel-window-loader.js'; +import './panel/responsive-control.js'; // chartjs.defaults.defaultFontFamily = "Vazir"; // chartjs.defaults.defaultFontSize = 18; diff --git a/resources/js/panel/responsive-control.js b/resources/js/panel/responsive-control.js new file mode 100644 index 0000000..a202b74 --- /dev/null +++ b/resources/js/panel/responsive-control.js @@ -0,0 +1,39 @@ +const responsiveControl = function () { + let vpw = document.querySelector('body').clientWidth; // view port width + + if (document.querySelectorAll('.table-list').length > 0) { + if (vpw > 620) { + document.querySelectorAll('.table-list span.th')?.forEach(function (el) { + el.remove(); + }) + } else { + if (document.querySelectorAll('.table-list span.th')?.length === 0) { + + document.querySelectorAll('.table-list')?.forEach(function (table) { + + console.log(table); + // Get all the header cells + const headers = Array.from(table.querySelectorAll('th')).map(th => th.textContent.trim()); + + // Get all the rows in the table, excluding the header row + const rows = table.querySelectorAll('tr'); + + rows.forEach(function (row) { + const cells = row.querySelectorAll('td'); + + cells.forEach(function (cell, index) { + const headerText = headers[index]; // Get the corresponding header for this cell + if (headerText.trim() != ''){ + cell.innerHTML = ` ${headerText}: ${cell.innerHTML}`; // Update the cell content + } + }); + }); + }); + + + } + } + } +}; +window.addEventListener('resize', responsiveControl); +window.addEventListener('load', responsiveControl) diff --git a/resources/sass/panel/_breadcrumbs.scss b/resources/sass/panel/_breadcrumbs.scss index 8ad5ab8..1e39c5b 100644 --- a/resources/sass/panel/_breadcrumbs.scss +++ b/resources/sass/panel/_breadcrumbs.scss @@ -61,3 +61,28 @@ $pnl-brc-height: 50px; } } + +/*-500px width*/ +@media (max-width: 600px) { + #panel-breadcrumb{ + display: block; + li{ + text-align: end; + } + + span{ + display: none !important; + } + i{ + margin: 0; + display: inline-block; + } + a{ + justify-content: end !important; + padding-right: 0 !important; + padding-left: 0 !important; + } + } + + +} diff --git a/resources/sass/panel/_common.scss b/resources/sass/panel/_common.scss index 558398f..aace9a9 100644 --- a/resources/sass/panel/_common.scss +++ b/resources/sass/panel/_common.scss @@ -338,3 +338,41 @@ a.btn,a.action-btn,a.circle-btn{ .btn-light,a.btn-light{ color: black !important; } +/* -620px width */ +@media (max-width: 620px) { + .table-list { + position: relative; /* Ensure this is the direct container */ + overflow: auto; /* Allow scrolling */ + } + + tr, td, th { + display: block; + width: 100% !important; + text-align: end; + } + td{ + display: flex; + justify-content: space-between; + align-items: center; + } + td:last-child{ + justify-content: center; + } + + div.float-start, div.float-end { + float: none !important; + } + + .dropdown{ + min-width: 75%; + .btn{ + width: 100%; + } + } + + thead { + display: none; + } + + +} diff --git a/resources/views/admin/templates/panel-list-template.blade.php b/resources/views/admin/templates/panel-list-template.blade.php index 2772efa..8eb012d 100644 --- a/resources/views/admin/templates/panel-list-template.blade.php +++ b/resources/views/admin/templates/panel-list-template.blade.php @@ -133,7 +133,6 @@ @endforeach {{-- @yield('table-head')--}} - diff --git a/resources/views/components/panel-breadcrumb.blade.php b/resources/views/components/panel-breadcrumb.blade.php index 4920e5c..74f8d5b 100644 --- a/resources/views/components/panel-breadcrumb.blade.php +++ b/resources/views/components/panel-breadcrumb.blade.php @@ -3,13 +3,17 @@
  • - {{config('app.name')}} + + {{config('app.name')}} +
  • - {{__("Dashboard")}} + + {{__("Dashboard")}} +
  • {{lastCrump()}}