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

Back Office Product List - Hide search field and filters when there are no products in list #12957

Open
sigmundpetersen opened this issue Oct 30, 2024 · 5 comments · May be fixed by #12983
Open

Comments

@sigmundpetersen
Copy link
Contributor

When a new person signs up and goes to the admin for the first time, they likely won't have any product.

We want them to really focus on creating new ones or importing them. at the moment in the list we still show the section with search and filters, which is not relevant to people. Let's hide it when there are no products.

Image

@saunmanoj888
Copy link
Contributor

hii @sigmundpetersen
I'd love to work on this issue as a way to ease back into open source after a break. Could you please assign it to me?

@sigmundpetersen
Copy link
Contributor Author

Sure, thanks @saunmanoj888 👍

@sigmundpetersen sigmundpetersen moved this from To triage (By the maintainers) to In progress in Welcome New Developers! Nov 14, 2024
@sigmundpetersen sigmundpetersen moved this from All the things 💤 to In Progress ⚙ in OFN Delivery board Nov 14, 2024
@saunmanoj888
Copy link
Contributor

hii @sigmundpetersen

I have started working on above issue. I have one small query.
When there are a list of product available and user searches for a product which is not available, we show the message No product found, in such scenario we still want to keep the search and filters right?
The current behaviour is as follow
Screenshot 2024-11-17 003932

If we want to achieve above I was thinking of below solution

When user visits product page for the first time, no product is present, search_term is empty, cateogory_id is also nil, we will hide the search and filters section

When products are present, user searches for some product which is not available, search_term is present, cateogory might be selected, @products object will be empty since searched product is not there, we will still show the search and filters section

the condition that i can use in html.haml file is

 - if products.any? || search_term.present? || cateogory_id.present?
  // show  search and filters section

please let me know your thought on above

@sigmundpetersen
Copy link
Contributor Author

Let's hear from our @openfoodfoundation/core-devs , @RachL , @filipefurtad0 :)

@chahmedejaz
Copy link
Collaborator

When there are a list of product available and user searches for a product which is not available, we show the message No product found, in such scenario we still want to keep the search and filters right?

Thanks, @saunmanoj888 for bringing this case.
Let's keep it in this scenario; it would make sense. Thanks.

the condition that i can use in html.haml file is

  • if products.any? || search_term.present? || cateogory_id.present?
    // show search and filters section

I think it would be fine. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress ⚙
Status: In progress
3 participants