Skip to content

Commit

Permalink
move menuitem from list to tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
mdspeardevs committed Nov 15, 2024
1 parent b51e9a3 commit c977807
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

/etc/build/*
!/etc/build/.gitignore
/.idea

/tests/Application/yarn.lock

Expand Down
12 changes: 3 additions & 9 deletions config/routing/shop_routing.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
speardevs_push_notifications_section:
path: /account/push-notifications
defaults:
_controller: 'SpearDevs\SyliusPushNotificationsPlugin\Controller\Shop\PushNotificationAction'
template: '@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/push_notification.html.twig'

speardevs_push_notifications_history_index:
path: /account/push-notifications-history
speardevs_push_notifications:
path: /account/push-notifications-section
methods: [ GET ]
defaults:
_controller: speardevs_sylius_push_notifications_plugin.controller.push_notification_history::indexAction
Expand All @@ -16,7 +10,7 @@ speardevs_push_notifications_history_index:
grid: speardevs_push_notification_history
section: shop_account
permission: true
template: '@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/push_notification_history.html.twig'
template: '@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/index.html.twig'
repository:
method: findByCustomer
arguments:
Expand Down
7 changes: 1 addition & 6 deletions src/Menu/Shop/AccountMenuListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,8 @@ public function addAccountMenuItems(MenuBuilderEvent $event): void
$menu = $event->getMenu();

$menu
->addChild('push_notification_section', ['route' => 'speardevs_push_notifications_section'])
->addChild('push_notification_section', ['route' => 'speardevs_push_notifications'])
->setLabel('speardevs_sylius_push_notifications_plugin.ui.my_account.push_notifications')
->setLabelAttribute('icon', 'star');

$menu
->addChild('push_notification_history', ['route' => 'speardevs_push_notifications_history_index'])
->setLabel('speardevs_sylius_push_notifications_plugin.ui.my_account.push_notification_history')
->setLabelAttribute('icon', 'history');
}
}
37 changes: 37 additions & 0 deletions templates/Shop/Account/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{% extends '@SyliusShop/Account/RefundationDocument/layout.html.twig' %}

{% import '@SyliusUi/Macro/messages.html.twig' as messages %}
{% import '@SyliusUi/Macro/pagination.html.twig' as pagination %}
{% import '@SyliusShop/Common/Macro/headers.html.twig' as headers %}
{% import "@SyliusShop/Common/Macro/icons.html.twig" as icons %}

{% block turbo_frame_content %}

{{ block('grid_navigation') }}

<div class="tab-content mt-4">
<div class="tab-pane fade show active" id="active-tab-pane" role="tabpanel" aria-labelledby="active-tab" tabindex="0">
{{ include('@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/push_notification.html.twig') }}
</div>
<div class="tab-pane fade" id="realized-tab-pane" role="tabpanel" aria-labelledby="realized-tab" tabindex="1">
{{ include('@SpearDevsSyliusPushNotificationsPlugin/Shop/Account/push_notification_history.html.twig') }}
</div>
</div>
{% endblock %}

{% block grid_navigation %}
{% set verified = resources.parameters.get('criteria').verified|default(null) %}

<ul class="nav nav-tabs refundations-documents-tabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="active-tab" data-bs-toggle="tab" data-bs-target="#active-tab-pane" type="button" role="tab" aria-controls="active-tab-pane" aria-selected="true">
{{ 'speardevs_sylius_push_notifications_plugin.ui.my_account.push_notifications'|trans }}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="realized-tab" data-bs-toggle="tab" data-bs-target="#realized-tab-pane" type="button" role="tab" aria-controls="realized-tab-pane" aria-selected="false">
{{ 'speardevs_sylius_push_notifications_plugin.ui.my_account.push_notification_history'|trans }}
</button>
</li>
</ul>
{% endblock %}

0 comments on commit c977807

Please sign in to comment.