-
Notifications
You must be signed in to change notification settings - Fork 118
[Woo POS] Extract CartViewModel
and TotalsViewModel
#13179
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
Conversation
Generated by 🚫 Danger |
|
|
||
struct CartView: View { | ||
@ObservedObject private var viewModel: PointOfSaleDashboardViewModel | ||
@ObservedObject private var dashboardViewModel: PointOfSaleDashboardViewModel |
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.
The reference to the dashboard is currently necessary due to .submitCart()
. This calls for syncOrder(for cartProducts: [CartItem]) async
which contains OrderService
and card reader logic
addMoreButton | ||
.padding(32) | ||
.disabled(viewModel.isAddMoreDisabled) | ||
.disabled(dashboardViewModel.isAddMoreDisabled) |
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 .disabled
state relies on the payment state, possibly shouldn't be attached to the cart logic, but totals.
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.
Are you planning to move forward with this PR @iamgabrielma?
I noticed it involves isAddMoreDisabled
which I've updated in my PR to also take into account order syncing state.
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 the ping! This can be closed as was just a preliminary draft for the following changes:
CartViewModel
CartViewModel
and TotalsViewModel
Closes: #
Description
Steps to reproduce
Testing information
Screenshots
RELEASE-NOTES.txt
if necessary.