Skip to content

Commit

Permalink
Merge branch '1.x' into pr/paginate
Browse files Browse the repository at this point in the history
  • Loading branch information
alecritson authored Feb 9, 2024
2 parents 7c0c72b + 0b4d5ea commit 5ba8f1f
Show file tree
Hide file tree
Showing 196 changed files with 7,473 additions and 875 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/table_rate_shipping_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
APP_ENV: testing
DB_CONNECTION: testing
DB_DATABASE: ":memory:"
run: vendor/bin/pest --testsuite shipping --parallel
run: vendor/bin/pest --testsuite shipping
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"kalnoy/nestedset": "^6.0",
"laravel/framework": "^10.0",
"laravel/scout": "^10.0",
"leandrocfe/filament-apex-charts": "^3.0",
"leandrocfe/filament-apex-charts": "^3.1.2",
"lukascivil/treewalker": "0.9.1",
"marvinosswald/filament-input-select-affix": "^0.1.0",
"php": "^8.1",
Expand Down Expand Up @@ -122,4 +122,4 @@
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
94 changes: 93 additions & 1 deletion docs/admin/extending/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,20 @@ use Filament\Actions;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Lunar\Admin\Support\Extending\CreatePageExtension;
use Lunar\Admin\Filament\Widgets;

class MyCreateExtension extends CreatePageExtension
{
public function headerWidgets(array $widgets): array
{
$widgets = [
...$widgets,
Widgets\Dashboard\Orders\OrderStatsOverview::make(),
];

return $widgets;
}

public function headerActions(array $actions): array
{
$actions = [
Expand All @@ -54,6 +65,16 @@ class MyCreateExtension extends CreatePageExtension
return $actions;
}

public function footerWidgets(array $widgets): array
{
$widgets = [
...$widgets,
Widgets\Dashboard\Orders\LatestOrdersTable::make(),
];

return $widgets;
}

public function beforeCreate(array $data): array
{
$data['model_code'] .= 'ABC';
Expand Down Expand Up @@ -85,9 +106,20 @@ use Filament\Actions;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Lunar\Admin\Support\Extending\EditPageExtension;
use Lunar\Admin\Filament\Widgets;

class MyEditExtension extends EditPageExtension
{
public function headerWidgets(array $widgets): array
{
$widgets = [
...$widgets,
Widgets\Dashboard\Orders\OrderStatsOverview::make(),
];

return $widgets;
}

public function headerActions(array $actions): array
{
$actions = [
Expand All @@ -112,6 +144,16 @@ class MyEditExtension extends EditPageExtension
return $actions;
}

public function footerWidgets(array $widgets): array
{
$widgets = [
...$widgets,
Widgets\Dashboard\Orders\LatestOrdersTable::make(),
];

return $widgets;
}

public function beforeFill(array $data): array
{
$data['model_code'] .= 'ABC';
Expand Down Expand Up @@ -153,9 +195,20 @@ use Filament\Actions;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Lunar\Admin\Support\Extending\ListPageExtension;
use Lunar\Admin\Filament\Widgets;

class MyListExtension extends ListPageExtension
{
public function headerWidgets(array $widgets): array
{
$widgets = [
...$widgets,
Widgets\Dashboard\Orders\OrderStatsOverview::make(),
];

return $widgets;
}

public function headerActions(array $actions): array
{
$actions = [
Expand All @@ -169,13 +222,52 @@ class MyListExtension extends ListPageExtension

return $actions;
}


public function footerWidgets(array $widgets): array
{
$widgets = [
...$widgets,
Widgets\Dashboard\Orders\LatestOrdersTable::make(),
];

return $widgets;
}
}

// Typically placed in your AppServiceProvider file...
LunarPanel::registerExtension(new MyListExtension, \Lunar\Admin\Filament\Resources\ProductResource\Pages\ListProducts::class);
```

## ViewPageExtension

An example of extending a view page.

```php
use Filament\Actions;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
use Lunar\Admin\Support\Extending\ViewPageExtension;

class MyViewExtension extends ViewPageExtension
{
public function headerActions(array $actions): array
{
$actions = [
...$actions,
Actions\ActionGroup::make([
Actions\Action::make('Download PDF')
])
];

return $actions;
}

}

// Typically placed in your AppServiceProvider file...
LunarPanel::registerExtension(new MyViewExtension, \Lunar\Admin\Filament\Resources\OrderResource\Pages\ManageOrder::class);
```

## Extending Pages In Addons

If you are building an addon for Lunar, you may need to take a slightly different approach when modifying forms, etc.
Expand Down
6 changes: 2 additions & 4 deletions docs/admin/extending/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ class MyProductResourceExtension extends \Lunar\Panel\Support\Extending\Resource

public function extendTable(\Filament\Tables\Table $table): \Filament\Tables\Table
{
$actions = [
return $table->columns([
...$table->getColumns(),
\Filament\Tables\Columns\TextColumn::make('product_code')
];

return $table;
]);
}

public function getRelations(array $managers) : array
Expand Down
2 changes: 1 addition & 1 deletion docs/core/reference/pricing.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ them, first we'll create a standard price model.
$priceModel = \Lunar\Models\Price::create([
// ...
'price' => 1000, // Price is an int and should be in the lowest common denominator
'tier' => 1,
'quantity_break' => 1,
]);

// Lunar\DataTypes\Price
Expand Down
24 changes: 12 additions & 12 deletions docs/core/reference/products.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ front end.
| `price` | A integer value for the price | `null` | yes |
| `compare_price` | For display purposes, allows you to show a comparison price, e.g. RRP. | `null` | no |
| `currency_id` | The ID of the related currency | `null` | yes |
| `tier` | The lower limit to get this price, 1 is the default for base pricing. | `1` | no |
| `quantity_break` | The lower limit to get this price, 1 is the default for base pricing. | `1` | no |
| `customer_group_id` | The customer group this price relates to, leaving as `null` means any customer group | `null` | no |
| `priceable_type` | This is the class reference to the related model which owns the price | `null` | yes |
| `priceable_id` | This is the id of the related model which owns the price | `null` | yes |
Expand All @@ -450,7 +450,7 @@ $price = \Lunar\Models\Price::create([
'price' => 199,
'compare_price' => 299,
'currency_id' => 1,
'tier' => 1,
'quantity_break' => 1,
'customer_group_id' => null,
'priceable_type' => 'Lunar\Models\ProductVariant',
'priceable_id' => 1,
Expand All @@ -476,7 +476,7 @@ relationship method.
'price' => 199,
'compare_price' => 299,
'currency_id' => 1,
'tier' => 1,
'quantity_break' => 1,
'customer_group_id' => null,
'priceable_type' => 'Lunar\Models\ProductVariant',
'priceable_id' => 1,
Expand All @@ -491,26 +491,26 @@ $variant->prices()->create([/* .. */]);

You can specify which customer group the price applies to by setting the `customer_group_id` column. If left as `null`
the price will apply to all customer groups. This is useful if you want to have different pricing for certain customer
groups and also different price tiers per customer group.
groups and also different price quantity breaks per customer group.

### Tiered Pricing
### Quantity Break Pricing

Tiered pricing is a concept in which when you buy in bulk, the cost per item will change (usually go down). With Pricing
on Lunar, this is determined by the `tier` column when creating prices. For example:
Quantity Break pricing is a concept in which when you buy in bulk, the cost per item will change (usually go down). With Pricing
on Lunar, this is determined by the `quantity_break` column when creating prices. For example:

```php
Price::create([
// ...
'price' => 199,
'compare_price' => 399,
'tier' => 1,
'quantity_break' => 1,
]);

Price::create([
// ...
'price' => 150,
'compare_price' => 399,
'tier' => 10,
'quantity_break' => 10,
]);
```

Expand All @@ -522,7 +522,7 @@ will pay `1.50` per item.
Once you've got your pricing all set up, you're likely going to want to display it on your storefront. We've created
a `PricingManager` which is available via a facade to make this process as painless as possible.

To get the pricing for a product you can simple use the following helpers:
To get the pricing for a product you can simply use the following helpers:

#### Minimum example

Expand Down Expand Up @@ -605,9 +605,9 @@ $pricing->matched;
$pricing->base;

/**
* A collection of all the price tiers available for the given criteria.
* A collection of all the price quantity breaks available for the given criteria.
*/
$pricing->tiers;
$pricing->quantityBreaks;

/**
* All customer group pricing available for the given criteria.
Expand Down
31 changes: 31 additions & 0 deletions docs/core/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,37 @@ The `lunar.media.conversions` configuration has been removed, in favour of regis
Media definition classes allow you to register media collections, conversions and much more. See [Media Collections](/core/reference/media.html#media-collections)
for further information.

#### Product Options
The `position` field has been removed from the `product_options` table and is now found on the `product_product_option`
pivot table. Any position data will be automatically adjusted when running migrations.

#### Tiers renamed to Quantity Breaks

The `tier` column on pricing has been renamed to `quantity_break`, any references in code to `tiers` needs to be updated.

##### Price Model

```php
// Old
$priceModel->tier
// New
$priceModel->quantity_break

// Old
$priceModel->tiers
// New
$priceModel->quantityBreaks
```

##### Lunar\Base\DataTransferObjects\PricingResponse

```php
// Old
public Collection $tiered,
// New
public Collection $quantityBreaks,
```

## 0.7

### High Impact
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"minimum-stability": "dev",
"require": {
"lunarphp/core": "self.version",
"filament/filament": "^3.1.23",
"filament/filament": "^3.2.25",
"filament/spatie-laravel-media-library-plugin": "^3.0-stable",
"spatie/laravel-permission": "^5.10",
"barryvdh/laravel-dompdf": "^2.0",
"technikermathe/blade-lucide-icons": "^v2.24.0",
"marvinosswald/filament-input-select-affix": "^0.1.0",
"leandrocfe/filament-apex-charts": "^3.0",
"leandrocfe/filament-apex-charts": "^3.1.2",
"awcodes/shout": "^2.0.2"
},
"extra": {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/resources/css/index.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import '../../vendor/filament/filament/resources/css/theme.css';
@import '../../vendor/filament/filament/resources/css/theme.css';
2,058 changes: 2,057 additions & 1 deletion packages/admin/resources/dist/lunar-panel.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/admin/resources/dist/lunar-panel.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/admin/resources/lang/en/attribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
'name' => [
'label' => 'Name',
],
'description' => [
'label' => 'Description',
],
'handle' => [
'label' => 'Handle',
],
Expand All @@ -25,6 +28,10 @@
'name' => [
'label' => 'Name',
],
'description' => [
'label' => 'Description',
'helper' => 'Use to display the helper text below the entry',
],
'handle' => [
'label' => 'Handle',
],
Expand Down
21 changes: 21 additions & 0 deletions packages/admin/resources/lang/en/components.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,25 @@
],
],
],

'product-options-list' => [
'add-option' => [
'label' => 'Add Option',
],
'delete-option' => [
'label' => 'Delete Option',
],
'remove-shared-option' => [
'label' => 'Remove Shared Option',
],
'add-value' => [
'label' => 'Add Another Value',
],
'name' => [
'label' => 'Name',
],
'values' => [
'label' => 'Values',
],
],
];
6 changes: 6 additions & 0 deletions packages/admin/resources/lang/en/customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
'account_reference' => [
'label' => 'Account Reference',
],
'new' => [
'label' => 'New',
],
'returning' => [
'label' => 'Returning',
],
],

'form' => [
Expand Down
Loading

0 comments on commit 5ba8f1f

Please sign in to comment.