diff --git a/app/Http/Controllers/Families/MemberController.php b/app/Http/Controllers/Families/MemberController.php index 6be5aae169..117ec260c9 100644 --- a/app/Http/Controllers/Families/MemberController.php +++ b/app/Http/Controllers/Families/MemberController.php @@ -46,7 +46,7 @@ public function index(Campaign $campaign, Family $family) 'entity', 'entity.tags', 'entity.tags.entity', 'entity.image' ]) ->has('entity') - ->paginate(15); + ->paginate(); // Ajax Datagrid if (request()->ajax()) { diff --git a/app/View/Components/Box.php b/app/View/Components/Box.php index 9ae6746987..b9ebb5f1fe 100644 --- a/app/View/Components/Box.php +++ b/app/View/Components/Box.php @@ -8,26 +8,17 @@ class Box extends Component { - public ?string $id; - public ?string $url; - public ?string $href; - public string $css; - public bool $padding; /** * Create a new component instance. */ public function __construct( - string $id = null, - string $url = null, - string $href = null, - string $css = '', - bool $padding = true, + public null|string $id = null, + public null|string $url = null, + public null|string $href = null, + public array $extra = [], + public string $css = '', + public bool $padding = true, ) { - $this->id = $id; - $this->url = $url; - $this->css = $css; - $this->href = $href; - $this->padding = $padding; } /** diff --git a/resources/js/app.js b/resources/js/app.js index db11bb7c18..cc44a49a89 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -324,6 +324,7 @@ import './forms/calendar-date'; import './keep-alive'; import './quick-creator'; import './datagrids'; +import './datagrids2'; import './animations'; import './quick-links'; import './webhooks'; diff --git a/resources/js/components/select2.js b/resources/js/components/select2.js index 90d29ba9a6..f056b18568 100644 --- a/resources/js/components/select2.js +++ b/resources/js/components/select2.js @@ -1,16 +1,15 @@ $(document).ready(function() { window.initForeignSelect = function () { - if ($('select.select2').length === 0) { + const fields = document.querySelectorAll('select.select2'); + if (fields.length === 0) { return; } - $.each($('select.select2'), function (index) { - - if ($(this).hasClass('select2-hidden-accessible')) { + fields.forEach(field => { + if (field.classList.contains('select2-hidden-accessible')) { return; } - if ($(this).hasClass('campaign-genres')) { - - $(this).select2({ + if (field.classList.contains('campaign-genres')) { + $(field).select2({ tags: false, allowClear: true, dropdownParent: '', @@ -20,33 +19,34 @@ $(document).ready(function() { return; } - let url = $(this).data('url'); - let allowClear = $(this).data('allow-clear'); - let dropdownParent = $(this).data('dropdown-parent'); + const url = field.dataset.url; + const allowClear = field.dataset.allowClear; + const dropdownParent = field.dataset.dropdownParent || ''; + const placeholder = field.dataset.placeholder; if (!url) { - $(this).select2({ + $(field).select2({ tags: false, - placeholder: $(this).data('placeholder'), + placeholder: placeholder, allowClear: allowClear ?? false, //tags: $(this).data('tags') || false, - language: $(this).data('language'), + language: field.dataset.language, minimumInputLength: 0, - dropdownParent: dropdownParent || '', + dropdownParent: dropdownParent, width: '100%', }); return; } // Check it isn't the select2-icon - $(this).select2({ + $(field).select2({ tags: false, - placeholder: $(this).data('placeholder'), + placeholder: placeholder, allowClear: allowClear || true, //tags: $(this).data('tags') || false, - language: $(this).data('language'), + language: field.dataset.language, minimumInputLength: 0, - dropdownParent: dropdownParent || '', + dropdownParent: dropdownParent, width: '100%', ajax: { @@ -65,7 +65,7 @@ $(document).ready(function() { }; }, error: function(response) { - console.log('error', response); + //console.log('error', response); if (response.status === 503) { window.showToast(response.responseJSON.message, 'error'); } @@ -73,58 +73,88 @@ $(document).ready(function() { }, cache: true }, - templateResult: function (item) { - let $span = ''; - if (item.image) { - $span = $("" + - "" + - "" + item.text + "" + - ""); - } else { - $span = $("" + item.text + ""); - } - return $span; - }, + templateResult: formatResultList, + templateSelection: formatResult, createTag: function (data) { return null; } }); }); - // Select2 with local search - $('select.select2-local').select2({ - placeholder: $(this).data('placeholder'), - language: $(this).data('language'), + initLocalSelects(); + initColourSelects(); + }; +}); + +const formatResultList = (item) => { + const element = document.createElement('span'); + if (item.image) { + element.classList.add('flex', 'gap-2', 'items-center', 'text-left'); + element.innerHTML = "" + + "" + item.text + ""; + } else { + element.innerHTML = item.text; + } + return element; +}; + +const formatResult = (item) => { + if (!item.id) { + return item.text; + } + const ele = document.createElement('span'); + ele.innerHTML = item.text; + return ele; +}; + +const initLocalSelects = () => { + // Select2 with local search + const fields = document.querySelectorAll('select.select2-local'); + if (fields.length === 0) { + return; + } + fields.forEach(field => { + $(field).select2({ + placeholder: field.dataset.placeholder, + language: field.dataset.language, allowClear: true }); + }); +}; - // Select2 with colour box - $('select.select2-colour').select2({ +const initColourSelects = () => { + // Select2 with local search + const fields = document.querySelectorAll('select.select2-colour'); + if (fields.length === 0) { + return; + } + fields.forEach(field => { + $(field).select2({ + placeholder: field.dataset.placeholder, + language: field.dataset.language, allowClear: false, templateResult: select2ColourState, templateSelection: select2ColourState, }); - } -}); + }); +}; -function select2ColourState (state) { +const select2ColourState = (state) => { if (state.id === 'none') { return state.text; } - let $state = $( + const span = $( '
' + state.text + '
' ); - return $state; -} + return span; +}; // Load the translations into memory -import "select2/dist/js/i18n/ca.js"; import "select2/dist/js/i18n/de.js"; import "select2/dist/js/i18n/en.js"; import "select2/dist/js/i18n/es.js"; import "select2/dist/js/i18n/fr.js"; -import "select2/dist/js/i18n/hu.js"; import "select2/dist/js/i18n/it.js"; import "select2/dist/js/i18n/nl.js"; import "select2/dist/js/i18n/pl.js"; diff --git a/resources/js/crud.js b/resources/js/crud.js index c195cd259a..49637c87da 100644 --- a/resources/js/crud.js +++ b/resources/js/crud.js @@ -91,21 +91,29 @@ const registerDropdownFormActions = () => { */ function registerUnsavedChanges() { // Return early if we have no elements to handle - entityFormActions = document.querySelectorAll('form[data-unload="1"]'); - if (entityFormActions.length === 0) { + const forms = document.querySelectorAll('form[data-unload="1"]'); + if (forms.length === 0) { return; } - let save = document.querySelector('#form-submit-main'); + const save = document.querySelector('#form-submit-main'); // Save every input change - const inputs = document.querySelectorAll('input', 'checkbox', 'select', 'textarea'); + const inputs = document.querySelectorAll('form[data-unload="1"] input, form[data-unload="1"] select, form[data-unload="1"] textarea'); inputs.forEach(input => { - input.addEventListener('change', function (e) { - if (input.dataset.skipUnsaved) { - return; - } + // Skip based on a data property, of it its old bootstrap fields (summernote) + if (input.dataset.skipUnsaved || input.classList.contains('form-control')) { + return; + } + // Standard input fields are simple + input.addEventListener('change', function () { window.entityFormHasUnsavedChanges = true; }); + // For select2 fields, we need to listen to onchange directly, because jquery won't trigger the change event + if (input.classList.contains('select2')) { + input.onchange = () => { + window.entityFormHasUnsavedChanges = true; + }; + } }); if (!save) { diff --git a/resources/js/datagrids.js b/resources/js/datagrids.js index ebcf028d8e..e2714ce124 100644 --- a/resources/js/datagrids.js +++ b/resources/js/datagrids.js @@ -1,247 +1,113 @@ -let datagrid2DeleteConfirm = false; -let datagrid2Form; -let datagrid2Table; - -const datagrid2Observer = new IntersectionObserver(function(entries) { - // isIntersecting is true when element and viewport are overlapping - // isIntersecting is false when element and viewport don't overlap - if(entries[0].isIntersecting === true) { - //console.log('Element has just become visible in screen', entries[0]); - datagrid2Reorder($('.datagrid-onload')); - } - -}, { threshold: [0] }); - - -$(document).ready(function () { - registerBulkDelete(); - registerBulkActions(); - toggleCrudMultiDelete(); - registerDatagrids2(); - treeViewInit(); - - $(document).on('shown.bs.modal', function () { - registerBulkActions(); - initDatagrid2Bulk(); - }); -}); - /** * Register button handeling for bulk actions */ -function registerBulkActions() { - $('[data-bulk-action]').unbind('click').on('click', function() { - setBulkModels($(this).data('bulk-action')); +const registerBulkActions = () => { + const actions = document.querySelectorAll('[data-bulk-action]'); + actions?.forEach(action => { + if (action.dataset.loaded === '1') { + return + } + action.dataset.loaded = '1' + action.addEventListener('click', (e) => { + setBulkModels(action.dataset.bulkAction) + }); }); - $('.bulk-print').unbind('click').on('click', function (e) { - e.preventDefault(); - let form = $(this).closest('form'); - form.find(); - form.submit(); + const prints = document.querySelectorAll('.bulk-print'); + prints?.forEach(print => { + print.addEventListener('click', (e) => { + e.preventDefault(); + const form = print.closest('form'); + form.requestSubmit(); + }); }); -} +}; /** * Register the handler for checking the bulk-delete checkboxes */ -function registerBulkDelete() { - let crudDelete = $('#datagrid-select-all'); - if (crudDelete.length > 0) { - crudDelete.unbind('click').click(function () { - if ($(this).prop('checked')) { - $.each($("input[name='model[]']"), function () { - $(this).prop('checked', true); - }); - } else { - $.each($("input[name='model[]']"), function () { - $(this).prop('checked', false); - }); - } +const registerBulkDelete = () => { + registerDeleteAllToggler(); + + const checkboxes = document.querySelectorAll("input[name='model[]']"); + checkboxes?.forEach(checkbox => { + checkbox.addEventListener('change', (e) => { + e.preventDefault(); toggleCrudMultiDelete(); }); + }); +}; + +const registerDeleteAllToggler = () => { + const field = document.querySelector('#datagrid-select-all'); + if (!field) { + return; } - $.each($("input[name='model[]']"), function () { - $(this).change(function (e) { - toggleCrudMultiDelete(); - e.preventDefault(); - }); + if (field.dataset.loaded === '1') { + return; + } + field.dataset.loaded = '1'; + field.addEventListener('click', function (e) { + const checkboxes = document.querySelectorAll("input[name='model[]']"); + if (field.checked) { + checkboxes?.forEach(checkbox => { + checkbox.checked = true; + }); + } else { + checkboxes?.forEach(checkbox => { + checkbox.checked = false; + }); + } + toggleCrudMultiDelete(); }); -} +}; /** * Set the datagrid bulk models * @param modelField */ -function setBulkModels(modelField) { +const setBulkModels = (modelField) => { let values = []; - $.each($("input[name='model[]']"), function () { - if ($(this).prop('checked')) { - values.push($(this).val()); + const checkboxes = document.querySelectorAll("input[name='model[]']"); + checkboxes?.forEach(element => { + if (element.checked) { + values.push(element.value); } }); if (modelField === 'ajax') { $(document).on('shown.bs.modal', function () { - $('#primary-dialog').find('input[name="models"]').val(values.toString()); + document.querySelector('#primary-dialog input[name="models"]').value = values.toString(); }); } else { - $('#datagrid-bulk-' + modelField + '-models').val(values.toString()); + document.querySelector('#datagrid-bulk-' + modelField + '-models').value = values.toString(); } -} +}; /** * */ -function toggleCrudMultiDelete() -{ +const toggleCrudMultiDelete = () => { let hide = true; - $.each($("input[name='model[]']"), function () { - if ($(this).prop('checked')) { + const checkboxes = document.querySelectorAll("input[name='model[]']"); + checkboxes?.forEach(checkbox => { + if (checkbox.checked) { hide = false; } }); - if (hide) { - $('.datagrid-bulk-actions .btn2').prop('disabled', true).addClass('btn-disabled'); - } else { - $('.datagrid-bulk-actions .btn2').prop('disabled', false).removeClass('btn-disabled').removeClass('disabled'); - } -} - -/** - * - */ -function registerDatagrids2() { - - initDatagrid2Bulk(); - initDatagrid2Ajax(); - initDatagrid2OnLoad(); - toggleCrudMultiDelete(); -} - -function initDatagrid2Bulk() { - // Bulk edit multiple models at the same time - $('.datagrid-bulk').unbind('click').click(function (e) { - e.preventDefault(); - - datagrid2Form = $(this).closest('form'); - - let models = []; - $.each($("input[name='model[]']"), function () { - if ($(this).prop('checked')) { - models.push($(this).val()); - } - }); - //console.log('models', models); - $.ajax({ - url: datagrid2Form.attr('action') + '?action=edit', - method: 'POST', - data: {model: models} - }).done(function (response) { - let target = document.getElementById('primary-dialog'); - target.innerHTML = response; - window.openDialog('primary-dialog'); - $(document).trigger('shown.bs.modal'); // Get tooltips, select2 and delete-confirmation to re-generate - }); - }); - - // Other bulk actions - $('.datagrid-submit').click(function (e) { - e.preventDefault(); - - datagrid2Form = $(this).closest('form'); - - let action = datagrid2Form.find('input[name="action"]'); - action.val($(this).data('action')); - - if ($(this).data('action') === 'delete') { - if (datagrid2DeleteConfirm === false) { - window.openDialog('datagrid-bulk-delete'); - return false; - } - } - - // Disable the whole dropdown and replace it with a spinning wheel - $('.datagrid-bulk-actions').hide(); - $('.datagrid-spinner').show(); - datagrid2Form.submit(); - }); - - $('#datagrid-action-confirm').click(function () { - window.closeDialog('datagrid-bulk-delete'); - datagrid2Form.submit(); - }); -} - -/** - * - */ -function initDatagrid2Ajax() { - $.each($('table[data-render="datagrid2"]'), function () { - datagrid2Table = $(this); - $(this).find('thead a').click(function (e) { - e.preventDefault(); - datagrid2Reorder($(this)); - }); - $(this).closest('#datagrid-parent').find('nav[role="navigation"] a').click(function (e) { - e.preventDefault(); - datagrid2Reorder($(this)); - }); - }); - registerBulkDelete(); - registerBulkActions(); - initDatagrid2Bulk(); -} - -/** - * - */ -function initDatagrid2OnLoad() { - if ($('.datagrid-onload').length == 0) { - return; - } - datagrid2Observer.observe(document.querySelector('.datagrid-onload')); -} - -/** - * - * @param ele - */ -function datagrid2Reorder(ele) { - datagrid2Table.find('thead').hide(); - datagrid2Table.find('tbody').hide(); - datagrid2Table.find('tfoot').show(); - - let url = ele.attr('href'); - let dataUrl = ele.data('url'); - if (url === '#' && dataUrl) { - url = dataUrl; - } - - let target = ele.data('target') ?? '#datagrid-parent'; - //console.log('url', url, ele); - $.ajax( - url - ).done(function (res) { - //console.log('res', res); - if (res.html) { - $(target).html(res.html); - } - if (res.deletes) { - $('#datagrid-delete-forms').html(res.deletes); + const btn = document.querySelectorAll('.datagrid-bulk-actions .btn2'); + btn?.forEach(btn => { + if (hide) { + btn.disabled = true; + btn.classList.add('btn-disabled'); + } else { + btn.disabled = false; + btn.classList.remove('btn-disabled', 'disabled'); } - if (res.url) { - window.history.pushState({}, "", res.url); - } - initDatagrid2Ajax(); - $(document).trigger('shown.bs.modal'); // Get tooltips to re-generate - }).fail(function (err) { - console.error('datagrid2', err); - datagrid2Table.find('tfoot').addClass('bg-danger'); }); -} +}; /** * Go through table trs to add on click support @@ -271,3 +137,13 @@ const treeViewInit = () => { } }); }; + + +registerBulkDelete(); +registerBulkActions(); +toggleCrudMultiDelete(); +treeViewInit(); + +$(document).on('shown.bs.modal', function () { + registerBulkActions(); +}); diff --git a/resources/js/datagrids2.js b/resources/js/datagrids2.js new file mode 100644 index 0000000000..eb96566476 --- /dev/null +++ b/resources/js/datagrids2.js @@ -0,0 +1,190 @@ +let datagrid2DeleteConfirm = false; +let form; + +const datagridObserver = new IntersectionObserver(function(entries) { + entries.forEach(entry => { + if (entry.isIntersecting === true) { + initDatagrid(entry.target); + } + }); +}, { threshold: [0] }); + +const initDatagrids = () => { + const datagrids = document.querySelectorAll('table[data-render="datagrid2"]'); + datagrids?.forEach(datagrid => { + initDatagrid(datagrid); + }); +}; + +const initDatagrid = (datagrid) => { + if (datagrid.dataset.initiated === '1') { + return; + } + datagrid.dataset.initiayed = '1'; + registerHeaders(datagrid); + registerBulk(datagrid); + if (datagrid.dataset.url) { + loadDatagrid(datagrid, datagrid); + } +}; + +const registerHeaders = (datagrid) => { + datagrid.querySelectorAll('thead a')?.forEach(ele => { + if (ele.dataset.loaded === '1') { + return; + } + ele.dataset.loaded = '1'; + ele.addEventListener('click', function (e) { + e.preventDefault(); + loadDatagrid(ele, datagrid); + }); + }); + // Pagination + datagrid.parentNode + .querySelectorAll('nav[role="navigation"] a') + ?.forEach(ele => { + if (ele.dataset.loaded === '1') { + return; + } + ele.dataset.loaded = '1'; + ele.addEventListener('click', (e) => { + e.preventDefault(); + loadDatagrid(ele, datagrid); + }); + }); +}; + + +/** + * + */ +const initOnloadDatagrids = () => { + const datagrids = document.querySelectorAll('[data-render="datagrid2-onload"]'); + if (datagrids.length === 0) { + return; + } + datagrids.forEach(datagrid => { + datagridObserver.observe(datagrid); + }); +}; + +/** + * When a datagrid header is clicked, reorder it + */ +const loadDatagrid = (element, datagrid) => { + datagrid.querySelector('thead')?.classList.add('hidden'); + datagrid.querySelector('tbody')?.classList.add('hidden'); + datagrid.querySelector('tfoot')?.classList.remove('hidden'); + + let url = element.getAttribute('href'); + if (element.dataset.url) { + url = element.dataset.url; + } + + // It's sometimes possible to have no parent node when the datagrid is already removed from the dom + // but some user action is still referencing it. + if (!datagrid.parentNode) { + return; + } + + + axios.get(url) + .then(res => { + const target = datagrid.parentNode; + if (res.data.html) { + target.innerHTML = res.data.html; + } + if (res.data.deletes) { + document.querySelector('#datagrid-delete-forms').innerHTML = res.data.deletes; + } + if (res.data.url) { + window.history.pushState({}, "", res.data.url); + } + const newDatagrid = target.querySelector('[data-render="datagrid2"]'); + initDatagrid(newDatagrid); + $(document).trigger('shown.bs.modal'); // Get tooltips to re-generate + }) + .catch(err => { + console.error('datagrid2 error', datagrid, datagrid.parentNode); + //datagrid.querySelector('tfoot')?.classList.add('bg-danger'); + }); +}; + +const registerBulk = (datagrid) => { + // Bulk edit multiple models at the same time + const parent = datagrid.parentNode; + const bulks = parent.querySelectorAll('.datagrid-bulk'); + bulks?.forEach(bulk => { + registerBulkClick(datagrid, bulk); + }); + + // Other bulk actions + const submits = parent.querySelectorAll('.datagrid-submit'); + submits?.forEach(submit => { + submit.addEventListener('click', function (e) { + e.preventDefault(); + form = submit.closest('form'); + + const action = form.querySelector('input[name="action"]'); + action.value = submit.dataset.action; + + if (submit.dataset.action === 'delete') { + if (datagrid2DeleteConfirm === false) { + window.openDialog('datagrid-bulk-delete'); + return false; + } + } + + // Disable the whole dropdown and replace it with a spinning wheel + datagrid.querySelectorAll('.datagrid-bulk-actions')?.forEach(ele => ele.classList.add('hidden')); + datagrid.querySelector('.datagrid-spinner').classList.remove('hidden'); + form.submit(); + }); + }); + + document.querySelector('#datagrid-action-confirm')?.addEventListener('click', function () { + window.closeDialog('datagrid-bulk-delete'); + form.submit(); + }); +}; + +const registerBulkClick = (datagrid, element) => { + if (element.dataset.loaded === '1') { + return; + } + element.dataset.loaded = '1'; + element.addEventListener('click', function (e) { + e.preventDefault(); + form = datagrid.closest('form'); + + //console.log('models', models); + axios.post( + form.getAttribute('action') + '?action=edit', + {model: checkedModels(datagrid)} + ) + .done(res => { + const target = document.getElementById('primary-dialog'); + target.innerHTML = res.data; + window.openDialog('primary-dialog'); + $(document).trigger('shown.bs.modal'); // Get tooltips, select2 and delete-confirmation to re-generate + }); + }); +}; + +const checkedModels = (datagrid) => { + let models = []; + const checkboxes = datagrid.querySelectorAll("input[name='model[]']"); + checkboxes?.forEach(element => { + if (element.checked) { + models.push(element.value); + } + }); + return models; +}; + +initOnloadDatagrids(); +initDatagrids(); + +$(document).on('shown.bs.modal', function () { + initDatagrids(); +}); diff --git a/resources/views/campaigns/members/index.blade.php b/resources/views/campaigns/members/index.blade.php index 7e65e30051..89f2125ef4 100644 --- a/resources/views/campaigns/members/index.blade.php +++ b/resources/views/campaigns/members/index.blade.php @@ -30,13 +30,13 @@ @endif @if(Datagrid::hasBulks()) -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@else -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@endif diff --git a/resources/views/campaigns/plugins/index.blade.php b/resources/views/campaigns/plugins/index.blade.php index 17f5465d42..d06d40fe9d 100644 --- a/resources/views/campaigns/plugins/index.blade.php +++ b/resources/views/campaigns/plugins/index.blade.php @@ -13,13 +13,13 @@ @if($campaign->boosted()) @if(Datagrid::hasBulks()) -
- @include('layouts.datagrid._table', ['empty' => __('campaigns/plugins.empty_list'), 'responsive' => true]) +
+ @include('layouts.datagrid._table', ['empty' => __('campaigns/plugins.empty_list')])
@else -
- @include('layouts.datagrid._table', ['empty' => __('campaigns/plugins.empty_list'), 'responsive' => true]) +
+ @include('layouts.datagrid._table', ['empty' => __('campaigns/plugins.empty_list')])
@endif @else diff --git a/resources/views/campaigns/recovery/index.blade.php b/resources/views/campaigns/recovery/index.blade.php index 4f3bba2d98..13697aa79a 100644 --- a/resources/views/campaigns/recovery/index.blade.php +++ b/resources/views/campaigns/recovery/index.blade.php @@ -44,12 +44,12 @@ @if(Datagrid::hasBulks()) -
+
@include('layouts.datagrid._table')
@else -
+
@include('layouts.datagrid._table')
@endif diff --git a/resources/views/campaigns/roles/create.blade.php b/resources/views/campaigns/roles/create.blade.php index 1ee3875b28..33bbb80781 100644 --- a/resources/views/campaigns/roles/create.blade.php +++ b/resources/views/campaigns/roles/create.blade.php @@ -17,6 +17,7 @@ 'content' => 'campaigns.roles._form', 'save' => __('campaigns.roles.actions.add'), 'dialog' => true, + 'model' => null, ]) diff --git a/resources/views/campaigns/roles/index.blade.php b/resources/views/campaigns/roles/index.blade.php index 8412ca3ced..1075fc7cec 100644 --- a/resources/views/campaigns/roles/index.blade.php +++ b/resources/views/campaigns/roles/index.blade.php @@ -23,13 +23,13 @@ */?> @if(Datagrid::hasBulks()) -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@else -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@endif diff --git a/resources/views/campaigns/styles/index.blade.php b/resources/views/campaigns/styles/index.blade.php index d9974c7987..6df98291e0 100644 --- a/resources/views/campaigns/styles/index.blade.php +++ b/resources/views/campaigns/styles/index.blade.php @@ -47,12 +47,12 @@ @else @if(Datagrid::hasBulks()) -
+
@include('layouts.datagrid._table', ['rows' => $styles])
@else -
+
@include('layouts.datagrid._table', ['rows' => $styles])
@endif diff --git a/resources/views/campaigns/webhooks/index.blade.php b/resources/views/campaigns/webhooks/index.blade.php index b29d3ed9e1..5c21f55868 100644 --- a/resources/views/campaigns/webhooks/index.blade.php +++ b/resources/views/campaigns/webhooks/index.blade.php @@ -28,13 +28,13 @@ */?> @if(Datagrid::hasBulks()) -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@else -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@endif @endif diff --git a/resources/views/components/box.blade.php b/resources/views/components/box.blade.php index 7540e8ef8c..1f663cdbb3 100644 --- a/resources/views/components/box.blade.php +++ b/resources/views/components/box.blade.php @@ -1,6 +1,8 @@ -
$v) data-{{ $k }}="{{ $v }}" @endforeach > {!! $slot !!}
diff --git a/resources/views/cruds/fields/image.blade.php b/resources/views/cruds/fields/image.blade.php index 6ce5ce1fc9..7f7b745961 100644 --- a/resources/views/cruds/fields/image.blade.php +++ b/resources/views/cruds/fields/image.blade.php @@ -32,7 +32,7 @@ } ?> -
+
diff --git a/resources/views/entities/pages/print/_abilities.blade.php b/resources/views/entities/pages/print/_abilities.blade.php index 49807b4bd0..280253cf9f 100644 --- a/resources/views/entities/pages/print/_abilities.blade.php +++ b/resources/views/entities/pages/print/_abilities.blade.php @@ -1,11 +1,11 @@ @inject('abilities', 'App\Services\Abilities\AbilityService') -@php $entityAbilities = $abilities->campaign($campaign)->entity($entity)->abilities() @endphp +@php $entityAbilities = $abilities->campaign($campaign)->entity($entity)->get() @endphp @endforeach - - @foreach ($entityAbilities['abilities'] as $ability) -
-

