WFDASHDRIVER-APP/lib/types.ts
SJCoetz b80551fe4d refactor(ui): rebrand app, fix supplier naming
- rename `supplier` field to `suppliers` in OrderItem interface and PocketBase expand queries
- complete visual rebrand to warm cream (#f2f1ed) and dark brown (#26251e) color palette with custom CSS variables
- add accessibility improvements: skip-to-main content link, focus-visible styles, reduced motion support, and proper ARIA labels
- update all component styling to match new theme, including offline indicator, install prompt, login page, modals, map, bottom nav and global CSS
- standardize status colors: use green for success, red for errors, retain orange (#f54e00) as primary accent CTAs
2026-07-05 22:32:20 +02:00

117 lines
2.8 KiB
TypeScript

export interface Supplier {
id: string;
suppliername: string;
email: string;
suppliernumber: string;
supplieraddress: string;
supply_tags: string;
coordinates: string; // Raw coordinates text (e.g. "-33.9249, 18.4241")
closingtime: string;
}
export interface Order {
id: string;
order_number: string;
status: string;
notes: string;
}
export interface PurchaseOrder {
id: string;
po_number: string;
status: string;
}
export interface OrderItem {
id: string;
order: string;
quote_item?: string;
purchase_order?: string;
supplier?: string;
drv_id?: string;
driver?: string;
description: string;
po_description?: string;
notes?: string;
problem_notes?: string;
quantity: number;
order_qty?: number;
qty_processed?: number;
qty_assigned?: number;
qty_collected?: number;
qty_delivered?: number;
cost_price?: number;
selling_price?: number;
markup?: number;
markup_percent?: number;
item_status:
| 'pending'
| 'processed'
| 'po_generated'
| 'driver_pool'
| 'assigned'
| 'collected'
| 'stock_verified'
| 'picking'
| 'ready_delivery'
| 'delivered'
| 'cancelled';
drv_status?: 'unassigned' | 'assigned' | 'en_route' | 'collected' | 'failed';
driver_status?: 'unassigned' | 'assigned' | 'en_route' | 'collected' | 'failed';
delivery_status?: 'pending' | 'ready' | 'in_transit' | 'delivered' | 'failed';
invoice_status?: 'pending' | 'invoiced' | 'paid' | 'cancelled';
problem_flag?: boolean;
problem_type?: 'stock' | 'supplier' | 'driver' | 'delivery' | 'pricing' | 'other';
drv_assigned_at?: string;
drv_collected_at?: string;
delivered_at?: string;
legacy_order_item_id?: string;
// Backwards-compat shim the app uses in some spots
is_stock_item?: boolean;
collected_date?: string;
collection_date?: string;
// Expanded fields
expand?: {
supplier?: Supplier;
order?: Order;
purchase_order?: PurchaseOrder;
};
}
export interface DriverLocation {
id: string;
driver: string;
latitude: number;
longitude: number;
accuracy?: number;
altitude?: number;
speed?: number;
heading?: number;
timestamp: string;
}
export interface AppSettings {
locationInterval: number;
minimumAccuracy: number;
enableHighAccuracy: boolean;
darkMode: boolean;
fontSize: 'small' | 'normal' | 'large';
offlineMode: boolean;
}
export const DEFAULT_SETTINGS: AppSettings = {
locationInterval: 60,
minimumAccuracy: 50,
enableHighAccuracy: true,
darkMode: false,
fontSize: 'normal',
offlineMode: false,
};
export const PROBLEM_TYPES = [
{ value: 'out_of_stock', label: 'Out of Stock' },
{ value: 'partial_stock', label: 'Partial Stock' },
{ value: 'quality_issue', label: 'Quality Issue' },
{ value: 'wrong_item', label: 'Wrong Item' },
{ value: 'other', label: 'Other' },
] as const;