Skip to content

Conversation

@AidanHT
Copy link

@AidanHT AidanHT commented Jan 20, 2026

🚀 Overview
Introduces a database-backed lock system, empowering administrators to control hardware order submissions directly via the UI.

Problem: Previously, order windows were controlled by hard-coded date constants, requiring a redeployment to change.

Solution: A dynamic toggle that allows instant control without touching the codebase.

✨ Key Features
Admin Lock Button: A simple toggle on the Orders page for real-time control.

User Feedback: Clear, context-aware messaging for users when orders are restricted.

Superuser Override: Built-in emergency bypass for Tech Leads/Superusers.

Audit Trail: Comprehensive tracking of who engaged the lock and at what time.

🛠 Technical Changes
Backend
Model: Added OrderLockConfig to store is_locked, locked_by, locked_at, and reason.

API: Created new endpoints at GET/POST /api/hardware/orders/lock/.

Logic: Enhanced order validation middleware to verify lock status before processing.

Coverage: Added unit tests for the lock state logic and superuser permission overrides.

Frontend
State Management: Added orderLockSlice.ts for global lock status via Redux.

Components: * OrderLockButton: Admin-only toggle located on the Orders page.

OrderLockAlert: Warning banner for participants on the Cart page.

UX: Submit button is now dynamically disabled based on lock state.

Documentation
Updated README.md with instructions on how to manage the lock and view audit logs.

✅ Testing & Verification
[ ] Admin: Toggle the lock on the Orders page and verify state persists on refresh.

[ ] Participant: Attempt to submit an order while locked; verify the button is disabled and the alert is visible.

[ ] Superuser: Verify the ability to submit orders even when the global lock is active.

[ ] Audit Log: Navigate to /admin/hardware/orderlockconfig/ and verify the history reflects the correct user and timestamp.

…ding admin assignment and UI updates for better visibility. Update serializers, models, and components to support new status and display packing admin information.
- Introduced OrderLockConfig model to manage order submission locks.
- Implemented API endpoints for fetching and toggling lock status.
- Added OrderLockButton and OrderLockAlert components for user interaction.
- Updated Cart and Orders pages to integrate order lock status checks.
- Enhanced validation in order submission to respect lock status.
- Created migrations for the new model and updated serializers accordingly.
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.

1 participant