Skip to content

Commit

Permalink
Feat - Variant Generation (#1488)
Browse files Browse the repository at this point in the history
This PR looks to add variant generation to the filament hub. This isn't
a port of the current offering in `0.7` but is instead a complete
reimagining of how it should work, inspired by some other popular
systems out there.
  • Loading branch information
alecritson authored Jan 29, 2024
1 parent 8a92100 commit d8bbaee
Show file tree
Hide file tree
Showing 38 changed files with 4,585 additions and 160 deletions.
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.

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',
],
],
];
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
88 changes: 88 additions & 0 deletions packages/admin/resources/lang/en/productoption.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,92 @@
],
],

'widgets' => [
'product-options' => [
'notifications' => [
'save-variants' => [
'success' => [
'title' => 'Product Variants Saved',
],
],
],
'actions' => [
'cancel' => [
'label' => 'Cancel',
],
'save-options' => [
'label' => 'Save Options',
],
'add-shared-option' => [
'label' => 'Add Shared Option',
'form' => [
'product_option' => [
'label' => 'Product Option',
],
'no_shared_components' => [
'label' => 'No shared options are available.',
],
],
],
'add-restricted-option' => [
'label' => 'Add Option',
],
],
'options-list' => [
'empty' => [
'heading' => 'There are no product options configured',
'description' => 'Add a shared or restricted product option to start generating some variants.',
],
],
'options-table' => [
'title' => 'Product Options',
'configure-options' => [
'label' => 'Configure Options',
],
'table' => [
'option' => [
'label' => 'Option',
],
'values' => [
'label' => 'Values',
],
],
],
'variants-table' => [
'title' => 'Product Variants',
'actions' => [
'create' => [
'label' => 'Create Variant',
],
'edit' => [
'label' => 'Edit',
],
'delete' => [
'label' => 'Delete',
],
],
'empty' => [
'heading' => 'No Variants Configured',
],
'table' => [
'new' => [
'label' => 'NEW',
],
'option' => [
'label' => 'Option',
],
'sku' => [
'label' => 'SKU',
],
'price' => [
'label' => 'Price',
],
'stock' => [
'label' => 'Stock',
],
],
],
],
],

];
102 changes: 102 additions & 0 deletions packages/admin/resources/lang/en/productvariant.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?php

return [
'label' => 'Product Variant',
'plural_label' => 'Product Variants',
'pages' => [
'edit' => [
'title' => 'Basic Information',
],
'media' => [
'title' => 'Media',
'form' => [
'no_selection' => [
'label' => 'You do not currently have an image selected for this variant.',
],
'no_media_available' => [
'label' => 'There is currently no media available on this product.',
],
'images' => [
'label' => 'Primary Image',
'helper_text' => 'Select the product image which represents this variant.',
],
],
],
'identifiers' => [
'title' => 'Identifiers',
],
'inventory' => [
'title' => 'Inventory',
],
'shipping' => [
'title' => 'Shipping',
],
],
'form' => [
'sku' => [
'label' => 'SKU',
],
'gtin' => [
'label' => 'Global Trade Item Number (GTIN)',
],
'mpn' => [
'label' => 'Manufacturer Part Number (MPN)',
],
'ean' => [
'label' => 'UPC/EAN',
],
'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.',
],
'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',
],
],
];
11 changes: 11 additions & 0 deletions packages/admin/resources/lang/en/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,15 @@
],
],
],
'variant_switcher' => [
'label' => 'Switch Variant',
'table' => [
'sku' => [
'label' => 'SKU',
],
'values' => [
'label' => 'Values',
],
],
],
];
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div>
@livewire(\Lunar\Admin\Filament\Widgets\Products\VariantSwitcherTable::class, [
'record' => $record,
])
</div>
Loading

0 comments on commit d8bbaee

Please sign in to comment.