diff --git a/src/Traits/Helpers/ColumnHelpers.php b/src/Traits/Helpers/ColumnHelpers.php index beb4e2439..97eb7a29b 100644 --- a/src/Traits/Helpers/ColumnHelpers.php +++ b/src/Traits/Helpers/ColumnHelpers.php @@ -27,6 +27,13 @@ protected function setupColumns(): void ->setHasTableRowUrl($this->hasTableRowUrl()) ->setIsReorderColumn($this->getDefaultReorderColumn() == $column->getField()); + if ($column->hasFooter()) { + $this->columnsWithFooter = true; + } + if ($column->hasSecondaryHeader()) { + $this->columnsWithSecondaryHeader = true; + } + if ($column instanceof AggregateColumn) { if ($column->getAggregateMethod() == 'count' && $column->hasDataSource()) { $this->addExtraWithCount($column->getDataSource()); diff --git a/src/Traits/WithFooter.php b/src/Traits/WithFooter.php index 44b9f7dc0..781d80511 100644 --- a/src/Traits/WithFooter.php +++ b/src/Traits/WithFooter.php @@ -18,18 +18,4 @@ trait WithFooter protected bool $useHeaderAsFooterStatus = false; protected bool $columnsWithFooter = false; - - public function setupFooter(): void - { - foreach ($this->getColumns() as $column) { - if ($column->hasFooter()) { - $this->columnsWithFooter = true; - } - } - } - - public function renderingWithFooter(): void - { - $this->setupFooter(); - } } diff --git a/src/Traits/WithSecondaryHeader.php b/src/Traits/WithSecondaryHeader.php index 11b08d51a..e093bd4da 100644 --- a/src/Traits/WithSecondaryHeader.php +++ b/src/Traits/WithSecondaryHeader.php @@ -15,18 +15,4 @@ trait WithSecondaryHeader protected bool $secondaryHeaderStatus = true; protected bool $columnsWithSecondaryHeader = false; - - public function bootedWithSecondaryHeader(): void - { - $this->setupSecondaryHeader(); - } - - public function setupSecondaryHeader(): void - { - foreach ($this->getColumns() as $column) { - if ($column->hasSecondaryHeader()) { - $this->columnsWithSecondaryHeader = true; - } - } - } } diff --git a/tests/DataTableComponentTest.php b/tests/DataTableComponentTest.php index 62a1e46ec..15831df4e 100644 --- a/tests/DataTableComponentTest.php +++ b/tests/DataTableComponentTest.php @@ -73,7 +73,6 @@ public function test_minimum_one_column_expected(): void $table->bootedComponentUtilities(); $table->bootedWithColumns(); $table->bootedWithColumnSelect(); - $table->bootedWithSecondaryHeader(); $table->booted(); $table->renderingWithPagination($view, []); $table->render(); diff --git a/tests/TestCase.php b/tests/TestCase.php index 70cc035de..f80c08875 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -102,13 +102,11 @@ protected function setupBasicTable() $this->basicTable->bootedComponentUtilities(); $this->basicTable->bootedWithColumns(); $this->basicTable->bootedWithColumnSelect(); - $this->basicTable->bootedWithSecondaryHeader(); $this->basicTable->booted(); $this->basicTable->renderingWithColumns($view, $view->getData()); $this->basicTable->renderingWithColumnSelect($view, $view->getData()); $this->basicTable->renderingWithCustomisations($view, $view->getData()); $this->basicTable->renderingWithData($view, $view->getData()); - $this->basicTable->renderingWithFooter($view, $view->getData()); $this->basicTable->renderingWithReordering($view, $view->getData()); $this->basicTable->renderingWithPagination($view, $view->getData()); $this->basicTable->render(); @@ -124,13 +122,11 @@ protected function setupEventsTable() $this->eventsTable->bootedManagesFilters(); $this->eventsTable->bootedWithColumns(); $this->eventsTable->bootedWithColumnSelect(); - $this->eventsTable->bootedWithSecondaryHeader(); $this->eventsTable->booted(); $this->eventsTable->renderingWithColumns($view, $view->getData()); $this->eventsTable->renderingWithColumnSelect($view, $view->getData()); $this->eventsTable->renderingWithCustomisations($view, $view->getData()); $this->eventsTable->renderingWithData($view, $view->getData()); - $this->eventsTable->renderingWithFooter($view, $view->getData()); $this->eventsTable->renderingWithReordering($view, $view->getData()); $this->eventsTable->renderingWithPagination($view, $view->getData()); @@ -147,13 +143,11 @@ protected function setupBreedsTable() $this->breedsTable->bootedManagesFilters(); $this->breedsTable->bootedWithColumns(); $this->breedsTable->bootedWithColumnSelect(); - $this->breedsTable->bootedWithSecondaryHeader(); $this->breedsTable->booted(); $this->breedsTable->renderingWithColumns($view, $view->getData()); $this->breedsTable->renderingWithColumnSelect($view, $view->getData()); $this->breedsTable->renderingWithCustomisations($view, $view->getData()); $this->breedsTable->renderingWithData($view, $view->getData()); - $this->breedsTable->renderingWithFooter($view, $view->getData()); $this->breedsTable->renderingWithReordering($view, $view->getData()); $this->breedsTable->renderingWithPagination($view, $view->getData()); $this->breedsTable->render(); @@ -169,13 +163,11 @@ protected function setupPetOwnerTable() $this->petOwnerTable->bootedManagesFilters(); $this->petOwnerTable->bootedWithColumns(); $this->petOwnerTable->bootedWithColumnSelect(); - $this->petOwnerTable->bootedWithSecondaryHeader(); $this->petOwnerTable->booted(); $this->petOwnerTable->renderingWithColumns($view, $view->getData()); $this->petOwnerTable->renderingWithColumnSelect($view, $view->getData()); $this->petOwnerTable->renderingWithCustomisations($view, $view->getData()); $this->petOwnerTable->renderingWithData($view, $view->getData()); - $this->petOwnerTable->renderingWithFooter($view, $view->getData()); $this->petOwnerTable->renderingWithReordering($view, $view->getData()); $this->petOwnerTable->renderingWithPagination($view, $view->getData()); $this->petOwnerTable->render(); @@ -191,13 +183,11 @@ protected function setupSpeciesTable() $this->speciesTable->bootedManagesFilters(); $this->speciesTable->bootedWithColumns(); $this->speciesTable->bootedWithColumnSelect(); - $this->speciesTable->bootedWithSecondaryHeader(); $this->speciesTable->booted(); $this->speciesTable->renderingWithColumns($view, $view->getData()); $this->speciesTable->renderingWithColumnSelect($view, $view->getData()); $this->speciesTable->renderingWithCustomisations($view, $view->getData()); $this->speciesTable->renderingWithData($view, $view->getData()); - $this->speciesTable->renderingWithFooter($view, $view->getData()); $this->speciesTable->renderingWithReordering($view, $view->getData()); $this->speciesTable->renderingWithPagination($view, $view->getData()); $this->speciesTable->render(); @@ -214,13 +204,11 @@ protected function setupUnpaginatedTable() $this->unpaginatedTable->bootedManagesFilters(); $this->unpaginatedTable->bootedWithColumns(); $this->unpaginatedTable->bootedWithColumnSelect(); - $this->unpaginatedTable->bootedWithSecondaryHeader(); $this->unpaginatedTable->booted(); $this->unpaginatedTable->renderingWithColumns($view, $view->getData()); $this->unpaginatedTable->renderingWithColumnSelect($view, $view->getData()); $this->unpaginatedTable->renderingWithCustomisations($view, $view->getData()); $this->unpaginatedTable->renderingWithData($view, $view->getData()); - $this->unpaginatedTable->renderingWithFooter($view, $view->getData()); $this->unpaginatedTable->renderingWithReordering($view, $view->getData()); $this->unpaginatedTable->renderingWithPagination($view, $view->getData()); $this->unpaginatedTable->render(); diff --git a/tests/Unit/Traits/Configuration/SortingConfigurationTest.php b/tests/Unit/Traits/Configuration/SortingConfigurationTest.php index 4e5847aae..9bbe071b4 100644 --- a/tests/Unit/Traits/Configuration/SortingConfigurationTest.php +++ b/tests/Unit/Traits/Configuration/SortingConfigurationTest.php @@ -112,7 +112,6 @@ public function configure(): void $tempDesc->bootedManagesFilters(); $tempDesc->bootedWithColumns(); $tempDesc->bootedWithColumnSelect(); - $tempDesc->bootedWithSecondaryHeader(); $tempDesc->booted(); $tempDesc->mountManagesFilters(); $tempDesc->mountWithSorting(); @@ -120,7 +119,6 @@ public function configure(): void $tempDesc->renderingWithColumnSelect($viewDesc, $viewDesc->getData()); $tempDesc->renderingWithCustomisations($viewDesc, $viewDesc->getData()); $tempDesc->renderingWithData($viewDesc, $viewDesc->getData()); - $tempDesc->renderingWithFooter($viewDesc, $viewDesc->getData()); $tempDesc->renderingWithReordering($viewDesc, $viewDesc->getData()); $tempDesc->renderingWithPagination($viewDesc, $viewDesc->getData()); $tempDesc->render(); @@ -142,7 +140,6 @@ public function configure(): void $tempAsc->bootedManagesFilters(); $tempAsc->bootedWithColumns(); $tempAsc->bootedWithColumnSelect(); - $tempAsc->bootedWithSecondaryHeader(); $tempAsc->booted(); $tempAsc->mountManagesFilters(); $tempAsc->mountWithSorting(); @@ -150,7 +147,6 @@ public function configure(): void $tempAsc->renderingWithColumnSelect($viewAsc, $viewAsc->getData()); $tempAsc->renderingWithCustomisations($viewAsc, $viewAsc->getData()); $tempAsc->renderingWithData($viewAsc, $viewAsc->getData()); - $tempAsc->renderingWithFooter($viewAsc, $viewAsc->getData()); $tempAsc->renderingWithReordering($viewAsc, $viewAsc->getData()); $tempAsc->renderingWithPagination($viewAsc, $viewAsc->getData()); $tempAsc->render(); diff --git a/tests/Unit/Traits/Helpers/ColumnHelpersTest.php b/tests/Unit/Traits/Helpers/ColumnHelpersTest.php index f7f6eb55b..e1e2fd5e6 100644 --- a/tests/Unit/Traits/Helpers/ColumnHelpersTest.php +++ b/tests/Unit/Traits/Helpers/ColumnHelpersTest.php @@ -199,7 +199,6 @@ public function columns(): array $testTable->bootedManagesFilters(); $testTable->bootedWithColumns(); $testTable->bootedWithColumnSelect(); - $testTable->bootedWithSecondaryHeader(); $testTable->booted(); } diff --git a/tests/Unit/Traits/Helpers/ColumnSelectHelpersTest.php b/tests/Unit/Traits/Helpers/ColumnSelectHelpersTest.php index 05ea4cdc9..581dce5f2 100644 --- a/tests/Unit/Traits/Helpers/ColumnSelectHelpersTest.php +++ b/tests/Unit/Traits/Helpers/ColumnSelectHelpersTest.php @@ -125,7 +125,6 @@ public function configure(): void $testTable->bootedComponentUtilities(); $testTable->bootedWithColumns(); $testTable->bootedWithColumnSelect(); - $testTable->bootedWithSecondaryHeader(); $testTable->booted(); $this->assertSame(['id', 'sort', 'name', 'age', 'breed', 'other', 'link', 'rowimg'], $testTable->selectedColumns); @@ -164,7 +163,6 @@ public function configure(): void $testTable->bootedManagesFilters(); $testTable->bootedWithColumns(); $testTable->bootedWithColumnSelect(); - $testTable->bootedWithSecondaryHeader(); $testTable->booted(); $this->assertSame(['id', 'sort', 'name', 'age', 'breed', 'other', 'link', 'rowimg'], $testTable->selectedColumns); @@ -195,7 +193,6 @@ public function configure(): void $testTable->bootedComponentUtilities(); $testTable->bootedWithColumns(); $testTable->bootedWithColumnSelect(); - $testTable->bootedWithSecondaryHeader(); $testTable->booted(); $this->assertSame(['id', 'sort', 'name', 'age', 'breed', 'other', 'link', 'rowimg'], $testTable->selectedColumns); diff --git a/tests/Unit/Traits/Helpers/FilterHelpersTest.php b/tests/Unit/Traits/Helpers/FilterHelpersTest.php index 85c07c072..907624d30 100644 --- a/tests/Unit/Traits/Helpers/FilterHelpersTest.php +++ b/tests/Unit/Traits/Helpers/FilterHelpersTest.php @@ -232,7 +232,6 @@ public function configure(): void $testTable->bootedComponentUtilities(); $testTable->bootedWithColumns(); $testTable->bootedWithColumnSelect(); - $testTable->bootedWithSecondaryHeader(); $testTable->booted(); $testTable->setFilter('breed_id_filter', '2'); diff --git a/tests/Unit/Traits/Helpers/QueryStringHelpersTest.php b/tests/Unit/Traits/Helpers/QueryStringHelpersTest.php index f98e6f6df..884094bac 100644 --- a/tests/Unit/Traits/Helpers/QueryStringHelpersTest.php +++ b/tests/Unit/Traits/Helpers/QueryStringHelpersTest.php @@ -31,7 +31,6 @@ public function getCurrentQueryStringBinding(): array $testTableQueryString->bootedManagesFilters(); $testTableQueryString->bootedWithColumns(); $testTableQueryString->bootedWithColumnSelect(); - $testTableQueryString->bootedWithSecondaryHeader(); $testTableQueryString->booted(); $this->assertSame([], $testTableQueryString->getCurrentQueryStringBinding()); @@ -62,7 +61,6 @@ public function getCurrentQueryStringBinding(): array $testTableQueryString->bootedManagesFilters(); $testTableQueryString->bootedWithColumns(); $testTableQueryString->bootedWithColumnSelect(); - $testTableQueryString->bootedWithSecondaryHeader(); $testTableQueryString->booted(); $this->assertSame(['table' => ['except' => null, 'history' => false, 'keep' => false, 'as' => 'table']], $testTableQueryString->getCurrentQueryStringBinding()); @@ -93,7 +91,6 @@ public function getCurrentQueryStringBinding(): array $testTableQueryString->bootedManagesFilters(); $testTableQueryString->bootedWithColumns(); $testTableQueryString->bootedWithColumnSelect(); - $testTableQueryString->bootedWithSecondaryHeader(); $testTableQueryString->booted(); $this->assertFalse($testTableQueryString->hasQueryStringAlias()); diff --git a/tests/Unit/Traits/WithColumnsTest.php b/tests/Unit/Traits/WithColumnsTest.php index c258f92cf..14de629cd 100644 --- a/tests/Unit/Traits/WithColumnsTest.php +++ b/tests/Unit/Traits/WithColumnsTest.php @@ -28,13 +28,11 @@ public function configure(): void $testTableDefault->bootedManagesFilters(); $testTableDefault->bootedWithColumns(); $testTableDefault->bootedWithColumnSelect(); - $testTableDefault->bootedWithSecondaryHeader(); $testTableDefault->booted(); $testTableDefault->renderingWithColumns($view, $view->getData()); $testTableDefault->renderingWithColumnSelect($view, $view->getData()); $testTableDefault->renderingWithCustomisations($view, $view->getData()); $testTableDefault->renderingWithData($view, $view->getData()); - $testTableDefault->renderingWithFooter($view, $view->getData()); $testTableDefault->renderingWithReordering($view, $view->getData()); $testTableDefault->renderingWithPagination($view, $view->getData()); $testTableDefault->render(); diff --git a/tests/Unit/Traits/WithCustomisationsTest.php b/tests/Unit/Traits/WithCustomisationsTest.php index ede4b6584..036840a01 100644 --- a/tests/Unit/Traits/WithCustomisationsTest.php +++ b/tests/Unit/Traits/WithCustomisationsTest.php @@ -28,13 +28,11 @@ public function configure(): void $temp->bootedManagesFilters(); $temp->bootedWithColumns(); $temp->bootedWithColumnSelect(); - $temp->bootedWithSecondaryHeader(); $temp->booted(); $temp->renderingWithColumns($view, $view->getData()); $temp->renderingWithColumnSelect($view, $view->getData()); $temp->renderingWithCustomisations($view, $view->getData()); $temp->renderingWithData($view, $view->getData()); - $temp->renderingWithFooter($view, $view->getData()); $temp->renderingWithReordering($view, $view->getData()); $temp->renderingWithPagination($view, $view->getData()); $temp->render(); @@ -63,13 +61,11 @@ public function configure(): void $temp->bootedManagesFilters(); $temp->bootedWithColumns(); $temp->bootedWithColumnSelect(); - $temp->bootedWithSecondaryHeader(); $temp->booted(); $temp->renderingWithColumns($view, $view->getData()); $temp->renderingWithColumnSelect($view, $view->getData()); $temp->renderingWithCustomisations($view, $view->getData()); $temp->renderingWithData($view, $view->getData()); - $temp->renderingWithFooter($view, $view->getData()); $temp->renderingWithReordering($view, $view->getData()); $temp->renderingWithPagination($view, $view->getData()); $temp->render(); @@ -98,13 +94,11 @@ public function configure(): void $temp->bootedManagesFilters(); $temp->bootedWithColumns(); $temp->bootedWithColumnSelect(); - $temp->bootedWithSecondaryHeader(); $temp->booted(); $temp->renderingWithColumns($view, $view->getData()); $temp->renderingWithColumnSelect($view, $view->getData()); $temp->renderingWithCustomisations($view, $view->getData()); $temp->renderingWithData($view, $view->getData()); - $temp->renderingWithFooter($view, $view->getData()); $temp->renderingWithReordering($view, $view->getData()); $temp->renderingWithPagination($view, $view->getData()); $temp->render(); @@ -131,13 +125,11 @@ public function configure(): void $temp->bootedComponentUtilities(); $temp->bootedWithColumns(); $temp->bootedWithColumnSelect(); - $temp->bootedWithSecondaryHeader(); $temp->booted(); $temp->renderingWithColumns($view, $view->getData()); $temp->renderingWithColumnSelect($view, $view->getData()); $temp->renderingWithCustomisations($view, $view->getData()); $temp->renderingWithData($view, $view->getData()); - $temp->renderingWithFooter($view, $view->getData()); $temp->renderingWithReordering($view, $view->getData()); $temp->renderingWithPagination($view, $view->getData()); $temp->render(); diff --git a/tests/Unit/Traits/WithMountTest.php b/tests/Unit/Traits/WithMountTest.php index 0e660a57d..3a8b1e49d 100644 --- a/tests/Unit/Traits/WithMountTest.php +++ b/tests/Unit/Traits/WithMountTest.php @@ -18,7 +18,6 @@ public function test_mounttable_gets_correct_first_item(): void $table->bootedComponentUtilities(); $table->bootedWithColumns(); $table->bootedWithColumnSelect(); - $table->bootedWithSecondaryHeader(); $table->booted(); $table->renderingWithPagination($view, []); $table->render(); @@ -36,7 +35,6 @@ public function test_mounttable_gets_correct_first_item(): void $table2->bootedManagesFilters(); $table2->bootedWithColumns(); $table2->bootedWithColumnSelect(); - $table2->bootedWithSecondaryHeader(); $table2->booted(); $table2->renderingWithPagination($view, []); $table2->render(); @@ -53,7 +51,6 @@ public function test_mounttable_gets_correct_first_item(): void $table3->bootedComponentUtilities(); $table3->bootedWithColumns(); $table3->bootedWithColumnSelect(); - $table3->bootedWithSecondaryHeader(); $table3->booted(); $table3->renderingWithPagination($view, []); $table3->render(); diff --git a/tests/Unit/Traits/WithSearchTest.php b/tests/Unit/Traits/WithSearchTest.php index 25452f352..e014c5eb3 100644 --- a/tests/Unit/Traits/WithSearchTest.php +++ b/tests/Unit/Traits/WithSearchTest.php @@ -56,7 +56,6 @@ public function configure(): void $testTableDefault->bootedManagesFilters(); $testTableDefault->bootedWithColumns(); $testTableDefault->bootedWithColumnSelect(); - $testTableDefault->bootedWithSecondaryHeader(); $testTableDefault->booted(); $this->assertSame('', $testTableDefault->search); @@ -97,7 +96,6 @@ public function configure(): void $testTableTrimSearch->bootedManagesFilters(); $testTableTrimSearch->bootedWithColumns(); $testTableTrimSearch->bootedWithColumnSelect(); - $testTableTrimSearch->bootedWithSecondaryHeader(); $testTableTrimSearch->booted(); $this->assertSame('', $testTableTrimSearch->search);