Commit graph

19 commits

Author SHA1 Message Date
Adam Moussa
b072d1fa2d Extract zip code from location address as fallback for distance calc
- Regex extracts 5-digit zip from address string when ZipCode field is empty
- Enables distance calculation for synced locations without structured zip data
2026-04-17 11:59:34 -04:00
Adam Moussa
521bb0fba2 Add zip-to-zip distance calculation for vendor dispatch
- ZipCodeDistance helper with Haversine formula on 33K US zip code centroids
- Loaded as singleton from wwwroot/zipcodes.csv on startup
- Vendor Dropdown endpoint accepts siteZip, returns address and distanceMiles
- Vendors sorted by distance when siteZip provided
- Include locationZip in GetWorkorderById response
2026-04-17 11:56:06 -04:00
Adam Moussa
ee69a1863a Add vendor scheduled date to dispatch workflow
- Add ScheduledDate field to Dispatch model and DTO
- Save scheduled date when dispatching to vendor
- Include ScheduledDate in dispatch response projections
2026-04-17 11:47:00 -04:00
Adam Moussa
d24c4643f5 Add vendor dispatch workflow backend
- Create Vendor model with company info, trade specialties, active flag
- Create Dispatch model (doubles as Vendor PO) with PO number, NTE, status, reply-to address
- VendorController: CRUD, paginated list, dropdown endpoint with trade filtering
- DispatchToVendor endpoint: multi-vendor dispatch, auto-generated PO numbers (VPO-00001),
  HTML email with full WO details via SendGrid, reply-to wo-{number}@int.seahaven.com
- GetDispatches endpoint for listing dispatches by WO
- Include dispatches in GetWorkorderById response
- SendMessage.SendDispatchEmail with reply-to support
- Audit log entry for each dispatch
2026-04-17 11:37:35 -04:00
Adam Moussa
05b36ef7dd Add configurable dropdowns, new WO fields, and seed data
- Create DropdownOption model with Category, Value, ParentValue for Trade/SubTrade/Problem
- Add DropdownOptionsController with CRUD + ByCategory endpoint with parent filtering
- Add Problem, Trade, SubTrade, VendorNTE, ScheduledDate, CompletedDate, Source to WorkOrder
- Update EditWorkorder_DTO and GetWorkorderById with new fields
- Audit log tracks changes to all new fields
- Seed default Trades (10), SubTrades (20), and Problems (11) on startup
2026-04-17 10:40:38 -04:00
Adam Moussa
8959efc06b Add ChangeAssignment endpoint with audit logging
- POST /api/WorkOrder/ChangeAssignment?id=&assignTo=
- Logs old and new user names in audit trail
- Returns updated assignment name
2026-04-16 19:04:59 -04:00
Adam Moussa
d07e24e419 Add InternalWONumber field with auto-generation
- Add InternalWONumber to WorkOrder model
- Auto-generate 8-digit sequential numbers starting at 10000001
- Generate on new work order creation and DynamoDB sync
- Include in GetWorkorderById and GetWorkOrderList responses
- Add BackfillInternalWONumbers endpoint for existing records
- Add migration for new column
2026-04-16 18:42:58 -04:00
Adam Moussa
18ca737307 Add JSON-based AddCommentJson endpoint
- Accepts JSON body instead of FormData for simple text comments
- Returns new comment with user name for immediate UI update
- Defaults to internal comment type
2026-04-16 18:22:34 -04:00
Adam Moussa
e1f57d3fb2 Add comment types, audit logging, and WorkOrderAuditLog table
- Add CommentType field to Comments (customer, vendor, internal)
- Add Status field to EditWorkorder_DTO
- Create WorkOrderAuditLog model tracking field-level changes
- Log all field changes on work order edit and status change
- Include commentType and auditLog in GetWorkorderById response
- Set CommentType=customer on synced comments from DynamoDB
- Add BackfillCommentTypes endpoint for existing data
2026-04-16 18:09:57 -04:00
Adam Moussa
c69cef7fa9 Add HttpPut route to EditWorkorder endpoint
- services/api.js sends PUT for updates, controller only accepted POST
- Add [HttpPut("{id:int}")] alongside existing [HttpPost]
2026-04-16 17:44:00 -04:00
Adam Moussa
cc87039a77 Include commenter and recordType in GetWorkorderById comments response 2026-04-16 17:41:11 -04:00
Adam Moussa
5a4d8e2240 Add description, createdDate, locationId to GetWorkorderById response 2026-04-16 17:37:21 -04:00
Adam Moussa
60fc933da7 Add lowercase route aliases for all controllers
- services/api.js uses lowercase routes (/api/workorders, /api/employees, etc.)
- Add matching [Route] attributes to WorkOrder, Employee, Contact, Account, FollowUp, PMSchedule controllers
- Add [HttpGet("{id:int}")] to WorkOrderController for REST-style get by ID
2026-04-16 17:32:28 -04:00
Adam Moussa
e8c400a20a Add null safety checks across all API controllers
- Add null checks after FirstOrDefault() before property access
- Guard navigation property access (Locations, AssignToUser, ApplicationUser, POC, Contacts)
- Null-coalesce string properties in search/filter LINQ queries
- Protect Sum() on nullable LineItems collections
- Change FirstAsync to FirstOrDefaultAsync with null guard in UserController
- Add null check on model.Attachments iteration in EditWorkorder
2026-04-16 16:33:42 -04:00
npalOmega
a9fc4b8701 fix 2026-03-30 06:49:40 -05:00
npalOmega
cd78c93fa8 fix 2026-01-21 16:24:54 -06:00
npalOmega
2e9716fe34 fix 2025-03-09 19:39:28 -05:00
npalOmega
9a23c41b21 initial commit for api changes 2025-02-18 13:13:33 -06:00
69b9e69f00 Initial commit 2024-09-28 14:58:36 -04:00