-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Admin][Zones] Choosing disabled country as a zone member made possible for admin user #14058
[Admin][Zones] Choosing disabled country as a zone member made possible for admin user #14058
Conversation
c5fa95b
to
93eb48e
Compare
src/Sylius/Bundle/AddressingBundle/Form/Type/CountryChoiceType.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AddressingBundle/Tests/Form/Type/CountryChoiceTypeTest.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AddressingBundle/Tests/Form/Type/CountryChoiceTypeTest.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AddressingBundle/Form/Type/CountryChoiceType.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AddressingBundle/Form/Type/CountryChoiceType.php
Outdated
Show resolved
Hide resolved
b2aede0
to
9d43959
Compare
src/Sylius/Bundle/AddressingBundle/Form/Type/CountryChoiceType.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/AddressingBundle/Tests/Form/Type/CountryChoiceTypeTest.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Form/Extension/ChannelTypeExtension.php
Outdated
Show resolved
Hide resolved
30b6d6b
to
59f9069
Compare
$resolver | ||
->setDefaults([ | ||
'attr' => ['class' => 'country_search_dropdown ui fluid search selection dropdown'], | ||
'enabled' => 'false', |
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.
I can add here almost the same comment as in the previous iteration: #14058 (comment)
CountryCodeChoiceType
is used in several different places if I'm correct, but you want to change the behaviour only for selecting countries for zones, so this parameter should be disabled only in ZoneType
, at least for now
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.
We can't resolve it in ZoneType as it is only parent of members
and we need to add enabled
key to his child code
- sorry for not letting you know in the previous comment. Yeah, but you are right, CountryCodeChoiceType
has impact on other forms as it is in CountryChoiceType
- I must have missed it. I decided to make custom form type here that is only referencing code
child field in zoneMembers
form. What do you think about it? CountryCodeChoiceType
and CountryChoiceType
can be then used anywhere else and we still achieve wanted behavior
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.
I'm almost sure that if you will change this line: https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/AddressingBundle/Form/Type/ZoneType.php#L104 by adding there an enabled
parameter, it will work correctly:
ZoneInterface::TYPE_COUNTRY => ['label' => 'sylius.form.zone.types.country', 'enabled' => false],
And you will not need to add a custom form type. Did you check this approach?
5aaa116
to
c6a8cb7
Compare
c6a8cb7
to
2093c5c
Compare
Thank you, Kamil! 🎉 |
Right now we’re experiencing a bug-o-feature, where when you disable a country that is a zone member, the members list on the Zone shows empty dropdown and field is unable to be controlled.
Changes made:
Before:
![502e0587-5f2a-46e6-bf0a-978a51e0462c](https://user-images.githubusercontent.com/53942444/172257473-40796456-eef2-4287-9462-7c116b233012.png)
![Zrzut ekranu 2022-06-7 o 15 24 15](https://user-images.githubusercontent.com/53942444/172391514-ce9b377c-32bb-4e45-b9d1-446ce161beda.png)
After: