Skip to content

Commit

Permalink
Create very simple grid for catalog promotion updates
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Jan 3, 2025
1 parent ac3e4fa commit 8634576
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 12 deletions.
44 changes: 44 additions & 0 deletions src/DependencyInjection/SetonoSyliusCatalogPromotionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,50 @@ public function prepend(ContainerBuilder $container): void

$container->prependExtensionConfig('sylius_grid', [
'grids' => [
'setono_sylius_catalog_promotion_admin_catalog_promotion_update' => [
'driver' => [
'name' => 'doctrine/orm',
'options' => [
'class' => '%setono_sylius_catalog_promotion.model.catalog_promotion_update.class%',
],
],
'sorting' => [
'createdAt' => 'desc',
],
'limits' => [100, 200, 500],
'fields' => [
'state' => [
'type' => 'string',
'label' => 'sylius.ui.state',
'sortable' => null,
],
'catalogPromotions' => [
'type' => 'twig',
'label' => 'setono_sylius_catalog_promotion.ui.catalog_promotions',
'options' => [
'template' => '@SetonoSyliusCatalogPromotionPlugin/Admin/grid/field/catalog_promotion_list.html.twig',
],
],
'createdAt' => [
'type' => 'datetime',
'label' => 'sylius.ui.created_at',
'sortable' => null,
],
'updatedAt' => [
'type' => 'datetime',
'label' => 'setono_sylius_catalog_promotion.ui.updated_at',
'sortable' => null,
],
],
// todo add show action
// 'actions' => [
// 'item' => [
// 'show' => [
// 'type' => 'show',
// ],
// ],
// ],
],
'setono_sylius_catalog_promotion_admin_promotion' => [
'driver' => [
'name' => 'doctrine/orm',
Expand Down
12 changes: 12 additions & 0 deletions src/Resources/config/routes/admin.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
setono_sylius_catalog_promotion_admin_catalog_promotion_update:
resource: |
alias: setono_sylius_catalog_promotion.catalog_promotion_update
section: admin
templates: '@SyliusAdmin\\Crud'
grid: setono_sylius_catalog_promotion_admin_catalog_promotion_update
permission: true
vars:
index:
icon: in cart
type: sylius.resource

setono_sylius_catalog_promotion_admin_promotion:
resource: |
alias: setono_sylius_catalog_promotion.promotion
Expand Down
27 changes: 15 additions & 12 deletions src/Resources/translations/messages.en.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
setono_sylius_catalog_promotion:
ui:
edit_promotion: Edit catalog promotion
manage_promotions: Manage catalog promotions
new_promotion: Create new catalog promotion
promotion: Catalog promotion
promotions: Catalog promotions
rules_explanation: If you don't add any rules, the promotion will be applied to all products
menu:
admin:
main:
marketing:
promotions: Catalog promotions
form:
promotion:
add_rule: Add rule
Expand Down Expand Up @@ -40,3 +28,18 @@ setono_sylius_catalog_promotion:
taxons: Taxons
taxonomy: Taxonomy
type: Type
menu:
admin:
main:
marketing:
promotions: Catalog promotions
ui:
catalog_promotions: Catalog promotions
edit_promotion: Edit catalog promotion
manage_promotions: Manage catalog promotions
new_promotion: Create new catalog promotion
promotion: Catalog promotion
promotions: Catalog promotions
rules_explanation: If you don't add any rules, the promotion will be applied to all products
updated_at: Updated at
catalog_promotion_updates: Catalog promotion updates
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{# @var data string[] #}
<ul class="ui list">
{% for item in data %}
<li>{{ item }}</li>
{% endfor %}
</ul>

0 comments on commit 8634576

Please sign in to comment.