Skip to content

Commit

Permalink
Merge branch '1.x' into translated-column
Browse files Browse the repository at this point in the history
  • Loading branch information
lguichard committed Jan 31, 2024
2 parents 0d9e7d2 + 5db295f commit c13a3d6
Show file tree
Hide file tree
Showing 90 changed files with 4,993 additions and 209 deletions.
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
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
3 changes: 3 additions & 0 deletions packages/admin/resources/lang/en/order.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
'date' => [
'label' => 'Date',
],
'new_customer' => [
'label' => 'Customer Type',
],
],

'form' => [
Expand Down
71 changes: 0 additions & 71 deletions packages/admin/resources/lang/en/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,83 +87,12 @@
],
'identifiers' => [
'label' => 'Product Identifiers',
'form' => [
'sku' => [
'label' => 'SKU',
],
'gtin' => [
'label' => 'Global Trade Item Number (GTIN)',
],
'mpn' => [
'label' => 'Manufacturer Part Number (MPN)',
],
'ean' => [
'label' => 'UPC/EAN',
],
],
],
'inventory' => [
'label' => 'Inventory',
'form' => [
'stock' => [
'label' => 'In Stock',
],
'backorder' => [
'label' => 'On Backorder',
],
'purchasable' => [
'label' => 'Purchasability',
'options' => [
'always' => 'Always',
'in_stock' => 'In Stock',
'backorder' => 'Backorder Only',
],
],
'unit_quantity' => [
'label' => 'Unit Quantity',
'helper_text' => 'How many individual items make up 1 unit.',
],
'min_quantity' => [
'label' => 'Minimum Quantity',
'helper_text' => 'The minimum quantity of a product variant that can be bought in a single purchase.',
],
'quantity_increment' => [
'label' => 'Quantity Increment',
'helper_text' => 'The product variant must be purchased in multiples of this quantity.',
],
],
],
'shipping' => [
'label' => 'Shipping',
'form' => [
'shippable' => [
'label' => 'Shippable',
],
'length_value' => [
'label' => 'Length',
],
'length_unit' => [
'label' => 'Length Unit',
],
'width_value' => [
'label' => 'Width',
],
'width_unit' => [
'label' => 'Width Unit',
],
'height_value' => [
'label' => 'Height',
],
'height_unit' => [
'label' => 'Height Unit',
],
'weight_value' => [
'label' => 'Weight',
],
'weight_unit' => [
'label' => 'Weight Unit',
],
],
],
],

Expand Down
Loading

0 comments on commit c13a3d6

Please sign in to comment.