Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Payment's index page #15473

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4f29d2c
Add basic template events for CRUD's index
jakubtobiasz Sep 22, 2023
7a84255
Add support for Twig Components in Template Events
jakubtobiasz Sep 17, 2023
e33eb4d
Add navbar notifications button
jakubtobiasz Sep 22, 2023
92fe997
Add navbar user dropdown
jakubtobiasz Sep 22, 2023
8e9afe4
Improve passing event_prefix and resource_event_prefix between blocks
jakubtobiasz Sep 22, 2023
79625f2
Add a mocked searchbar
jakubtobiasz Sep 22, 2023
ec78873
Rename common template events
jakubtobiasz Sep 22, 2023
65b9f87
Add sidebar
jakubtobiasz Sep 22, 2023
1cd5fec
Fix "User profile" item in the user dropdown
jakubtobiasz Sep 22, 2023
15fa984
Add user dropdown on the mobile view
jakubtobiasz Sep 22, 2023
2cecce2
Add Admin Panel login page
jakubtobiasz Sep 22, 2023
63136e4
Add header to the CRUD's index page
jakubtobiasz Sep 23, 2023
852f703
Add filters to the CRUD's index page
jakubtobiasz Sep 23, 2023
eda1e1d
Add grid to the CRUD's index page
jakubtobiasz Sep 23, 2023
430158a
Fix action buttons on the index page
jakubtobiasz Sep 25, 2023
8213542
Fix static analysis
jakubtobiasz Sep 25, 2023
2b4c8f5
Fix icons in the sidebar
jakubtobiasz Sep 25, 2023
05e8cd4
Add pagination and batch actions
jakubtobiasz Sep 25, 2023
0cc1e7e
Add handling flashes
jakubtobiasz Sep 25, 2023
c25bccb
Fix batch checkboxes styling
jakubtobiasz Sep 25, 2023
ec839c5
Fix channel badge color on the index page
jakubtobiasz Sep 25, 2023
04f4a81
Add a default create page
jakubtobiasz Sep 26, 2023
b657b97
Add a default update page
jakubtobiasz Sep 26, 2023
b0240e2
Add a default show page
jakubtobiasz Sep 27, 2023
2f7d8c2
Adjust twig events' names
jakubtobiasz Sep 29, 2023
d932da8
Add a new twig_event Twig Function
jakubtobiasz Sep 29, 2023
a1b7cd5
Add a note about Component in the Data Collector
jakubtobiasz Sep 29, 2023
77af62e
Refactor Template Events to use a standalone ComponentBlock with a bc…
jakubtobiasz Oct 2, 2023
31f6005
Implement the Dashboard view
jakubtobiasz Oct 4, 2023
c78e343
Fix Sylius Template Events
jakubtobiasz Oct 4, 2023
c3e6497
Add pagination
jakubtobiasz Oct 5, 2023
52810fc
Cleanup old templates in the Admin Panel
jakubtobiasz Oct 5, 2023
8f09df2
Add missing fields for the product's index page
jakubtobiasz Oct 9, 2023
c720b1c
Add the product's CRUD
jakubtobiasz Oct 17, 2023
06e365e
Add a taxon's create and update actions
jakubtobiasz Oct 18, 2023
ca9f01b
Add a taxon tree
jakubtobiasz Oct 19, 2023
03efe82
Make the taxon tree a live component
jakubtobiasz Oct 19, 2023
712d72e
Implement order's show page
jakubtobiasz Oct 20, 2023
075fb7c
Improve the Dashboard view
jakubtobiasz Oct 24, 2023
60ed5f7
Implement the inventory index page
jakubtobiasz Oct 25, 2023
4703d0e
Fix Product Attribute's index page
jakubtobiasz Oct 26, 2023
5945016
Fix Payments' index page
jakubtobiasz Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion composer.json
Expand Up @@ -126,11 +126,14 @@
"symfony/security-http": "^6.3.4",
"symfony/serializer": "^6.3.4",
"symfony/service-contracts": "^2.5 || ^3.0",
"symfony/stimulus-bundle": "^2.12",
"symfony/string": "^6.3.2",
"symfony/templating": "^6.3.0",
"symfony/translation": "^6.3.3",
"symfony/translation-contracts": "^2.5.2",
"symfony/twig-bundle": "^6.3.0",
"symfony/ux-live-component": "^2.12",
"symfony/ux-twig-component": "^2.11.2",
"symfony/validator": "^6.3.4",
"symfony/webpack-encore-bundle": "^1.17.1",
"symfony/yaml": "^6.3.3",
Expand Down Expand Up @@ -232,7 +235,7 @@
"symfony/runtime": "^6.3.2",
"symfony/web-profiler-bundle": "^6.3.2",
"symplify/monorepo-builder": "^11.0",
"vimeo/psalm": "5.15.*",
"vimeo/psalm": "5.14.*",
"weirdan/doctrine-psalm-plugin": "^2.8"
},
"suggest": {
Expand Down
3 changes: 3 additions & 0 deletions config/bundles.php
Expand Up @@ -59,4 +59,7 @@
SyliusLabs\DoctrineMigrationsExtraBundle\SyliusLabsDoctrineMigrationsExtraBundle::class => ['all' => true],
SyliusLabs\Polyfill\Symfony\Security\Bundle\SyliusLabsPolyfillSymfonySecurityBundle::class => ['all' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true],
Symfony\UX\StimulusBundle\StimulusBundle::class => ['all' => true],
Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true],
];
4 changes: 2 additions & 2 deletions config/packages/_sylius.yaml
@@ -1,12 +1,12 @@
imports:
- { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusShopBundle/Resources/config/app/config.yml" }

- { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" }

- { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" }

parameters:
sylius_core.public_dir: '%kernel.project_dir%/public'

Expand Down
5 changes: 5 additions & 0 deletions config/routes/ux_live_component.yaml
@@ -0,0 +1,5 @@
live_component:
resource: '@LiveComponentBundle/config/routes.php'
prefix: '/_components'
# adjust prefix to add localization to your components
#prefix: '/{_locale}/_components'
7 changes: 5 additions & 2 deletions package.json
Expand Up @@ -10,15 +10,18 @@
"jquery.dirtyforms": "^2.0.0",
"lightbox2": "^2.9.0",
"semantic-ui-css": "^2.2.0",
"slick-carousel": "^1.8.1"
"slick-carousel": "^1.8.1",
"@symfony/ux-live-component": "file:vendor/symfony/ux-live-component/assets"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/polyfill": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
"@babel/polyfill": "^7.0.0",
"@babel/preset-env": "^7.18.10",
"@babel/register": "^7.0.0",
"@hotwired/stimulus": "^3.0.0",
"@semantic-ui-react/css-patch": "^1.1.2",
"@symfony/stimulus-bridge": "^3.2.0",
"@symfony/webpack-encore": "^3.1.0",
"eslint": "^8.23.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
3 changes: 2 additions & 1 deletion psalm.xml
Expand Up @@ -66,6 +66,7 @@
<DeprecatedInterface>
<errorLevel type="info">
<referencedClass name="ApiPlatform\Core\Api\IriConverterInterface" /> <!-- deprecated in ApiPlatform 2.7 -->
<referencedClass name="Sylius\Bundle\ShopBundle\Calculator\OrderItemsSubtotalCalculatorInterface" />
<referencedClass name="Sylius\Component\Core\Calculator\ProductVariantPriceCalculatorInterface" />
<referencedClass name="Sylius\Component\Core\Provider\ProductVariantsPricesProviderInterface" />
<referencedClass name="Sylius\Component\User\Security\UserPasswordEncoderInterface" />
Expand Down Expand Up @@ -135,7 +136,7 @@

<InvalidPropertyAssignmentValue>
<errorLevel type="info">
<file name="src/Sylius/Bundle/UiBundle/DataCollector/TemplateBlockRenderingHistory.php" />
<file name="src/Sylius/Bundle/UiBundle/DataCollector/BlockRenderingHistory.php" />
</errorLevel>
</InvalidPropertyAssignmentValue>

Expand Down
19 changes: 5 additions & 14 deletions rector.php
Expand Up @@ -2,21 +2,12 @@

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void
return static function (RectorConfig $config): void
{
$containerConfigurator->import(LevelSetList::UP_TO_PHP_80);

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$parameters->set(Option::IMPORT_SHORT_CLASSES, false);

$services = $containerConfigurator->services();
$services->set(TypedPropertyRector::class);
$services->set(ClosureToArrowFunctionRector::class);
$config->sets([
LevelSetList::UP_TO_PHP_82
]);
};
Expand Up @@ -38,6 +38,16 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
->end()
->end()
->arrayNode('templates')
->addDefaultsIfNotSet()
->children()
->arrayNode('item_action')
->useAttributeAsKey('name')
->scalarPrototype()->end()
->end()
->end()
->end()
->end()
->end()
;

Expand Down
Expand Up @@ -28,6 +28,7 @@ public function load(array $configs, ContainerBuilder $container): void
$container->setParameter('sylius.admin.notification.enabled', $config['notifications']['enabled']);
$container->setParameter('sylius.admin.notification.frequency', $config['notifications']['frequency']);
$container->setParameter('sylius.admin.shop_enabled', false);
$container->setParameter('sylius.admin.templates.item_action', $config['templates']['item_action']);

$bundles = $container->getParameter('kernel.bundles');
if (array_key_exists('SyliusShopBundle', $bundles)) {
Expand Down
@@ -0,0 +1,23 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Grid\Renderer;

use Sylius\Component\Grid\Definition\Action;
use Sylius\Component\Grid\Renderer\GridRendererInterface as BaseGridRendererInterface;
use Sylius\Component\Grid\View\GridViewInterface;

interface GridRendererInterface extends BaseGridRendererInterface
{
public function renderItemAction(GridViewInterface $gridView, Action $action, mixed $data = null): string;
}
@@ -0,0 +1,81 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Sylius\Bundle\AdminBundle\Grid\Renderer;

use Sylius\Bundle\ResourceBundle\Grid\Parser\OptionsParserInterface;
use Sylius\Bundle\ResourceBundle\Grid\View\ResourceGridView;
use Sylius\Component\Grid\Definition\Action;
use Sylius\Component\Grid\Definition\Field;
use Sylius\Component\Grid\Definition\Filter;
use Sylius\Component\Grid\Renderer\GridRendererInterface as BaseGridRendererInterface;
use Sylius\Component\Grid\View\GridViewInterface;
use Twig\Environment as Twig;
use Webmozart\Assert\Assert;

/** @internal */
final readonly class TwigGridRenderer implements GridRendererInterface
{
/**
* @param array<string, string> $itemActionTemplates
*/
public function __construct (
private BaseGridRendererInterface $decorated,
private Twig $twig,
private OptionsParserInterface $optionsParser,
private array $itemActionTemplates = [],
) {
}

public function render(GridViewInterface $gridView, ?string $template = null): string
{
return $this->decorated->render($gridView, $template);
}

public function renderField(GridViewInterface $gridView, Field $field, $data): string
{
return $this->decorated->renderField($gridView, $field, $data);
}

public function renderAction(GridViewInterface $gridView, Action $action, $data = null): string
{
return $this->decorated->renderAction($gridView, $action, $data);
}

public function renderItemAction(GridViewInterface $gridView, Action $action, mixed $data = null): string
{
Assert::isInstanceOf($gridView, ResourceGridView::class);

$type = $action->getType();
if (!isset($this->itemActionTemplates[$type])) {
throw new \InvalidArgumentException(sprintf('Missing template for action type "%s".', $type));
}

$options = $this->optionsParser->parseOptions(
$action->getOptions(),
$gridView->getRequestConfiguration()->getRequest(),
$data,
);

return $this->twig->render($this->itemActionTemplates[$type], [
'grid' => $gridView,
'action' => $action,
'data' => $data,
'options' => $options,
]); }

public function renderFilter(GridViewInterface $gridView, Filter $filter): string
{
return $this->decorated->renderFilter($gridView, $filter);
}
}
26 changes: 23 additions & 3 deletions src/Sylius/Bundle/AdminBundle/Menu/MainMenuBuilder.php
Expand Up @@ -17,19 +17,24 @@
use Knp\Menu\ItemInterface;
use Sylius\Bundle\UiBundle\Menu\Event\MenuBuilderEvent;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Routing\RouterInterface;

final class MainMenuBuilder
final readonly class MainMenuBuilder
{
public const EVENT_NAME = 'sylius.menu.admin.main';

public function __construct(private FactoryInterface $factory, private EventDispatcherInterface $eventDispatcher)
{
public function __construct(
private FactoryInterface $factory,
private EventDispatcherInterface $eventDispatcher,
private RouterInterface $router,
) {
}

public function createMenu(array $options): ItemInterface
{
$menu = $this->factory->createItem('root');

$this->addDashboardSubmenu($menu);
$this->addCatalogSubMenu($menu);
$this->addSalesSubMenu($menu);
$this->addCustomersSubMenu($menu);
Expand All @@ -41,11 +46,22 @@ public function createMenu(array $options): ItemInterface
return $menu;
}

private function addDashboardSubmenu(ItemInterface $menu): void
{
$menu
->addChild('dashboard')
->setLabel('sylius.ui.dashboard')
->setLabelAttribute('icon', 'dashboard')
->setUri($this->router->generate('sylius_admin_dashboard'))
;
}

private function addCatalogSubMenu(ItemInterface $menu): void
{
$catalog = $menu
->addChild('catalog')
->setLabel('sylius.menu.admin.main.catalog.header')
->setLabelAttribute('icon', 'list-details')
;

$catalog
Expand Down Expand Up @@ -111,6 +127,7 @@ private function addCustomersSubMenu(ItemInterface $menu): void
$customers = $menu
->addChild('customers')
->setLabel('sylius.menu.admin.main.customers.header')
->setLabelAttribute('icon', 'users')
;

$customers
Expand Down Expand Up @@ -138,6 +155,7 @@ private function addMarketingSubMenu(ItemInterface $menu): void
$marketing = $menu
->addChild('marketing')
->setLabel('sylius.menu.admin.main.marketing.header')
->setLabelAttribute('icon', 'percentage')
;

$marketing
Expand Down Expand Up @@ -177,6 +195,7 @@ private function addSalesSubMenu(ItemInterface $menu): void
$sales = $menu
->addChild('sales')
->setLabel('sylius.menu.admin.main.sales.header')
->setLabelAttribute('icon', 'shopping-bag')
;

$sales
Expand Down Expand Up @@ -209,6 +228,7 @@ private function addConfigurationSubMenu(ItemInterface $menu): void
$configuration = $menu
->addChild('configuration')
->setLabel('sylius.menu.admin.main.configuration.header')
->setLabelAttribute('icon', 'adjustments')
;

$configuration
Expand Down
21 changes: 21 additions & 0 deletions src/Sylius/Bundle/AdminBundle/Resources/assets/bootstrap.js
@@ -0,0 +1,21 @@
/*
* This file is part of the Sylius package.
*
* (c) Sylius Sp. z o.o.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

import {startStimulusApp} from '@symfony/stimulus-bridge';
import LiveController from '@symfony/ux-live-component';
import '@symfony/ux-live-component/styles/live.css';

// Registers Stimulus controllers from controllers.json and in the controllers/ directory
export const app = startStimulusApp(require.context(
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
true,
/\.[jt]sx?$/
));

app.register('live', LiveController);
Empty file.
@@ -0,0 +1,4 @@
{
"controllers": [],
"entrypoints": []
}
Empty file.
11 changes: 10 additions & 1 deletion src/Sylius/Bundle/AdminBundle/Resources/assets/entrypoint.js
Expand Up @@ -9,7 +9,16 @@

import './styles/main.scss';

import './scripts/apexcharts';
import './bootstrap';

import './scripts/choices';
import './scripts/statistics_chart';
import './scripts/sticky-header';
import './scripts/tree';

import 'bootstrap';

import './images/loader.gif';
import './images/no_data.svg';
import './images/sylius-logo.svg';
import './images/sylius-logo-dark-text.png';
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.