Customer Management: Complete Dashboard Guide
BSTD's Customer Management module provides a centralized, powerful dashboard to view, organize, and maintain all your customer data and linked logistics documents. This comprehensive guide covers every feature, interaction, and workflow available in the customer table.
From cross-field search across customer and quotation data, linking 9 different document types, instant PDF viewing with zero caching, secure token-based sharing, and smart viewport-aware dropdowns — this page documents everything you need to master your customer operations.
Customer Table & Cards
The dashboard displays customers in two responsive layouts: a detailed table for desktop and compact cards for mobile. Both views show the same rich information organized for optimal scanning.
Desktop Table Columns
- # (Index): Sequential row number for easy reference.
- Customer:Displays the customer's party name (from linked quotation), a colored avatar with the first initial, customer ID, and clickable phone number.
- Route: Shows origin city and destination city with a directional arrow, plus the creation date formatted via
formatDate. - Docs:A badge showing the count of linked documents out of 9 total possible types (e.g., "3/9"). Click to open the Link Docs modal.
- Actions: A three-dot menu button that opens the comprehensive action dropdown.
Mobile Card Layout
On mobile devices (below the md breakpoint), the table transforms into stacked cards. Each card shows:
- Customer avatar with initial, party name, customer ID, and phone number
- Route (origin → destination) with document count badge
- Creation date and the three-dot action menu
Customer Information Display
- Avatar: A rounded square avatar with the first letter of the party name, using theme-aware background colors (gray-100 in light, gray-800 in dark).
- Party Name:The primary customer name from the linked quotation. If no quotation is linked, displays "N/A".
- Customer ID: The unique internal identifier for the customer record.
- Phone Link:The customer's mobile number is a clickable
tel:link that opens your device's calling application. - Route Colors: Origin city is styled with success text color (green), destination with danger text color (red), making the direction visually intuitive.
Advanced Cross-Field Search
The search bar is one of the most powerful features of the Customer Management module. It searches across both customer data and linked quotation data simultaneously.
Search Scope
The search scans the following fields in real-time:
Customer Fields
All customer object values (name, ID, phone, email, etc.)
Quotation Fields
Party name, phone, origin city, destination city, quotation number, email, address, vehicle number, driver name, driver phone
- Real-time Filtering: Results update instantly as you type. No need to press Enter or click a search button.
- Case-insensitive: Searches are case-insensitive and trim whitespace automatically.
- Quotation Cross-search: You can search for a vehicle number, driver name, or destination city and find the associated customer even if that data is stored in the quotation, not the customer record.
- Clear Button:When a search query is active, a "Clear" button appears to instantly reset the filter and show all customers.
- Result Count:The header displays the total number of entries currently visible (e.g., "47 entries").
Document Linking System
The document linking system is the core of the Customer Management module. It allows you to associate up to 9 different logistics document types with each customer, creating a centralized document repository.
Linked Document Badge
Each customer row displays a pill-shaped badge showing the count of linked documents (e.g., "3/9"). The badge styling changes based on linkage status:
- Linked (≥1): Uses the brand theme background color, indicating active document associations.
- Unlinked (0): Uses a neutral gray background, indicating no documents have been linked yet.
- Click to Link: Clicking the badge opens the
LinkDocsModalwhere you can associate documents.
Link Docs Modal
The Link Docs modal provides an interface to connect existing documents to a customer profile. It accepts the customer ID and pre-populates with any existing linked data.
- Pre-populated Data: If documents are already linked, the modal loads them automatically for editing.
- Success Feedback:After successful linking, a green success toast appears ("Documents linked successfully") and the parent data refreshes via the
onLinkDocsSuccesscallback. - Company Theme:The modal inherits the company's theme colors for consistent branding.
Document Number Storage
Each document type stores its unique number in the customer record:
| Document | Storage Key | Example Value |
|---|---|---|
| LR | lr_number | LR-2024-001 |
| Invoice | invoice_number | INV-2024-089 |
| Vehicle Condition | vc_number | VC-2024-012 |
| Packing List | gr_number | GR-2024-023 |
| Money Receipt | rec_number | MR-2024-067 |
| FOV | fov_number | FOV-2024-005 |
| NOC | noc_number | NOC-2024-003 |
| TWS | tws_number | TWS-2024-018 |
9 Document Types Supported
BSTD supports linking and managing 9 distinct logistics document types. Each type has its own page route, API endpoint, and document number field.
Lorry Receipt
Route: /v1/lr · API: lr · Key: lr_number
Tax Invoice
Route: /v1/invoice · API: invoice · Key: invoice_number
Vehicle Condition
Route: /v1/vehicle-condition · API: vc · Key: vc_number
Packing List
Route: /v1/packing-list · API: gr · Key: gr_number
Money Receipt
Route: /v1/money-receipt · API: mr · Key: rec_number
Freight on Value
Route: /v1/fov · API: fov · Key: fov_number
No Objection Certificate
Route: /v1/noc · API: noc · Key: noc_number
Transport Work Sheet
Route: /v1/tws · API: tws · Key: tws_number
Edit vs. Create Workflow
From the dropdown menu, each document type provides smart routing:
- Edit Existing: If a document number exists for that type, the link opens the document editor in edit mode (e.g.,
/v1/lr?edit=LR-2024-001). - Create New:If no document is linked, the link opens the document creator pre-filled with the customer's quotation number (e.g.,
/v1/lr?quotation=QT-2024-001). - Visual Indicators:Each document row in the dropdown shows a pencil icon and clearly labels whether you're editing an existing document or creating a new one.
Instant PDF Viewer
For any linked document, you can instantly view its PDF without navigating away from the customer dashboard. The PDF viewer is optimized for zero caching and memory leak prevention.
PDF Generation
- No Cache: Every PDF request appends a cache-busting query parameter (
_cb=timestamp) to ensure you always see the latest version. - Blob URL Lifecycle: PDFs are fetched as blobs, converted to temporary object URLs, opened in a new tab, and automatically revoked after 8 seconds to prevent memory leaks.
- Popup Blocker Safe: PDFs open via a hidden anchor element with
target="_blank"andrel="noopener noreferrer", avoiding popup blocker issues and double-window problems. - Debounced Clicks: A 1.2-second lock prevents accidental double-clicks from generating duplicate PDF requests.
Supported PDF Types
The PDF viewer supports all 9 document types through dedicated API endpoints:
- LR PDF — Generated via
api.lr.generatePdf(docId, "consignor", cacheBuster) - Tax Invoice PDF —
api.invoices.generatePdf(docId, cacheBuster) - Vehicle Condition PDF —
api.vc.generatePdf(docId, cacheBuster) - Packing List PDF —
api.gr.generatePdf(docId, cacheBuster) - Money Receipt PDF —
api.mr.generatePdf(docId, cacheBuster) - FOV PDF —
api.fov.generatePdf(docId, cacheBuster) - NOC PDF —
api.noc.generatePdf(docId, cacheBuster) - TWS PDF —
api.tws.generatePdf(docId, cacheBuster)
Deleting Customers
Customer deletion is protected by multiple safeguards to prevent accidental data loss.
Delete Flow
- Click Delete: From the dropdown menu, select Delete. The menu closes immediately.
- Confirmation Modal:A styled modal appears (not a native browser alert) with a red warning icon, the customer's party name prominently displayed, and a clear warning that the action cannot be undone.
- Cancel Option: Clicking Cancel, the backdrop, or the X button safely dismisses the modal without any deletion.
- Confirm Delete: Clicking the red Delete button triggers the
onDeletecallback, which makes a single API call to remove the customer. - Toast Feedback:After deletion, a success toast appears ("Customer deleted successfully"). If the API call fails, an error toast displays the error message.
Delete Confirmation Modal Design
- Red Warning Icon: A circular red background with a trash icon visually signals the destructive nature.
- Customer Name Display: The party name (or customer ID as fallback) is shown in bold to confirm the target.
- Theme-aware Styling:The modal uses the current theme's card background, border, and text colors for consistent appearance.
Infinite Scroll Pagination
The customer list uses infinite scroll pagination to handle large datasets efficiently without overwhelming the browser or the user.
How It Works
- Batch Size: Initially loads 10 customers. As you scroll, additional batches of 10 are loaded automatically.
- Sorting: Customers are sorted by creation date in descending order (newest first) before pagination is applied.
- Loading Indicator:When fetching the next batch, a spinning loader with "Loading more..." text appears at the bottom of the list.
- Search Compatibility: Infinite scroll works seamlessly with search filtering — only filtered results are paginated.
- Hook-based: Powered by the
useInfiniteScrollcustom hook for clean, reusable logic.
Responsive Design
The Customer Management module is fully responsive, adapting its layout from mobile phones to large desktop monitors.
Layout Breakpoints
Mobile (< 768px)
- • Stacked card layout
- • Full-width customer cards
- • Compact action dropdown
- • Search bar stacks below header
Desktop (≥ 768px)
- • Full data table with columns
- • Horizontal header with search
- • Row-based document badges
- • Optimized for wide screens
- Table Overflow: The desktop table supports horizontal scrolling via
overflow-x-autofor narrow viewports that still meet the desktop breakpoint. - Touch Targets: All interactive elements (buttons, dropdown triggers) maintain adequate touch target sizes for mobile usability.
- Text Truncation: Long party names are truncated with
truncateandmin-w-0classes to prevent layout breaking.
Dark Mode & Theme Support
The entire Customer Management module adapts seamlessly to both light and dark themes through the useThemeColors hook.
- Dynamic Colors: All backgrounds, borders, text, and input colors are determined by the theme hook and update instantly when the system theme changes.
- Avatar Backgrounds: Customer avatars use
gray-100in light mode andgray-800in dark mode for optimal contrast. - Table Hover: Row hover states use theme-aware colors for subtle highlighting without jarring transitions.
- Dropdown Styling: The fixed dropdown menu inherits card background, border, and text colors from the active theme.
- Company Theme Override: If a company has a custom theme configured, it is passed to all child components (modals, dropdowns, toasts) for brand consistency.
Security & User Experience
BSTD implements multiple layers of security safeguards and UX optimizations to ensure reliable, safe customer data management.
UX Safeguards
- Toast Notifications: All actions (delete, link, PDF open) provide immediate visual feedback via positioned toast notifications that auto-dismiss after 3 seconds.
- Confirmation Modals: Destructive actions (delete) require explicit confirmation through styled modal dialogs, not native browser alerts.
- PDF Debouncing: 1.2-second click lock prevents duplicate PDF generation requests and server overload.
- Memory Management: Blob URLs are revoked after 8 seconds to prevent browser memory leaks from accumulated object URLs.
- Error Handling: Failed API calls (PDF generation, deletion) display descriptive error toasts instead of silent failures.
- No Cache PDFs: Cache-busting timestamps ensure every PDF view reflects the latest document state, preventing stale data display.
Data Security
- Authenticated Access: All API calls are protected through authenticated user sessions.
- Token-Based Sharing: Shared document links use encrypted, time-limited tokens that cannot be guessed or reverse-engineered.
- No Public Indexing: Customer data and shared content are never exposed publicly or indexed by search engines.
- CSRF Protection: All state-changing operations include CSRF token validation.