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

Show "Unavailable" status for products with a future Available On date #5734

Conversation

forkata
Copy link
Contributor

@forkata forkata commented May 1, 2024

Summary

This change addresses two issues in the new Solidus admin

  • Products that are not available shouldn't show Available status - this is resolved by adding a new status as Unavailable, but I am open to suggestions on this. The issue is that currently products with a future Available On date still show as Available which is misleading.
  • Provide formatted date values to Field UI component - This resolves an issue where the values passed to the Field component contained the full date and time, which is not valid given we're using an input of type date. This change ensures that the date is formatted correctly before being passed to the component.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.
Issue Before After
Available On / Discontinue On Screenshot 2024-04-19 at 3 36 18 PM Screenshot 2024-05-01 at 12 44 02 PM
Product Status Screenshot 2024-05-01 at 12 46 51 PM Screenshot 2024-05-01 at 12 45 25 PM

@forkata forkata requested a review from a team as a code owner May 1, 2024 19:37
forkata and others added 2 commits May 1, 2024 12:48
Currently if a product has the `available_on` date in the future, it
will still show a status of Available, even though it is not available
for purchase on the store. This change proposes a new status of
`Unavailable` for scheduled products.

Co-authored-by: Harmony Bouvier <[email protected]>
This change fixes an issue where certain browsers (namely Firefox) will
not render the date field correctly when it contains the full date and
time format as the value. This change just truncates the available_on
and discontinue_on values to match the precision expected, rather switch
to the datetime-local input which is not fully supported in all
browsers, but also maintains the old admin behaviour.

Co-authored-by: Andrew Stewart <[email protected]>
@forkata forkata force-pushed the feature/solidus_admin/show-unavailable-status-products branch from 69504bd to 1fdb686 Compare May 1, 2024 19:48
Copy link

codecov bot commented May 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.84%. Comparing base (eda3961) to head (1fdb686).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5734   +/-   ##
=======================================
  Coverage   88.84%   88.84%           
=======================================
  Files         704      704           
  Lines       16762    16764    +2     
=======================================
+ Hits        14892    14894    +2     
  Misses       1870     1870           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tvdeyen
Copy link
Member

tvdeyen commented May 2, 2024

Amazing. Thanks

@tvdeyen tvdeyen merged commit 5b65373 into solidusio:main May 2, 2024
14 checks passed
@tvdeyen
Copy link
Member

tvdeyen commented May 2, 2024

This is actually a bug fix. I would like to back port this to 3.4 @kennyadsl wdyt?

@forkata forkata deleted the feature/solidus_admin/show-unavailable-status-products branch May 2, 2024 20:52
@kennyadsl
Copy link
Member

@tvdeyen I'm good with that, please add the appropriate tags. 🙏

Copy link

github-actions bot commented May 3, 2024

💚 All backports created successfully

Status Branch Result
v4.3

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v4.3 Backport this pull-request to v4.3 changelog:solidus_admin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants