feat: give the console customer page a flat address to edit

The admin customer page collected an address (door no, street, suburb,
city, state, postcode, landmark, lat/lng) that the backend had nowhere to
store, so it was silently dropped on save. Add those fields flat onto
appcustomers, matching the reference console's shape, plus an applocationid
for zone scoping.

- GET /admin/customers: add ?applocationid= filter; emit firstname/lastname
  split and the address fields alongside the existing joined name.
- GET /admin/customers/summary (new): stat-tile counts (total/active/blocked)
  scoped like the list, so the client stops deriving them from the full page.
- PATCH /admin/customers/🆔 accept firstname/lastname directly (single name
  still splits as a fallback) and persist every address field; pointer fields
  so an omitted field is not confused with one cleared to empty.

Pagination and keyword search were already present. Additive, nullable
columns — AutoMigrate handles it, no data rewrite.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Suriyakumarvijayanayagam
2026-08-17 11:05:51 +05:30
parent ba800aee66
commit cfdc99ec9a
4 changed files with 212 additions and 60 deletions

View File

@@ -2,20 +2,27 @@ package constants
// Miler Availability Statuses
const (
MilerOffline = "Offline"
MilerAvailable = "Available"
MilerAssigned = "Assigned"
MilerOnPickup = "On_Pickup"
MilerAtCustomer = "At_Customer"
MilerPickedUp = "Picked_Up"
MilerOnDelivery = "On_Delivery"
MilerBreak = "Break"
MilerBlocked = "Blocked"
MilerOffline = "Offline"
MilerAvailable = "Available"
MilerAssigned = "Assigned"
MilerOnPickup = "On_Pickup"
MilerAtCustomer = "At_Customer"
MilerPickedUp = "Picked_Up"
MilerOnDelivery = "On_Delivery"
MilerBreak = "Break"
MilerBlocked = "Blocked"
)
// App (B2C) Customer Statuses
const (
CustomerStatusActive = "Active"
CustomerStatusBlocked = "Blocked"
CustomerStatusDeleted = "Deleted"
)
// Booking Statuses
const (
BookingPendingPickup = "Pending_Pickup" // customer requested pickup, delivery details not yet known
BookingPendingPickup = "Pending_Pickup" // customer requested pickup, delivery details not yet known
BookingCreated = "Created"
BookingMilerAssigned = "Miler_Assigned"
BookingPickupScheduled = "Pickup_Scheduled"
@@ -26,16 +33,16 @@ const (
// Consignment Statuses
const (
ConsignmentCreated = "Created"
ConsignmentInwardedAtHub = "Inwarded_at_Hub"
ConsignmentTripsheetLoaded = "Tripsheet_Loaded"
ConsignmentInTransit = "In_Transit"
ConsignmentOutForDelivery = "Out_for_Delivery"
ConsignmentDelivered = "Delivered"
ConsignmentRTOInitiated = "RTO_Initiated"
ConsignmentReturnedToSender = "Returned_to_Sender"
ConsignmentMissing = "Missing"
ConsignmentDamaged = "Damaged"
ConsignmentCreated = "Created"
ConsignmentInwardedAtHub = "Inwarded_at_Hub"
ConsignmentTripsheetLoaded = "Tripsheet_Loaded"
ConsignmentInTransit = "In_Transit"
ConsignmentOutForDelivery = "Out_for_Delivery"
ConsignmentDelivered = "Delivered"
ConsignmentRTOInitiated = "RTO_Initiated"
ConsignmentReturnedToSender = "Returned_to_Sender"
ConsignmentMissing = "Missing"
ConsignmentDamaged = "Damaged"
)
// Payment Modes
@@ -93,8 +100,8 @@ const (
// Exception Statuses
const (
ExceptionOpen = "Open"
ExceptionOpen = "Open"
ExceptionUnderInvestigation = "Under_Investigation"
ExceptionResolved = "Resolved"
ExceptionClosed = "Closed"
ExceptionResolved = "Resolved"
ExceptionClosed = "Closed"
)