- {{ $ability['name'] }} - @if ($ability['type']) - {{ $ability['type'] }}@endif -

- - - {!! $ability['entry'] !!} - - @if ($ability['note']) - {!! $ability['note'] !!} - @endif - - @if(!empty($ability['charges'])) -
- @for ($i = 1; $i <= $ability['charges']; $i++) - @if ($i <= $ability['used_charges']) - [ x ] - @else - [   ] - @endif - @endfor -
- @endif -
-
- @endforeach
diff --git a/resources/views/layouts/datagrid/_table.blade.php b/resources/views/layouts/datagrid/_table.blade.php index da79ab2503..a4d0700baf 100644 --- a/resources/views/layouts/datagrid/_table.blade.php +++ b/resources/views/layouts/datagrid/_table.blade.php @@ -1,13 +1,12 @@ @if (!empty($datagridUrl)) - -
- -
+
+ + + @endif -@if (isset($responsive))
@endif - +
@foreach (Datagrid::headers() as $header) @@ -33,7 +32,7 @@ @endforelse - +
-@if (isset($responsive))
@endif @if ($rows->hasPages() || Datagrid::hasBulks() )
@includeWhen(Datagrid::hasBulks(), 'layouts.datagrid.bulks') diff --git a/resources/views/maps/panels/groups.blade.php b/resources/views/maps/panels/groups.blade.php index 36cb0f0972..0149f2485c 100644 --- a/resources/views/maps/panels/groups.blade.php +++ b/resources/views/maps/panels/groups.blade.php @@ -11,13 +11,13 @@
@if(Datagrid::hasBulks()) -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@else -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@endif
diff --git a/resources/views/maps/panels/layers.blade.php b/resources/views/maps/panels/layers.blade.php index 3342cac277..3fe1725edb 100644 --- a/resources/views/maps/panels/layers.blade.php +++ b/resources/views/maps/panels/layers.blade.php @@ -11,13 +11,13 @@
@if(Datagrid::hasBulks()) -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@else -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@endif diff --git a/resources/views/maps/panels/markers.blade.php b/resources/views/maps/panels/markers.blade.php index ac6f073ac5..c7bb8d7635 100644 --- a/resources/views/maps/panels/markers.blade.php +++ b/resources/views/maps/panels/markers.blade.php @@ -5,13 +5,13 @@
@if(Datagrid::hasBulks()) -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@else -
- @include('layouts.datagrid._table', ['responsive' => true]) +
+ @include('layouts.datagrid._table')
@endif
diff --git a/resources/views/organisations/panels/members.blade.php b/resources/views/organisations/panels/members.blade.php index 40737cbfd3..2821f47a7a 100644 --- a/resources/views/organisations/panels/members.blade.php +++ b/resources/views/organisations/panels/members.blade.php @@ -6,7 +6,7 @@ $datagridOptions = [ $campaign, $model, - 'init' => 1 + 'init' => 1, ]; if (request()->has('all')) { $datagridOptions['all'] = 1; diff --git a/resources/views/timelines/panels/eras.blade.php b/resources/views/timelines/panels/eras.blade.php index 671bf3aa6c..17ce49c34f 100644 --- a/resources/views/timelines/panels/eras.blade.php +++ b/resources/views/timelines/panels/eras.blade.php @@ -1,12 +1,12 @@
@if(Datagrid::hasBulks()) -
+
@include('layouts.datagrid._table')
@else -
+
@include('layouts.datagrid._table')
@endif