-
Notifications
You must be signed in to change notification settings - Fork 71
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
Convert RefundPayment state values to lowercase #197
Merged
lchrusciel
merged 1 commit into
Sylius:master
from
diimpp:Issue188_state_machine_lower_case
Mar 11, 2020
+65
−27
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20200304172851 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Updates sylius_refund_payment state values to new schema'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); | ||
|
||
$this->addSql('UPDATE sylius_refund_payment SET state = "new" WHERE state = "New"'); | ||
$this->addSql('UPDATE sylius_refund_payment SET state = "completed" WHERE state = "Completed"'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); | ||
|
||
$this->addSql('UPDATE sylius_refund_payment SET state = "New" WHERE state = "new"'); | ||
$this->addSql('UPDATE sylius_refund_payment SET state = "Completed" WHERE state = "completed"'); | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
src/Resources/views/Common/Label/refundPaymentState.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% | ||
set viewOptions = { | ||
completed: { icon: 'adjust', color: 'green' }, | ||
new: { icon: 'clock', color: 'olive' }, | ||
} | ||
%} | ||
|
||
{% set value = 'sylius_refund.ui.' ~ data %} | ||
|
||
<span class="ui {{ viewOptions[data]['color'] }} label"> | ||
<i class="{{ viewOptions[data]['icon'] }} icon"></i> | ||
{{ value|trans }} | ||
</span> |
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,4 @@ | ||
{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %} | ||
{% import "@SyliusUi/Macro/buttons.html.twig" as buttons %} | ||
{% import '@SyliusAdmin/Common/Macro/money.html.twig' as money %} | ||
|
||
{% if refund_payments|length > 0 %} | ||
<div class="ui segment" id="refund-payments"> | ||
|
@@ -17,15 +16,12 @@ | |
<tr> | ||
<td>{{ money.format(refund_payment.amount, refund_payment.currencyCode) }}</td> | ||
<td> | ||
{% include [('@SyliusRefundPlugin/RefundPayment/Label/State/' ~ refund_payment.state ~ '.html.twig'), '@SyliusUi/Label/_default.html.twig'] with {'value': refund_payment.state} %} | ||
{% include '@SyliusRefundPlugin/Common/Label/refundPaymentState.html.twig' with {'data': refund_payment.state} %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</td> | ||
<td class="aligned collapsing"> | ||
{% if refund_payment.state != 'sylius_refund.ui.completed'|trans %} | ||
{% if sm_can(refund_payment, 'complete', 'sylius_refund_refund_payment') %} | ||
<form action="{{ path('sylius_refund_complete_refund_payment', {'orderNumber': refund_payment.orderNumber, 'id': refund_payment.id}) }}" method="POST"> | ||
<button class="button ui labeled icon yellow"> | ||
<i class="icon check"></i> | ||
{{ 'sylius.ui.complete'|trans }} | ||
</button> | ||
<button class="ui icon labeled yellow loadable button"><i class="check icon"></i> {{ 'sylius.ui.complete'|trans }}</button> | ||
</form> | ||
{% endif %} | ||
</td> | ||
|
4 changes: 0 additions & 4 deletions
4
src/Resources/views/RefundPayment/Label/State/completed.html.twig
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Colors and icons are re-used from regular payment label. To me it looks better balanced.