Add booking approval/rejection workflow for admin review#2318
Draft
carlosvirreira wants to merge 1 commit into
Draft
Add booking approval/rejection workflow for admin review#2318carlosvirreira wants to merge 1 commit into
carlosvirreira wants to merge 1 commit into
Conversation
…ings Add APPROVED and REJECTED statuses to the BookingStatus enum with full approval workflow for Base user booking requests. Schema changes: - Add APPROVED and REJECTED values to BookingStatus enum - Add rejectionReason field to Booking model - Database migration for new enum values and field Service layer: - Add approveBooking() function (RESERVED -> APPROVED) - Add rejectBooking() function (RESERVED -> REJECTED) - Update cancelBooking to accept APPROVED bookings - Update revertBookingToDraft to accept APPROVED bookings - Update checkoutBooking to work from APPROVED status - Update booking conflict detection to include APPROVED - Add status transition notes for approve/reject Email notifications: - Add approved booking email content helper - Add rejected booking email content helper with reason - Add reasonLabel prop to email template for rejection - Send approval/rejection emails to custodian UI changes: - Add Approve button in actions dropdown for admin/owner - Add Reject button with dialog requiring rejection reason - Show rejection reason on booking detail page - Update checkout button to show for APPROVED bookings - Update calendar, badge colors, and status helpers - Update booking process sidebar with approval info - Disable form fields for REJECTED status Permission guards: - Only admin/owner can approve/reject - Only shown for bookings created by BASE users - Include creator's org role in loader for detection https://claude.ai/code/session_01MWiJMghMb6ZB6QVcMy1MUa
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
Summary
This PR introduces a new booking approval/rejection workflow that allows administrators and owners to review and approve/reject bookings created by BASE users. When a booking is rejected, the custodian receives a notification with the rejection reason.
Key Changes
Database & Schema
APPROVEDandREJECTEDrejectionReasonfield to the Booking model to store rejection detailsBooking Service
approveBooking()function to transition RESERVED bookings to APPROVED statusrejectBooking()function to transition RESERVED bookings to REJECTED status with a reasoncancelBooking()to support cancelling APPROVED bookingsrevertBookingToDraft()to support reverting from APPROVED statusUI Components
RejectBookingDialogcomponent with form for entering rejection reasonActionsDropdownto show approve/reject actions only for:EditBookingFormto disable editing for REJECTED bookingsRevertToDraftDialogto support APPROVED statusTimeRemainingcomponent to handle APPROVED statusAvailabilityLabelto treat APPROVED bookings as unavailableEmail Templates
BookingUpdatesEmailTemplateto support custom reason labelsapprovedBookingEmailContent()for approval notificationsrejectedBookingEmailContent()for rejection notifications with reasonPermissions & Validation
RejectBookingSchemafor rejection reason (required, max 500 chars)Other Updates
isApprovedandisRejectedflagsImplementation Details
https://claude.ai/code/session_01MWiJMghMb6ZB6QVcMy1MUa