From: Vincent Vanwaelscappel Date: Thu, 16 Nov 2023 14:44:16 +0000 (+0100) Subject: wait #6484 @0:20 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=cd65b2473eb285b1036585942051bfcae29699cb;p=fluidbook-toolbox.git wait #6484 @0:20 --- diff --git a/resources/views/vendor/backpack/crud/inc/datatables_logic.blade.php b/resources/views/vendor/backpack/crud/inc/datatables_logic.blade.php index 4ce7f6f54..2912be81a 100644 --- a/resources/views/vendor/backpack/crud/inc/datatables_logic.blade.php +++ b/resources/views/vendor/backpack/crud/inc/datatables_logic.blade.php @@ -1,13 +1,13 @@ - @php +@php // as it is possible that we can be redirected with persistent table we save the alerts in a variable // and flush them from session, so we will get them later from localStorage. $backpack_alerts = \Alert::getMessages(); \Alert::flush(); - @endphp +@endphp - {{-- DATA TABLES SCRIPT --}} - - +{{-- DATA TABLES SCRIPT --}} + + @@ -30,7 +30,7 @@ var $dtDefaultPageLength = {{ $crud->getDefaultPageLength() }}; let $dtStoredPageLength = localStorage.getItem('DataTables_crudTable_/{{$crud->getRoute()}}_pageLength'); - if(!$dtStoredPageLength && $dtCachedInfo.length !== 0 && $dtCachedInfo.length !== $dtDefaultPageLength) { + if (!$dtStoredPageLength && $dtCachedInfo.length !== 0 && $dtCachedInfo.length !== $dtDefaultPageLength) { localStorage.removeItem('DataTables_crudTable_/{{$crud->getRoute()}}'); } @@ -41,9 +41,9 @@ $newAlerts = @json($backpack_alerts); - Object.entries($newAlerts).forEach(function(type) { - if(typeof $oldAlerts[type[0]] !== 'undefined') { - type[1].forEach(function(msg) { + Object.entries($newAlerts).forEach(function (type) { + if (typeof $oldAlerts[type[0]] !== 'undefined') { + type[1].forEach(function (msg) { $oldAlerts[type[0]].push(msg); }); } else { @@ -97,12 +97,12 @@ @endif if (saved_list_url && persistentUrl != window.location.href) { - // finally redirect the user. + // finally redirect the user. window.location.href = persistentUrl; } @endif - window.crud = { + window.crud = { exportButtons: JSON.parse('{!! json_encode($crud->get('list.export_buttons')) !!}'), functionsToRunOnDataTablesDrawEvent: [], addFunctionToDataTablesDrawEventQueue: function (functionName) { @@ -119,35 +119,36 @@ var arr = str.split('.'); var fn = window[arr[0]]; - for (var i = 1; i < arr.length; i++) - { fn = fn[ arr[i] ]; } + for (var i = 1; i < arr.length; i++) { + fn = fn[arr[i]]; + } fn.apply(window, args); }, - updateUrl : function (url) { - let urlStart = "{{ url($crud->route) }}"; - let urlEnd = url.replace(urlStart, ''); - urlEnd = urlEnd.replace('/search', ''); - let newUrl = urlStart + urlEnd; - let tmpUrl = newUrl.split("?")[0], - params_arr = [], - queryString = (newUrl.indexOf("?") !== -1) ? newUrl.split("?")[1] : false; - - // exclude the persistent-table parameter from url - if (queryString !== false) { - params_arr = queryString.split("&"); - for (let i = params_arr.length - 1; i >= 0; i--) { - let param = params_arr[i].split("=")[0]; - if (param === 'persistent-table') { - params_arr.splice(i, 1); + updateUrl: function (url) { + let urlStart = "{{ url($crud->route) }}"; + let urlEnd = url.replace(urlStart, ''); + urlEnd = urlEnd.replace('/search', ''); + let newUrl = urlStart + urlEnd; + let tmpUrl = newUrl.split("?")[0], + params_arr = [], + queryString = (newUrl.indexOf("?") !== -1) ? newUrl.split("?")[1] : false; + + // exclude the persistent-table parameter from url + if (queryString !== false) { + params_arr = queryString.split("&"); + for (let i = params_arr.length - 1; i >= 0; i--) { + let param = params_arr[i].split("=")[0]; + if (param === 'persistent-table') { + params_arr.splice(i, 1); + } } + newUrl = params_arr.length ? tmpUrl + "?" + params_arr.join("&") : tmpUrl; } - newUrl = params_arr.length ? tmpUrl + "?" + params_arr.join("&") : tmpUrl; - } - window.history.pushState({}, '', newUrl); - localStorage.setItem('{{ Str::slug($crud->getRoute()) }}_list_url', newUrl); + window.history.pushState({}, '', newUrl); + localStorage.setItem('{{ Str::slug($crud->getRoute()) }}_list_url', newUrl); }, dataTableConfiguration: { - bInfo: {{ var_export($crud->getOperationSetting('showEntryCount') ?? true) }}, + bInfo: {{ var_export($crud->getOperationSetting('showEntryCount') ?? true) }}, @if ($crud->getResponsiveTable()) responsive: { details: { @@ -182,7 +183,7 @@ }, } }, - fixedHeader: true, + fixedHeader: true, @else responsive: false, scrollX: true, @@ -227,7 +228,7 @@ @endif @endif autoWidth: false, - pageLength: $dtDefaultPageLength, + pageLength: $dtDefaultPageLength, lengthMenu: @json($crud->getPageLengthMenu()), /* Disable initial sort */ aaSorting: [], @@ -240,7 +241,7 @@ "thousands": "{{ trans('backpack::crud.thousands') }}", "lengthMenu": "{{ trans('backpack::crud.lengthMenu') }}", "loadingRecords": "{{ trans('backpack::crud.loadingRecords') }}", - "processing": "{{ trans(", + "processing": "{{ trans(", "search": "_INPUT_", "searchPlaceholder": "{{ trans('backpack::crud.search') }}...", "zeroRecords": "{{ trans('backpack::crud.zeroRecords') }}", @@ -265,16 +266,16 @@ }, processing: true, serverSide: true, - @if($crud->getOperationSetting('showEntryCount') === false) + @if($crud->getOperationSetting('showEntryCount') === false) pagingType: "simple", - @endif + @endif searching: @json($crud->getOperationSetting('searchableTable') ?? true), ajax: { - "url": "{!! url($crud->route.'/search').'?'.Request::getQueryString() !!}", - "type": "POST", - "data": { - "totalEntryCount": "{{$crud->getOperationSetting('totalEntryCount') ?? false}}" - }, + "url": "{!! url($crud->route.'/search').'?'.Request::getQueryString() !!}", + "type": "POST", + "data": { + "totalEntryCount": "{{$crud->getOperationSetting('totalEntryCount') ?? false}}" + }, }, dom: "<'row hidden'<'col-sm-6'i><'col-sm-6 d-print-none'f>>" + @@ -289,20 +290,20 @@