Changelog – October 23, 2025
๐ New Features & Improvements
New Batch Page Enhancements
- Fixed ShippingEasy Preview: Resolved “shippingeasy” preview not working on new batch page by removing non-existent database columns (
o.shipping_address2,o.shipping_phone) - Customer Information Display: Fixed missing customer information display on new batch page by updating display logic to check
order.shipping_name || order.customer_name || order.shipping_address1 - Individual Shipment Creation: Fixed “Create Shipment” button to create shipments for individual orders instead of adding all line items from all orders to one shipment
- Individual Packing Lists: Implemented one packing list per order instead of per batch, with individual “Print Packing List” buttons for each order
- Bulk Packing Lists: Added “Print Packing Lists” button at batch level to print all order packing lists at once
- Work Order Generation: Modified work order creation to group by decoration process instead of product, creating one work order with multiple pages (001, 002, 003, etc.)
- Bulk Work Orders: Added “Print Work Orders” button to print all work orders for a batch
Database & API Improvements
- Connection Pool Management: Fixed “too many clients already” errors by replacing individual
pg.Poolinstances with shareddbconnection from@/lib/dbin multiple API routes - Bulk Packing Lists API: Created new
/api/batches/[id]/bulk-packing-listsendpoint to fetch all packing list data for multiple orders in a single query - Color Data Integration: Fixed missing color information in packing lists by joining with
blank_style_colorstable and usingbc.color_name - Database Schema Corrections: Updated queries to use correct column names (
snapshot_variant_size,snapshot_variant_color_name,snapshot_product_title)
Print System Overhaul
- Print Layout Fixes: Resolved multiple print layout issues including:
- Blank pages between packing lists
- Incorrect page dimensions causing 2 pages per packing list
- Single page printing all packing lists
- Width overflow issues
- Print Styles Optimization: Implemented
multiPagePrintStylesutility for consistent print formatting across packing lists - Individual Packing List Pages: Created
/orders/[id]/packing-listpages with auto-print functionality - Bulk Packing List Pages: Created
/batches-new/[id]/packing-listsfor printing multiple packing lists with proper page breaks
Inventory & Shipment Management
- Inventory Check Bypass: Added
force: trueparameter to shipment creation to bypass inventory checks for new batch page workflow - Shipment Dialog Fixes: Removed undefined state variable references (
setPendingShipmentData,setNotReadyItems,setShowOverrideDialog) - ShippingEasy Integration: Updated ShippingEasy data preparation to match exact format of working
send-to-shippingeasyendpoint
๐ Bug Fixes
Database Issues
- Column Existence Errors: Fixed multiple “column does not exist” errors by removing references to non-existent columns in
mama_tried_orderstable - Type Mismatches: Fixed string vs number ID comparison issues in shipment creation filtering
- Connection Leaks: Resolved database connection limit errors by standardizing on shared
dbconnection
Print System Issues
- Sidebar in Print: Fixed sidebar appearing in printed packing lists by adding proper CSS print media queries
- Checkbox Issues: Removed header row checkbox and set item checkboxes to
checkedby default - Date Display: Removed unnecessary date from packing list headers
- Page Break Issues: Fixed multiple page break problems causing incorrect pagination
UI/UX Issues
- Customer Information: Fixed missing customer information display on new batch page
- Shipment Creation: Fixed shipment creation to work with individual orders instead of all orders at once
- Button Functionality: Fixed “Create Shipment” button to properly filter line items by selected order
๐ง Technical Improvements
API Route Updates
src/app/api/orders/prepare-shippingeasy-data/route.ts: Fixed column references and data structuresrc/app/api/orders/[id]/shipment-references/route.ts: Replaced Pool with db connectionsrc/app/api/orders/bulk-dimensions/route.ts: Replaced Pool with db connectionsrc/app/api/shipments/route.ts: Added force parameter for inventory check bypasssrc/app/api/batches/[id]/bulk-packing-lists/route.ts: New endpoint for bulk packing list data
Frontend Components
src/app/(authenticated)/batches-new/[id]/page.tsx: Enhanced with individual shipment creation and bulk printingsrc/app/(authenticated)/orders/[id]/packing-list/page.tsx: New individual packing list pagesrc/app/(authenticated)/batches-new/[id]/packing-lists/page.tsx: New bulk packing list pagesrc/components/orders/shipment-dialog.tsx: Fixed undefined state variables and added force parameter
Database Schema
- Updated queries to use correct column names from
mama_tried_order_line_items - Added proper joins to
blank_style_colorsfor color information - Implemented
COALESCEfor fallback data when snapshot data is null
๐ Performance Improvements
- Single Query Optimization: Replaced multiple API calls with single bulk queries for packing list data
- Connection Pool Efficiency: Standardized database connections to prevent connection leaks
- Print Performance: Optimized print styles to reduce layout calculations and improve rendering speed
๐ฏ User Experience Improvements
- Simplified Workflow: New batch page now “just works” without inventory check impediments
- Bulk Operations: Added bulk printing capabilities for both packing lists and work orders
- Visual Consistency: Fixed print layouts to match working individual packing lists
- Error Prevention: Added proper error handling and data validation throughout the workflow
๐ Documentation Updates
- Updated database management instructions
- Added local server management guidelines
- Enhanced API documentation for new endpoints
Total Commits: 7
Files Modified: 15+
New Files Created: 4
Major Features Added: Bulk packing lists, individual shipment creation, print system overhaul
