From f7c423e44698d272122f8dadcb7737eba9cad941 Mon Sep 17 00:00:00 2001
From: Luan Freitas <33601626+luanfreitasdev@users.noreply.github.com>
Date: Thu, 7 Sep 2023 14:53:55 -0300
Subject: [PATCH 1/3] fix bootstrap spinner (#1134)
---
.../components/frameworks/bootstrap5/header/loading.blade.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/resources/views/components/frameworks/bootstrap5/header/loading.blade.php b/resources/views/components/frameworks/bootstrap5/header/loading.blade.php
index 05dcf2a9..8f00a4cc 100644
--- a/resources/views/components/frameworks/bootstrap5/header/loading.blade.php
+++ b/resources/views/components/frameworks/bootstrap5/header/loading.blade.php
@@ -3,8 +3,7 @@ class="d-flex align-items-center"
style="padding-left: 10px;"
>
From c0cde0974da53bb89fbbe7650c16cd9db6611905 Mon Sep 17 00:00:00 2001
From: abhaypithadiya
Date: Tue, 12 Sep 2023 08:44:41 +0530
Subject: [PATCH 2/3] If the checkbox rule is disabled, the value should not be
selected while clicking on select all.
---
src/Traits/WithCheckbox.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Traits/WithCheckbox.php b/src/Traits/WithCheckbox.php
index 5292b4bc..ef9b3a62 100644
--- a/src/Traits/WithCheckbox.php
+++ b/src/Traits/WithCheckbox.php
@@ -40,7 +40,7 @@ public function selectCheckboxAll(): void
collect($data->items())->each(function (array|Model|\stdClass $model) use ($actionRulesClass) {
$rules = $actionRulesClass->recoverFromAction('pg:checkbox', $model);
- if (isset($rules['hide'])) {
+ if (isset($rules['hide']) || isset($rules['disable'])) {
return;
}
$value = $model->{$this->checkboxAttribute};
From 84a049e165eaf699bbd78e2bb8c44bbd8c9a57db Mon Sep 17 00:00:00 2001
From: abhaypithadiya
Date: Wed, 20 Sep 2023 18:35:46 +0530
Subject: [PATCH 3/3] - Resolved Checkbox All Errror when Collection is empty.
---
src/Traits/WithCheckbox.php | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/Traits/WithCheckbox.php b/src/Traits/WithCheckbox.php
index ef9b3a62..f2faf32b 100644
--- a/src/Traits/WithCheckbox.php
+++ b/src/Traits/WithCheckbox.php
@@ -37,22 +37,24 @@ public function selectCheckboxAll(): void
$actionRulesClass = resolve(ActionRules::class);
/** @phpstan-ignore-next-line */
- collect($data->items())->each(function (array|Model|\stdClass $model) use ($actionRulesClass) {
- $rules = $actionRulesClass->recoverFromAction('pg:checkbox', $model);
-
- if (isset($rules['hide']) || isset($rules['disable'])) {
- return;
- }
- $value = $model->{$this->checkboxAttribute};
-
- if (!in_array($value, $this->checkboxValues)) {
- $this->checkboxValues[] = (string) $value;
-
- $this->dispatchBrowserEvent('pgBulkActions::addMore', [
- 'value' => $value,
- 'tableName' => $this->tableName,
- ]);
- }
- });
+ if ($data->isNotEmpty()) {
+ collect($data->items())->each(function (array|Model|\stdClass $model) use ($actionRulesClass) {
+ $rules = $actionRulesClass->recoverFromAction('pg:checkbox', $model);
+
+ if (isset($rules['hide']) || isset($rules['disable'])) {
+ return;
+ }
+ $value = $model->{$this->checkboxAttribute};
+
+ if (!in_array($value, $this->checkboxValues)) {
+ $this->checkboxValues[] = (string) $value;
+
+ $this->dispatchBrowserEvent('pgBulkActions::addMore', [
+ 'value' => $value,
+ 'tableName' => $this->tableName,
+ ]);
+ }
+ });
+ }
}
}