feat(cart): add LIFO cart order setting (newest item on top)#301
Open
NotAbdelrahmanelsayed wants to merge 1 commit into
Open
feat(cart): add LIFO cart order setting (newest item on top)#301NotAbdelrahmanelsayed wants to merge 1 commit into
NotAbdelrahmanelsayed wants to merge 1 commit into
Conversation
Adds a "LIFO Cart Order (Newest on Top)" POS setting. When enabled and no explicit cart sort is active, the most recently added item is shown at the top of the cart instead of the bottom — handy on long carts where the cashier wants to see what was just scanned. - New cart_lifo check field on POS Settings (default off) + backend constants (POS_SETTINGS_FIELDS / DEFAULT_POS_SETTINGS). - posSettings store exposes a cartLifo computed. - useCartSort accepts an optional lifoMode; reverses the list when LIFO is on and no sort column is selected. Explicit sorts are unaffected. - InvoiceCart passes the setting through; toggle lives in the Sales Operations settings group so it takes effect live via reloadSettings(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a new POS setting — LIFO Cart Order (Newest on Top) — that, when enabled, shows the most recently added item at the top of the cart instead of the bottom.
Why
On long carts, cashiers often want to immediately see the item they just scanned/added for a quick visual confirmation, without scrolling to the bottom. This is a per-profile preference, off by default, so existing behaviour is unchanged.
How
cart_lifoCheck field on POS Settings (default0), registered inPOS_SETTINGS_FIELDSandDEFAULT_POS_SETTINGS.posSettingsexposes acartLifocomputed.useCartSort(itemsGetter, lifoMode)gains an optionallifoMode. When no explicit sort column is active and LIFO is on, it returns[...items].reverse(). Explicit sorts (name/price/quantity/total/addition-order) are completely unaffected.settings:sales-operations-changed, which triggersreloadSettings()and the cart re-orders live (no page reload).Scope
7 files, +36/−4. Default off, fully backward compatible. Production build passes (
vite build✓).