Feature #10700
openImplement Custom pickable visit schedule by customer, handle single visit job creation.
66%
Description
max jobs per day limit from the company profile to 25 or 30
customer pick the visits from the subscription flow...
total number of jobs completed can we mark the subscription completed ?
what is the max number of allowed value in monthly visit schedule.
Related issues
Updated by Divya Inapakurthi 15 days ago
- Due date changed from 09/03/2026 to 09/04/2026
- Status changed from New to In Progress
- % Done changed from 0 to 60
- Estimated time changed from 16:00 h to 24:00 h
Work Completed Summary:
1. Customer Custom Pickable Visit Schedule (Frontend & Flow)
Modal Input & Auto-fill Fixes: Disabled autocomplete/browser autofill popups on month input fields and removed number spinner arrows for clean manual entry.
12-Month Coverage Order: Fixed calendar month order to wrap dynamically over a 12-month coverage cycle starting from the subscription start month instead of defaulting to Jan–Dec.
Allocation & Limit Guards:
Enforced a hard cap of max 4 visits per month (MAX_VISITS_PER_MONTH = 4) directly in the modal inputs and validation handlers.
Implemented real-time over-allocation guards to ensure the customer allocates exactly the required total visits for the selected plan variant.
2. Schedule Prioritization & Snapshot Architecture (Backend & Models)
adminVisitSchedule Snapshot: Added adminVisitSchedule to SubscriptionContract schema to freeze the admin's plan schedule at the exact moment of contract creation, protecting historical contracts from future plan updates.
Custom Schedule Prioritization:
Compared admin selection vs customer custom selection across quotation acceptance, Stripe checkout sessions, and invoice webhooks.
Ensured custom selection is strictly prioritized whenever customized (customVisitSchedule $\rightarrow$ adminVisitSchedule $\rightarrow$ effectiveVisitSchedule).
Sync on Quotation Acceptance: Fixed QuotationController to copy customVisitSchedule and snapshot adminVisitSchedule when an on-store/public quote is accepted.
3. Autojob Scheduling & Business Rules Enhancements
Same-Month-Next-Year Rollover: Fixed the mid-month / late signup carry-over logic in visitScheduleHelper.js. If a signup occurs near month-end (e.g. Aug 30) and visits cannot fit within cutoff lead days, excess visits roll over into the same month next year (Aug 2027) rather than bleeding into the next sequential calendar month (Sep 2026).
Enforced 4-Visit Monthly Cap: Clamped scheduling calculations in visitScheduleHelper.js (getMasterDatesForMonth and buildEvenlySpacedDatesInMonth) to a maximum of 4 visits per month.
Master Grid Expansion: Updated the company default fixed dates grid from 2 dates [1, 15] to 4 weekly anchor dates [1, 8, 15, 22] in both the schema and database, ensuring clean mathematical date distribution for 1, 2, 3, or 4 visits per month without falling back to arbitrary spacing.
4. Webhook Bug Fixes & Stability
Resolved ConflictingUpdateOperators (Code 40): Fixed MongoDB error in checkoutCompleted.js and invoicePaid.js where customVisitSchedule was declared in both $set and $setOnInsert during upserts.
5. Subscriber Details UI Overhaul
Redesigned Visits & Schedule Section:
Restructured the section into a compact, side-by-side 3-column layout (Admin Recommended, Customer Selected, and Active Job Schedule) with status chips and icons.
Significantly reduced vertical space consumption while keeping all three schedule views clear and distinct.
6. Code Quality
Ran ESLint across all modified backend JavaScript files (visitScheduleHelper.js, checkoutCompleted.js, invoicePaid.js, etc.) with 0 errors.
Updated by Divya Inapakurthi 15 days ago
Divya Inapakurthi wrote:
max jobs per day limit from the company profile to 25 or 30
customer pick the visits from the subscription flow... -- done
total number of jobs completed can we mark the subscription completed ? -- chandra working on this
what is the max number of allowed value in monthly visit schedule. --done in customer view need to work on admins (4)
end subscriptions by jobs last day only those who's payment is already done so only yearly plans are possible