WFDASHDRIVER-APP/lib/types.ts

92 lines
1.9 KiB
TypeScript
Raw Normal View History

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;
supplier: string;
driver: string;
description: string;
po_description: string;
quantity: number;
order_qty: number;
selling_price: number;
cost_price: number;
item_status: string;
status: string;
driver_status: string;
notes: string;
problem_type: string;
problem_flag: boolean;
problem_notes: string;
qty_collected: number;
collected_date: string;
collection_date: string;
is_stock_item: boolean;
// 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;