Skip to content

feat(booking): add list selection for web scanner and camera checkout for mobile - #2788

Open
Pallavikumarimdb wants to merge 3 commits into
Shelf-nu:mainfrom
Pallavikumarimdb:feat/partial-checkout-checkin-selection-options
Open

feat(booking): add list selection for web scanner and camera checkout for mobile#2788
Pallavikumarimdb wants to merge 3 commits into
Shelf-nu:mainfrom
Pallavikumarimdb:feat/partial-checkout-checkin-selection-options

Conversation

@Pallavikumarimdb

@Pallavikumarimdb Pallavikumarimdb commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Introduces list-based selection ("Check out/in without scanning") for individual assets in the web booking scanner drawers, and adds a camera "Scan to Check Out" option for booking checkout in the mobile companion app.

Key Changes

  • Web: Added synthetic check-in/out atoms and prefixes for individual assets; updated pending list component and drawers to render and handle "without scanning" action buttons.
  • Mobile: Added a "Scan to Check Out" button on the booking detail screen; implemented checkout mode handling in the companion scanner screen.

Closes: #2655

Summary by CodeRabbit

  • New Features
    • Added scanner-based checkout from booking details, including partial checkout and validation for unavailable, already checked-out, or incorrectly assigned assets.
    • Added “Check in without scanning” and “Check out without scanning” actions for individual and quantity-tracked assets.
    • Improved pending asset selection across responsive booking and kit layouts.
  • Bug Fixes
    • Refreshed booking details after successful checkout and improved scanner success and error handling.

@Pallavikumarimdb
Pallavikumarimdb marked this pull request as ready for review July 31, 2026 21:18
Comment thread apps/webapp/app/routes/_auth+/dev-login.tsx Outdated
Comment thread apps/webapp/app/modules/auth/service.server.ts Outdated
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The PR adds scanner-based partial checkout to Companion and no-scan quick actions for individual booking assets in the web scanner. It adds checkout validation, submission handling, synthetic scanned-item atoms, responsive pending-asset actions, and updated tests.

Changes

Partial booking actions

Layer / File(s) Summary
Companion checkout scanning
apps/companion/app/(tabs)/bookings/[id].tsx, apps/companion/app/(tabs)/scanner.tsx
Booking details now open checkout scanner mode. The scanner validates assets, submits partialCheckoutBooking, refreshes booking state, and navigates after success.
Web individual-asset quick actions
apps/webapp/app/atoms/qr-scanner.ts, apps/webapp/app/components/scanner/drawer/uses/partial-checkin-drawer.tsx, apps/webapp/app/components/scanner/drawer/uses/partial-checkout-drawer.tsx
Synthetic quick check-in and checkout entries now support individual assets as well as quantity-tracked assets.
Web pending asset actions and validation
apps/webapp/app/components/scanner/drawer/uses/pending-items-list.tsx, apps/webapp/app/components/scanner/drawer/uses/partial-checkin-drawer.test.tsx, apps/webapp/app/components/scanner/drawer/uses/partial-checkout-drawer.test.tsx
Pending individual and kit-child rows now provide responsive no-scan actions. Tests verify actions for individual and quantity-tracked rows.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant BookingDetail
  participant CompanionScanner
  participant partialCheckoutBooking
  BookingDetail->>CompanionScanner: open checkout scanner
  CompanionScanner->>CompanionScanner: validate scanned assets
  CompanionScanner->>partialCheckoutBooking: submit selected assets
  partialCheckoutBooking-->>CompanionScanner: return checkout result
  CompanionScanner->>BookingDetail: navigate after success
Loading

Possibly related PRs

Suggested labels: enhancement, User requested feature

