-
-
Notifications
You must be signed in to change notification settings - Fork 725
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
Fix infinite loop when printing invoices for orders not in completed #8197
Fix infinite loop when printing invoices for orders not in completed #8197
Conversation
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.
Thanks for this contribution @sinansonmez - I'm not sure that this is the correct solution in the long term. If there are other actions that could be applied to orders, or we want to add other actions, we would still need to be able to select orders that are not in the complete
state to do those actions. There's also no indication to the user as to why the order can't be selected.
I saw @filipefurtad0's comment suggesting this as the solution; Filipe, what do you think?
Thanks for the feedback @andrewpbrett. This also came to my mind but since currently the only action user can do with selection of orders is printing invoices, I thought my solution would be fine. Alternative (maybe ideal) solution would be hiding the |
Agree @andrewpbrett , it might not be clear for users why these cannot be printed. Maybe the Also, my previous comment should also mention other order states, as "completed" orders include these as well:
Would this sound like a good solution? What do you think @openfoodfoundation/train-drivers-product-owners ? |
It might be hard to understand for the user, but I guess it's a good compromise if we cannot generate the pdf skipping uncompleted orders. |
I was going to ask the same.
would only partially solve the problem. So best case would be automatically enable bulk printing via action button only for order state are
, i,e. automatically skipping the uncompleted ones when generating the PDF But if this requires more effort than the "minimum required" solution
Ideally we d need a tooltip then on the Action button, indicating to the user "Choose 'show only complete orders' to enable bulk printing invoices" |
Thanks for the feedbacks. I will try to implement best case scenario mentioned by @jaycmb.
|
@sinansonmez sorry, I might have been not precise with the best case scenario.
I meant automatically skipping the uncompleted ones when generating the PDF, so there is no need for the user to take any action and also no tooltip needed for explaining why they need to select that option. If this requires more effort though, then the option with
would be a solution as well |
I just updated the pull request according to discussion above. For tooltip info, I didn't know how to manage translation. For this reason I only inserted the text to English. Please guide me how to manage other languages. Screen.Recording.2021-09-28.at.01.09.47.mov |
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.
@sinansonmez I'm sorry for all the confusion here. This issue hasn't been discussed that well to start with and the discussion is happening here now. I will give my opinion here but don't implement it yet until someone else agrees and nobody disagrees. 😄
I like your original contribution because it enables you to select completed orders and print them even when there are incomplete orders visible. The issue is that it's not clear why people can't select incomplete orders.
The second solution has a great tooltip to explain things but you have to do extra steps to print when you are showing incomplete orders.
What do you think about a mixture of the two? We could have checkboxes for all orders so that other actions can be added later on. But we enable the print button only if all selected orders are complete. The tooltip can explain that. That could be easier than fixing my mentioned issue below. What do you think @jaycmb?
@@ -2708,6 +2708,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using | |||
Perhaps it has become unavailable or the shop is closing. | |||
admin: | |||
unit_price_tooltip: "The unit price increases transparency by allowing your customers to easily compare prices between different products and packaging sizes. Note, that the final unit price displayed in the shopfront might differ as it is includes taxes & fees." | |||
print_invoice_tooltip: "Choose 'ONLY SHOW COMPLETE ORDERS' to enable bulk printing of invoices" |
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.
This is perfect for translations. ✔️
@@ -23,8 +23,14 @@ | |||
= render partial: 'per_page_controls' | |||
|
|||
- if Spree::Config[:enable_invoices?] | |||
%button.invoices-modal{'ng-controller' => 'bulkInvoiceCtrl', 'ng-click' => 'createBulkInvoice()', 'ng-disabled' => 'selected_orders.length == 0'} | |||
%button.invoices-modal{'ng-controller' => 'bulkInvoiceCtrl', 'ng-click' => 'createBulkInvoice()', 'ng-disabled' => 'selected_orders.length == 0 || !q.completed_at_not_null'} |
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.
This changes live on the page when you toggle the "Only show complete orders" checkbox. So it's possible to just tick that box but not reload the page which means that you can still select an incomplete order and run into the same issue of the infinite spinner.
Thanks for the feedback @mkllnk. I will wait others to comment to implement sth |
@mkllnk not sure if I understood what you mean by
because this we have already implemented, right? Or you mean the change is about
Because currently the Print invoices button is also enabled when incomplete orders are selected? More Product / Compliance question: |
Yes, I meant that we keep the checkboxes as they are.
Yes, my suggestion was to only change two things:
I can't answer that question but if we implement the ability to print incomplete orders then it's very easy to enable the print button for those again. The invoice should probably have a big label that the order incomplete so that people realise it when looking at the PDF or print-outs. |
Maybe this functionality could be kept only on the Order Details page? I don't know if that is feasible tech-wise though. |
Thanks @sigmundpetersen and others, for the comments. For
For Screen.Recording.2021-10-05.at.18.29.22.movPlease let me know about final decision on |
Sorry to get back to you so late @sinansonmez After some thoughts, I wonder if a simple solution for now wouldn't be to hide the print invoice button when showing incomplete orders. A bit rough, but easy to test / cleaner on the UI rather than a button with a tooltip. I'm not a big fan of disabling the button when incomplete orders are shown. I'm afraid the user will try to unselect incomplete order one by one before even thinking at the tooltip or at the incomplete checkbox. @openfoodfoundation/train-drivers-product-owners @openfoodfoundation/testers @openfoodfoundation/core-devs any opinion on this? |
Hello @sinansonmez sorry this took so long :( I will rewrite the original issue to include the decided solution. Let me know if you still want to work on it. Otherwise I think we will close the PR :( |
Hello @RachL unfortunately I will not be able to work on this. Thanks |
What? Why?
Closes #5708
ISSUE: If an order is not in completed state, the user can select the order with checkbox and click
Print Invoices
button. In this case, user see an endless-spinner.SOLUTION:
toggleAll
function, the order is not included inselected_orders
so when user click select all checkbox, the order is not selected.What should we test?
Release notes
Fixes the bug when user tries to print not completed orders
Changelog Category: User facing changes
Dependencies
Documentation updates