From 7f6ced9feb7bce9051ae017379c6ffefe77aa51a Mon Sep 17 00:00:00 2001 From: Aaron lawrence <91675986+AaronNeonDigital@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:14:05 +0000 Subject: [PATCH 1/5] Fix type declaration on toggle field type (#1982) This PR fixes the type declaration of `Lunar\FieldTypes\Toggle` to allow `boolean|string` types. Currently it is set to just `string`. --------- Co-authored-by: Author Co-authored-by: Glenn Jacobs --- packages/admin/resources/lang/es/order.php | 2 +- packages/admin/resources/lang/nl/order.php | 3 +-- packages/admin/resources/lang/nl/widgets.php | 1 - packages/core/src/FieldTypes/Toggle.php | 2 +- .../resources/lang/es/relationmanagers.php | 2 +- .../core/Unit/FieldTypes/ToggleFieldTest.php | 24 +++++++++++++++++++ 6 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 tests/core/Unit/FieldTypes/ToggleFieldTest.php diff --git a/packages/admin/resources/lang/es/order.php b/packages/admin/resources/lang/es/order.php index 9a27272e40..2aee39a6da 100644 --- a/packages/admin/resources/lang/es/order.php +++ b/packages/admin/resources/lang/es/order.php @@ -113,7 +113,7 @@ 'label' => 'Cantidad', 'hint' => [ - 'less_than_total' => "Está a punto de capturar un monto menor al valor total de la transacción", + 'less_than_total' => 'Está a punto de capturar un monto menor al valor total de la transacción', ], ], diff --git a/packages/admin/resources/lang/nl/order.php b/packages/admin/resources/lang/nl/order.php index aa2ba2a11f..311cce8d89 100644 --- a/packages/admin/resources/lang/nl/order.php +++ b/packages/admin/resources/lang/nl/order.php @@ -113,7 +113,7 @@ 'label' => 'Bedrag', 'hint' => [ - 'less_than_total' => "Je staat op het punt een bedrag te incasseren dat minder is dan de totale transactiewaarde", + 'less_than_total' => 'Je staat op het punt een bedrag te incasseren dat minder is dan de totale transactiewaarde', ], ], @@ -290,4 +290,3 @@ ], ]; - diff --git a/packages/admin/resources/lang/nl/widgets.php b/packages/admin/resources/lang/nl/widgets.php index 6ee4f9d56f..fcfa019967 100644 --- a/packages/admin/resources/lang/nl/widgets.php +++ b/packages/admin/resources/lang/nl/widgets.php @@ -116,4 +116,3 @@ ], ], ]; - diff --git a/packages/core/src/FieldTypes/Toggle.php b/packages/core/src/FieldTypes/Toggle.php index a229b16071..9949210133 100644 --- a/packages/core/src/FieldTypes/Toggle.php +++ b/packages/core/src/FieldTypes/Toggle.php @@ -26,7 +26,7 @@ public function jsonSerialize(): mixed /** * Create a new instance of Toggle field type. * - * @param string $value + * @param bool|string $value */ public function __construct($value = false) { diff --git a/packages/table-rate-shipping/resources/lang/es/relationmanagers.php b/packages/table-rate-shipping/resources/lang/es/relationmanagers.php index 8a25486a86..5b4d6c6015 100644 --- a/packages/table-rate-shipping/resources/lang/es/relationmanagers.php +++ b/packages/table-rate-shipping/resources/lang/es/relationmanagers.php @@ -3,7 +3,7 @@ return [ 'shipping_methods' => [ 'customer_groups' => [ - 'description' => "Asocia grupos de clientes a este método de envío para determinar su disponibilidad.", + 'description' => 'Asocia grupos de clientes a este método de envío para determinar su disponibilidad.', ], ], 'shipping_rates' => [ diff --git a/tests/core/Unit/FieldTypes/ToggleFieldTest.php b/tests/core/Unit/FieldTypes/ToggleFieldTest.php new file mode 100644 index 0000000000..629196cc25 --- /dev/null +++ b/tests/core/Unit/FieldTypes/ToggleFieldTest.php @@ -0,0 +1,24 @@ +setValue(false); + + expect($field->getValue())->toEqual(false); +}); + +test('can set value in constructor', function () { + $field = new Toggle(true); + + expect($field->getValue())->toEqual(true); +}); + +test('check it does not allow array', function () { + $this->expectException(FieldTypeException::class); + + new Toggle(['foo']); +}); From 9fb098ff06cf293386316ae11031b44d370b0af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferdi=20=C3=9CNAL?= Date: Wed, 20 Nov 2024 02:18:52 +0300 Subject: [PATCH 2/5] fix: removed $navigationLabel static property for localization. (#1977) Hello, First of all, thank you for providing us this product for free. I am doing localisation work with this PR I opened. When I translate the language files into Turkish, localisation does not work properly because the `protected static ?string $navigationLabel` property in the `\Lunar\Admin\Filament\Resources\CollectionGroupResource` class is static. I think the `$navigationLabel` property should be removed to fix this. Before removal Turkish: image English image --- After removal Turkish: image English: image Co-authored-by: Glenn Jacobs --- .../admin/src/Filament/Resources/CollectionGroupResource.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/admin/src/Filament/Resources/CollectionGroupResource.php b/packages/admin/src/Filament/Resources/CollectionGroupResource.php index d96f76427d..d506b2184c 100644 --- a/packages/admin/src/Filament/Resources/CollectionGroupResource.php +++ b/packages/admin/src/Filament/Resources/CollectionGroupResource.php @@ -21,8 +21,6 @@ class CollectionGroupResource extends BaseResource protected static ?int $navigationSort = 3; - protected static ?string $navigationLabel = 'Collections'; - public static function getLabel(): string { return __('lunarpanel::collectiongroup.label'); From cc1c927cb02bd84664e5efb16eccacc702272c82 Mon Sep 17 00:00:00 2001 From: halmanza <53095432+halmanza@users.noreply.github.com> Date: Tue, 19 Nov 2024 16:20:50 -0700 Subject: [PATCH 3/5] Add description for setting minimum-stability to be set to dev for local development (#1963) ## Description Updates documentation for the `local-development.md` to include `minimum-stability` should be set to `dev` in `composer.json`. - Error displayed when not setting `minimum-stability` option to `dev` ```sh Root composer.json requires lunarphp/lunar , it is satisfiable by lunarphp/lunar[0.1.1, ..., 0.8.1] from composer repo (https://repo.packagist.org/) but lunarphp/lunar[1.x-dev] from path repo (packages/) has higher repository priority. The packages from the higher priority repository do not match your minimum-stability and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance. ```` Co-authored-by: halmanza --- docs/core/local-development.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/core/local-development.md b/docs/core/local-development.md index f3cf643e91..c5ec42339e 100644 --- a/docs/core/local-development.md +++ b/docs/core/local-development.md @@ -45,6 +45,11 @@ Update your `composer.json` file similar to the following. } ```` +Ensure minimum stability is set for development +```json + "minimum-stability": "dev", +```` + Run `composer update` from your Laravel application's root directory and fingers crossed you're all up and running,. ```sh From 613e597eb40dff46d6dbb80e4c18bb41bab7c226 Mon Sep 17 00:00:00 2001 From: Lionel Guichard Date: Wed, 20 Nov 2024 00:28:48 +0100 Subject: [PATCH 4/5] Fix doc schedule the product for customer groups (#1950) --- docs/core/reference/products.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/core/reference/products.md b/docs/core/reference/products.md index 252ce776e2..94e663f2cb 100644 --- a/docs/core/reference/products.md +++ b/docs/core/reference/products.md @@ -35,13 +35,13 @@ group, or you can state which dates they should be active for (as long as the cu ```php // Will schedule for this product to be enabled in 14 days for this customer group. -$product->schedule($customerGroup, now()->addDays(14)); +$product->scheduleCustomerGroup($customerGroup, now()->addDays(14)); // Schedule the product to be enabled straight away -$product->schedule($customerGroup); +$product->scheduleCustomerGroup($customerGroup); // The schedule method will accept an array or collection of customer groups. -$product->schedule(CustomerGroup::get()); +$product->scheduleCustomerGroup(CustomerGroup::get()); ``` ### Retrieving products for a customer group From fd3008b9ba95c16318d6be7c34f3ccf881eb4bfe Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Tue, 19 Nov 2024 23:31:22 +0000 Subject: [PATCH 5/5] Allow extending of page edit record forms (#1938) This PR adds the ability to extend base edit record pages. Our use case is the ability to add to the inventory pages, which is why I've applied this to them. --------- Co-authored-by: Author --- .../Pages/ManageProductInventory.php | 2 +- .../Pages/ManageVariantInventory.php | 2 +- .../src/Support/Pages/BaseCreateRecord.php | 1 + .../admin/src/Support/Pages/BaseEditRecord.php | 1 + .../Support/Pages/Concerns/ExtendsForms.php | 18 ++++++++++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 packages/admin/src/Support/Pages/Concerns/ExtendsForms.php diff --git a/packages/admin/src/Filament/Resources/ProductResource/Pages/ManageProductInventory.php b/packages/admin/src/Filament/Resources/ProductResource/Pages/ManageProductInventory.php index 900356b578..da6d6ef1ff 100644 --- a/packages/admin/src/Filament/Resources/ProductResource/Pages/ManageProductInventory.php +++ b/packages/admin/src/Filament/Resources/ProductResource/Pages/ManageProductInventory.php @@ -92,7 +92,7 @@ protected function getFormActions(): array ]; } - public function form(Form $form): Form + public function getDefaultForm(Form $form): Form { return (new ManageVariantInventory)->form($form)->statePath(''); } diff --git a/packages/admin/src/Filament/Resources/ProductVariantResource/Pages/ManageVariantInventory.php b/packages/admin/src/Filament/Resources/ProductVariantResource/Pages/ManageVariantInventory.php index 3dec22cadd..72aac2712d 100644 --- a/packages/admin/src/Filament/Resources/ProductVariantResource/Pages/ManageVariantInventory.php +++ b/packages/admin/src/Filament/Resources/ProductVariantResource/Pages/ManageVariantInventory.php @@ -61,7 +61,7 @@ protected function getDefaultHeaderActions(): array ]; } - public function form(Form $form): Form + public function getDefaultForm(Form $form): Form { return $form->schema([ Section::make()->schema([ diff --git a/packages/admin/src/Support/Pages/BaseCreateRecord.php b/packages/admin/src/Support/Pages/BaseCreateRecord.php index 4a0b803d8e..0c5e414618 100644 --- a/packages/admin/src/Support/Pages/BaseCreateRecord.php +++ b/packages/admin/src/Support/Pages/BaseCreateRecord.php @@ -9,6 +9,7 @@ abstract class BaseCreateRecord extends CreateRecord { use Concerns\ExtendsFooterWidgets; use Concerns\ExtendsFormActions; + use Concerns\ExtendsForms; use Concerns\ExtendsHeaderActions; use Concerns\ExtendsHeaderWidgets; use Concerns\ExtendsHeadings; diff --git a/packages/admin/src/Support/Pages/BaseEditRecord.php b/packages/admin/src/Support/Pages/BaseEditRecord.php index f63f3de97c..4e43fbed8a 100644 --- a/packages/admin/src/Support/Pages/BaseEditRecord.php +++ b/packages/admin/src/Support/Pages/BaseEditRecord.php @@ -9,6 +9,7 @@ abstract class BaseEditRecord extends EditRecord { use Concerns\ExtendsFooterWidgets; use Concerns\ExtendsFormActions; + use Concerns\ExtendsForms; use Concerns\ExtendsHeaderActions; use Concerns\ExtendsHeaderWidgets; use Concerns\ExtendsHeadings; diff --git a/packages/admin/src/Support/Pages/Concerns/ExtendsForms.php b/packages/admin/src/Support/Pages/Concerns/ExtendsForms.php new file mode 100644 index 0000000000..d699471537 --- /dev/null +++ b/packages/admin/src/Support/Pages/Concerns/ExtendsForms.php @@ -0,0 +1,18 @@ +getDefaultForm($form)); + } + + public function getDefaultForm(Form $form): Form + { + return $form; + } +}