Suggested reviewers: donkoko

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes web list selection and mobile camera checkout, which are the primary changes.
Linked Issues check ✅ Passed The changes satisfy issue #2655 by adding web list actions for individual assets and a mobile scan entry point for checkout.
Out of Scope Changes check ✅ Passed The changed files support the linked issue through web quick actions, mobile checkout scanning, and related tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/companion/app/`(tabs)/scanner.tsx:
- Line 207: Update the kit-linked scan branch around isBookingCheckoutMode so
checkout uses the same eligibility rules as the single-asset checkout path:
exclude members that are CHECKED_OUT or IN_CUSTODY, while retaining the existing
CHECKED_OUT requirement for check-in. Adjust the related “Not Checked Out” and
“Already Covered” user-facing messages in the kit-member handling to describe
checkout-specific failures when isBookingCheckoutMode is true, including the
corresponding flow near the single-asset branch.
- Around line 2033-2101: Update handleBookingCheckout so the success alert’s
navigation callback only clears scanner state and routes to the booking detail
when result?.isComplete is true; for partial checkouts, keep the operator on the
scanner while preserving the successful submission feedback and updated booking
state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 96af5a67-2d00-4924-8285-6b77f9dcd15b

📥 Commits

Reviewing files that changed from the base of the PR and between 58c6465 and 7ee9572.

📒 Files selected for processing (8)
  • apps/companion/app/(tabs)/bookings/[id].tsx
  • apps/companion/app/(tabs)/scanner.tsx
  • apps/webapp/app/atoms/qr-scanner.ts
  • apps/webapp/app/components/scanner/drawer/uses/partial-checkin-drawer.test.tsx
  • apps/webapp/app/components/scanner/drawer/uses/partial-checkin-drawer.tsx
  • apps/webapp/app/components/scanner/drawer/uses/partial-checkout-drawer.test.tsx
  • apps/webapp/app/components/scanner/drawer/uses/partial-checkout-drawer.tsx
  • apps/webapp/app/components/scanner/drawer/uses/pending-items-list.tsx

Comment thread apps/companion/app/(tabs)/scanner.tsx
Comment thread apps/companion/app/(tabs)/scanner.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/companion/app/`(tabs)/scanner.tsx:
- Around line 2105-2114: After a successful partial checkout in the submission
flow around result?.isComplete, immediately update local bookingCtx.bookedAssets
entries corresponding to the submitted asset IDs to status CHECKED_OUT before
calling fetchBookingCtx(). Preserve fetchBookingCtx() as reconciliation, and add
a regression test covering an immediate kit rescan to ensure already checked-out
members are not queued.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cf6d1d50-660e-49d4-a447-5bd6b523667a

📥 Commits

Reviewing files that changed from the base of the PR and between 7ee9572 and 3cb56aa.

📒 Files selected for processing (1)
  • apps/companion/app/(tabs)/scanner.tsx

Comment on lines +2105 to +2114
if (result?.isComplete) {
InteractionManager.runAfterInteractions(() => {
pushIntoTab(
"/(tabs)/bookings",
`/(tabs)/bookings/${bookingId}`
);
});
} else {
fetchBookingCtx();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep kit eligibility current after a partial checkout.

When result?.isComplete is false, Line 2113 starts fetchBookingCtx() but leaves bookingCtx.bookedAssets stale until the request resolves. The camera can accept a kit scan in that interval. The kit branch at Lines 900-912 can then queue members that assetIds already checked out.

Update the local bookedAssets statuses to CHECKED_OUT after a successful submission, then keep fetchBookingCtx() as reconciliation. Add a regression test that rescans a kit immediately after a partial checkout.

Proposed fix
             Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
             playScanSound();
+            const checkedOutAssetIds = new Set(assetIds);
+            setBookingCtx((prev) =>
+              prev
+                ? {
+                    ...prev,
+                    bookedAssets: prev.bookedAssets.map((asset) =>
+                      checkedOutAssetIds.has(asset.id)
+                        ? { ...asset, status: "CHECKED_OUT" }
+                        : asset
+                    ),
+                  }
+                : prev
+            );
             const msg = result?.isComplete
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (result?.isComplete) {
InteractionManager.runAfterInteractions(() => {
pushIntoTab(
"/(tabs)/bookings",
`/(tabs)/bookings/${bookingId}`
);
});
} else {
fetchBookingCtx();
}
const checkedOutAssetIds = new Set(assetIds);
setBookingCtx((prev) =>
prev
? {
...prev,
bookedAssets: prev.bookedAssets.map((asset) =>
checkedOutAssetIds.has(asset.id)
? { ...asset, status: "CHECKED_OUT" }
: asset
),
}
: prev
);
if (result?.isComplete) {
InteractionManager.runAfterInteractions(() => {
pushIntoTab(
"/(tabs)/bookings",
`/(tabs)/bookings/${bookingId}`
);
});
} else {
fetchBookingCtx();
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/companion/app/`(tabs)/scanner.tsx around lines 2105 - 2114, After a
successful partial checkout in the submission flow around result?.isComplete,
immediately update local bookingCtx.bookedAssets entries corresponding to the
submitted asset IDs to status CHECKED_OUT before calling fetchBookingCtx().
Preserve fetchBookingCtx() as reconciliation, and add a regression test covering
an immediate kit rescan to ensure already checked-out members are not queued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial check-out/in: offer both "pick from list" and "scan" on web and mobile

1 participant