diff --git a/src/Form/Type/AutomaticBlacklistingConfigurationType.php b/src/Form/Type/AutomaticBlacklistingConfigurationType.php
index ee9d396..3b8095a 100644
--- a/src/Form/Type/AutomaticBlacklistingConfigurationType.php
+++ b/src/Form/Type/AutomaticBlacklistingConfigurationType.php
@@ -14,7 +14,6 @@
use BitBag\SyliusBlacklistPlugin\Entity\FraudPrevention\AutomaticBlacklistingRuleInterface;
use Sylius\Bundle\AdminBundle\Form\Type\AddButtonType;
use Sylius\Bundle\ChannelBundle\Form\Type\ChannelChoiceType;
-use Sylius\Bundle\PromotionBundle\Form\Type\PromotionRuleType;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@@ -30,10 +29,10 @@ final class AutomaticBlacklistingConfigurationType extends AbstractResourceType
private $attributeChoices;
public function __construct(
+ private array $rules,
string $dataClass,
array $attributeChoices,
array $validationGroups = [],
- private array $rules,
) {
parent::__construct($dataClass, $validationGroups);
$this->attributeChoices = $attributeChoices;
diff --git a/src/Form/Type/CustomerAutocompleteChoiceType.php b/src/Form/Type/CustomerAutocompleteType.php
similarity index 52%
rename from src/Form/Type/CustomerAutocompleteChoiceType.php
rename to src/Form/Type/CustomerAutocompleteType.php
index a9ce755..14a8f77 100644
--- a/src/Form/Type/CustomerAutocompleteChoiceType.php
+++ b/src/Form/Type/CustomerAutocompleteType.php
@@ -11,39 +11,38 @@
namespace BitBag\SyliusBlacklistPlugin\Form\Type;
-use Sylius\Bundle\ResourceBundle\Form\Type\ResourceAutocompleteChoiceType;
use Symfony\Component\Form\AbstractType;
-use Symfony\Component\Form\FormInterface;
-use Symfony\Component\Form\FormView;
use Symfony\Component\OptionsResolver\OptionsResolver;
-
-final class CustomerAutocompleteChoiceType extends AbstractType
+use Symfony\UX\Autocomplete\Form\AsEntityAutocompleteField;
+use Symfony\UX\Autocomplete\Form\BaseEntityAutocompleteType;
+
+#[AsEntityAutocompleteField(
+ alias: 'sylius_admin_customer',
+ route: 'sylius_admin_entity_autocomplete',
+)]
+final class CustomerAutocompleteType extends AbstractType
{
+ public function __construct(
+ private string $customerClass,
+ ) {
+ }
+
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
- 'resource' => 'sylius.customer',
- 'choice_name' => 'email',
+ 'class' => $this->customerClass,
+ 'choice_label' => 'email',
'choice_value' => 'id',
]);
}
- public function buildView(
- FormView $view,
- FormInterface $form,
- array $options,
- ): void {
- $view->vars['remote_criteria_type'] = 'contains';
- $view->vars['remote_criteria_name'] = 'email';
- }
-
public function getBlockPrefix(): string
{
- return 'bitbag_sylius_customer_autocomplete_choice';
+ return 'bitbag_sylius_admin_customer_autocomplete';
}
public function getParent(): string
{
- return ResourceAutocompleteChoiceType::class;
+ return BaseEntityAutocompleteType::class;
}
}
diff --git a/src/Form/Type/FraudSuspicionType.php b/src/Form/Type/FraudSuspicionType.php
index 06dc6b9..d73c143 100644
--- a/src/Form/Type/FraudSuspicionType.php
+++ b/src/Form/Type/FraudSuspicionType.php
@@ -31,7 +31,7 @@ public function __construct(
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
- ->add('customer', CustomerAutocompleteChoiceType::class, [
+ ->add('customer', CustomerAutocompleteType::class, [
'label' => 'sylius.ui.customer',
'priority' => 1,
'constraints' => [
diff --git a/src/Menu/FraudPreventionMenuBuilder.php b/src/Menu/FraudPreventionMenuBuilder.php
index c92b4ec..b9cb5da 100755
--- a/src/Menu/FraudPreventionMenuBuilder.php
+++ b/src/Menu/FraudPreventionMenuBuilder.php
@@ -28,6 +28,7 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void
$rootMenuItem = $menu
->addChild('bitbag_fraud_prevention')
->setLabel('bitbag_sylius_blacklist_plugin.ui.fraud_prevention')
+ ->setLabelAttribute('icon', 'spy')
;
$rootMenuItem
@@ -35,7 +36,6 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void
'route' => 'bitbag_sylius_blacklist_plugin_admin_blacklisting_rule_index',
])
->setLabel('bitbag_sylius_blacklist_plugin.ui.blacklisting_rules')
- ->setLabelAttribute('icon', 'hand paper')
;
$rootMenuItem
@@ -43,7 +43,6 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void
'route' => 'bitbag_sylius_blacklist_plugin_admin_automatic_blacklisting_configuration_index',
])
->setLabel('bitbag_sylius_blacklist_plugin.ui.automatic_blacklisting_configurations')
- ->setLabelAttribute('icon', 'microchip')
;
$rootMenuItem
@@ -51,7 +50,6 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void
'route' => 'bitbag_sylius_blacklist_plugin_admin_fraud_suspicion_index',
])
->setLabel('bitbag_sylius_blacklist_plugin.ui.fraud_suspicions')
- ->setLabelAttribute('icon', 'exclamation triangle')
;
$rootMenuItem
@@ -59,7 +57,6 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void
'route' => 'bitbag_sylius_blacklist_plugin_admin_automatic_blacklisting_configuration_index',
])
->setLabel('bitbag_sylius_blacklist_plugin.ui.automatic_blacklisting_configurations')
- ->setLabelAttribute('icon', 'cog')
;
}
}
diff --git a/src/Resources/config/routing/admin/fraud_suspicion.yaml b/src/Resources/config/routing/admin/fraud_suspicion.yaml
index 26bf091..fc1a0df 100644
--- a/src/Resources/config/routing/admin/fraud_suspicion.yaml
+++ b/src/Resources/config/routing/admin/fraud_suspicion.yaml
@@ -12,7 +12,7 @@ bitbag_sylius_blacklist_plugin_admin_fraud_suspicion:
icon: clipboard list
type: sylius.resource
-bitbag_sylius_blacklist_plugin_admin_fraud_suspicion_show:
+sylius_admin_fraud_suspicion_show:
path: fraud-suspicions/{id}
methods: [GET]
defaults:
diff --git a/src/Resources/config/services/form.xml b/src/Resources/config/services/form.xml
index faa93ba..95b7e03 100644
--- a/src/Resources/config/services/form.xml
+++ b/src/Resources/config/services/form.xml
@@ -47,10 +47,10 @@
+ %bitbag.sylius_blacklist_plugin.automatic_blacklisting_rules%
%bitbag_sylius_blacklist_plugin.model.automatic_blacklisting_configuration.class%
%bitbag.sylius_blacklist_plugin.form.type.automatic_blacklisting_configuration.validation_groups%
%bitbag.sylius_blacklist_plugin.form.type.validation_groups%
- %bitbag.sylius_blacklist_plugin.automatic_blacklisting_rules%
%bitbag.sylius_blacklist_plugin.automatic_blacklisting_rules%
+
+ %sylius.model.customer.class%
+
+
+
diff --git a/src/Resources/config/services/twig/component.xml b/src/Resources/config/services/twig/component.xml
index 3337589..545092b 100644
--- a/src/Resources/config/services/twig/component.xml
+++ b/src/Resources/config/services/twig/component.xml
@@ -7,7 +7,7 @@
>
@@ -17,9 +17,41 @@
+
+
+
+
+ %bitbag_sylius_blacklist_plugin.model.blacklisting_rule.class%
+ BitBag\SyliusBlacklistPlugin\Form\Type\BlacklistingRuleType
+
+
+
+
+
+
+
+ %bitbag_sylius_blacklist_plugin.model.fraud_suspicion.class%
+ BitBag\SyliusBlacklistPlugin\Form\Type\FraudSuspicionType
+
+
+
diff --git a/src/Resources/config/services/twig/extension.xml b/src/Resources/config/services/twig/extension.xml
new file mode 100644
index 0000000..1d569d3
--- /dev/null
+++ b/src/Resources/config/services/twig/extension.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+ %bitbag.sylius_blacklist_plugin.automatic_blacklisting_rules%
+
+
+
+
diff --git a/src/Resources/config/twig_hooks/automatic_blacklisting_configuration/create.yaml b/src/Resources/config/twig_hooks/automatic_blacklisting_configuration/create.yaml
index 84806c9..1780160 100644
--- a/src/Resources/config/twig_hooks/automatic_blacklisting_configuration/create.yaml
+++ b/src/Resources/config/twig_hooks/automatic_blacklisting_configuration/create.yaml
@@ -1,13 +1,13 @@
twig_hooks:
hooks:
- 'bitbag_sylius_blacklist_plugin.automatic_blacklisting_configuration.create.content':
+ 'sylius_admin.automatic_blacklisting_configuration.create.content':
form:
- component: 'bitbag_sylius_blacklist_plugin:automatic_blacklisting_configuration:form'
+ component: 'sylius_admin:automatic_blacklisting_configuration:form'
props:
resource: '@=_context.resource'
form: '@=_context.form'
configuration:
render_rest: false
- 'bitbag_sylius_blacklist_plugin.automatic_blacklisting_configuration.create.content.form':
+ 'sylius_admin.automatic_blacklisting_configuration.create.content.form':
sections:
- template: '@SyliusAdmin/promotion/form/sections.html.twig'
+ template: '@BitBagSyliusBlacklistPlugin/AutomaticBlacklistingConfiguration/Admin/form.html.twig'
diff --git a/src/Resources/config/twig_hooks/automatic_blacklisting_configuration/update.yaml b/src/Resources/config/twig_hooks/automatic_blacklisting_configuration/update.yaml
new file mode 100644
index 0000000..1e98180
--- /dev/null
+++ b/src/Resources/config/twig_hooks/automatic_blacklisting_configuration/update.yaml
@@ -0,0 +1,13 @@
+twig_hooks:
+ hooks:
+ 'sylius_admin.automatic_blacklisting_configuration.update.content':
+ form:
+ component: 'sylius_admin:automatic_blacklisting_configuration:form'
+ props:
+ resource: '@=_context.resource'
+ form: '@=_context.form'
+ configuration:
+ method: 'PUT'
+ 'sylius_admin.automatic_blacklisting_configuration.update.content.form':
+ sections:
+ template: '@BitBagSyliusBlacklistPlugin/AutomaticBlacklistingConfiguration/Admin/form.html.twig'
diff --git a/src/Resources/config/twig_hooks/blacklisting_rule/create.yaml b/src/Resources/config/twig_hooks/blacklisting_rule/create.yaml
new file mode 100644
index 0000000..83c576b
--- /dev/null
+++ b/src/Resources/config/twig_hooks/blacklisting_rule/create.yaml
@@ -0,0 +1,13 @@
+twig_hooks:
+ hooks:
+ 'sylius_admin.blacklisting_rule.create.content':
+ form:
+ component: 'sylius_admin:blacklisting_rule:form'
+ props:
+ resource: '@=_context.resource'
+ form: '@=_context.form'
+ configuration:
+ render_rest: false
+ 'sylius_admin.blacklisting_rule.create.content.form':
+ sections:
+ template: '@BitBagSyliusBlacklistPlugin/BlacklistingRule/Admin/form.html.twig'
diff --git a/src/Resources/config/twig_hooks/blacklisting_rule/update.yaml b/src/Resources/config/twig_hooks/blacklisting_rule/update.yaml
new file mode 100644
index 0000000..4b0e13a
--- /dev/null
+++ b/src/Resources/config/twig_hooks/blacklisting_rule/update.yaml
@@ -0,0 +1,13 @@
+twig_hooks:
+ hooks:
+ 'sylius_admin.blacklisting_rule.update.content':
+ form:
+ component: 'sylius_admin:blacklisting_rule:form'
+ props:
+ resource: '@=_context.resource'
+ form: '@=_context.form'
+ configuration:
+ method: 'PUT'
+ 'sylius_admin.blacklisting_rule.update.content.form':
+ sections:
+ template: '@BitBagSyliusBlacklistPlugin/BlacklistingRule/Admin/form.html.twig'
diff --git a/src/Resources/config/twig_hooks/fraud_suspicion/create.yaml b/src/Resources/config/twig_hooks/fraud_suspicion/create.yaml
new file mode 100644
index 0000000..136e9ee
--- /dev/null
+++ b/src/Resources/config/twig_hooks/fraud_suspicion/create.yaml
@@ -0,0 +1,13 @@
+twig_hooks:
+ hooks:
+ 'sylius_admin.fraud_suspicion.create.content':
+ form:
+ component: 'sylius_admin:fraud_suspicion:form'
+ props:
+ resource: '@=_context.resource'
+ form: '@=_context.form'
+ configuration:
+ render_rest: false
+ 'sylius_admin.fraud_suspicion.create.content.form':
+ sections:
+ template: '@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/form.html.twig'
diff --git a/src/Resources/config/twig_hooks/fraud_suspicion/show.yaml b/src/Resources/config/twig_hooks/fraud_suspicion/show.yaml
new file mode 100644
index 0000000..bc137af
--- /dev/null
+++ b/src/Resources/config/twig_hooks/fraud_suspicion/show.yaml
@@ -0,0 +1,5 @@
+twig_hooks:
+ hooks:
+ 'sylius_admin.fraud_suspicion.show.content':
+ general:
+ template: '@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/show.html.twig'
diff --git a/src/Resources/config/twig_hooks/fraud_suspicion/update.yaml b/src/Resources/config/twig_hooks/fraud_suspicion/update.yaml
new file mode 100644
index 0000000..3cc29ce
--- /dev/null
+++ b/src/Resources/config/twig_hooks/fraud_suspicion/update.yaml
@@ -0,0 +1,13 @@
+twig_hooks:
+ hooks:
+ 'sylius_admin.fraud_suspicion.update.content':
+ form:
+ component: 'sylius_admin:fraud_suspicion:form'
+ props:
+ resource: '@=_context.resource'
+ form: '@=_context.form'
+ configuration:
+ method: 'PUT'
+ 'sylius_admin.fraud_suspicion.update.content.form':
+ sections:
+ template: '@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/form.html.twig'
diff --git a/src/Resources/translations/messages.en.yml b/src/Resources/translations/messages.en.yml
index b09f055..f75121f 100644
--- a/src/Resources/translations/messages.en.yml
+++ b/src/Resources/translations/messages.en.yml
@@ -1,7 +1,9 @@
bitbag_sylius_blacklist_plugin:
ui:
blacklisting_rules: Blacklisting rules
+ blacklisting_rule: Blacklisting rule
fraud_suspicions: Fraud suspicions
+ fraud_suspicion: Fraud suspicion
manage_blacklisting_rules: Manage blacklisting rules
manage_fraud_suspicions: Manage fraud suspicions
edit_fraud_suspicion: Edit fraud suspicion
@@ -18,6 +20,7 @@ bitbag_sylius_blacklist_plugin:
mark_suspicious: Mark suspicious
mark_blacklisted: Mark blacklisted
mark_neutral: Mark neutral
+ automatic_blacklisting_configuration: Auto-block rules
automatic_blacklisting_configurations: Auto-block rules
configure_automatic_blacklisting_configurations: Configure auto-blacklisitng
new_automatic_blacklisting_configuration: Add new automatic blacklisting configuration
@@ -71,4 +74,4 @@ bitbag_sylius_blacklist_plugin:
date_modifier: Date modifier
per_day: Per day
per_week: Per week
- per_month: Per month
\ No newline at end of file
+ per_month: Per month
diff --git a/src/Resources/views/AutomaticBlacklistingConfiguration/Admin/form.html.twig b/src/Resources/views/AutomaticBlacklistingConfiguration/Admin/form.html.twig
index e69de29..3e80227 100644
--- a/src/Resources/views/AutomaticBlacklistingConfiguration/Admin/form.html.twig
+++ b/src/Resources/views/AutomaticBlacklistingConfiguration/Admin/form.html.twig
@@ -0,0 +1,53 @@
+{% form_theme form '@BitBagSyliusBlacklistPlugin/Form/theme.html.twig' %}
+
+
+ {{ form_start(form, {'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate', 'id': form.vars.id}}) }}
+ {% if hookable_metadata.configuration.method is defined %}
+
+ {% endif %}
+ {{ form_errors(form) }}
+ {{ form_widget(form._token) }}
+
+
+
+
+
+
+ {{ form_row(form.name) }}
+
+
+ {{ form_row(form.channels) }}
+
+
+ {{ form_row(form.enabled) }}
+
+
+ {{ form_row(form.addFraudSuspicion) }}
+
+
+ {{ form_row(form.permittedFraudSuspicionsNumber) }}
+
+
+ {{ form_row(form.permittedFraudSuspicionsTime) }}
+
+
+
+
+
+
+
+
+
+
+ {{ form_row(form.rules, {label: false}) }}
+
+
+
+
+
+ {{ form_end(form, {render_rest: hookable.configuration.render_rest|default(false)}) }}
+
diff --git a/src/Resources/views/BlacklistingRule/Admin/_form.html.twig b/src/Resources/views/BlacklistingRule/Admin/_form.html.twig
deleted file mode 100644
index 20de171..0000000
--- a/src/Resources/views/BlacklistingRule/Admin/_form.html.twig
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- {{ form_errors(form) }}
-
- {{ form_row(form.name) }}
-
-
- {{ form_row(form.channels) }}
-
-
- {{ form_row(form.enabled) }}
-
-
-
-
- {{ form_row(form.attributes) }}
-
-
- {{ form_row(form.permittedStrikes) }}
-
-
-
-
-
- {{ 'bitbag_sylius_blacklist_plugin.form.blacklisting_rule.customer_group_help'|trans }}
-
-
-
- {{ form_label(form.customerGroups) }}
- {{ form_widget(form.customerGroups) }}
- {{ form_row(form.forUnassignedCustomers) }}
-
-
-
-
-
- {{ form_row(form.onlyForGuests) }}
-
-
-
-
diff --git a/src/Resources/views/BlacklistingRule/Admin/form.html.twig b/src/Resources/views/BlacklistingRule/Admin/form.html.twig
new file mode 100644
index 0000000..d376e14
--- /dev/null
+++ b/src/Resources/views/BlacklistingRule/Admin/form.html.twig
@@ -0,0 +1,44 @@
+{% form_theme form '@BitBagSyliusBlacklistPlugin/Form/theme.html.twig' %}
+
+
+ {{ form_start(form, {'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate', 'id': form.vars.id}}) }}
+ {% if hookable_metadata.configuration.method is defined %}
+
+ {% endif %}
+ {{ form_errors(form) }}
+ {{ form_widget(form._token) }}
+
+
+
+
+
+
+ {{ form_row(form.name) }}
+
+
+ {{ form_row(form.channels) }}
+
+
+ {{ form_row(form.enabled) }}
+
+
+ {{ form_row(form.attributes) }}
+
+
+ {{ form_row(form.permittedStrikes) }}
+
+
+ {{ form_row(form.customerGroups) }}
+
+
+ {{ form_row(form.forUnassignedCustomers) }}
+
+
+ {{ form_row(form.onlyForGuests) }}
+
+
+
+
+
diff --git a/src/Resources/views/Form/theme.html.twig b/src/Resources/views/Form/theme.html.twig
index c462a2c..ee5c7d0 100644
--- a/src/Resources/views/Form/theme.html.twig
+++ b/src/Resources/views/Form/theme.html.twig
@@ -1,10 +1,25 @@
-{% extends '@SyliusUi/Form/theme.html.twig' %}
+{% extends '@SyliusAdmin/shared/form_theme.html.twig' %}
{% block bitbag_sylius_customer_autocomplete_choice_row %}
- {{ form_row(form, {
- 'remote_url': path('bitbag_sylius_blacklist_plugin_admin_ajax_customer_by_email'),
- 'load_edit_url': path('bitbag_sylius_blacklist_plugin_admin_ajax_customer_by_id')
- }) }}
+
+ {{- form_label(form) -}}
+
+ {{- form_widget(form, {'attr': {'class' : 'autocomplete'}}) -}}
+
+
{% if placeholder is defined %} {{ placeholder|trans }} {% endif %}
+
+
+ {{- form_errors(form) -}}
+
+
{% endblock %}
{% block bitbag_sylius_blacklist_plugin_automatic_blacklisting_rule_widget %}
@@ -19,7 +34,7 @@
{{- form_row(form.type) -}}
-
ads
+
{{ automatic_blacklisting_configuration_get_rule_label(form.type.vars.data)|trans }}
{{- form_row(button_delete, sylius_test_form_attribute('delete')|sylius_merge_recursive({'attr': {'class': 'btn-close'}})) -}}
diff --git a/src/Resources/views/FraudSuspicion/Admin/Show/_customer.html.twig b/src/Resources/views/FraudSuspicion/Admin/Show/_customer.html.twig
index 04cea67..132edec 100644
--- a/src/Resources/views/FraudSuspicion/Admin/Show/_customer.html.twig
+++ b/src/Resources/views/FraudSuspicion/Admin/Show/_customer.html.twig
@@ -1,19 +1,14 @@
-
-
-
-
-
-
- {% if fraudSuspicion.customer != null %}
-
-
- {{ fraudSuspicion.customer }}
-
- {% else %}
- {{ 'bitbag_sylius_blacklist_plugin.ui.no_related_customer'|trans }}
- {% endif %}
-
-
-
-
-
\ No newline at end of file
+
+
+
+ {% if fraudSuspicion.customer != null %}
+
+ {{ fraudSuspicion.customer }}
+
+ {% else %}
+
{{ 'bitbag_sylius_blacklist_plugin.ui.no_related_customer'|trans }}
+ {% endif %}
+
+
diff --git a/src/Resources/views/FraudSuspicion/Admin/Show/_details.html.twig b/src/Resources/views/FraudSuspicion/Admin/Show/_details.html.twig
index d417496..aedb945 100644
--- a/src/Resources/views/FraudSuspicion/Admin/Show/_details.html.twig
+++ b/src/Resources/views/FraudSuspicion/Admin/Show/_details.html.twig
@@ -1,85 +1,75 @@
-
-
-
-
-
- {{ 'sylius.ui.company'|trans }}
-
- {{ fraudSuspicion.company }}
-
-
- {{ 'sylius.ui.first_name'|trans }}
-
- {{ fraudSuspicion.firstName }}
-
-
- {{ 'sylius.ui.last_name'|trans }}
-
- {{ fraudSuspicion.lastName }}
-
-
- {{ 'sylius.ui.phone_number'|trans }}
-
- {{ fraudSuspicion.phoneNumber }}
-
-
- {{ 'sylius.ui.email'|trans }}
-
- {{ fraudSuspicion.email }}
-
-
- {{ 'sylius.ui.street'|trans }}
-
- {{ fraudSuspicion.street }}
-
-
- {{ 'sylius.ui.city'|trans }}
-
- {{ fraudSuspicion.city }}
-
-
- {{ 'sylius.ui.postcode'|trans }}
-
- {{ fraudSuspicion.postcode }}
-
-
- {{ 'sylius.ui.province'|trans }}
-
- {{ fraudSuspicion.province }}
-
-
- {{ 'sylius.ui.country'|trans }}
-
- {{ fraudSuspicion.country }}
-
-
- {{ 'bitbag_sylius_blacklist_plugin.form.blacklisting_rule.customer_ip'|trans }}
-
- {{ fraudSuspicion.customerIp }}
-
-
- {{ 'bitbag_sylius_blacklist_plugin.ui.address_type'|trans }}
-
- {{ fraudSuspicion.addressType }}
-
-
- {{ 'bitbag_sylius_blacklist_plugin.form.fraud_suspicion.comment'|trans }}
-
- {{ fraudSuspicion.comment }}
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+ {{ 'sylius.ui.company'|trans }}
+ {{ fraudSuspicion.company }}
+
+
+ {{ 'sylius.ui.first_name'|trans }}
+ {{ fraudSuspicion.firstName }}
+
+
+ {{ 'sylius.ui.last_name'|trans }}
+ {{ fraudSuspicion.lastName }}
+
+
+ {{ 'sylius.ui.phone_number'|trans }}
+ {{ fraudSuspicion.phoneNumber }}
+
+
+ {{ 'sylius.ui.email'|trans }}
+ {{ fraudSuspicion.email }}
+
+
+ {{ 'sylius.ui.street'|trans }}
+ {{ fraudSuspicion.street }}
+
+
+ {{ 'sylius.ui.city'|trans }}
+ {{ fraudSuspicion.city }}
+
+
+ {{ 'sylius.ui.postcode'|trans }}
+ {{ fraudSuspicion.postcode }}
+
+
+ {{ 'sylius.ui.province'|trans }}
+ {{ fraudSuspicion.province }}
+
+
+ {{ 'sylius.ui.country'|trans }}
+ {{ fraudSuspicion.country }}
+
+
+
+
+ {{ 'bitbag_sylius_blacklist_plugin.form.blacklisting_rule.customer_ip'|trans }}
+
+
+ {{ fraudSuspicion.customerIp }}
+
+
+
+
+ {{ 'bitbag_sylius_blacklist_plugin.ui.address_type'|trans }}
+
+
+ {{ fraudSuspicion.addressType }}
+
+
+
+
+ {{ 'bitbag_sylius_blacklist_plugin.form.fraud_suspicion.comment'|trans }}
+
+
+ {{ fraudSuspicion.comment }}
+
+
+
+
+
diff --git a/src/Resources/views/FraudSuspicion/Admin/Show/_order.html.twig b/src/Resources/views/FraudSuspicion/Admin/Show/_order.html.twig
index e735d21..a9b7aad 100644
--- a/src/Resources/views/FraudSuspicion/Admin/Show/_order.html.twig
+++ b/src/Resources/views/FraudSuspicion/Admin/Show/_order.html.twig
@@ -1,23 +1,18 @@
-
-
\ No newline at end of file
diff --git a/src/Resources/views/FraudSuspicion/Admin/form.html.twig b/src/Resources/views/FraudSuspicion/Admin/form.html.twig
new file mode 100644
index 0000000..b3b93ad
--- /dev/null
+++ b/src/Resources/views/FraudSuspicion/Admin/form.html.twig
@@ -0,0 +1,59 @@
+{% form_theme form '@BitBagSyliusBlacklistPlugin/Form/theme.html.twig' %}
+
+
+ {{ form_start(form, {'attr': {'class': 'ui loadable form', 'novalidate': 'novalidate', 'id': form.vars.id}}) }}
+ {% if hookable_metadata.configuration.method is defined %}
+
+ {% endif %}
+ {{ form_errors(form) }}
+ {{ form_widget(form._token) }}
+
+
+
+
+
+
+ {{ form_row(form.customer) }}
+
+
+ {{ form_row(form.company) }}
+
+
+ {{ form_row(form.firstName) }}
+
+
+ {{ form_row(form.lastName) }}
+
+
+ {{ form_row(form.email) }}
+
+
+ {{ form_row(form.street) }}
+
+
+ {{ form_row(form.city) }}
+
+
+ {{ form_row(form.province) }}
+
+
+ {{ form_row(form.country) }}
+
+
+ {{ form_row(form.postcode) }}
+
+
+ {{ form_row(form.customerIp) }}
+
+
+ {{ form_row(form.addressType) }}
+
+
+ {{ form_row(form.comment) }}
+
+
+
+
+
diff --git a/src/Resources/views/FraudSuspicion/Admin/show.html.twig b/src/Resources/views/FraudSuspicion/Admin/show.html.twig
index 34ac33c..774b821 100644
--- a/src/Resources/views/FraudSuspicion/Admin/show.html.twig
+++ b/src/Resources/views/FraudSuspicion/Admin/show.html.twig
@@ -1,22 +1,16 @@
-{% extends '@SyliusAdmin/layout.html.twig' %}
+{% set fraudSuspicion = hookable_metadata.context.resource %}
-{% set fraudSuspicion = resource %}
-
-{% block content %}
- {% include '@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/Show/_header.html.twig' %}
-
-
-
-
-
+
+
+
{% include '@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/Show/_customer.html.twig' with {'fraudSuspicion': fraudSuspicion} %}
-
+
{% include '@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/Show/_order.html.twig' with {'fraudSuspicion': fraudSuspicion} %}
-
+
{% include '@BitBagSyliusBlacklistPlugin/FraudSuspicion/Admin/Show/_details.html.twig' with {'fraudSuspicion': fraudSuspicion} %}
-{% endblock %}
+
diff --git a/src/Twig/AutomaticBlacklistingConfigurationLabelsExtension.php b/src/Twig/AutomaticBlacklistingConfigurationLabelsExtension.php
new file mode 100644
index 0000000..17835f3
--- /dev/null
+++ b/src/Twig/AutomaticBlacklistingConfigurationLabelsExtension.php
@@ -0,0 +1,38 @@
+ $ruleTypes
+ */
+ public function __construct(
+ private array $ruleTypes,
+ ) {
+ }
+
+ public function getFunctions(): array
+ {
+ return [
+ new TwigFunction('automatic_blacklisting_configuration_get_rule_label', [$this, 'getRuleLabel']),
+ ];
+ }
+
+ public function getRuleLabel(string $type): string
+ {
+ return $this->ruleTypes[$type] ?? '';
+ }
+}
diff --git a/tests/Application/assets/controllers.json b/tests/Application/assets/controllers.json
index 696ad49..8428b1f 100644
--- a/tests/Application/assets/controllers.json
+++ b/tests/Application/assets/controllers.json
@@ -1,5 +1,17 @@
{
"controllers": {
+ "@symfony/ux-autocomplete": {
+ "autocomplete": {
+ "main": "dist/controller.js",
+ "webpackMode": "eager",
+ "fetch": "eager",
+ "enabled": true,
+ "autoimport": {
+ "tom-select/dist/css/tom-select.default.css": false,
+ "tom-select/dist/css/tom-select.bootstrap5.css": false
+ }
+ }
+ }
},
"entrypoints": []
}
diff --git a/tests/Behat/Behaviour/ContainsEmptyListTrait.php b/tests/Behat/Behaviour/ContainsEmptyListTrait.php
index d7f2e2f..180b579 100755
--- a/tests/Behat/Behaviour/ContainsEmptyListTrait.php
+++ b/tests/Behat/Behaviour/ContainsEmptyListTrait.php
@@ -17,6 +17,6 @@ trait ContainsEmptyListTrait
public function isEmpty(): bool
{
- return false !== strpos($this->getDocument()->find('css', '.message')->getText(), 'There are no results to display');
+ return false !== strpos($this->getDocument()->find('css', '.empty-title')->getText(), 'No results found');
}
}
diff --git a/tests/Behat/Behaviour/ContainsErrorTrait.php b/tests/Behat/Behaviour/ContainsErrorTrait.php
index 113180f..5c35f71 100755
--- a/tests/Behat/Behaviour/ContainsErrorTrait.php
+++ b/tests/Behat/Behaviour/ContainsErrorTrait.php
@@ -18,7 +18,7 @@ trait ContainsErrorTrait
public function containsErrorWithMessage(string $message, bool $strict = true): bool
{
- $validationMessageElements = $this->getDocument()->findAll('css', '.sylius-validation-error');
+ $validationMessageElements = $this->getDocument()->findAll('css', '.invalid-feedback');
$result = false;
/** @var NodeElement $validationMessageElement */
diff --git a/tests/Behat/Resources/services/contexts/ui.xml b/tests/Behat/Resources/services/contexts/ui.xml
index f02eb9a..fa43c22 100644
--- a/tests/Behat/Resources/services/contexts/ui.xml
+++ b/tests/Behat/Resources/services/contexts/ui.xml
@@ -12,7 +12,7 @@
class="Tests\BitBag\SyliusBlacklistPlugin\Behat\Context\Ui\Admin\BlacklistingRuleContext">
-
+
@@ -24,7 +24,7 @@
class="Tests\BitBag\SyliusBlacklistPlugin\Behat\Context\Ui\Admin\CustomerContext">
-
+
@@ -36,7 +36,7 @@
class="Tests\BitBag\SyliusBlacklistPlugin\Behat\Context\Ui\Admin\FraudSuspicionContext">
-
+
@@ -51,7 +51,7 @@
class="Tests\BitBag\SyliusBlacklistPlugin\Behat\Context\Ui\Admin\AutomaticBlacklistingConfigurationContext">
-
+