-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #458 from mpysiak/SYL-4168-add-twig-components
Remove partials, add twig components
- Loading branch information
Showing
19 changed files
with
116 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
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. | ||
--> | ||
|
||
<container | ||
xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" | ||
> | ||
<services> | ||
<service id="sylius_refund.twig_component.customer_credit_memos" class="Sylius\RefundPlugin\Twig\Component\OrderCreditMemosComponent"> | ||
<argument type="service" id="sylius_refund.repository.credit_memo" /> | ||
<tag | ||
name="sylius.twig_component" | ||
key="sylius_refund:shop:account:credit_memos" | ||
/> | ||
<tag | ||
name="sylius.twig_component" | ||
key="sylius_refund:admin:credit_memos" | ||
/> | ||
</service> | ||
</services> | ||
</container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?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\RefundPlugin\Twig\Component; | ||
|
||
use Sylius\Component\Core\Model\OrderInterface; | ||
use Sylius\RefundPlugin\Entity\CreditMemoInterface; | ||
use Sylius\RefundPlugin\Repository\CreditMemoRepositoryInterface; | ||
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent; | ||
use Symfony\UX\TwigComponent\Attribute\ExposeInTemplate; | ||
|
||
#[AsTwigComponent] | ||
class OrderCreditMemosComponent | ||
{ | ||
public ?OrderInterface $order = null; | ||
|
||
public function __construct(private readonly CreditMemoRepositoryInterface $creditMemoRepository) | ||
{ | ||
} | ||
|
||
/** @return array<CreditMemoInterface> */ | ||
#[ExposeInTemplate(name: 'credit_memos')] | ||
public function getCreditMemosForOrder(): array | ||
{ | ||
if ($this->order === null || $this->order->getId() === null) { | ||
return []; | ||
} | ||
|
||
return $this->creditMemoRepository->findByOrderId($this->order->getId()); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...lates/admin/credit_memo/show/content/sections/memo_details/table/body/net_value.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{% set item = hookable_metadata.context.item %} | ||
|
||
<td> | ||
{{ '%0.2f'|format(item.netValue/100) }} | ||
{{ (item.netValue / 100)|number_format(2) }} | ||
</td> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
templates/Download/creditMemo.html.twig → templates/download/credit_memo.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,25 @@ | ||
{% set order = hookable_metadata.context.order %} | ||
|
||
{{ render(url('sylius_refund_plugin_shop_order_credit_memos_partial', {'orderId': order.id})) }} | ||
{% if credit_memos|length > 0 %} | ||
<div class="card border-0 bg-body-tertiary mb-3" id="credit-memos"> | ||
<div class="card-header">{{ 'sylius_refund.ui.credit_memos'|trans }}</div> | ||
<div class="card-body"> | ||
<table class="table align-middle mb-0"> | ||
<tbody> | ||
{% for credit_memo in credit_memos %} | ||
<tr> | ||
<td> | ||
<div class="d-flex flex-column"> | ||
<strong>{{ credit_memo.issuedAt|date('d-m-Y') }}</strong> | ||
<span class="text-body-tertiary">{{ credit_memo.number }}</span> | ||
</div> | ||
</td> | ||
<td class="text-end">{{ credit_memo.total|sylius_format_money(credit_memo.currencyCode, credit_memo.localeCode) }}</td> | ||
<td class="w-1"> | ||
{% hook 'sylius_shop.account.order.show.content.main.credit_memos' %} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
{% endif %} |